mirror of
https://github.com/jellyfin/jellyfin-androidtv.git
synced 2024-11-27 08:00:28 +00:00
Prepare Gradle build scripts for new publish CI
- Removes proguard (unused) - Make output APK name consistent with jellyfin-android - Add versionTxt task - Add release signing configuration
This commit is contained in:
parent
5516a07cd9
commit
e25f5a0693
@ -15,6 +15,7 @@ android {
|
||||
// Release version
|
||||
versionName = project.getVersionName()
|
||||
versionCode = getVersionCode(versionName!!)
|
||||
setProperty("archivesBaseName", "jellyfin-androidtv-v$versionName")
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
@ -31,18 +32,26 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("release") {
|
||||
val release by getting {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
|
||||
|
||||
// Add applicationId as string for XML resources
|
||||
resValue("string", "app_id", "org.jellyfin.androidtv")
|
||||
|
||||
// Set flavored application name
|
||||
resValue("string", "app_name", "@string/app_name_release")
|
||||
|
||||
signingConfig = createReleaseSigningConfig()?.let { config ->
|
||||
signingConfigs.create("release") {
|
||||
storeFile = config.storeFile
|
||||
storePassword = config.storePassword
|
||||
keyAlias = config.keyAlias
|
||||
keyPassword = config.keyPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getByName("debug") {
|
||||
val debug by getting {
|
||||
// Use different application id to run release and debug at the same time
|
||||
applicationIdSuffix = ".debug"
|
||||
|
||||
@ -53,15 +62,15 @@ android {
|
||||
resValue("string", "app_name", "@string/app_name_debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applicationVariants.all {
|
||||
val variant = this
|
||||
variant.outputs.all {
|
||||
val output = this as com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
||||
output.outputFileName = output.outputFileName
|
||||
.replace("app-", "jellyfin-androidtv_")
|
||||
.replace(".apk", "_v${variant.versionName}.apk")
|
||||
}
|
||||
val versionTxt by tasks.registering {
|
||||
val path = buildDir.resolve("version.txt")
|
||||
|
||||
doLast {
|
||||
val versionString = "v${android.defaultConfig.versionName}=${android.defaultConfig.versionCode}"
|
||||
logger.info("Writing [$versionString] to $path")
|
||||
path.writeText("$versionString\n")
|
||||
}
|
||||
}
|
||||
|
||||
|
17
app/proguard-rules.pro
vendored
17
app/proguard-rules.pro
vendored
@ -1,17 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\Users\Eric\AppData\Local\Android\android-sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
43
buildSrc/src/main/kotlin/Signing.kt
Normal file
43
buildSrc/src/main/kotlin/Signing.kt
Normal file
@ -0,0 +1,43 @@
|
||||
import org.gradle.api.Project
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
fun Project.createReleaseSigningConfig(): SigningConfigData? {
|
||||
val serializedKeystore = getProperty("keystore") ?: return null
|
||||
val storeFile = File.createTempFile("jf", "keystore").apply {
|
||||
writeBytes(Base64.getDecoder().decode(serializedKeystore))
|
||||
}
|
||||
|
||||
val storePassword = getProperty("keystore.password") ?: return null
|
||||
val keyAlias = getProperty("key.alias") ?: return null
|
||||
val keyPassword = getProperty("key.password") ?: return null
|
||||
|
||||
return SigningConfigData(
|
||||
storeFile,
|
||||
storePassword,
|
||||
keyAlias,
|
||||
keyPassword
|
||||
)
|
||||
}
|
||||
|
||||
data class SigningConfigData(
|
||||
/**
|
||||
* Store file used when signing.
|
||||
*/
|
||||
val storeFile: File,
|
||||
|
||||
/**
|
||||
* Store password used when signing.
|
||||
*/
|
||||
val storePassword: String,
|
||||
|
||||
/**
|
||||
* Key alias used when signing.
|
||||
*/
|
||||
val keyAlias: String,
|
||||
|
||||
/**
|
||||
* Key password used when signing.
|
||||
*/
|
||||
val keyPassword: String,
|
||||
)
|
Loading…
Reference in New Issue
Block a user