mirror of
https://bitbucket.org/myhomie/myhomie_app.git
synced 2025-12-06 09:01:20 +00:00
114 lines
3.4 KiB
Groovy
114 lines
3.4 KiB
Groovy
def localProperties = new Properties()
|
|
def localPropertiesFile = rootProject.file('local.properties')
|
|
if (localPropertiesFile.exists()) {
|
|
localPropertiesFile.withReader('UTF-8') { reader ->
|
|
localProperties.load(reader)
|
|
}
|
|
}
|
|
|
|
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
if (flutterRoot == null) {
|
|
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
|
}
|
|
|
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
|
if (flutterVersionCode == null) {
|
|
flutterVersionCode = '1'
|
|
}
|
|
|
|
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
|
if (flutterVersionName == null) {
|
|
flutterVersionName = '1.0'
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
|
|
android {
|
|
compileSdkVersion 32
|
|
|
|
sourceSets {
|
|
main.java.srcDirs += 'src/main/kotlin'
|
|
}
|
|
|
|
lintOptions {
|
|
disable 'InvalidPackage'
|
|
}
|
|
|
|
def versionPropsFile = file('version.properties')
|
|
def value = 0
|
|
|
|
Properties versionProps = new Properties()
|
|
|
|
if (!versionPropsFile.exists()) {
|
|
versionProps['VERSION_MAJOR'] = "1"
|
|
versionProps['VERSION_MINOR'] = "0"
|
|
versionProps['VERSION_PATCH'] = "0"
|
|
versionProps['VERSION_BUILD'] = "0"
|
|
versionProps.store(versionPropsFile.newWriter(), null)
|
|
}
|
|
|
|
def runTasks = gradle.startParameter.taskNames
|
|
if ('assembleRelease' in runTasks) {
|
|
value = 1
|
|
}
|
|
|
|
if (versionPropsFile.canRead()) {
|
|
|
|
versionProps.load(new FileInputStream(versionPropsFile))
|
|
|
|
versionProps['VERSION_PATCH'] = (versionProps['VERSION_PATCH'].toInteger() + value).toString()
|
|
versionProps['VERSION_BUILD'] = (versionProps['VERSION_BUILD'].toInteger() + 1).toString()
|
|
|
|
versionProps.store(versionPropsFile.newWriter(), null)
|
|
|
|
// change major and minor version here
|
|
def mVersionName = "${versionProps['VERSION_MAJOR']}.${versionProps['VERSION_MINOR']}.${versionProps['VERSION_PATCH']}"
|
|
|
|
defaultConfig {
|
|
applicationId "be.unov.myhomie" // leave it at the value you have in your file
|
|
minSdkVersion 23 // this as well
|
|
targetSdkVersion 28 // and this
|
|
versionCode versionProps['VERSION_BUILD'].toInteger()
|
|
versionName "${mVersionName} Build: ${versionProps['VERSION_BUILD']}"
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
}
|
|
else {
|
|
throw new GradleException("Could not read version.properties!")
|
|
}
|
|
|
|
/*
|
|
defaultConfig {
|
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
|
applicationId "be.unov.myhomie"
|
|
minSdkVersion 20
|
|
targetSdkVersion 32
|
|
versionCode flutterVersionCode.toInteger()
|
|
versionName flutterVersionName
|
|
multiDexEnabled true
|
|
}
|
|
|
|
*/
|
|
|
|
buildTypes {
|
|
release {
|
|
// TODO: Add your own signing config for the release build.
|
|
// Signing with the debug keys for now, so `flutter run --release` works.
|
|
signingConfig signingConfigs.debug
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
debuggable false
|
|
}
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source '../..'
|
|
}
|
|
|
|
dependencies {
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
}
|