mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-05-19 23:18:19 +00:00
Fix signing config
[skip ci]
This commit is contained in:
parent
b1dc47a047
commit
94c7dbedf2
@ -28,7 +28,11 @@ object Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val Project.baseDir: File get() = rootProject.file("..")
|
fun Project.rootFile(path: String): File {
|
||||||
|
val file = File(path)
|
||||||
|
return if (file.isAbsolute) file
|
||||||
|
else File(rootProject.file(".."), path)
|
||||||
|
}
|
||||||
|
|
||||||
class MagiskPlugin : Plugin<Project> {
|
class MagiskPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project) = project.applyPlugin()
|
override fun apply(project: Project) = project.applyPlugin()
|
||||||
@ -38,11 +42,11 @@ class MagiskPlugin : Plugin<Project> {
|
|||||||
props.clear()
|
props.clear()
|
||||||
rootProject.file("gradle.properties").inputStream().use { props.load(it) }
|
rootProject.file("gradle.properties").inputStream().use { props.load(it) }
|
||||||
val configPath: String? by this
|
val configPath: String? by this
|
||||||
val config = configPath?.let { File(it) } ?: File(baseDir, "config.prop")
|
val config = rootFile(configPath ?: "config.prop")
|
||||||
if (config.exists())
|
if (config.exists())
|
||||||
config.inputStream().use { props.load(it) }
|
config.inputStream().use { props.load(it) }
|
||||||
|
|
||||||
val repo = FileRepository(File(baseDir, ".git"))
|
val repo = FileRepository(rootFile(".git"))
|
||||||
val refId = repo.refDatabase.exactRef("HEAD").objectId
|
val refId = repo.refDatabase.exactRef("HEAD").objectId
|
||||||
commitHash = repo.newObjectReader().abbreviate(refId, 8).name()
|
commitHash = repo.newObjectReader().abbreviate(refId, 8).name()
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ fun Project.setupCoreLib() {
|
|||||||
into("src/main/jniLibs")
|
into("src/main/jniLibs")
|
||||||
for (abi in abiList) {
|
for (abi in abiList) {
|
||||||
into(abi) {
|
into(abi) {
|
||||||
from(File(baseDir, "native/out/$abi")) {
|
from(rootFile("native/out/$abi")) {
|
||||||
include("magiskboot", "magiskinit", "magiskpolicy", "magisk", "libinit-ld.so")
|
include("magiskboot", "magiskinit", "magiskpolicy", "magisk", "libinit-ld.so")
|
||||||
rename { if (it.endsWith(".so")) it else "lib$it.so" }
|
rename { if (it.endsWith(".so")) it else "lib$it.so" }
|
||||||
}
|
}
|
||||||
@ -173,10 +173,10 @@ fun Project.setupCoreLib() {
|
|||||||
|
|
||||||
val syncResources by tasks.registering(Sync::class) {
|
val syncResources by tasks.registering(Sync::class) {
|
||||||
into("src/main/resources/META-INF/com/google/android")
|
into("src/main/resources/META-INF/com/google/android")
|
||||||
from(File(baseDir, "scripts/update_binary.sh")) {
|
from(rootFile("scripts/update_binary.sh")) {
|
||||||
rename { "update-binary" }
|
rename { "update-binary" }
|
||||||
}
|
}
|
||||||
from(File(baseDir, "scripts/flash_script.sh")) {
|
from(rootFile("scripts/flash_script.sh")) {
|
||||||
rename { "updater-script" }
|
rename { "updater-script" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,14 +197,14 @@ fun Project.setupCoreLib() {
|
|||||||
inputs.property("version", Config.version)
|
inputs.property("version", Config.version)
|
||||||
inputs.property("versionCode", Config.versionCode)
|
inputs.property("versionCode", Config.versionCode)
|
||||||
into("src/${this@all.name}/assets")
|
into("src/${this@all.name}/assets")
|
||||||
from(File(baseDir, "scripts")) {
|
from(rootFile("scripts")) {
|
||||||
include("util_functions.sh", "boot_patch.sh", "addon.d.sh",
|
include("util_functions.sh", "boot_patch.sh", "addon.d.sh",
|
||||||
"app_functions.sh", "uninstaller.sh", "module_installer.sh")
|
"app_functions.sh", "uninstaller.sh", "module_installer.sh")
|
||||||
}
|
}
|
||||||
from(File(baseDir, "tools/bootctl"))
|
from(rootFile("tools/bootctl"))
|
||||||
into("chromeos") {
|
into("chromeos") {
|
||||||
from(File(baseDir, "tools/futility"))
|
from(rootFile("tools/futility"))
|
||||||
from(File(baseDir, "tools/keys")) {
|
from(rootFile("tools/keys")) {
|
||||||
include("kernel_data_key.vbprivk", "kernel.keyblock")
|
include("kernel_data_key.vbprivk", "kernel.keyblock")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,9 +292,9 @@ fun Project.setupAppCommon() {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
create("config") {
|
Config["keyStore"]?.also {
|
||||||
Config["keyStore"]?.also {
|
create("config") {
|
||||||
storeFile = File(baseDir, it)
|
storeFile = rootFile(it)
|
||||||
storePassword = Config["keyStorePass"]
|
storePassword = Config["keyStorePass"]
|
||||||
keyAlias = Config["keyAlias"]
|
keyAlias = Config["keyAlias"]
|
||||||
keyPassword = Config["keyPass"]
|
keyPassword = Config["keyPass"]
|
||||||
@ -310,15 +310,12 @@ fun Project.setupAppCommon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
signingConfigs["config"].also {
|
val config = signingConfigs.findByName("config") ?: signingConfigs["debug"]
|
||||||
debug {
|
debug {
|
||||||
signingConfig = if (it.storeFile?.exists() == true) it
|
signingConfig = config
|
||||||
else signingConfigs["debug"]
|
}
|
||||||
}
|
release {
|
||||||
release {
|
signingConfig = config
|
||||||
signingConfig = if (it.storeFile?.exists() == true) it
|
|
||||||
else signingConfigs["debug"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user