1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-07-02 10:33:36 +00:00

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 keystorePwd = null
def alias = null def alias = null
def pwd = null def pwd = null
Properties properties def ignoreX86 = false
Properties properties
def base64 = System.getenv("LOCAL_PROPERTIES") def base64 = System.getenv("LOCAL_PROPERTIES")
if (base64 != null && !base64.isBlank()) { if (base64 != null && !base64.isBlank()) {
properties = new Properties() properties = new Properties()
@ -132,6 +133,7 @@ if (properties != null) {
keystorePwd = properties.getProperty("KEYSTORE_PASS") keystorePwd = properties.getProperty("KEYSTORE_PASS")
alias = properties.getProperty("ALIAS_NAME") alias = properties.getProperty("ALIAS_NAME")
pwd = properties.getProperty("ALIAS_PASS") pwd = properties.getProperty("ALIAS_PASS")
ignoreX86 = properties.getProperty("IGNORE_X86") == "true"
} }
keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS") keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS")
@ -145,6 +147,20 @@ android {
defaultConfig.applicationId = "nekox.messenger" defaultConfig.applicationId = "nekox.messenger"
splits {
abi {
enable true
universalApk false
if (ignoreX86) {
exclude 'x86', 'x86_64'
}
}
}
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
//noinspection ExpiredTargetSdkVersion,OldTargetApi //noinspection ExpiredTargetSdkVersion,OldTargetApi
@ -328,13 +344,6 @@ android {
} }
splits.abi {
enable true
universalApk false
}
flavorDimensions "version" flavorDimensions "version"
productFlavors { 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 com.android.build.gradle.internal.tasks.factory.dependsOn
import org.apache.tools.ant.filters.StringInputStream
import java.util.*
import java.io.*
plugins { plugins {
id("com.android.library") id("com.android.library")
id("org.mozilla.rust-android-gradle.rust-android") 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 { android {
ndkVersion = rootProject.extra.get("ndkVersion").toString() ndkVersion = rootProject.extra.get("ndkVersion").toString()
@ -16,12 +37,22 @@ android {
} }
buildToolsVersion = "30.0.3" buildToolsVersion = "30.0.3"
if (ignoreX86) {
splits.abi {
exclude("x86", "x86_64")
}
}
} }
cargo { cargo {
module = "src/main/rust/shadowsocks-rust" module = "src/main/rust/shadowsocks-rust"
libname = "ss-local" 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" profile = findProperty("CARGO_PROFILE")?.toString() ?: "release"
extraCargoBuildArguments = listOf("--bin", "sslocal") extraCargoBuildArguments = listOf("--bin", "sslocal")
featureSpec.noDefaultBut(arrayOf( featureSpec.noDefaultBut(arrayOf(