Use Gradle conventions through base plugin

This commit is contained in:
Daniel Wolf 2019-08-03 22:31:06 +02:00
parent 356e30f446
commit 7c49f76efe
4 changed files with 27 additions and 16 deletions

View File

@ -3,20 +3,20 @@ plugins {
// See https://guides.gradle.org/creating-build-scans/#enable_build_scans_on_all_builds_of_your_project
id("com.gradle.build-scan") version "2.1"
// Sets up standard lifecycle tasks like `build` and `assemble`.
// Also required for the Zip task to compute its archive file name.
base
}
group = "com.rhubarb_lip_sync"
version = "2.0.0-pre-alpha"
val distsDirName = convention.getPlugin(BasePluginConvention::class).distsDirName
tasks {
val zip by creating(Zip::class) {
subprojects.forEach { dependsOn("${it.name}:assemble") }
for (subproject in subprojects) {
from(File(subproject.buildDir, "distributions")) {
from(File(subproject.buildDir, distsDirName)) {
into(if (subproject.name == "rhubarb") "" else subproject.name)
}
}

View File

@ -1,12 +1,17 @@
tasks {
var distDirectory = File(project.buildDir, "distributions")
plugins {
base
}
val assemble by creating(Copy::class) {
val distsDirName = convention.getPlugin(BasePluginConvention::class).distsDirName
var distDirectory = File(project.buildDir, distsDirName)
tasks {
val copy by creating(Copy::class) {
from(listOf("Rhubarb Lip Sync.jsx", "README.adoc"))
into(distDirectory)
}
val build by creating {
dependsOn(assemble)
assemble {
dependsOn(copy)
}
}

View File

@ -18,9 +18,10 @@ dependencies {
testCompile("org.assertj:assertj-core:3.11.1")
}
tasks {
var distDirectory = File(project.buildDir, "distributions")
val distsDirName = convention.getPlugin(BasePluginConvention::class).distsDirName
var distDirectory = File(project.buildDir, distsDirName)
tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

View File

@ -1,7 +1,12 @@
tasks {
var distDirectory = File(project.buildDir, "distributions")
val distsDirName = convention.getPlugin(BasePluginConvention::class).distsDirName
var distDirectory = File(project.buildDir, distsDirName)
val assemble by creating(Copy::class) {
plugins {
base
}
tasks {
val copy by creating(Copy::class) {
from(listOf(
"Debug Rhubarb.cs",
"Debug Rhubarb.cs.config",
@ -12,7 +17,7 @@ tasks {
into(distDirectory)
}
create("build") {
dependsOn(assemble)
assemble {
dependsOn(copy)
}
}