aboutsummaryrefslogtreecommitdiff
path: root/runners/maven-plugin/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'runners/maven-plugin/build.gradle')
-rw-r--r--runners/maven-plugin/build.gradle45
1 files changed, 32 insertions, 13 deletions
diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle
index bac05b2b..37a79a69 100644
--- a/runners/maven-plugin/build.gradle
+++ b/runners/maven-plugin/build.gradle
@@ -1,14 +1,18 @@
-import groovy.xml.QName
+import groovy.io.FileType
import org.jetbrains.CrossPlatformExec
+import shadow.org.apache.commons.io.FileUtils
+
+import java.nio.file.FileVisitResult
+import java.nio.file.Files
+import java.nio.file.Paths
+import java.nio.file.StandardCopyOption
+import java.nio.file.attribute.BasicFileAttributes
+
apply plugin: 'kotlin'
apply plugin: 'com.github.johnrengelman.shadow'
-tasks.withType(AbstractCompile) {
- classpath += configurations.shadow
-}
-
dependencies {
shadow project(":runners:fatjar")
shadow "org.apache.maven:maven-core:$maven_version"
@@ -28,14 +32,33 @@ task ("generatePom") doLast {
.replace("<version>maven-plugin-plugin</version>", "<version>$maven_plugin_tools_version</version>")
}
+task mergeClassOutputs doLast {
+ def sourceDir = new File(buildDir, "classes/kotlin")
+ def targetDir = new File(buildDir, "classes/java")
+
+ sourceDir.eachFileRecurse FileType.ANY, {
+ def filePath = it.toPath()
+ def targetFilePath = targetDir.toPath().resolve(sourceDir.toPath().relativize(filePath))
+ if (it.isFile()) {
+ Files.move(filePath, targetFilePath, StandardCopyOption.REPLACE_EXISTING)
+ } else if (it.isDirectory()) {
+ targetFilePath.toFile().mkdirs()
+ }
+ }
+}
+
task pluginDescriptor(type: CrossPlatformExec) {
workingDir buildDir
commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:descriptor'
+
+ dependsOn mergeClassOutputs
}
task helpMojo(type: CrossPlatformExec) {
workingDir buildDir
commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:helpmojo'
+
+ dependsOn mergeClassOutputs
}
helpMojo.dependsOn generatePom
@@ -67,6 +90,8 @@ publishing {
classifier "sources"
}
+ project.shadow.component(publication)
+
pom.withXml {
Node root = asNode()
@@ -81,7 +106,7 @@ publishing {
''')
root.children().find {
- return ((QName) it.name()).qualifiedName == "dependencies"
+ return it.name() == "dependencies"
}.append(dependency)
def profiles = new XmlParser().parseText('''
@@ -115,14 +140,8 @@ publishing {
root.append(profiles)
}
- project.shadow.component(publication)
- }
- }
-}
-
-tasks.withType(GenerateMavenPom) { Task generatePom ->
- generatePom.doLast {
+ }
}
}