mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
109 lines
3.2 KiB
Groovy
109 lines
3.2 KiB
Groovy
plugins {
|
|
id "com.android.application"
|
|
id "kotlin-android"
|
|
id "dev.flutter.flutter-gradle-plugin"
|
|
}
|
|
|
|
def localProperties = new Properties()
|
|
def localPropertiesFile = rootProject.file('local.properties')
|
|
if (localPropertiesFile.exists()) {
|
|
localPropertiesFile.withReader('UTF-8') { reader ->
|
|
localProperties.load(reader)
|
|
}
|
|
}
|
|
|
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
|
if (flutterVersionCode == null) {
|
|
flutterVersionCode = '1'
|
|
}
|
|
|
|
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
|
if (flutterVersionName == null) {
|
|
flutterVersionName = '1.0'
|
|
}
|
|
|
|
|
|
// Keys for the android play store
|
|
def keystoreProperties = new Properties()
|
|
def keystorePropertiesFile = rootProject.file('../fastlane/metadata/envfiles/key.properties')
|
|
if (keystorePropertiesFile.exists()) {
|
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
}
|
|
|
|
// Key for wger.de REST API
|
|
def wgerProperties = new Properties()
|
|
def localMapsPropertiesFile = rootProject.file('../fastlane/metadata/envfiles/wger.properties')
|
|
if (localMapsPropertiesFile.exists()) {
|
|
project.logger.info('Load maps properties from local file')
|
|
localMapsPropertiesFile.withReader('UTF-8') { reader ->
|
|
wgerProperties.load(reader)
|
|
}
|
|
} else {
|
|
project.logger.info('Load maps properties from environment')
|
|
try {
|
|
wgerProperties['WGER_API_KEY'] = System.getenv('WGER_API_KEY')
|
|
} catch (NullPointerException e) {
|
|
project.logger.warn('Failed to load WGER_API_KEY from environment.', e)
|
|
}
|
|
}
|
|
def wgerApiKey = wgerProperties.getProperty('WGER_API_KEY')
|
|
if (wgerApiKey == null) {
|
|
wgerApiKey = ""
|
|
project.logger.error('Wger Api Key not configured. Set it in `/fastlane/metadata/android/envfiles/wger.properties` or in the environment variable `WGER_API_KEY`')
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 34
|
|
ndkVersion "25.1.8937393"
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = '1.8'
|
|
}
|
|
|
|
sourceSets {
|
|
main.java.srcDirs += 'src/main/kotlin'
|
|
}
|
|
|
|
lintOptions {
|
|
disable 'InvalidPackage'
|
|
}
|
|
|
|
defaultConfig {
|
|
// Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
|
applicationId "de.wger.flutter"
|
|
minSdkVersion 21
|
|
targetSdkVersion 34
|
|
versionCode flutterVersionCode.toInteger()
|
|
versionName flutterVersionName
|
|
manifestPlaceholders += [WGER_API_KEY: wgerApiKey]
|
|
}
|
|
|
|
signingConfigs {
|
|
release {
|
|
keyAlias keystoreProperties['keyAlias']
|
|
keyPassword keystoreProperties['keyPassword']
|
|
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
|
|
storePassword keystoreProperties['storePassword']
|
|
}
|
|
}
|
|
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.release
|
|
}
|
|
debug {
|
|
applicationIdSuffix ".debug"
|
|
}
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source '../..'
|
|
}
|