Changeset View
Changeset View
Standalone View
Standalone View
native/android/app/build.gradle
Show First 20 Lines • Show All 373 Lines • ▼ Show 20 Lines | |||||
task updateRustToolchain(type: Exec) { | task updateRustToolchain(type: Exec) { | ||||
commandLine "rustup", "target", "add", | commandLine "rustup", "target", "add", | ||||
"aarch64-linux-android", | "aarch64-linux-android", | ||||
"armv7-linux-androideabi", | "armv7-linux-androideabi", | ||||
"i686-linux-android", | "i686-linux-android", | ||||
"x86_64-linux-android" | "x86_64-linux-android" | ||||
} | } | ||||
def rustManifestPath = "../../native_rust_library/Cargo.toml" | |||||
def cargoProjectDirectory = "../../native_rust_library" | |||||
def cargoLibDirectory = '../../native_rust_library/target/cxxbridge/native_rust_library/src' | |||||
def cargoCXXDirectory = '../../native_rust_library/target/cxxbridge/rust' | |||||
task buildNativeRustLibrary(type: Exec) { | |||||
commandLine "cargo", "build", "--manifest-path", rustManifestPath | |||||
} | |||||
task rustDeploy(dependsOn: buildNativeRustLibrary, type: Copy) { | |||||
from(cargoLibDirectory) { | |||||
include 'lib.rs.h' | |||||
include 'lib.rs.cc' | |||||
} | |||||
from(cargoCXXDirectory) { | |||||
include 'cxx.h' | |||||
} | |||||
into cargoProjectDirectory | |||||
} | |||||
// Bind preBuild dependencies only if not 'clean' running | // Bind preBuild dependencies only if not 'clean' running | ||||
if (!isCleanRunning()) { | if (!isCleanRunning()) { | ||||
afterEvaluate { | afterEvaluate { | ||||
preBuild.dependsOn(prepareExternalLibs, updateRustToolchain) | preBuild.dependsOn(prepareExternalLibs, updateRustToolchain, rustDeploy) | ||||
} | } | ||||
} | } | ||||
// Run removing CXX task before the clean execution | // Run removing CXX task before the clean execution | ||||
beforeEvaluate { | beforeEvaluate { | ||||
clean.dependsOn(removeCXX) | clean.dependsOn(removeCXX) | ||||
} | } | ||||
▲ Show 20 Lines • Show All 334 Lines • Show Last 20 Lines |