migrated to new gradle building shit

This commit is contained in:
Kima 2024-03-17 21:59:32 +01:00
parent 3a2b3fa568
commit 941ed5e0d1
3 changed files with 61 additions and 34 deletions

View File

@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
@ -6,10 +12,10 @@ if (localPropertiesFile.exists()) {
} }
} }
def flutterRoot = localProperties.getProperty('flutter.sdk') // def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) { // if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") // throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
} // }
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
@ -21,9 +27,9 @@ if (flutterVersionName == null) {
throw new GradleException("Undefined VersionName") throw new GradleException("Undefined VersionName")
} }
apply plugin: 'com.android.application' // apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' // apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" // apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties() def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties") def keystorePropertiesFile = rootProject.file("key.properties")
@ -36,7 +42,8 @@ debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
android { android {
ndkVersion "25.1.8937393" ndkVersion "25.1.8937393"
compileSdkVersion rootProject.ext.compileSdkVersion // compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion 34
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
@ -52,7 +59,7 @@ android {
defaultConfig { defaultConfig {
applicationId "hu.refilc.naplo" applicationId "hu.refilc.naplo"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion 34
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -106,7 +113,7 @@ flutter {
dependencies { dependencies {
implementation 'com.android.support:multidex:2.0.1' implementation 'com.android.support:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.21"
implementation 'joda-time:joda-time:2.9.4' implementation 'joda-time:joda-time:2.9.4'
androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

View File

@ -1,22 +1,22 @@
buildscript { // buildscript {
ext.kotlin_version = '1.8.21' // ext.kotlin_version = '1.8.21'
ext { // ext {
compileSdkVersion = 34 // compileSdkVersion = 34
targetSdkVersion = 34 // targetSdkVersion = 34
appCompatVersion = "1.1.0" // appCompatVersion = "1.1.0"
} // }
repositories { // repositories {
google() // google()
jcenter() // jcenter()
} // }
dependencies { // dependencies {
classpath 'com.android.tools.build:gradle:7.1.1' // classpath 'com.android.tools.build:gradle:7.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} // }
} // }
allprojects { allprojects {
repositories { repositories {

View File

@ -1,11 +1,31 @@
include ':app' pluginManagement {
def flutterSdkPath = {
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties() def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk") def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
// ext {
// compileSdkVersion = 34
// targetSdkVersion = 34
// appCompatVersion = "1.1.0"
// }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.1.1" apply false
id "org.jetbrains.kotlin.android" version "1.8.21" apply false
}
include ":app"