0.3.3-0-pre.5
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: Android/gradle/sasedev-rust-android.gradle
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
import java.util.Collections
|
||||
import java.util.zip.ZipFile
|
||||
@@ -27,6 +27,9 @@ abstract class BuildSasedevRustAndroidTask extends DefaultTask {
|
||||
@Input
|
||||
abstract Property<String> getNdkVersion()
|
||||
|
||||
@Input
|
||||
abstract Property<Boolean> getReleaseBuild()
|
||||
|
||||
@Internal
|
||||
abstract DirectoryProperty getRepositoryRoot()
|
||||
|
||||
@@ -92,25 +95,32 @@ abstract class BuildSasedevRustAndroidTask extends DefaultTask {
|
||||
def linkFlag = "-Lnative=${linkDirectory}"
|
||||
def rustFlags = inheritedRustFlags ? "${inheritedRustFlags} ${linkFlag}" : linkFlag
|
||||
|
||||
def cargoCommand = [
|
||||
"cargo",
|
||||
"ndk",
|
||||
"-t",
|
||||
selectedAbi,
|
||||
"-o",
|
||||
output.absolutePath,
|
||||
"build",
|
||||
"-p",
|
||||
"game-android-entrypoint",
|
||||
]
|
||||
if (releaseBuild.get()) {
|
||||
cargoCommand.add("--release")
|
||||
}
|
||||
cargoCommand.addAll([
|
||||
"--no-default-features",
|
||||
"--features",
|
||||
selectedFeature,
|
||||
])
|
||||
|
||||
execOperations.exec { spec ->
|
||||
spec.workingDir(repository)
|
||||
spec.environment("ANDROID_NDK_HOME", configuredNdk.absolutePath)
|
||||
spec.environment("CARGO_NDK_PLATFORM", androidApi.get().toString())
|
||||
spec.environment("RUSTFLAGS", rustFlags)
|
||||
spec.commandLine(
|
||||
"cargo",
|
||||
"ndk",
|
||||
"-t",
|
||||
selectedAbi,
|
||||
"-o",
|
||||
output.absolutePath,
|
||||
"build",
|
||||
"-p",
|
||||
"game-android-entrypoint",
|
||||
"--no-default-features",
|
||||
"--features",
|
||||
selectedFeature,
|
||||
)
|
||||
spec.commandLine(cargoCommand)
|
||||
}
|
||||
|
||||
def rustLibrary = new File(runtimeDirectory, "libgame_android_entrypoint.so")
|
||||
@@ -153,7 +163,8 @@ if (!unsupportedAbis.isEmpty()) {
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants(selector().withBuildType("debug")) { variant ->
|
||||
onVariants(selector().all()) { variant ->
|
||||
def selectedReleaseBuild = variant.buildType == "release"
|
||||
selectedAbis.each { selectedAbi ->
|
||||
def variantSuffix = variant.name.substring(0, 1).toUpperCase() + variant.name.substring(1)
|
||||
def abiSuffix = selectedAbi
|
||||
@@ -177,6 +188,7 @@ androidComponents {
|
||||
abi.set(selectedAbi)
|
||||
androidApi.set(selectedAndroidApi)
|
||||
ndkVersion.set(configuredNdkVersion)
|
||||
releaseBuild.set(selectedReleaseBuild)
|
||||
repositoryRoot.set(repositoryDirectory)
|
||||
outputDirectory.set(layout.buildDirectory.dir("generated/sasedevNative/${variant.name}/${selectedAbi}/jniLibs"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user