Ignore x86 for f-droid build

This commit is contained in:
世界 2021-02-28 15:08:33 +08:00
parent b033b6d704
commit f0e45007d1
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 50 additions and 10 deletions

View File

@ -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 {
}
}
}
}

View File

@ -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(