add: release CI
This commit is contained in:
@@ -6,8 +6,7 @@ plugins {
|
||||
}
|
||||
|
||||
def appVersionName = "0.1.1"
|
||||
def appVersionCode = 1
|
||||
def lspatchReleaseUrl = "https://api.github.com/repos/LSPosed/LSPatch/releases/latest"
|
||||
def appVersionCode = 3
|
||||
|
||||
android {
|
||||
compileSdk 33
|
||||
@@ -56,12 +55,6 @@ android {
|
||||
}
|
||||
dimension "release"
|
||||
}
|
||||
prod {
|
||||
ndk {
|
||||
abiFilter("none")
|
||||
}
|
||||
dimension "release"
|
||||
}
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
@@ -71,48 +64,6 @@ android {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
getTasks().getByPath(":app:assembleProdDebug").doLast {
|
||||
def apkReleaseFile = android.applicationVariants.find { it.buildType.name == "debug" && it.flavorName == "prod" }.outputs[0].outputFile
|
||||
|
||||
//download the target apk
|
||||
println "Downloading target apk"
|
||||
def targetApkFile = new File("${buildDir}/${apkReleaseFile.name}")
|
||||
try {
|
||||
def targetApkUrl = project.property("targetApkUrl")
|
||||
targetApkFile.withOutputStream { out ->
|
||||
new URL(targetApkUrl).withInputStream { input ->
|
||||
out << input
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
println "No target apk url provided"
|
||||
return
|
||||
}
|
||||
|
||||
//download the latest lspatch jar
|
||||
def connection = new URL(lspatchReleaseUrl).openConnection()
|
||||
def json = new JsonSlurper().parseText(connection.getInputStream().getText())
|
||||
def downloadUrl = json.assets[0].browser_download_url
|
||||
println "Downloading LSPatch from ${downloadUrl}"
|
||||
|
||||
def lspatchJarfile = new File("${buildDir}/lspatch.jar")
|
||||
lspatchJarfile.withOutputStream { out ->
|
||||
new URL(downloadUrl).withInputStream { input ->
|
||||
out << input
|
||||
}
|
||||
}
|
||||
|
||||
println "Executing LSPatch"
|
||||
exec {
|
||||
commandLine "java", "-jar", lspatchJarfile.absolutePath,
|
||||
targetApkFile.absolutePath,
|
||||
"--force", "-l", "2", "-m",
|
||||
apkReleaseFile.absolutePath,
|
||||
"-o",
|
||||
"${buildDir}/outputs/apk/lspatch/debug/"
|
||||
}
|
||||
}
|
||||
|
||||
//auto install for debug purpose
|
||||
getTasks().getByPath(":app:assembleArmv8Debug").doLast {
|
||||
def apkDebugFile = android.applicationVariants.find { it.buildType.name == "debug" && it.flavorName == "armv8" }.outputs[0].outputFile
|
||||
@@ -136,6 +87,13 @@ afterEvaluate {
|
||||
}
|
||||
}
|
||||
|
||||
task getVersion {
|
||||
doLast {
|
||||
def version = new File('app/build/version.txt')
|
||||
version.text = android.defaultConfig.versionName
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.8.21'
|
||||
|
||||
Reference in New Issue
Block a user