apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' def rootCMakeLists = "../../CMakeLists.txt" def rootCMakeListsContent = file(rootCMakeLists).text static def grepVersionComponent(content, varname) { def match = content =~ /set\($varname ([0-9]+)\)/ if(!match.find()) throw new GradleException("Failed to find $varname in CMakeLists.txt") return match.group(1) } def chiakiVersionMajor = grepVersionComponent(rootCMakeListsContent, "CHIAKI_VERSION_MAJOR") def chiakiVersionMinor = grepVersionComponent(rootCMakeListsContent, "CHIAKI_VERSION_MINOR") def chiakiVersionPatch = grepVersionComponent(rootCMakeListsContent, "CHIAKI_VERSION_PATCH") def chiakiVersion = "$chiakiVersionMajor.$chiakiVersionMinor.$chiakiVersionPatch" println("Determined Chiaki Version: $chiakiVersion") android { compileSdkVersion 30 buildToolsVersion "30.0.2" defaultConfig { applicationId "com.metallic.chiaki" minSdkVersion 21 targetSdkVersion 30 versionCode 9 versionName chiakiVersion externalNativeBuild { cmake { arguments "-DCHIAKI_ENABLE_TESTS=OFF", "-DCHIAKI_ENABLE_CLI=OFF", "-DCHIAKI_ENABLE_GUI=OFF", "-DCHIAKI_ENABLE_SETSU=OFF", "-DCHIAKI_ENABLE_ANDROID=ON", "-DCHIAKI_LIB_ENABLE_OPUS=OFF", "-DCHIAKI_LIB_OPENSSL_EXTERNAL_PROJECT=ON" } } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } externalNativeBuild { cmake { version "3.10.2+" path rootCMakeLists } } signingConfigs { release } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } Properties properties = new Properties() def propertiesFile = file("../local.properties") if (propertiesFile.exists()) { properties.load(propertiesFile.newDataInputStream()) } if(properties.containsKey("chiakiKeystore")) { println("Enabling Local Signing") buildTypes.release.signingConfig = signingConfigs.release buildTypes.debug.signingConfig = signingConfigs.release signingConfigs.release.storeFile = file(properties.get("chiakiKeystore")) signingConfigs.release.storePassword = properties.get("chiakiKeystorePW") signingConfigs.release.keyAlias = properties.get("chiakiKeyAlias") signingConfigs.release.keyPassword = properties.get("chiakiKeyPW") } else { println("Signing not enabled") } } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { freeCompilerArgs += "-Xuse-experimental=kotlin.ExperimentalUnsignedTypes" } } androidExtensions { // for @Parcelize experimental = true } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.preference:preference:1.1.0' implementation 'com.google.android.material:material:1.1.0-beta02' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0' implementation 'androidx.lifecycle:lifecycle-reactivestreams:2.2.0' implementation "io.reactivex.rxjava2:rxjava:2.2.12" implementation "io.reactivex.rxjava2:rxkotlin:2.4.0" implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' def room_version = "2.2.4" implementation "androidx.room:room-runtime:$room_version" kapt "androidx.room:room-compiler:$room_version" implementation "androidx.room:room-ktx:$room_version" implementation "androidx.room:room-rxjava2:$room_version" implementation "com.squareup.moshi:moshi:1.9.2" kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.2" }