119 lines
4.3 KiB
Groovy
119 lines
4.3 KiB
Groovy
apply plugin: 'com.android.application'
|
|
|
|
// 버전 관리를 위한 파일 로드 및 함수 정의
|
|
def versionPropsFile = file("${rootDir}/version.properties")
|
|
def versionProps = new Properties()
|
|
|
|
// 파일이 존재하면 로드, 없으면 기본값 설정
|
|
if (versionPropsFile.exists()) {
|
|
versionPropsFile.withInputStream { stream -> versionProps.load(stream) }
|
|
} else {
|
|
versionProps['versionCode'] = '1'
|
|
versionProps['versionName'] = '1.0.0'
|
|
versionProps['buildNumber'] = '1'
|
|
}
|
|
|
|
// 버전 코드와 빌드 번호 가져오기
|
|
def versionCode = versionProps['versionCode'].toInteger()
|
|
def versionName = versionProps['versionName']
|
|
def buildNumber = versionProps['buildNumber'].toInteger()
|
|
|
|
// 릴리즈 빌드 시 버전 코드 증가 함수
|
|
def incrementVersionCode() {
|
|
versionCode += 1
|
|
versionProps['versionCode'] = versionCode.toString()
|
|
versionPropsFile.withOutputStream { stream -> versionProps.store(stream, null) }
|
|
}
|
|
|
|
// 빌드 번호 증가 함수
|
|
def incrementBuildNumber() {
|
|
buildNumber += 1
|
|
versionProps['buildNumber'] = buildNumber.toString()
|
|
versionPropsFile.withOutputStream { stream -> versionProps.store(stream, null) }
|
|
}
|
|
|
|
android {
|
|
namespace "com.lovable.zellyfinance"
|
|
compileSdk rootProject.ext.compileSdkVersion
|
|
defaultConfig {
|
|
applicationId "com.lovable.zellyfinance"
|
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
versionCode versionCode
|
|
versionName versionName
|
|
// 빌드 번호 추가
|
|
buildConfigField "int", "BUILD_NUMBER", buildNumber.toString()
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
aaptOptions {
|
|
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
|
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
|
|
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
|
}
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
// 릴리즈 빌드 시 버전 코드와 빌드 번호 증가
|
|
doLast {
|
|
incrementVersionCode()
|
|
incrementBuildNumber()
|
|
println "릴리즈 빌드 완료: 버전 코드 = ${versionCode}, 빌드 번호 = ${buildNumber}"
|
|
}
|
|
}
|
|
debug {
|
|
// 디버거 대기 방지
|
|
debuggable false
|
|
jniDebuggable false
|
|
|
|
// 디버그 빌드 시 빌드 번호만 증가
|
|
doLast {
|
|
incrementBuildNumber()
|
|
println "디버그 빌드 완료: 버전 코드 = ${versionCode}, 빌드 번호 = ${buildNumber}"
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
|
|
buildFeatures {
|
|
buildConfig true
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
flatDir{
|
|
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
|
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
|
implementation project(':capacitor-android')
|
|
testImplementation "junit:junit:$junitVersion"
|
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
implementation project(':capacitor-cordova-android-plugins')
|
|
|
|
// 스플래시 화면 플러그인 추가
|
|
implementation "androidx.core:core-splashscreen:1.0.0"
|
|
}
|
|
|
|
apply from: 'capacitor.build.gradle'
|
|
|
|
try {
|
|
def servicesJSON = file('google-services.json')
|
|
if (servicesJSON.text) {
|
|
apply plugin: 'com.google.gms.google-services'
|
|
}
|
|
} catch(Exception e) {
|
|
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
|
|
}
|