import java.util.Properties plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.compose) } val localProperties = Properties().apply { val file = rootProject.file("local.properties") if (file.isFile) { file.inputStream().use { load(it) } } } fun releaseSecret(name: String): String? { return providers.environmentVariable(name).orNull ?: localProperties.getProperty(name) } val releaseStoreFile = releaseSecret("NGX_RELEASE_STORE_FILE") val releaseStorePassword = releaseSecret("NGX_RELEASE_STORE_PASSWORD") val releaseKeyAlias = releaseSecret("NGX_RELEASE_KEY_ALIAS") val releaseKeyPassword = releaseSecret("NGX_RELEASE_KEY_PASSWORD") val hasReleaseSigning = listOf( releaseStoreFile, releaseStorePassword, releaseKeyAlias, releaseKeyPassword, ).all { !it.isNullOrBlank() } android { namespace = "net.rodakot.ngxhttpmonitoringclient" compileSdk { version = release(36) { minorApiLevel = 1 } } defaultConfig { applicationId = "net.rodakot.ngxhttpmonitoringclient" minSdk = 24 targetSdk = 36 versionCode = (providers.gradleProperty("VERSION_CODE").orNull ?: "1").toInt() versionName = providers.gradleProperty("VERSION_NAME").orNull ?: "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { if (hasReleaseSigning) { create("release") { storeFile = file(releaseStoreFile!!) storePassword = releaseStorePassword keyAlias = releaseKeyAlias keyPassword = releaseKeyPassword } } } buildTypes { release { isMinifyEnabled = true isShrinkResources = true if (hasReleaseSigning) { signingConfig = signingConfigs.getByName("release") } proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) } } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } kotlin { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11) } } buildFeatures { compose = true } } dependencies { implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.activity.compose) implementation(libs.androidx.compose.foundation) implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.ui) implementation(libs.androidx.compose.ui.graphics) implementation(libs.androidx.compose.ui.tooling.preview) implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.lifecycle.viewmodel.ktx) implementation(libs.kotlinx.coroutines.android) implementation(libs.okhttp) testImplementation(libs.junit) androidTestImplementation(platform(libs.androidx.compose.bom)) androidTestImplementation(libs.androidx.compose.ui.test.junit4) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(libs.androidx.junit) debugImplementation(libs.androidx.compose.ui.test.manifest) debugImplementation(libs.androidx.compose.ui.tooling) }