From cdf597a1ef142a63a146bee8006802685d7878c0 Mon Sep 17 00:00:00 2001 From: Lucwousin Date: Sat, 27 Jun 2020 19:08:52 +0200 Subject: [PATCH] lazy resolve bootstrap deps --- buildSrc/src/main/kotlin/BootstrapPlugin.kt | 12 +++--------- buildSrc/src/main/kotlin/BootstrapTask.kt | 18 ++++++++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/buildSrc/src/main/kotlin/BootstrapPlugin.kt b/buildSrc/src/main/kotlin/BootstrapPlugin.kt index 51f54c8506..c704cddb30 100644 --- a/buildSrc/src/main/kotlin/BootstrapPlugin.kt +++ b/buildSrc/src/main/kotlin/BootstrapPlugin.kt @@ -4,20 +4,13 @@ import org.gradle.kotlin.dsl.* class BootstrapPlugin : Plugin { override fun apply(project: Project): Unit = with(project) { - val clientJar by configurations.creating { - isCanBeConsumed = false - isCanBeResolved = true - isTransitive = false - } val bootstrapDependencies by configurations.creating { - extendsFrom(clientJar) isCanBeConsumed = false isCanBeResolved = true isTransitive = false } dependencies { - clientJar(tasks["jar"].outputs.files) bootstrapDependencies(project(":runelite-api")) bootstrapDependencies(project(":runescape-api")) bootstrapDependencies(project(":http-api")) @@ -29,6 +22,9 @@ class BootstrapPlugin : Plugin { tasks.register("bootstrapStable", "stable") tasks.withType { + this.group = "openosrs" + this.clientJar.fileProvider(provider { tasks["jar"].outputs.files.singleFile }) + dependsOn(bootstrapDependencies) dependsOn("publish") dependsOn(project(":runelite-api").tasks["publish"]) @@ -36,8 +32,6 @@ class BootstrapPlugin : Plugin { dependsOn(project(":http-api").tasks["publish"]) dependsOn(project(":injected-client").tasks["publish"]) - this.clientJar = clientJar.singleFile - doLast { copy { from(bootstrapDependencies) diff --git a/buildSrc/src/main/kotlin/BootstrapTask.kt b/buildSrc/src/main/kotlin/BootstrapTask.kt index ce9576ed1a..b4769207c8 100644 --- a/buildSrc/src/main/kotlin/BootstrapTask.kt +++ b/buildSrc/src/main/kotlin/BootstrapTask.kt @@ -1,9 +1,6 @@ import org.gradle.api.DefaultTask -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.PathSensitive -import org.gradle.api.tasks.PathSensitivity -import org.gradle.api.tasks.TaskAction +import org.gradle.api.file.RegularFileProperty +import org.gradle.api.tasks.* import org.gradle.kotlin.dsl.extra import org.gradle.kotlin.dsl.get import java.io.File @@ -14,7 +11,7 @@ open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultT @InputFile @PathSensitive(PathSensitivity.ABSOLUTE) - var clientJar: File? = null + val clientJar: RegularFileProperty = project.objects.fileProperty() @Input val launcherJvm11Arguments = arrayOf("-XX:+DisableAttachMechanism", "-Drunelite.launcher.nojvm=true", "-Xmx1G", "-Xss2m", "-XX:CompileThreshold=1500", "-Djna.nosys=true") @@ -81,11 +78,12 @@ open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultT } } + val cjar = clientJar.get().asFile artifacts.add(JsonBuilder( - "name" to clientJar!!.name, - "path" to "https://github.com/open-osrs/hosting/raw/master/${type}/${clientJar!!.name}", - "size" to clientJar!!.length(), - "hash" to hash(clientJar!!.readBytes()) + "name" to cjar.name, + "path" to "https://github.com/open-osrs/hosting/raw/master/${type}/${cjar.name}", + "size" to cjar.length(), + "hash" to hash(cjar.readBytes()) )) return artifacts.toTypedArray()