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

Fix the compile error #2930 #2935

Merged
merged 5 commits into from
Sep 21, 2022
Merged
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
23 changes: 20 additions & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.gradle.tasks.throwGradleExceptionIfError

plugins {
id("com.android.library")
Expand Down Expand Up @@ -51,9 +53,24 @@ cargo {
"aead-cipher-2022",
))
exec = { spec, toolchain ->
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python3")
spec.environment("RUST_ANDROID_GRADLE_LINKER_WRAPPER_PY", "$projectDir/$module/../linker-wrapper.py")
spec.environment("RUST_ANDROID_GRADLE_TARGET", "target/${toolchain.target}/$profile/lib$libname.so")
run {
try {
Runtime.getRuntime().exec("python3 -V >/dev/null 2>&1")
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python3")
project.logger.lifecycle("Python 3 detected.")
} catch (e: java.io.IOException) {
project.logger.lifecycle("No python 3 detected.")
try {
Runtime.getRuntime().exec("python -V >/dev/null 2>&1")
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python")
project.logger.lifecycle("Python detected.")
} catch (e: java.io.IOException) {
throw GradleException("No any python version detected. You should install the python first to compile project.")
}
}
spec.environment("RUST_ANDROID_GRADLE_LINKER_WRAPPER_PY", "$projectDir/$module/../linker-wrapper.py")
spec.environment("RUST_ANDROID_GRADLE_TARGET", "target/${toolchain.target}/$profile/lib$libname.so")
}
}
}

Expand Down