From 4aba9c815fd26d8cfadf3bbb2e51f0854a99d0dd Mon Sep 17 00:00:00 2001 From: particle-box Date: Tue, 24 Feb 2026 12:51:25 +0530 Subject: [PATCH] multiple fixes --- ...otlin-compiler-10372555141187290834.salive | 0 gradle/wrapper/gradle-wrapper.properties | 4 +- native/build-native.sh | 25 +++++++---- native/build.gradle.kts | 41 ++++++++++++------- 4 files changed, 45 insertions(+), 25 deletions(-) delete mode 100644 .kotlin/sessions/kotlin-compiler-10372555141187290834.salive diff --git a/.kotlin/sessions/kotlin-compiler-10372555141187290834.salive b/.kotlin/sessions/kotlin-compiler-10372555141187290834.salive deleted file mode 100644 index e69de29b..00000000 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bc75e3bb..6ca25867 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.0-bin.zip -distributionSha256Sum=371cb9fbebbe9880d147f59bab36d61eee122854ef8c9ee1ecf12b82368bcf10 +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip +distributionSha256Sum=8fad3d78296ca518113f3d29016617c7f9367dc005f932bd9d93bf45ba46072b networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/native/build-native.sh b/native/build-native.sh index bfc42fd4..9d62bc47 100644 --- a/native/build-native.sh +++ b/native/build-native.sh @@ -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}}" OMVLL_CACHE_DIR="$SCRIPT_DIR/.omvll/$OMVLL_VERSION" OMVLL_PLUGIN_PATH="$OMVLL_CACHE_DIR/omvll-ndk.so" + local tmp_tar="" - if [ ! -f "$OMVLL_PLUGIN_PATH" ]; then - echo "Downloading O-MVLL bundle from $archive_url" + download_omvll_bundle() { rm -rf "$OMVLL_CACHE_DIR" mkdir -p "$OMVLL_CACHE_DIR" - local tmp_tar tmp_tar=$(mktemp) curl -fL "$archive_url" -o "$tmp_tar" tar -xzf "$tmp_tar" -C "$OMVLL_CACHE_DIR" rm -f "$tmp_tar" + } + + if [ ! -f "$OMVLL_PLUGIN_PATH" ]; then + echo "Downloading O-MVLL bundle from $archive_url" + download_omvll_bundle fi if [ ! -f "$OMVLL_PLUGIN_PATH" ]; then @@ -117,11 +121,16 @@ ensure_omvll_bundle() { local py_root 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 "Unable to determine Python stdlib directory inside the O-MVLL bundle" >&2 - echo "OMVLL_CACHE_DIR: $OMVLL_CACHE_DIR" >&2 - echo "Contents:" >&2 - ls -la "$OMVLL_CACHE_DIR" >&2 || true - exit 1 + 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 + echo "Unable to determine Python stdlib directory inside the O-MVLL bundle" >&2 + echo "OMVLL_CACHE_DIR: $OMVLL_CACHE_DIR" >&2 + echo "Contents:" >&2 + ls -la "$OMVLL_CACHE_DIR" >&2 || true + exit 1 + fi fi export OMVLL_PYTHONPATH="$py_root/Lib" fi diff --git a/native/build.gradle.kts b/native/build.gradle.kts index 47825965..9e85b936 100644 --- a/native/build.gradle.kts +++ b/native/build.gradle.kts @@ -252,28 +252,39 @@ val syncTasks = cargoTargets.mapIndexed { index, target -> omvllArchiveUrl?.let { environment("OMVLL_ARCHIVE_URL", it) } } - tasks.register("syncNative${target.taskSuffix}") { + tasks.register("syncNative${target.taskSuffix}") { dependsOn(cargoTask) val outputLibName = nativeLibFileName - inputs.property("outputLibName", outputLibName) 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 sourceLibs = files(wslCandidate, localCandidate) - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from(sourceLibs) { - rename { outputLibName } - } - from(sourceLibs) { - rename { "libpurrfectsnap.so" } - } - into(layout.buildDirectory.dir("rustJniLibs/android/${target.abi}")) - inputs.files(sourceLibs) + val outputDir = layout.buildDirectory.dir("rustJniLibs/android/${target.abi}") + inputs.property("outputLibName", outputLibName) + inputs.files(wslCandidate, localCandidate) + outputs.dir(outputDir) + outputs.upToDateWhen { false } val checksumsDir = layout.buildDirectory.dir("checksums") doLast { - val file = File(destinationDir, outputLibName) - if (!file.exists()) { - error("Native library not found for ${target.abi}. Expected ${file.absolutePath}") + val sourceFile = listOf(wslCandidate, localCandidate).firstOrNull { it.exists() } + ?: error( + "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() crc.update(file.readBytes()) val checksumsDirFile = checksumsDir.get().asFile