|
| 1 | +import java.io.FileInputStream |
| 2 | +import java.io.InputStreamReader |
| 3 | +import java.util.Properties |
| 4 | + |
| 5 | +plugins { |
| 6 | + alias(libs.plugins.android.application) |
| 7 | + alias(libs.plugins.kotlin.android) |
| 8 | + alias(libs.plugins.kotlin.compose) |
| 9 | +} |
| 10 | + |
| 11 | +android { |
| 12 | + namespace = "com.ably.example" |
| 13 | + compileSdk = 35 |
| 14 | + |
| 15 | + defaultConfig { |
| 16 | + applicationId = "com.ably.example" |
| 17 | + minSdk = 30 |
| 18 | + targetSdk = 35 |
| 19 | + versionCode = 1 |
| 20 | + versionName = "1.0" |
| 21 | + |
| 22 | + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
| 23 | + |
| 24 | + buildConfigField("String", "ABLY_KEY", "\"${getLocalProperty("ABLY_KEY") ?: ""}\"") |
| 25 | + } |
| 26 | + |
| 27 | + buildTypes { |
| 28 | + release { |
| 29 | + isMinifyEnabled = false |
| 30 | + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") |
| 31 | + } |
| 32 | + } |
| 33 | + compileOptions { |
| 34 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 35 | + targetCompatibility = JavaVersion.VERSION_11 |
| 36 | + } |
| 37 | + kotlinOptions { |
| 38 | + jvmTarget = "11" |
| 39 | + } |
| 40 | + buildFeatures { |
| 41 | + compose = true |
| 42 | + buildConfig = true |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +dependencies { |
| 47 | + implementation(libs.core.ktx) |
| 48 | + implementation(libs.lifecycle.runtime.ktx) |
| 49 | + implementation(libs.activity.compose) |
| 50 | + implementation(platform(libs.compose.bom)) |
| 51 | + implementation(libs.ui) |
| 52 | + implementation(libs.ui.graphics) |
| 53 | + implementation(libs.ui.tooling.preview) |
| 54 | + implementation(libs.material3) |
| 55 | + |
| 56 | + implementation(project(":live-objects")) |
| 57 | + implementation(project(":android")) |
| 58 | + |
| 59 | + implementation(libs.navigation.compose) |
| 60 | + |
| 61 | + testImplementation(libs.junit) |
| 62 | + androidTestImplementation(libs.ext.junit) |
| 63 | + androidTestImplementation(libs.espresso.core) |
| 64 | + androidTestImplementation(platform(libs.compose.bom)) |
| 65 | + androidTestImplementation(libs.ui.test.junit4) |
| 66 | + debugImplementation(libs.ui.tooling) |
| 67 | + debugImplementation(libs.ui.test.manifest) |
| 68 | +} |
| 69 | + |
| 70 | +fun getLocalProperty(key: String, file: String = "local.properties"): String? { |
| 71 | + val properties = Properties() |
| 72 | + val localProperties = File(file) |
| 73 | + if (!localProperties.isFile) return null |
| 74 | + InputStreamReader(FileInputStream(localProperties), Charsets.UTF_8).use { reader -> |
| 75 | + properties.load(reader) |
| 76 | + } |
| 77 | + return properties.getProperty(key) |
| 78 | +} |
0 commit comments