77 lines
2.4 KiB
Groovy
77 lines
2.4 KiB
Groovy
apply plugin: 'com.android.library'
|
|
|
|
android {
|
|
compileSdkVersion androidCompileSdkVersion.toInteger()
|
|
|
|
defaultConfig {
|
|
minSdkVersion androidMinSdkVersion.toInteger()
|
|
targetSdkVersion androidTargetSdkVersion.toInteger()
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
|
|
cppFlags "-std=c++20"
|
|
cFlags "-std=gnu99"
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
externalNativeBuild {
|
|
cmake {
|
|
cppFlags "-O0"
|
|
cFlags "-O0"
|
|
}
|
|
}
|
|
}
|
|
release {
|
|
externalNativeBuild {
|
|
cmake {
|
|
cppFlags "-fvisibility=hidden -fvisibility-inlines-hidden -Os -s -Wno-unused-value"
|
|
cFlags "-fvisibility=hidden -fvisibility-inlines-hidden -Os -s -Wno-unused-value"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
externalNativeBuild {
|
|
cmake {
|
|
path "src/main/cpp/CMakeLists.txt"
|
|
}
|
|
}
|
|
}
|
|
|
|
afterEvaluate {
|
|
android.libraryVariants.all { variant ->
|
|
def variantNameCapped = variant.name.capitalize()
|
|
def variantNameLowered = variant.name.toLowerCase()
|
|
|
|
task("copyKeySelector${variantNameCapped}LibraryToMagiskTemplate") {
|
|
dependsOn tasks.getByName("assemble${variantNameCapped}")
|
|
def libPathRelease = "${buildDir}/intermediates/cmake/${variantNameLowered}/obj"
|
|
doLast {
|
|
copy {
|
|
include "key_selector"
|
|
from "${libPathRelease}/armeabi-v7a"
|
|
into "${zipPathMagiskReleasePath}/system/bin"
|
|
}
|
|
copy {
|
|
include "key_selector"
|
|
from "${libPathRelease}/arm64-v8a"
|
|
into "${zipPathMagiskReleasePath}/system/bin64"
|
|
}
|
|
copy {
|
|
include "key_selector"
|
|
from "${libPathRelease}/x86"
|
|
into "${zipPathMagiskReleasePath}/system_x86/bin"
|
|
}
|
|
copy {
|
|
include "key_selector"
|
|
from "${libPathRelease}/x86_64"
|
|
into "${zipPathMagiskReleasePath}/system_x86/bin64"
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
} |