diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-07-08 12:15:30 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-07-08 18:59:57 +0200 |
commit | 4f9e180a1f9e9e0432bf1aed379c024736623d12 (patch) | |
tree | d6f3bba272a38a4c52ae60f90a8c9a74bb1ace5f /runners/maven-plugin/build.gradle.kts | |
parent | caf48e76f3bff5e9907cd094cf0719f623e528d5 (diff) | |
download | dokka-4f9e180a1f9e9e0432bf1aed379c024736623d12.tar.gz dokka-4f9e180a1f9e9e0432bf1aed379c024736623d12.tar.bz2 dokka-4f9e180a1f9e9e0432bf1aed379c024736623d12.zip |
Implement SetupMaven task
Diffstat (limited to 'runners/maven-plugin/build.gradle.kts')
-rw-r--r-- | runners/maven-plugin/build.gradle.kts | 63 |
1 files changed, 22 insertions, 41 deletions
diff --git a/runners/maven-plugin/build.gradle.kts b/runners/maven-plugin/build.gradle.kts index 8e412b43..6214da6d 100644 --- a/runners/maven-plugin/build.gradle.kts +++ b/runners/maven-plugin/build.gradle.kts @@ -1,48 +1,29 @@ import org.jetbrains.configureBintrayPublication import org.jetbrains.CrossPlatformExec +import org.jetbrains.SetupMaven -/** - * [mavenBin] configuration is used to download Maven Plugin Plugin - * for generating plugin-help.xml and plugin.xml files - */ -val mavenBin: Configuration by configurations.creating -val mavenVersion = "3.5.0" -val mavenPluginToolsVersion = "3.5.2" -val aetherVersion = "1.1.0" +val setupMaven by tasks.register<SetupMaven>("setupMaven") dependencies { implementation(project(":core")) - implementation("org.apache.maven:maven-core:$mavenVersion") - implementation("org.apache.maven:maven-plugin-api:$mavenVersion") - implementation("org.apache.maven.plugin-tools:maven-plugin-annotations:$mavenPluginToolsVersion") + implementation("org.apache.maven:maven-core:${setupMaven.mavenVersion}") + implementation("org.apache.maven:maven-plugin-api:${setupMaven.mavenVersion}") + implementation("org.apache.maven.plugin-tools:maven-plugin-annotations:${setupMaven.mavenPluginToolsVersion}") implementation("org.apache.maven:maven-archiver:2.5") implementation(kotlin("stdlib-jdk8")) - implementation("org.eclipse.aether:aether-api:${aetherVersion}") - implementation("org.eclipse.aether:aether-spi:${aetherVersion}") - implementation("org.eclipse.aether:aether-impl:${aetherVersion}") - implementation("org.eclipse.aether:aether-connector-basic:${aetherVersion}") - implementation("org.eclipse.aether:aether-transport-file:${aetherVersion}") - implementation("org.eclipse.aether:aether-transport-http:${aetherVersion}") + implementation("org.eclipse.aether:aether-api:${setupMaven.aetherVersion}") + implementation("org.eclipse.aether:aether-spi:${setupMaven.aetherVersion}") + implementation("org.eclipse.aether:aether-impl:${setupMaven.aetherVersion}") + implementation("org.eclipse.aether:aether-connector-basic:${setupMaven.aetherVersion}") + implementation("org.eclipse.aether:aether-transport-file:${setupMaven.aetherVersion}") + implementation("org.eclipse.aether:aether-transport-http:${setupMaven.aetherVersion}") implementation("org.apache.maven:maven-aether-provider:3.3.3") - mavenBin(group = "org.apache.maven", name = "apache-maven", version = mavenVersion, classifier = "bin", ext = "zip") } -val mavenBinDir = "$buildDir/maven-bin" -val mavenBuildDir = "$buildDir/maven" -val mvn = File(mavenBinDir, "apache-maven-$mavenVersion/bin/mvn") -extra.set("MVN_BINARY_PATH", mvn.absolutePath) - tasks.named<Delete>("clean") { - delete(mavenBinDir) -} - -/** - * Copy Maven Plugin Plugin to [mavenBinDir] directory - */ -val setupMaven by tasks.registering(Sync::class) { - from(mavenBin.map { zipTree(it) }) - into(mavenBinDir) + delete(setupMaven.mavenBuildDir) + delete(setupMaven.mavenBinDir) } /** @@ -55,17 +36,17 @@ val generatePom by tasks.registering(Copy::class) { from("$projectDir/pom.tpl.xml") { rename("(.*).tpl.xml", "$1.xml") } - into(mavenBuildDir) + into(setupMaven.mavenBuildDir) eachFile { filter { line -> - line.replace("<maven.version></maven.version>", "<maven.version>$mavenVersion</maven.version>") + line.replace("<maven.version></maven.version>", "<maven.version>${setupMaven.mavenVersion}</maven.version>") } filter { line -> line.replace("<version>dokka_version</version>", "<version>$dokka_version</version>") } filter { line -> - line.replace("<version>maven-plugin-plugin</version>", "<version>$mavenPluginToolsVersion</version>") + line.replace("<version>maven-plugin-plugin</version>", "<version>${setupMaven.mavenPluginToolsVersion}</version>") } } } @@ -76,7 +57,7 @@ val generatePom by tasks.registering(Copy::class) { val syncClasses by tasks.registering(Sync::class) { dependsOn(tasks.compileKotlin, tasks.compileJava) from("$buildDir/classes/kotlin", "$buildDir/classes/java") - into("$mavenBuildDir/classes/java") + into("${setupMaven.mavenBuildDir}/classes/java") preserve { include("**/*.class") @@ -85,14 +66,14 @@ val syncClasses by tasks.registering(Sync::class) { val helpMojo by tasks.registering(CrossPlatformExec::class) { dependsOn(setupMaven, generatePom, syncClasses) - workingDir(mavenBuildDir) - commandLine(mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:helpmojo") + workingDir(setupMaven.mavenBuildDir) + commandLine(setupMaven.mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:helpmojo") } val pluginDescriptor by tasks.registering(CrossPlatformExec::class) { dependsOn(setupMaven, generatePom, syncClasses) - workingDir(mavenBuildDir) - commandLine(mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:descriptor") + workingDir(setupMaven.mavenBuildDir) + commandLine(setupMaven.mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:descriptor") } val sourceJar by tasks.registering(Jar::class) { @@ -103,7 +84,7 @@ val sourceJar by tasks.registering(Jar::class) { tasks.named<Jar>("jar") { dependsOn(pluginDescriptor, helpMojo) metaInf { - from("$mavenBuildDir/classes/java/main/META-INF") + from("${setupMaven.mavenBuildDir}/classes/java/main/META-INF") } manifest { attributes("Class-Path" to configurations.runtimeClasspath.get().files.joinToString(" ") { it.name }) |