Files
coco 723ce1af5c a
2026-07-03 15:12:48 +08:00

165 lines
5.4 KiB
Groovy

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'org.jlleitschuh.gradle.ktlint'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
apply from: '../dependencies.gradle'
int appPhase = 1
int feature = 1
int fixes = 0
def buildVersion = String.format("%d.%d", appPhase, feature)
if (fixes == 0) {
buildVersion = String.format("%s.%d", buildVersion, fixes)
}
android {
compileSdk rootProject.compileSdkVersion
signingConfigs {
debug {
storeFile file("keys/weather_jc_debug.key")
storePassword "Xl4MCAE3t&@VmyAomUstWP0%5JgdNHVU@rk7t9TJfXp*eanf7s95mQ5f*@K73zg%"
keyAlias "weather-jc-debug-key"
keyPassword "Xl4MCAE3t&@VmyAomUstWP0%5JgdNHVU@rk7t9TJfXp*eanf7s95mQ5f*@K73zg%"
}
release {
storeFile file("keys/weather_jc_release.key")
storePassword "kvWB1q7*5!X2gAucQKuQ##ZM@BXNw&PHG0uE^uF23lc8JhCN28pZ@*D6SP1Jj1Ba"
keyAlias "weather-jc-release-key"
keyPassword "kvWB1q7*5!X2gAucQKuQ##ZM@BXNw&PHG0uE^uF23lc8JhCN28pZ@*D6SP1Jj1Ba"
}
}
defaultConfig {
applicationId "com.jc.weather"
minSdk rootProject.minSdkVersion
targetSdk rootProject.targetSdkVersion
versionCode 1
versionName buildVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
debug {
manifestPlaceholders = [appNameSuffix: "_debug"]
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
buildConfigField "String", "BASE_URL_OPEN_WEATHER_MAP", "\"https://api.openweathermap.org/\""
buildConfigField "String", "OPEN_WEATHER_MAP_APP_ID", "\"978539e18a215484b0146ed80b932145\""
buildConfigField "String", "BASE_URL_IP_API", "\"http://ip-api.com/\""
signingConfig signingConfigs.debug
}
release {
manifestPlaceholders = [appNameSuffix: ""]
buildConfigField "String", "BASE_URL_OPEN_WEATHER_MAP", "\"https://api.openweathermap.org/\""
buildConfigField "String", "OPEN_WEATHER_MAP_APP_ID", "\"978539e18a215484b0146ed80b932145\""
buildConfigField "String", "BASE_URL_IP_API", "\"http://ip-api.com/\""
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility env.java_version
targetCompatibility env.java_version
}
kotlinOptions {
jvmTarget = env.java_version
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
pickFirsts += ['META-INF/LICENSE.md', 'META-INF/LICENSE-notice.md']
}
}
namespace 'com.jc.weather'
applicationVariants.all { variant ->
renameApk(variant)
}
}
def renameApk(variant) {
variant.outputs.each { output ->
variant.outputs.all {
def versionName = variant.versionName
outputFileName = "Weather-JC_v${versionName}.apk"
}
}
}
dependencies {
implementation platform(deps.app.google.firebase.bom)
implementation project(':feature:hourly_forecast')
implementation project(':foundation:dialog')
implementation project(':foundation:resources')
implementation project(':foundation:view')
implementation project(':library:time')
implementation project(':service:ip_api')
implementation project(':service:logger')
implementation project(':service:open_weather_map')
implementation deps.app.androidx.activity_compose
implementation deps.app.androidx.compose_material
implementation deps.app.androidx.compose_ui
implementation deps.app.androidx.compose_ui_tooling_preview
implementation deps.app.androidx.constraintlayout_compose
implementation deps.app.androidx.core_ktx
implementation deps.app.androidx.core_splashscreen
implementation deps.app.androidx.hilt_navigation_compose
implementation deps.app.androidx.hilt_navigation_fragment
implementation deps.app.androidx.lifecycle_runtime_ktx
implementation deps.app.androidx.lifecycle_viewmodel_compose
implementation deps.app.androidx.navigation_compose
implementation deps.app.glide
implementation deps.app.google.firebase.analytics
implementation deps.app.google.firebase.crashlytics
implementation deps.app.google.gson
implementation deps.app.google.hilt_android
kapt deps.app.google.hilt_compiler
implementation deps.app.squareup.converter_gson
implementation deps.app.squareup.logging_interceptor
implementation deps.app.squareup.retrofit
implementation deps.test.core_testing
implementation deps.test.mockk
implementation deps.test.mockk_android
androidTestImplementation deps.test.espresso_core
androidTestImplementation deps.test.junit_ext
androidTestImplementation deps.test.ui_test_junit4
debugImplementation deps.test.ui_test_manifest
debugImplementation deps.test.ui_tooling
testImplementation deps.test.junit
}