Neo-Store/build.gradle
2021-11-26 21:41:42 +05:30

174 lines
5.4 KiB
Groovy

buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: "kotlin-kapt"
android {
compileSdk = 31
defaultConfig {
archivesBaseName = 'droidify'
applicationId = 'com.looker.droidify'
minSdk = 21
targetSdk = 31
versionCode = 41
versionName = "0.4.1"
vectorDrawables.useSupportLibrary = true
}
sourceSets.all {
def javaDir = it.java.srcDirs.find { it.name == 'java' }
it.java.srcDirs += new File(javaDir.parentFile, 'kotlin')
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = compileOptions.sourceCompatibility.toString()
}
buildTypes {
debug {
minifyEnabled = false
shrinkResources = false
applicationIdSuffix = ".debug"
versionNameSuffix = "-debug"
resValue "string", "application_name", "Droid-ify-Debug"
}
release {
minifyEnabled = true
shrinkResources = true
resValue "string", "application_name", "Droid-ify"
}
all {
crunchPngs = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard.pro")
}
}
lintOptions {
warning 'InvalidPackage'
ignore 'InvalidVectorPath'
}
packagingOptions {
exclude '/DebugProbesKt.bin'
exclude '/kotlin/**.kotlin_builtins'
exclude '/kotlin/**.kotlin_metadata'
exclude '/META-INF/**.kotlin_module'
exclude '/META-INF/**.pro'
exclude '/META-INF/**.version'
exclude '/okhttp3/internal/publicsuffix/*'
}
def keystorePropertiesFile = rootProject.file('keystore.properties')
buildFeatures {
viewBinding true
}
if (keystorePropertiesFile.exists()) {
def keystoreProperties = new Properties()
keystoreProperties.load(keystorePropertiesFile.newDataInputStream())
def signing = [
storeFile : keystoreProperties['store.file'],
storePassword: keystoreProperties['store.password'],
keyAlias : keystoreProperties['key.alias'],
keyPassword : keystoreProperties['key.password']
]
if (!signing.any { _, v -> v == null }) {
signingConfigs {
primary {
storeFile = file(signing.storeFile)
storePassword = signing.storePassword
keyAlias = signing.keyAlias
keyPassword = signing.keyPassword
v2SigningEnabled = false
}
}
buildTypes {
debug.signingConfig = signingConfigs.primary
release.signingConfig = signingConfigs.primary
}
}
}
}
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
// Core
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.appcompat:appcompat-resources:1.4.0'
implementation 'androidx.fragment:fragment-ktx:1.4.0'
implementation 'androidx.activity:activity-ktx:1.4.0'
implementation "androidx.preference:preference-ktx:1.1.1"
// Material3
implementation 'com.google.android.material:material:1.5.0-beta01'
// Coil
implementation 'io.coil-kt:coil:1.4.0'
// OkHttps
implementation 'com.squareup.okhttp3:okhttp:4.9.2'
// RxJava
implementation 'io.reactivex.rxjava3:rxjava:3.1.2'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
// LibSu
implementation 'com.github.topjohnwu.libsu:core:3.1.2'
// JackSon
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0'
// Coroutines / Lifecycle
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
// Room
implementation 'androidx.room:room-runtime:2.3.0'
implementation 'androidx.room:room-ktx:2.3.0'
kapt 'androidx.room:room-compiler:2.3.0'
}
// using a task as a preBuild dependency instead of a function that takes some time insures that it runs
task detectAndroidLocals {
Set<String> langsList = new HashSet<>()
// in /res are (almost) all languages that have a translated string is saved. this is safer and saves some time
fileTree("src/main/res").visit { FileVisitDetails details ->
if (details.file.path.endsWith("strings.xml")
&& details.file.canonicalFile.getText('UTF-8').contains("<string")) {
def languageCode = details.file.parentFile.name.replace("values-", "")
languageCode = (languageCode == "values") ? "en" : languageCode
langsList.add(languageCode)
}
}
def langsListString = "{${langsList.collect { "\"${it}\"" }.join(",")}}"
android.defaultConfig.buildConfigField "String[]", "DETECTED_LOCALES", langsListString
}
preBuild.dependsOn detectAndroidLocals