Open chtimi59 opened 1 year ago
After some investigation I've found this:
// CARGO_TARGET_DIR can be used to force the use of a global, shared target directory
// across all rust projects on a machine. Use it if it's set, otherwise use the
// configured `targetDirectory` value, and fall back to `${module}/target`.
//
// We also allow this to be specified in `local.properties`, not because this is
// something you should ever need to do currently, but we don't want it to ruin anyone's
// day if it turns out we're wrong about that.
val target =
getProperty("rust.cargoTargetDir", "CARGO_TARGET_DIR")
?: targetDirectory
?: "${module!!}/target"
And I've realized that getProperty() is defined as follow:
internal fun getProperty(camelCaseName: String, snakeCaseName: String): String? {
val local: String? = localProperties.getProperty(camelCaseName)
if (local != null) {
return local
}
val global: String? = System.getenv(snakeCaseName)
if (global != null) {
return global
}
return null
}
I guess it makes sens then:
spec.environment("CARGO_TARGET_DIR", rustOutputFolder(toolchain.platform))
won't populate:
System.getenv("CARGO_TARGET_DIR")
possible little hack (?)
exec { spec, toolchain ->
spec.environment("CARGO_TARGET_DIR", rustOutputFolder(toolchain.platform))
localProperties.setProperty("rust.cargoTargetDir", "${rustOutputFolder(toolchain.platform)}")
}
Version 0.9.3
I've try to change
CARGO_TARGET_DIR
per target like so:As the result, even if, the build folder
build/rustJniLibs/..
is created and rust build succeed,the folder stay empty !