multiple fixes
This commit is contained in:
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
|
||||||
distributionSha256Sum=371cb9fbebbe9880d147f59bab36d61eee122854ef8c9ee1ecf12b82368bcf10
|
distributionSha256Sum=8fad3d78296ca518113f3d29016617c7f9367dc005f932bd9d93bf45ba46072b
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -88,16 +88,20 @@ ensure_omvll_bundle() {
|
|||||||
local archive_url="${OMVLL_ARCHIVE_URL:-https://github.com/open-obfuscator/o-mvll/releases/download/${OMVLL_VERSION}/${OMVLL_LINUX_ASSET}}"
|
local archive_url="${OMVLL_ARCHIVE_URL:-https://github.com/open-obfuscator/o-mvll/releases/download/${OMVLL_VERSION}/${OMVLL_LINUX_ASSET}}"
|
||||||
OMVLL_CACHE_DIR="$SCRIPT_DIR/.omvll/$OMVLL_VERSION"
|
OMVLL_CACHE_DIR="$SCRIPT_DIR/.omvll/$OMVLL_VERSION"
|
||||||
OMVLL_PLUGIN_PATH="$OMVLL_CACHE_DIR/omvll-ndk.so"
|
OMVLL_PLUGIN_PATH="$OMVLL_CACHE_DIR/omvll-ndk.so"
|
||||||
|
local tmp_tar=""
|
||||||
|
|
||||||
if [ ! -f "$OMVLL_PLUGIN_PATH" ]; then
|
download_omvll_bundle() {
|
||||||
echo "Downloading O-MVLL bundle from $archive_url"
|
|
||||||
rm -rf "$OMVLL_CACHE_DIR"
|
rm -rf "$OMVLL_CACHE_DIR"
|
||||||
mkdir -p "$OMVLL_CACHE_DIR"
|
mkdir -p "$OMVLL_CACHE_DIR"
|
||||||
local tmp_tar
|
|
||||||
tmp_tar=$(mktemp)
|
tmp_tar=$(mktemp)
|
||||||
curl -fL "$archive_url" -o "$tmp_tar"
|
curl -fL "$archive_url" -o "$tmp_tar"
|
||||||
tar -xzf "$tmp_tar" -C "$OMVLL_CACHE_DIR"
|
tar -xzf "$tmp_tar" -C "$OMVLL_CACHE_DIR"
|
||||||
rm -f "$tmp_tar"
|
rm -f "$tmp_tar"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -f "$OMVLL_PLUGIN_PATH" ]; then
|
||||||
|
echo "Downloading O-MVLL bundle from $archive_url"
|
||||||
|
download_omvll_bundle
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$OMVLL_PLUGIN_PATH" ]; then
|
if [ ! -f "$OMVLL_PLUGIN_PATH" ]; then
|
||||||
@@ -116,6 +120,10 @@ ensure_omvll_bundle() {
|
|||||||
if [ -z "${OMVLL_PYTHONPATH:-}" ]; then
|
if [ -z "${OMVLL_PYTHONPATH:-}" ]; then
|
||||||
local py_root
|
local py_root
|
||||||
py_root=$(find "$OMVLL_CACHE_DIR" -maxdepth 1 -type d -name 'Python-*' | head -n1 || true)
|
py_root=$(find "$OMVLL_CACHE_DIR" -maxdepth 1 -type d -name 'Python-*' | head -n1 || true)
|
||||||
|
if [ -z "$py_root" ] || [ ! -d "$py_root/Lib" ]; then
|
||||||
|
echo "OMVLL cache is incomplete. Re-downloading bundle..." >&2
|
||||||
|
download_omvll_bundle
|
||||||
|
py_root=$(find "$OMVLL_CACHE_DIR" -maxdepth 1 -type d -name 'Python-*' | head -n1 || true)
|
||||||
if [ -z "$py_root" ] || [ ! -d "$py_root/Lib" ]; then
|
if [ -z "$py_root" ] || [ ! -d "$py_root/Lib" ]; then
|
||||||
echo "Unable to determine Python stdlib directory inside the O-MVLL bundle" >&2
|
echo "Unable to determine Python stdlib directory inside the O-MVLL bundle" >&2
|
||||||
echo "OMVLL_CACHE_DIR: $OMVLL_CACHE_DIR" >&2
|
echo "OMVLL_CACHE_DIR: $OMVLL_CACHE_DIR" >&2
|
||||||
@@ -123,6 +131,7 @@ ensure_omvll_bundle() {
|
|||||||
ls -la "$OMVLL_CACHE_DIR" >&2 || true
|
ls -la "$OMVLL_CACHE_DIR" >&2 || true
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
export OMVLL_PYTHONPATH="$py_root/Lib"
|
export OMVLL_PYTHONPATH="$py_root/Lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -252,28 +252,39 @@ val syncTasks = cargoTargets.mapIndexed { index, target ->
|
|||||||
omvllArchiveUrl?.let { environment("OMVLL_ARCHIVE_URL", it) }
|
omvllArchiveUrl?.let { environment("OMVLL_ARCHIVE_URL", it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Sync>("syncNative${target.taskSuffix}") {
|
tasks.register("syncNative${target.taskSuffix}") {
|
||||||
dependsOn(cargoTask)
|
dependsOn(cargoTask)
|
||||||
val outputLibName = nativeLibFileName
|
val outputLibName = nativeLibFileName
|
||||||
inputs.property("outputLibName", outputLibName)
|
|
||||||
val wslCandidate = File(wslStagingDir, "native/rust/target/${target.triple}/release/libpurrfectsnap.so")
|
val wslCandidate = File(wslStagingDir, "native/rust/target/${target.triple}/release/libpurrfectsnap.so")
|
||||||
val localCandidate = layout.projectDirectory.file("rust/target/${target.triple}/release/libpurrfectsnap.so").asFile
|
val localCandidate = layout.projectDirectory.file("rust/target/${target.triple}/release/libpurrfectsnap.so").asFile
|
||||||
val sourceLibs = files(wslCandidate, localCandidate)
|
val outputDir = layout.buildDirectory.dir("rustJniLibs/android/${target.abi}")
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
inputs.property("outputLibName", outputLibName)
|
||||||
from(sourceLibs) {
|
inputs.files(wslCandidate, localCandidate)
|
||||||
rename { outputLibName }
|
outputs.dir(outputDir)
|
||||||
}
|
outputs.upToDateWhen { false }
|
||||||
from(sourceLibs) {
|
|
||||||
rename { "libpurrfectsnap.so" }
|
|
||||||
}
|
|
||||||
into(layout.buildDirectory.dir("rustJniLibs/android/${target.abi}"))
|
|
||||||
inputs.files(sourceLibs)
|
|
||||||
val checksumsDir = layout.buildDirectory.dir("checksums")
|
val checksumsDir = layout.buildDirectory.dir("checksums")
|
||||||
doLast {
|
doLast {
|
||||||
val file = File(destinationDir, outputLibName)
|
val sourceFile = listOf(wslCandidate, localCandidate).firstOrNull { it.exists() }
|
||||||
if (!file.exists()) {
|
?: error(
|
||||||
error("Native library not found for ${target.abi}. Expected ${file.absolutePath}")
|
"Native library not found for ${target.abi}. Looked in: " +
|
||||||
|
"${wslCandidate.absolutePath}, ${localCandidate.absolutePath}"
|
||||||
|
)
|
||||||
|
|
||||||
|
val abiDir = outputDir.get().asFile
|
||||||
|
abiDir.mkdirs()
|
||||||
|
|
||||||
|
project.copy {
|
||||||
|
from(sourceFile)
|
||||||
|
into(abiDir)
|
||||||
|
rename { outputLibName }
|
||||||
}
|
}
|
||||||
|
project.copy {
|
||||||
|
from(sourceFile)
|
||||||
|
into(abiDir)
|
||||||
|
rename { "libpurrfectsnap.so" }
|
||||||
|
}
|
||||||
|
|
||||||
|
val file = File(abiDir, outputLibName)
|
||||||
val crc = CRC32()
|
val crc = CRC32()
|
||||||
crc.update(file.readBytes())
|
crc.update(file.readBytes())
|
||||||
val checksumsDirFile = checksumsDir.get().asFile
|
val checksumsDirFile = checksumsDir.get().asFile
|
||||||
|
|||||||
Reference in New Issue
Block a user