diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index c1903ede7..e2aa3927d 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -117,8 +117,9 @@ dependencies { def keystorePwd = null def alias = null def pwd = null -Properties properties +def ignoreX86 = false +Properties properties def base64 = System.getenv("LOCAL_PROPERTIES") if (base64 != null && !base64.isBlank()) { properties = new Properties() @@ -132,6 +133,7 @@ if (properties != null) { keystorePwd = properties.getProperty("KEYSTORE_PASS") alias = properties.getProperty("ALIAS_NAME") pwd = properties.getProperty("ALIAS_PASS") + ignoreX86 = properties.getProperty("IGNORE_X86") == "true" } keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS") @@ -145,6 +147,20 @@ android { defaultConfig.applicationId = "nekox.messenger" + splits { + + abi { + + enable true + universalApk false + + if (ignoreX86) { + exclude 'x86', 'x86_64' + } + + } + } + defaultConfig { minSdkVersion 16 //noinspection ExpiredTargetSdkVersion,OldTargetApi @@ -328,13 +344,6 @@ android { } - splits.abi { - - enable true - universalApk false - - } - flavorDimensions "version" productFlavors { @@ -405,4 +414,4 @@ android { } } -} +} \ No newline at end of file diff --git a/ss-rust/build.gradle.kts b/ss-rust/build.gradle.kts index a6e0d3098..6dc5bfd9a 100644 --- a/ss-rust/build.gradle.kts +++ b/ss-rust/build.gradle.kts @@ -1,10 +1,31 @@ +import cn.hutool.core.codec.Base64 import com.android.build.gradle.internal.tasks.factory.dependsOn +import org.apache.tools.ant.filters.StringInputStream +import java.util.* +import java.io.* plugins { id("com.android.library") id("org.mozilla.rust-android-gradle.rust-android") } +var ignoreX86 = false + +lateinit var properties: Properties +val base64 = System.getenv("LOCAL_PROPERTIES") +if (!base64.isNullOrBlank()) { + properties = Properties() + properties.load(ByteArrayInputStream(Base64.decode(base64))) +} else if (project.rootProject.file("local.properties").exists()) { + properties = Properties() + properties.load(StringInputStream(project.rootProject.file("local.properties").readText())) +} + +if (::properties.isInitialized) { + ignoreX86 = properties.getProperty("IGNORE_X86") == "true" +} + + android { ndkVersion = rootProject.extra.get("ndkVersion").toString() @@ -16,12 +37,22 @@ android { } buildToolsVersion = "30.0.3" + if (ignoreX86) { + splits.abi { + exclude("x86", "x86_64") + } + } + } cargo { module = "src/main/rust/shadowsocks-rust" libname = "ss-local" - targets = listOf("arm", "arm64", "x86", "x86_64") + targets = if (ignoreX86) { + listOf("arm", "arm64") + } else { + listOf("arm", "arm64", "x86", "x86_64") + } profile = findProperty("CARGO_PROFILE")?.toString() ?: "release" extraCargoBuildArguments = listOf("--bin", "sslocal") featureSpec.noDefaultBut(arrayOf(