Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using doFirst to postpone setting task inputs #1326

Merged
merged 3 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions cast/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,17 @@ artifacts.add(
tasks.named<Javadoc>("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>("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) {

Expand Down
7 changes: 6 additions & 1 deletion cast/smoke_main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<File>()
Expand Down