mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-31 14:17:31 +01:00
build(Needs bump): Sign APK properly without relying on internal Gradle classes
This commit is contained in:
parent
2fabdb245f
commit
7af763f4b1
@ -2,6 +2,7 @@ plugins {
|
|||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.kotlin)
|
alias(libs.plugins.kotlin)
|
||||||
publishing
|
publishing
|
||||||
|
signing
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@ -53,28 +54,27 @@ dependencies {
|
|||||||
compileOnly(project(":stub"))
|
compileOnly(project(":stub"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
|
||||||
// Because the signing plugin doesn't support signing APKs, do it manually.
|
|
||||||
register("sign") {
|
|
||||||
group = "signing"
|
|
||||||
|
|
||||||
dependsOn(build)
|
tasks {
|
||||||
|
val assembleReleaseSignApk by registering {
|
||||||
|
dependsOn("assembleRelease")
|
||||||
|
|
||||||
|
val apk = layout.buildDirectory.file("outputs/apk/release/${rootProject.name}-$version.apk")
|
||||||
|
|
||||||
|
inputs.file(apk).withPropertyName("input")
|
||||||
|
outputs.file(apk.map { it.asFile.resolveSibling("${it.asFile.name}.asc") })
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val outputDirectory = layout.buildDirectory.dir("outputs/apk/release").get().asFile
|
signing {
|
||||||
val integrationsApk = outputDirectory.resolve("${rootProject.name}-$version.apk")
|
useGpgCmd()
|
||||||
|
sign(*inputs.files.files.toTypedArray())
|
||||||
org.gradle.security.internal.gnupg.GnupgSignatoryFactory().createSignatory(project).sign(
|
}
|
||||||
integrationsApk.inputStream(),
|
|
||||||
outputDirectory.resolve("${integrationsApk.name}.asc").outputStream(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed by gradle-semantic-release-plugin.
|
// Needed by gradle-semantic-release-plugin.
|
||||||
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435.
|
||||||
publish {
|
publish {
|
||||||
dependsOn(build)
|
dependsOn(assembleReleaseSignApk)
|
||||||
dependsOn("sign")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user