From a4d743adf19d4cf075843377fdbc3a7022ba1c7a Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Sat, 9 Sep 2023 21:20:14 -0400 Subject: [PATCH 1/3] Simplify setting a property This property setting is simple and speedy. We may as well do it eagerly, at configuration time, so that it can be recorded as a task input. --- cast/build.gradle.kts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cast/build.gradle.kts b/cast/build.gradle.kts index d0da3f529b..5c1ec82f41 100644 --- a/cast/build.gradle.kts +++ b/cast/build.gradle.kts @@ -68,8 +68,7 @@ tasks.named("javadoc") { tasks.named("test") { inputs.files(xlatorTestSharedLibrary) - val xlatorTestSharedLibrary = xlatorTestSharedLibrary.singleFile - doFirst { systemProperty("java.library.path", xlatorTestSharedLibrary.parent) } + systemProperty("java.library.path", xlatorTestSharedLibrary.singleFile.parent) if (rootProject.extra["isWindows"] as Boolean) { From 0f12a04b7c7442c76d22c38af9ac87d22f299691 Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Sat, 9 Sep 2023 21:46:54 -0400 Subject: [PATCH 2/3] Set executable during task configuration This task's `executable` is an input to the task. We should set it during task configuration time for more precise caching. --- cast/smoke_main/build.gradle.kts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cast/smoke_main/build.gradle.kts b/cast/smoke_main/build.gradle.kts index 31eb2bc2a7..7eea263c95 100644 --- a/cast/smoke_main/build.gradle.kts +++ b/cast/smoke_main/build.gradle.kts @@ -86,7 +86,12 @@ application { // main executable to run for test inputs.file(linkedFile) - doFirst { executable(linkedFile.get().asFile) } + executable( + object { + val toString by lazy { linkedFile.get().asFile.toString() } + + override fun toString() = toString + }) // xlator Java bytecode + implementation of native methods val pathElements = project.objects.listProperty() From 750e0cc774439b6152cb540fe9514b977303cbef Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Sat, 9 Sep 2023 21:47:39 -0400 Subject: [PATCH 3/3] Set Javadoc doclet options during task configuration This task's doclet options are inputs to the task. We should set them during task configuration time for more precise caching. --- cast/build.gradle.kts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cast/build.gradle.kts b/cast/build.gradle.kts index 5c1ec82f41..23e75b97f1 100644 --- a/cast/build.gradle.kts +++ b/cast/build.gradle.kts @@ -58,12 +58,12 @@ artifacts.add( tasks.named("javadoc") { inputs.files(castJsPackageListDirectory) - inputs.property("extdocURL", castJsJavadocDestinationDirectory.singleFile) - inputs.property("packagelistLoc", castJsPackageListDirectory.singleFile) - doFirst { - (options as StandardJavadocDocletOptions).linksOffline( - inputs.properties["extdocURL"].toString(), inputs.properties["packagelistLoc"].toString()) - } + val extdocURL = castJsJavadocDestinationDirectory.singleFile + val packagelistLoc = castJsPackageListDirectory.singleFile + inputs.property("extdocURL", extdocURL) + inputs.property("packagelistLoc", packagelistLoc) + (options as StandardJavadocDocletOptions).linksOffline( + extdocURL.toString(), packagelistLoc.toString()) } tasks.named("test") {