From 22e355fce2e6bac81a04222f6f21dc5fa94f58b1 Mon Sep 17 00:00:00 2001 From: Lukas Pieper <30661176+lukaspieper@users.noreply.github.com> Date: Wed, 5 Feb 2025 18:44:02 +0100 Subject: [PATCH] Migrate Gradle to KTS and version catalog, increase targetSDK --- app/build.gradle | 48 ------------------------ app/build.gradle.kts | 43 +++++++++++++++++++++ build.gradle | 12 ------ build.gradle.kts | 4 ++ gradle.properties | 12 +++--- gradle/libs.versions.toml | 7 ++++ gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 3 +- settings.gradle | 16 -------- settings.gradle.kts | 22 +++++++++++ 10 files changed, 85 insertions(+), 86 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 gradle/libs.versions.toml delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 9df91e9..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,48 +0,0 @@ -plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") -} - -kotlin { - jvmToolchain(17) -} - -android { - namespace 'de.lukaspieper.gcam.services' - compileSdk 34 - - defaultConfig { - minSdk 19 - targetSdk 31 - versionCode 8 - versionName "1.5.2" - } - - flavorDimensions 'default' - productFlavors { - basic { - dimension 'default' - applicationId 'de.lukaspieper.gcam.services' - } - photos { - dimension 'default' - applicationId 'com.google.android.apps.photos' - } - photosonly { - dimension 'default' - applicationId 'com.google.android.apps.photos' - } - } - - // No benefit outside of Google Play, disabled for IzzyOnDroid - // https://github.com/lukaspieper/Gcam-Services-Provider/issues/122#issuecomment-1930811074 - dependenciesInfo { - includeInApk false - includeInBundle false - } - - // TODO: Upgrade targetSdk - lintOptions { - disable 'ExpiredTargetSdkVersion' - } -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..52dcc79 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} + +kotlin { + jvmToolchain(17) +} + +android { + namespace = "de.lukaspieper.gcam.services" + compileSdk = 35 + + defaultConfig { + minSdk = 19 + targetSdk = 35 + versionCode = 8 + versionName = "1.5.2" + } + + flavorDimensions.add("default") + productFlavors { + create("basic") { + dimension = "default" + applicationId = "de.lukaspieper.gcam.services" + } + create("photos") { + dimension = "default" + applicationId = "com.google.android.apps.photos" + } + create("photosonly") { + dimension = "default" + applicationId = "com.google.android.apps.photos" + } + } + + // No benefit outside of Google Play, disabled for IzzyOnDroid + // https://github.com/lukaspieper/Gcam-Services-Provider/issues/122#issuecomment-1930811074 + dependenciesInfo { + includeInApk = false + includeInBundle = false + } +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index e15ce1c..0000000 --- a/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -buildscript { - ext.kotlin_version = '2.0.20' -} - -plugins { - id "com.android.application" version '8.7.0' apply false - id "org.jetbrains.kotlin.android" version "$kotlin_version" apply false -} - -tasks.register('clean', Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..7629126 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false +} diff --git a/gradle.properties b/gradle.properties index bbf7433..20e2a01 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,19 +4,19 @@ # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8 - +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. For more details, visit +# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects +# org.gradle.parallel=true # AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app"s APK +# Android operating system, and which are packaged with your app's APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true - # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official - # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..a829350 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,7 @@ +[versions] +agp = "8.8.0" +kotlin = "2.1.10" + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8e876e1..e1b837a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip +distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f5feea6..f3b75f3 100755 --- a/gradlew +++ b/gradlew @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 7d4c7ae..0000000 --- a/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - google() - } -} -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} - -rootProject.name='Gcam Services Provider' -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..ffc6129 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,22 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "Gcam Services Provider" +include(":app")