mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-07-26 14:32:28 +00:00
168 lines
5.8 KiB
Text
168 lines
5.8 KiB
Text
import java.util.Properties
|
|
|
|
fun readXcconfigValue(file: File, key: String): String? {
|
|
if (!file.exists()) return null
|
|
return file.readLines()
|
|
.asSequence()
|
|
.map(String::trim)
|
|
.filter { it.isNotEmpty() && !it.startsWith("#") && it.contains('=') }
|
|
.map { line ->
|
|
val separatorIndex = line.indexOf('=')
|
|
line.substring(0, separatorIndex).trim() to line.substring(separatorIndex + 1).trim()
|
|
}
|
|
.firstOrNull { (entryKey, _) -> entryKey == key }
|
|
?.second
|
|
}
|
|
|
|
plugins {
|
|
alias(libs.plugins.androidApplication)
|
|
alias(libs.plugins.sentry.android.gradle)
|
|
}
|
|
|
|
val localProps = Properties().apply {
|
|
val propsFile = rootProject.file("local.properties")
|
|
if (propsFile.exists()) propsFile.inputStream().use { load(it) }
|
|
}
|
|
val releaseStoreFile = localProps.getProperty("NUVIO_RELEASE_STORE_FILE")?.takeIf { it.isNotBlank() }
|
|
val releaseStorePassword = localProps.getProperty("NUVIO_RELEASE_STORE_PASSWORD")?.takeIf { it.isNotBlank() }
|
|
val releaseKeyAlias = localProps.getProperty("NUVIO_RELEASE_KEY_ALIAS")?.takeIf { it.isNotBlank() }
|
|
val releaseKeyPassword = localProps.getProperty("NUVIO_RELEASE_KEY_PASSWORD")?.takeIf { it.isNotBlank() }
|
|
val releaseKeystore = releaseStoreFile?.let(rootProject::file)
|
|
fun envOrLocalProperty(key: String): String? =
|
|
providers.environmentVariable(key).orNull?.trim()?.takeIf { it.isNotBlank() }
|
|
?: localProps.getProperty(key)?.trim()?.takeIf { it.isNotBlank() }
|
|
|
|
val sentryAuthToken = envOrLocalProperty("SENTRY_AUTH_TOKEN")
|
|
val sentryOrg = envOrLocalProperty("SENTRY_ORG")
|
|
val sentryProject = envOrLocalProperty("SENTRY_PROJECT")
|
|
val sentryMappingUploadEnabled = sentryAuthToken != null && sentryOrg != null && sentryProject != null
|
|
val appVersionConfigFile = rootProject.file("iosApp/Configuration/Version.xcconfig")
|
|
val releaseAppVersionName = readXcconfigValue(appVersionConfigFile, "MARKETING_VERSION")
|
|
?: error("MARKETING_VERSION is missing from ${appVersionConfigFile.path}")
|
|
val releaseAppVersionCode = readXcconfigValue(appVersionConfigFile, "CURRENT_PROJECT_VERSION")
|
|
?.toIntOrNull()
|
|
?: error("CURRENT_PROJECT_VERSION is missing or invalid in ${appVersionConfigFile.path}")
|
|
val requestedTaskNames = gradle.startParameter.taskNames.map { it.substringAfterLast(':') }
|
|
val buildsReleaseApks = requestedTaskNames.any {
|
|
it.startsWith("assemble", ignoreCase = true) && it.endsWith("Release", ignoreCase = true)
|
|
}
|
|
|
|
android {
|
|
namespace = "com.nuvio.android"
|
|
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
|
compileSdkMinor = libs.versions.android.compileSdkMinor.get().toInt()
|
|
|
|
signingConfigs {
|
|
create("release") {
|
|
if (releaseKeystore != null && releaseStorePassword != null && releaseKeyAlias != null && releaseKeyPassword != null) {
|
|
storeFile = releaseKeystore
|
|
storePassword = releaseStorePassword
|
|
keyAlias = releaseKeyAlias
|
|
keyPassword = releaseKeyPassword
|
|
}
|
|
}
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId = "com.nuvio.app"
|
|
minSdk = libs.versions.android.minSdk.get().toInt()
|
|
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
|
versionCode = releaseAppVersionCode
|
|
versionName = releaseAppVersionName
|
|
}
|
|
|
|
flavorDimensions += "distribution"
|
|
productFlavors {
|
|
create("full") {
|
|
dimension = "distribution"
|
|
}
|
|
create("playstore") {
|
|
dimension = "distribution"
|
|
}
|
|
}
|
|
|
|
sourceSets.getByName("full") {
|
|
manifest.srcFile("src/full/AndroidManifest.xml")
|
|
jniLibs.directories.add("../composeApp/src/full/jniLibs")
|
|
}
|
|
|
|
packaging {
|
|
resources {
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
}
|
|
jniLibs {
|
|
useLegacyPackaging = true
|
|
pickFirsts += listOf(
|
|
"lib/*/libc++_shared.so",
|
|
"lib/*/libavcodec.so",
|
|
"lib/*/libavutil.so",
|
|
"lib/*/libswscale.so",
|
|
"lib/*/libswresample.so"
|
|
)
|
|
}
|
|
}
|
|
|
|
splits {
|
|
abi {
|
|
isEnable = buildsReleaseApks
|
|
reset()
|
|
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
|
isUniversalApk = false
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
getByName("release") {
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"../composeApp/proguard-rules.pro",
|
|
)
|
|
signingConfig = signingConfigs.getByName("release")
|
|
ndk {
|
|
debugSymbolLevel = "FULL"
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
isCoreLibraryDesugaringEnabled = true
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
}
|
|
|
|
androidComponents {
|
|
onVariants(selector().withBuildType("debug")) { variant ->
|
|
variant.applicationId.set("com.nuviodebug.com")
|
|
}
|
|
}
|
|
|
|
sentry {
|
|
includeProguardMapping.set(true)
|
|
autoUploadProguardMapping.set(sentryMappingUploadEnabled)
|
|
uploadNativeSymbols.set(false)
|
|
autoUploadNativeSymbols.set(false)
|
|
includeNativeSources.set(false)
|
|
includeSourceContext.set(false)
|
|
autoUploadSourceContext.set(false)
|
|
includeDependenciesReport.set(false)
|
|
telemetry.set(false)
|
|
sentryAuthToken?.let(authToken::set)
|
|
sentryOrg?.let(org::set)
|
|
sentryProject?.let(projectName::set)
|
|
ignoredBuildTypes.set(setOf("debug"))
|
|
autoInstallation {
|
|
enabled.set(false)
|
|
}
|
|
tracingInstrumentation {
|
|
enabled.set(false)
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(":composeApp"))
|
|
coreLibraryDesugaring(libs.desugar.jdk.libs)
|
|
debugImplementation(libs.compose.uiTooling)
|
|
}
|