MPP: Generate Maven plugin from Gradle build, remove maven build files
diff --git a/atomicfu-gradle-plugin/build.gradle b/atomicfu-gradle-plugin/build.gradle
new file mode 100644
index 0000000..536eeec
--- /dev/null
+++ b/atomicfu-gradle-plugin/build.gradle
@@ -0,0 +1,7 @@
+apply plugin: 'kotlin'
+
+dependencies {
+ compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ compile project(":atomicfu-transformer")
+ compile gradleApi()
+}
\ No newline at end of file
diff --git a/atomicfu-gradle-plugin/pom.xml b/atomicfu-gradle-plugin/pom.xml
deleted file mode 100644
index 7794619..0000000
--- a/atomicfu-gradle-plugin/pom.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<!--
- ~ Copyright 2017 JetBrains s.r.o.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-parent</artifactId>
- <version>0.9.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>atomicfu-gradle-plugin</artifactId>
- <packaging>jar</packaging>
-
- <properties>
- <gradle.version>3.5</gradle.version>
- <groovy.version>2.4.12</groovy.version>
- </properties>
-
- <repositories>
- <repository>
- <id>gradle-libs-releases-local</id>
- <name>libs releases local</name>
- <url>https://repo.gradle.org/gradle/libs-releases-local/</url>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-transformer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>2.4.12</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gradle</groupId>
- <artifactId>gradle-core</artifactId>
- <version>${gradle.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gradle</groupId>
- <artifactId>gradle-base-services</artifactId>
- <version>${gradle.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.gradle</groupId>
- <artifactId>gradle-base-services-groovy</artifactId>
- <version>${gradle.version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <!-- publish empty javadocs -->
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>empty-javadoc-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>javadoc</classifier>
- <classesDirectory>${basedir}/javadoc</classesDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt b/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
index fcc7895..74bc9c2 100644
--- a/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
+++ b/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
@@ -13,14 +13,12 @@
import java.io.File
open class AtomicFUGradlePlugin : Plugin<Project> {
- private val TASK_NAME = "atomicFU"
override fun apply(target: Project) {
- target.tasks.create(TASK_NAME, AtomicFUTransformTask::class.java)
+ target.tasks.create("atomicFU", AtomicFUTransformTask::class.java)
}
}
open class AtomicFUTransformTask : DefaultTask() {
-
@InputFiles
lateinit var inputFiles: FileCollection
@OutputDirectory
@@ -35,10 +33,12 @@
@TaskAction
fun transform() {
inputFiles.files.forEach {
- val t = AtomicFUTransformer(
- classPath.files.map { it.absolutePath }, it, outputDir, variant)
- t.verbose = verbose
- t.transform()
+ AtomicFUTransformer(classPath.files.map { it.absolutePath }, it).let { t ->
+ t.outputDir = outputDir
+ t.variant = variant
+ t.verbose = verbose
+ t.transform()
+ }
}
}
}
\ No newline at end of file
diff --git a/atomicfu-maven-plugin/.mvn/wrapper/maven-wrapper.jar b/atomicfu-maven-plugin/.mvn/wrapper/maven-wrapper.jar
new file mode 100755
index 0000000..f775b1c
--- /dev/null
+++ b/atomicfu-maven-plugin/.mvn/wrapper/maven-wrapper.jar
Binary files differ
diff --git a/atomicfu-maven-plugin/.mvn/wrapper/maven-wrapper.properties b/atomicfu-maven-plugin/.mvn/wrapper/maven-wrapper.properties
new file mode 100755
index 0000000..a447c9f
--- /dev/null
+++ b/atomicfu-maven-plugin/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
\ No newline at end of file
diff --git a/atomicfu-maven-plugin/build.gradle b/atomicfu-maven-plugin/build.gradle
new file mode 100644
index 0000000..487b2b5
--- /dev/null
+++ b/atomicfu-maven-plugin/build.gradle
@@ -0,0 +1,60 @@
+apply plugin: 'kotlin'
+apply plugin: 'maven'
+
+dependencies {
+ compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ compile project(":atomicfu-transformer")
+ compile "org.apache.maven:maven-core:$maven_version"
+ compile "org.apache.maven:maven-plugin-api:$maven_version"
+ compile 'org.apache.maven.plugin-tools:maven-plugin-annotations:3.5'
+}
+
+def pomFile = file("$buildDir/pom.xml")
+def outputDir = compileKotlin.destinationDir
+
+task generatePomFile(dependsOn: [compileKotlin, task(":atomicfu-transformer:installToMavenLocal")]) {
+ def buildDir = project.buildDir // because Maven model also has "project"
+ outputs.file(pomFile)
+ doLast {
+ install.repositories.mavenInstaller.pom.with {
+ groupId = project.group
+ artifactId = project.name
+ version = project.version
+ packaging = 'maven-plugin'
+
+ withXml {
+ asNode().with {
+ appendNode('build').with {
+ appendNode('directory', buildDir)
+ appendNode('outputDirectory', outputDir)
+ }
+ appendNode('properties').with {
+ appendNode('project.build.sourceEncoding', 'UTF-8')
+ }
+ }
+ }
+ }
+ install.repositories.mavenInstaller.pom.writeTo(pomFile)
+ assert pomFile.file, "$pomFile: was not generated"
+ logger.info("POM is generated in $pomFile")
+ }
+}
+
+// runs the plugin description generator
+task generatePluginDescriptor(type: Exec, dependsOn: generatePomFile) {
+ def pluginDescriptorFile = new File(outputDir, 'META-INF/maven/plugin.xml')
+
+ workingDir projectDir
+ commandLine 'sh', './mvnw',
+ '--errors',
+ '--batch-mode',
+ '--file', pomFile,
+ 'org.apache.maven.plugins:maven-plugin-plugin:3.5.1:descriptor'
+
+ doLast {
+ assert pluginDescriptorFile.file, "$pluginDescriptorFile: was not generated"
+ logger.info("Plugin descriptor is generated in $pluginDescriptorFile")
+ }
+}
+
+project.jar.dependsOn(generatePluginDescriptor)
diff --git a/atomicfu-maven-plugin/mvnw b/atomicfu-maven-plugin/mvnw
new file mode 100755
index 0000000..e96ccd5
--- /dev/null
+++ b/atomicfu-maven-plugin/mvnw
@@ -0,0 +1,227 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+ # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`which java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/atomicfu-maven-plugin/mvnw.cmd b/atomicfu-maven-plugin/mvnw.cmd
new file mode 100755
index 0000000..6a6eec3
--- /dev/null
+++ b/atomicfu-maven-plugin/mvnw.cmd
@@ -0,0 +1,145 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%
diff --git a/atomicfu-maven-plugin/pom.xml b/atomicfu-maven-plugin/pom.xml
deleted file mode 100644
index 70e757e..0000000
--- a/atomicfu-maven-plugin/pom.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<!--
- ~ Copyright 2017 JetBrains s.r.o.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-parent</artifactId>
- <version>0.9.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>atomicfu-maven-plugin</artifactId>
- <packaging>maven-plugin</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-transformer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-annotations</artifactId>
- <version>3.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>3.0.8</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>3.5</version>
- <configuration>
- <goalPrefix>atomicfu</goalPrefix>
- <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
- </configuration>
- <executions>
- <execution>
- <id>mojo-descriptor</id>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!-- publish empty javadocs -->
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>empty-javadoc-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>javadoc</classifier>
- <classesDirectory>${basedir}/javadoc</classesDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/atomicfu-test/pom.xml b/atomicfu-test/pom.xml
deleted file mode 100644
index db35b3b..0000000
--- a/atomicfu-test/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<!--
- ~ Copyright 2017 JetBrains s.r.o.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-parent</artifactId>
- <version>0.9.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>atomicfu-test</artifactId>
- <packaging>jar</packaging>
-
- <properties>
- <atomicfu.version>${project.version}</atomicfu.version>
- </properties>
-
-
- <dependencies>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <!-- compile Kotlin files to staging directory -->
- <plugin>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-maven-plugin</artifactId>
- <version>${kotlin.version}</version>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <output>${project.build.directory}/classes-atomicfu</output>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- transform classes with AtomicFU plugin -->
- <plugin>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-maven-plugin</artifactId>
- <version>${atomicfu.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>transform</goal>
- </goals>
- <configuration>
- <verbose>true</verbose>
- <input>${project.build.directory}/classes-atomicfu</input>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- additional test execution with surefire on non-transformed files -->
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>atomicfu-test</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <classesDirectory>${project.build.directory}/classes-atomicfu</classesDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- other -->
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/atomicfu-transformer/pom.xml b/atomicfu-transformer/pom.xml
deleted file mode 100644
index 84e26a9..0000000
--- a/atomicfu-transformer/pom.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<!--
- ~ Copyright 2017 JetBrains s.r.o.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-parent</artifactId>
- <version>0.9.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>atomicfu-transformer</artifactId>
- <packaging>jar</packaging>
-
- <properties>
- <asm.version>5.2</asm.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-tree</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>${slf4j.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <!-- publish empty javadocs -->
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>empty-javadoc-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>javadoc</classifier>
- <classesDirectory>${basedir}/javadoc</classesDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/atomicfu/build.gradle b/atomicfu/build.gradle
index bbc3755..ed46c6b 100644
--- a/atomicfu/build.gradle
+++ b/atomicfu/build.gradle
@@ -3,27 +3,26 @@
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
expectedBy project(":atomicfu-common")
- compile project(":atomicfu-transformer")
+ testCompile project(":atomicfu-transformer")
testCompile "junit:junit:$junit_version"
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}
-def CLASSES_PRE_ATOMICFU = file("$buildDir/classes/kotlin/test")
-def CLASSES_POST_ATOMICFU = file("$buildDir/classes-post-atomicfu/test")
+def classesPreAtomicFuDir = file("$buildDir/classes/kotlin/test")
+def classesPostAtomicFuDir = file("$buildDir/classes-post-atomicfu/test")
task transformTestClasses(type: JavaExec, dependsOn: compileTestKotlin) {
main = "kotlinx.atomicfu.transformer.AtomicFUTransformerKt"
- args = [CLASSES_PRE_ATOMICFU, CLASSES_POST_ATOMICFU]
+ args = [classesPreAtomicFuDir, classesPostAtomicFuDir]
classpath = sourceSets.test.runtimeClasspath
- inputs.dir(CLASSES_PRE_ATOMICFU)
- outputs.dir(CLASSES_POST_ATOMICFU)
+ inputs.dir(classesPreAtomicFuDir)
+ outputs.dir(classesPostAtomicFuDir)
}
task transformedTest(type: Test, dependsOn: transformTestClasses) {
- classpath = files(configurations.testRuntime,
- CLASSES_POST_ATOMICFU)
+ classpath = files(configurations.testRuntime, classesPostAtomicFuDir)
exclude '**/*LFTest.*'
}
@@ -34,5 +33,5 @@
}
}
-build.dependsOn transformedTest
+test.dependsOn transformedTest
diff --git a/atomicfu/pom.xml b/atomicfu/pom.xml
deleted file mode 100644
index 3966a14..0000000
--- a/atomicfu/pom.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<!--
- ~ Copyright 2017 JetBrains s.r.o.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-parent</artifactId>
- <version>0.9.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>atomicfu</artifactId>
- <packaging>jar</packaging>
-
- <!-- documentation for release -->
- <profiles>
- <profile>
- <id>release</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jetbrains.dokka</groupId>
- <artifactId>dokka-maven-plugin</artifactId>
- <executions>
- <!-- attach javadoc with dokka -->
- <execution>
- <id>attach-javadocs</id>
- <phase>package</phase>
- <goals>
- <goal>javadocJar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/build.gradle b/build.gradle
index 1aa97e2..2878442 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,16 +1,19 @@
+
buildscript {
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
maven { url 'https://dl.bintray.com/jetbrains/kotlin-native-dependencies' }
-
+ maven { url "https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public" }
}
+
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$kotlin_native_version"
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintray_version"
+ classpath "com.liferay:com.liferay.gradle.plugins.maven.plugin.builder:1.2.0"
}
}
diff --git a/gradle.properties b/gradle.properties
index 0b3501d..4e1ee94 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,6 @@
version = 0.9.3-SNAPSHOT
+group = org.jetbrains.kotlinx
+
kotlin_version = 1.2.31
kotlin_native_version = 0.7-dev-1436
asm_version = 5.2
diff --git a/gradle/publish-bintray.gradle b/gradle/publish-bintray.gradle
index f307d8c..e39472c 100644
--- a/gradle/publish-bintray.gradle
+++ b/gradle/publish-bintray.gradle
@@ -4,9 +4,6 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
-// GroupId for publishing
-group = 'org.jetbrains.kotlinx'
-
// --------------- pom configuration ---------------
def pomConfig = {
@@ -47,6 +44,11 @@
maven(MavenPublication) {
from components.java
artifact sourcesJar
+ if (project.name.endsWith("-maven-plugin")) {
+ pom.with {
+ packaging = 'maven-plugin'
+ }
+ }
pom.withXml {
def root = asNode()
root.appendNode('name', project.name)
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 469c61c..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,177 +0,0 @@
-<!--
- ~ Copyright 2017 JetBrains s.r.o.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>atomicfu-parent</artifactId>
- <version>0.9.2-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <name>AtomicFU</name>
- <description>The idiomatic way to use atomic operations in Kotlin</description>
- <url>https://github.com/Kotlin/kotlinx.atomicfu/</url>
-
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- <comments>A business-friendly OSS license</comments>
- </license>
- </licenses>
-
- <modules>
- <module>atomicfu-gradle-plugin</module>
- <module>atomicfu-maven-plugin</module>
- <module>atomicfu-transformer</module>
- <module>atomicfu-test</module>
- <module>atomicfu</module>
- </modules>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <kotlin.version>1.2.21</kotlin.version>
- <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
- <dokka.version>0.9.15</dokka.version>
- <slf4j.version>1.8.0-alpha2</slf4j.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test</artifactId>
- <version>${kotlin.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src/main/kotlin</sourceDirectory>
- <testSourceDirectory>src/test/kotlin</testSourceDirectory>
-
- <plugins>
- <!-- compile kotlin -->
- <plugin>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-maven-plugin</artifactId>
- <version>${kotlin.version}</version>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>test-compile</id>
- <phase>test-compile</phase>
- <goals>
- <goal>test-compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-maven-plugin</artifactId>
- <version>${kotlin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.jetbrains.dokka</groupId>
- <artifactId>dokka-maven-plugin</artifactId>
- <version>${dokka.version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.19.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <profiles>
- <profile>
- <id>release</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <!-- publish sources -->
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <configuration>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <id>attach-sources</id>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <pluginRepositories>
- <pluginRepository>
- <id>bintray-kotlin-dokka</id>
- <name>bintray-kotlin-dokka</name>
- <url>http://dl.bintray.com/kotlin/dokka</url>
- </pluginRepository>
- </pluginRepositories>
-
- <developers>
- <developer>
- <id>JetBrains</id>
- <name>JetBrains Team</name>
- <organization>JetBrains</organization>
- <organizationUrl>http://www.jetbrains.com</organizationUrl>
- </developer>
- </developers>
-
- <scm>
- <url>https://github.com/Kotlin/kotlinx.atomicfu</url>
- <connection>scm:git:https://github.com/Kotlin/kotlinx.atomicfu.git</connection>
- <developerConnection>scm:git:https://github.com/Kotlin/kotlinx.atomicfu.git</developerConnection>
- </scm>
-
-</project>
diff --git a/settings.gradle b/settings.gradle
index 923c694..93e0eeb 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,6 +1,9 @@
include 'atomicfu'
include 'atomicfu-common'
-include 'atomicfu-transformer'
include 'atomicfu-js'
-include 'atomicfu-native'
\ No newline at end of file
+include 'atomicfu-native'
+
+include 'atomicfu-transformer'
+include 'atomicfu-gradle-plugin'
+include 'atomicfu-maven-plugin'