mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-02-04 13:13:19 +00:00
136 lines
4.8 KiB
Groovy
136 lines
4.8 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'
|
|
}
|
|
|
|
def keystoreProperties = new Properties()
|
|
// Prefer root key.properties, but fall back to android/key.properties if present (CI may place it there)
|
|
def keystorePropertiesFile = rootProject.file('key.properties')
|
|
if (!keystorePropertiesFile.exists()) {
|
|
def alt = rootProject.file('android/key.properties')
|
|
if (alt.exists()) {
|
|
keystorePropertiesFile = alt
|
|
}
|
|
}
|
|
if (keystorePropertiesFile.exists()) {
|
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
}
|
|
|
|
// Temporary debug task: prints which keystore file Gradle sees and whether the storeFile exists (does NOT print secrets)
|
|
task printSigning {
|
|
doLast {
|
|
println "keystorePropertiesFile = ${keystorePropertiesFile} (abs: ${keystorePropertiesFile?.absolutePath})"
|
|
println "keystoreProperties keys = " + keystoreProperties.keySet().toString()
|
|
def rawStore = keystoreProperties['storeFile'] ? keystoreProperties['storeFile'].toString().trim() : null
|
|
println "raw storeFile (trimmed) = " + (rawStore ?: 'null')
|
|
if (rawStore) {
|
|
def f = file(rawStore)
|
|
println "storeFile interpreted as file(...) = " + f.absolutePath + " exists = " + f.exists()
|
|
def f2 = new File(keystorePropertiesFile.parentFile, rawStore)
|
|
println "storeFile interpreted relative to keystorePropertiesFile = " + f2.absolutePath + " exists = " + f2.exists()
|
|
def f3 = new File(rootProject.projectDir, rawStore)
|
|
println "storeFile interpreted relative to rootProject = " + f3.absolutePath + " exists = " + f3.exists()
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
android {
|
|
namespace "inventree.inventree_app"
|
|
compileSdkVersion 35
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
|
|
// If using Kotlin
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_17
|
|
}
|
|
|
|
sourceSets {
|
|
main.java.srcDirs += 'src/main/kotlin'
|
|
}
|
|
|
|
packagingOptions {
|
|
exclude 'META-INF/proguard/androidx-annotations.pro'
|
|
}
|
|
|
|
lintOptions {
|
|
disable 'InvalidPackage'
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId "inventree.inventree_app"
|
|
minSdkVersion 21
|
|
targetSdkVersion 35
|
|
versionCode flutterVersionCode.toInteger()
|
|
versionName flutterVersionName
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
multiDexEnabled true
|
|
}
|
|
|
|
signingConfigs {
|
|
release {
|
|
keyAlias keystoreProperties['keyAlias']
|
|
keyPassword keystoreProperties['keyPassword']
|
|
// Resolve storeFile robustly: trim, then prefer absolute path; if not found, try relative to keystore properties file
|
|
def rawStoreFile = keystoreProperties['storeFile'] ? keystoreProperties['storeFile'].toString().trim() : null
|
|
def resolvedStoreFile = null
|
|
if (rawStoreFile) {
|
|
def candidate = file(rawStoreFile)
|
|
if (!candidate.exists()) {
|
|
// try relative to the keystore properties file directory
|
|
def parentCandidate = new File(keystorePropertiesFile.parentFile, rawStoreFile)
|
|
if (parentCandidate.exists()) {
|
|
candidate = parentCandidate
|
|
}
|
|
}
|
|
resolvedStoreFile = candidate.exists() ? candidate : null
|
|
}
|
|
storeFile resolvedStoreFile
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source '../..'
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation 'junit:junit:4.12'
|
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
|
androidTestImplementation 'com.android.support:multidex:2.0.1'
|
|
implementation "androidx.core:core:1.9.0"
|
|
implementation 'androidx.appcompat:appcompat:1.6.0'
|
|
}
|