Added flags to enable alternate between debug and release Rust builds
This commit is contained in:
parent
301f55a307
commit
8d863492ed
@ -26,6 +26,7 @@ version = projectVersion
|
|||||||
|
|
||||||
val isLinuxAarch64 = (properties.getOrDefault("isLinuxAarch64", "false") as String).toBoolean()
|
val isLinuxAarch64 = (properties.getOrDefault("isLinuxAarch64", "false") as String).toBoolean()
|
||||||
val useCross = (properties.getOrDefault("useCross", "false") as String).toBoolean()
|
val useCross = (properties.getOrDefault("useCross", "false") as String).toBoolean()
|
||||||
|
val isRustRelease = (properties.getOrDefault("isRustRelease", "true") as String).toBoolean()
|
||||||
|
|
||||||
|
|
||||||
sourceSets.getByName("main") {
|
sourceSets.getByName("main") {
|
||||||
@ -242,9 +243,13 @@ fun buildRust() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val params = mutableListOf(
|
val params = mutableListOf(
|
||||||
binary, "build", "--release",
|
binary, "build",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (isRustRelease) {
|
||||||
|
params.add("--release")
|
||||||
|
}
|
||||||
|
|
||||||
if (currentOs() == OS.LINUX && useCross) {
|
if (currentOs() == OS.LINUX && useCross) {
|
||||||
if (isLinuxAarch64) {
|
if (isLinuxAarch64) {
|
||||||
params.add("--target=$linuxArmTarget")
|
params.add("--target=$linuxArmTarget")
|
||||||
@ -261,14 +266,20 @@ fun buildRust() {
|
|||||||
fun copyRustBuild() {
|
fun copyRustBuild() {
|
||||||
val outputDir = "${project.projectDir}/src/main/resources"
|
val outputDir = "${project.projectDir}/src/main/resources"
|
||||||
|
|
||||||
|
val buildTypeDirectory = if (isRustRelease) {
|
||||||
|
"release"
|
||||||
|
} else {
|
||||||
|
"debug"
|
||||||
|
}
|
||||||
|
|
||||||
val workingDirPath = if (currentOs() == OS.LINUX && useCross) {
|
val workingDirPath = if (currentOs() == OS.LINUX && useCross) {
|
||||||
if (isLinuxAarch64) {
|
if (isLinuxAarch64) {
|
||||||
"rs/target/$linuxArmTarget/release"
|
"rs/target/$linuxArmTarget/$buildTypeDirectory"
|
||||||
} else {
|
} else {
|
||||||
"rs/target/$linuxX64Target/release"
|
"rs/target/$linuxX64Target/$buildTypeDirectory"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"rs/target/release"
|
"rs/target/$buildTypeDirectory"
|
||||||
}
|
}
|
||||||
|
|
||||||
val workingDir = File(project.projectDir, workingDirPath)
|
val workingDir = File(project.projectDir, workingDirPath)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
isLinuxAarch64=false
|
isLinuxAarch64=false
|
||||||
useCross=false
|
useCross=false
|
||||||
|
isRustRelease=false
|
Loading…
Reference in New Issue
Block a user