mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-23 17:13:54 +08:00
Revert "Revert "android: Move to new gradle setup""
This reverts commit 8a870911762fce95f3d2de0d8b81c0f163e191cf.
This commit is contained in:
@ -2,31 +2,11 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
def localProperties = new Properties()
|
plugins {
|
||||||
def localPropertiesFile = rootProject.file('local.properties')
|
id "com.android.application"
|
||||||
if (localPropertiesFile.exists()) {
|
id "kotlin-android"
|
||||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
||||||
|
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
def keystorePropertiesFile = rootProject.file('secrets/key.properties')
|
def keystorePropertiesFile = rootProject.file('secrets/key.properties')
|
||||||
@ -42,7 +22,7 @@ if (!keystoreProperties.containsKey('keyAlias')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
compileSdkVersion flutter.compileSdkVersion
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
disable 'InvalidPackage'
|
disable 'InvalidPackage'
|
||||||
@ -51,11 +31,11 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "io.gitjournal.gitjournal"
|
applicationId "io.gitjournal.gitjournal"
|
||||||
minSdkVersion 21
|
minSdkVersion flutter.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutter.versionCode
|
||||||
versionName flutterVersionName
|
versionName flutter.versionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "app"
|
flavorDimensions "app"
|
||||||
@ -103,10 +83,9 @@ flutter {
|
|||||||
source '../..'
|
source '../..'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
// Are these required?
|
||||||
testImplementation 'junit:junit:4.12'
|
// dependencies {
|
||||||
androidTestImplementation 'androidx.test:runner:1.1.0'
|
// testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
|
// androidTestImplementation 'androidx.test:runner:1.1.0'
|
||||||
|
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
// }
|
||||||
}
|
|
||||||
|
@ -2,24 +2,6 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
buildscript {
|
|
||||||
ext.kotlin_version = '1.8.0'
|
|
||||||
ext {
|
|
||||||
compileSdkVersion = 34
|
|
||||||
targetSdkVersion = 34
|
|
||||||
appCompatVersion = "1.1.0"
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
@ -39,8 +21,8 @@ tasks.register("clean", Delete) {
|
|||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
// gradle.projectsEvaluated {
|
||||||
tasks.withType(JavaCompile) {
|
// tasks.withType(JavaCompile) {
|
||||||
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
|
||||||
# See https://developer.android.com/studio/releases/gradle-plugin#groovy
|
# See https://developer.android.com/studio/releases/gradle-plugin#groovy
|
||||||
|
@ -2,18 +2,28 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
include ':app'
|
pluginManagement {
|
||||||
|
def flutterSdkPath = {
|
||||||
|
def properties = new Properties()
|
||||||
|
file("local.properties").withInputStream { properties.load(it) }
|
||||||
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
|
return flutterSdkPath
|
||||||
|
}()
|
||||||
|
|
||||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
|
|
||||||
def plugins = new Properties()
|
repositories {
|
||||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
google()
|
||||||
if (pluginsFile.exists()) {
|
mavenCentral()
|
||||||
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.each { name, path ->
|
plugins {
|
||||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
include ":$name"
|
id "com.android.application" version "7.2.1" apply false
|
||||||
project(":$name").projectDir = pluginDirectory
|
id "org.jetbrains.kotlin.android" version "1.8.0" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include ":app"
|
Reference in New Issue
Block a user