mirror of https://github.com/NekoX-Dev/NekoX.git
Split build type for f-droid build
This commit is contained in:
parent
f0e45007d1
commit
5a5e602bc7
|
@ -19,15 +19,10 @@ def serviceAccountCredentialsFile = rootProject.file("service_account_credential
|
||||||
def beta = verName.contains("preview")
|
def beta = verName.contains("preview")
|
||||||
|
|
||||||
if (serviceAccountCredentialsFile.isFile()) {
|
if (serviceAccountCredentialsFile.isFile()) {
|
||||||
|
|
||||||
setupPlay(beta)
|
setupPlay(beta)
|
||||||
|
|
||||||
play.serviceAccountCredentials = serviceAccountCredentialsFile
|
play.serviceAccountCredentials = serviceAccountCredentialsFile
|
||||||
|
|
||||||
} else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) {
|
} else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) {
|
||||||
|
|
||||||
setupPlay(beta)
|
setupPlay(beta)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupPlay(boolean beta) {
|
void setupPlay(boolean beta) {
|
||||||
|
@ -35,10 +30,8 @@ void setupPlay(boolean beta) {
|
||||||
apply plugin: 'com.github.triplet.play'
|
apply plugin: 'com.github.triplet.play'
|
||||||
|
|
||||||
play {
|
play {
|
||||||
|
|
||||||
track = beta ? "beta" : "production"
|
track = beta ? "beta" : "production"
|
||||||
defaultToAppBundles = true
|
defaultToAppBundles = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,10 +45,6 @@ def fcmVersion = '21.0.1'
|
||||||
def crashlyticsVersion = '17.3.1'
|
def crashlyticsVersion = '17.3.1'
|
||||||
def playCoreVersion = '1.9.1'
|
def playCoreVersion = '1.9.1'
|
||||||
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation "androidx.browser:browser:1.3.0"
|
implementation "androidx.browser:browser:1.3.0"
|
||||||
|
@ -117,7 +106,6 @@ dependencies {
|
||||||
def keystorePwd = null
|
def keystorePwd = null
|
||||||
def alias = null
|
def alias = null
|
||||||
def pwd = null
|
def pwd = null
|
||||||
def ignoreX86 = false
|
|
||||||
|
|
||||||
Properties properties
|
Properties properties
|
||||||
def base64 = System.getenv("LOCAL_PROPERTIES")
|
def base64 = System.getenv("LOCAL_PROPERTIES")
|
||||||
|
@ -133,13 +121,26 @@ 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")
|
||||||
alias = alias ?: System.getenv("ALIAS_NAME")
|
alias = alias ?: System.getenv("ALIAS_NAME")
|
||||||
pwd = pwd ?: System.getenv("ALIAS_PASS")
|
pwd = pwd ?: System.getenv("ALIAS_PASS")
|
||||||
|
|
||||||
|
def targetAbi = ""
|
||||||
|
if (!gradle.startParameter.taskNames.isEmpty()) {
|
||||||
|
if (gradle.startParameter.taskNames.size == 1) {
|
||||||
|
def targetTask = gradle.startParameter.taskNames[0].toLowerCase()
|
||||||
|
if (targetTask.contains("arm64")) {
|
||||||
|
targetAbi = "arm64"
|
||||||
|
} else if (targetTask.contains("arm")) {
|
||||||
|
targetAbi = "arm"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
targetAbi = "~"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
buildToolsVersion '30.0.3'
|
buildToolsVersion '30.0.3'
|
||||||
|
@ -154,11 +155,17 @@ android {
|
||||||
enable true
|
enable true
|
||||||
universalApk false
|
universalApk false
|
||||||
|
|
||||||
if (ignoreX86) {
|
if (!targetAbi.isBlank()) {
|
||||||
exclude 'x86', 'x86_64'
|
if (targetAbi == "arm64") {
|
||||||
|
exclude 'x86', 'x86_64', 'armeabi-v7a'
|
||||||
|
} else if (targetAbi == "arm") {
|
||||||
|
exclude 'x86', 'x86_64', 'arm64-v8a'
|
||||||
|
} else {
|
||||||
|
exclude 'x86', 'x86_64'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
@ -269,9 +276,7 @@ android {
|
||||||
zipAlignEnabled true
|
zipAlignEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
matchingFallbacks = ['debug']
|
matchingFallbacks = ['debug']
|
||||||
if (keystorePwd != null) {
|
signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release
|
||||||
signingConfig signingConfigs.release
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
release {
|
release {
|
||||||
|
@ -286,7 +291,7 @@ android {
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
}
|
}
|
||||||
|
|
||||||
fossRelease {
|
foss {
|
||||||
debuggable false
|
debuggable false
|
||||||
jniDebuggable false
|
jniDebuggable false
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
|
@ -296,6 +301,14 @@ android {
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
matchingFallbacks = ['debug']
|
matchingFallbacks = ['debug']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fdroidArmRelease {
|
||||||
|
initWith foss
|
||||||
|
}
|
||||||
|
|
||||||
|
fdroidArm64Release {
|
||||||
|
initWith foss
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
@ -336,7 +349,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fossRelease {
|
foss {
|
||||||
jni {
|
jni {
|
||||||
srcDirs = ['./jni/']
|
srcDirs = ['./jni/']
|
||||||
}
|
}
|
||||||
|
@ -383,7 +396,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.all { task ->
|
tasks.all { task ->
|
||||||
if (((task.name.endsWith('Ndk') || task.name.startsWith('generateJsonModel') || task.name.startsWith('externalNativeBuild'))) && !task.name.contains("Foss")) {
|
if (((task.name.endsWith('Ndk') || task.name.startsWith('generateJsonModel') || task.name.startsWith('externalNativeBuild'))) && !(task.name.contains("Foss") || task.name.contains("Fdroid"))) {
|
||||||
task.enabled = false
|
task.enabled = false
|
||||||
}
|
}
|
||||||
if (task.name.contains("uploadCrashlyticsMappingFile")) {
|
if (task.name.contains("uploadCrashlyticsMappingFile")) {
|
||||||
|
|
|
@ -1,31 +1,24 @@
|
||||||
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
|
var targetAbi = ""
|
||||||
|
if (gradle.startParameter.taskNames.isNotEmpty()) {
|
||||||
lateinit var properties: Properties
|
if (gradle.startParameter.taskNames.size == 1) {
|
||||||
val base64 = System.getenv("LOCAL_PROPERTIES")
|
val targetTask = gradle.startParameter.taskNames[0].toLowerCase()
|
||||||
if (!base64.isNullOrBlank()) {
|
if (targetTask.contains("arm64")) {
|
||||||
properties = Properties()
|
targetAbi = "arm64"
|
||||||
properties.load(ByteArrayInputStream(Base64.decode(base64)))
|
} else if (targetTask.contains("arm")) {
|
||||||
} else if (project.rootProject.file("local.properties").exists()) {
|
targetAbi = "arm"
|
||||||
properties = Properties()
|
}
|
||||||
properties.load(StringInputStream(project.rootProject.file("local.properties").readText()))
|
} else {
|
||||||
|
targetAbi = "~"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (::properties.isInitialized) {
|
|
||||||
ignoreX86 = properties.getProperty("IGNORE_X86") == "true"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
ndkVersion = rootProject.extra.get("ndkVersion").toString()
|
ndkVersion = rootProject.extra.get("ndkVersion").toString()
|
||||||
|
@ -37,10 +30,12 @@ android {
|
||||||
}
|
}
|
||||||
buildToolsVersion = "30.0.3"
|
buildToolsVersion = "30.0.3"
|
||||||
|
|
||||||
if (ignoreX86) {
|
if (targetAbi.isNotBlank()) {
|
||||||
splits.abi {
|
splits.abi.exclude(* when (targetAbi) {
|
||||||
exclude("x86", "x86_64")
|
"arm" -> arrayOf("x86", "x86_64", "arm64-v8a")
|
||||||
}
|
"arm64" -> arrayOf("x86", "x86_64", "armeabi-v7a")
|
||||||
|
else -> arrayOf("x86", "x86_64")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,10 +43,11 @@ android {
|
||||||
cargo {
|
cargo {
|
||||||
module = "src/main/rust/shadowsocks-rust"
|
module = "src/main/rust/shadowsocks-rust"
|
||||||
libname = "ss-local"
|
libname = "ss-local"
|
||||||
targets = if (ignoreX86) {
|
targets = when {
|
||||||
listOf("arm", "arm64")
|
targetAbi.isBlank() -> listOf("arm", "arm64", "x86", "x86_64")
|
||||||
} else {
|
targetAbi == "arm" -> listOf("arm")
|
||||||
listOf("arm", "arm64", "x86", "x86_64")
|
targetAbi == "arm64" -> listOf("arm64")
|
||||||
|
else -> listOf("arm", "arm64")
|
||||||
}
|
}
|
||||||
profile = findProperty("CARGO_PROFILE")?.toString() ?: "release"
|
profile = findProperty("CARGO_PROFILE")?.toString() ?: "release"
|
||||||
extraCargoBuildArguments = listOf("--bin", "sslocal")
|
extraCargoBuildArguments = listOf("--bin", "sslocal")
|
||||||
|
|
|
@ -2,6 +2,21 @@ plugins {
|
||||||
id 'com.android.library'
|
id 'com.android.library'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def targetAbi = ""
|
||||||
|
if (!gradle.startParameter.taskNames.isEmpty()) {
|
||||||
|
if (gradle.startParameter.taskNames.size == 1) {
|
||||||
|
def targetTask = gradle.startParameter.taskNames[0].toLowerCase()
|
||||||
|
if (targetTask.contains("arm64")) {
|
||||||
|
targetAbi = "arm64"
|
||||||
|
} else if (targetTask.contains("arm")) {
|
||||||
|
targetAbi = "arm"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
targetAbi = "~"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
buildToolsVersion '30.0.3'
|
buildToolsVersion '30.0.3'
|
||||||
|
@ -15,10 +30,19 @@ android {
|
||||||
|
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
ndkBuild {
|
ndkBuild {
|
||||||
|
if (!targetAbi.isBlank()) {
|
||||||
|
if (targetAbi == "arm64") {
|
||||||
|
abiFilters 'arm64-v8a'
|
||||||
|
} else if (targetAbi == "arm") {
|
||||||
|
abiFilters 'armeabi-v7a'
|
||||||
|
} else {
|
||||||
|
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||||
|
}
|
||||||
|
|
||||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
|
||||||
arguments "NDK_APPLICATION_MK:=src/main/jni/Application.mk", "APP_PLATFORM:=android-21", "--jobs=8"
|
arguments "NDK_APPLICATION_MK:=src/main/jni/Application.mk", "APP_PLATFORM:=android-21", "--jobs=8"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue