build: update AGP and kotlin
authorDa Risk <da_risk@geekorum.com>
Sat, 06 May 2023 19:27:48 -0400
changeset 44 275cbb10a516
parent 43 bb189d80c39c
child 45 e8e44d416387
build: update AGP and kotlin
build.gradle.kts
buildSrc/build.gradle.kts
buildSrc/src/main/kotlin/AndroidJavaVersion.kt
geekdroid-firebase/build.gradle.kts
geekdroid/build.gradle.kts
gradle/wrapper/gradle-wrapper.properties
--- a/build.gradle.kts	Mon Apr 17 12:27:00 2023 -0400
+++ b/build.gradle.kts	Sat May 06 19:27:48 2023 -0400
@@ -20,7 +20,6 @@
  * along with Geekdroid.  If not, see <http://www.gnu.org/licenses/>.
  */
 import com.geekorum.build.SourceLicenseCheckerPlugin
-import com.geekorum.build.configureAnnotationProcessorDeps
 import com.geekorum.build.setupGoogleContent
 
 plugins {
@@ -44,8 +43,6 @@
 subprojects {
     group = "com.geekorum"
     version = "0.0.1"
-
-    configureAnnotationProcessorDeps()
 }
 
 task("clean", type = Delete::class) {
--- a/buildSrc/build.gradle.kts	Mon Apr 17 12:27:00 2023 -0400
+++ b/buildSrc/build.gradle.kts	Sat May 06 19:27:48 2023 -0400
@@ -56,8 +56,8 @@
 }
 
 dependencies {
-    implementation("com.android.tools.build:gradle:7.3.1")
-    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
+    implementation("com.android.tools.build:gradle:8.0.1")
+    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
     implementation("gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1")
     implementation("com.github.triplet.gradle:play-publisher:3.7.0")
 
--- a/buildSrc/src/main/kotlin/AndroidJavaVersion.kt	Mon Apr 17 12:27:00 2023 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Geekdroid is a utility library for development on the Android
- * Platform.
- *
- * Copyright (C) 2017-2023 by Frederic-Charles Barthelery.
- *
- * This file is part of Geekdroid.
- *
- * Geekdroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Geekdroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Geekdroid.  If not, see <http://www.gnu.org/licenses/>.
- */
-package com.geekorum.build
-
-import com.android.build.api.dsl.CommonExtension
-import com.android.build.api.dsl.DefaultConfig
-import com.android.build.gradle.BaseExtension
-import org.gradle.api.JavaVersion
-import org.gradle.api.Project
-import org.gradle.api.plugins.ExtensionAware
-import org.gradle.kotlin.dsl.dependencies
-import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
-
-/**
- * Configure java version compile options based on minSdkVersion value
- */
-@Suppress("UNCHECKED_CAST")
-fun BaseExtension.configureJavaVersion() {
-    (this as CommonExtension<*, *, DefaultConfig, *>).configureJavaVersion()
-}
-
-fun CommonExtension<*, *, DefaultConfig, *>.configureJavaVersion() {
-    val api = defaultConfig.minSdk ?: 1
-    val version = when {
-        api >= 30 -> JavaVersion.VERSION_11
-        api >= 24 -> JavaVersion.VERSION_1_8
-        api >= 19 -> JavaVersion.VERSION_1_7
-        else -> JavaVersion.VERSION_1_6
-    }
-    compileOptions {
-        sourceCompatibility = version
-        targetCompatibility = version
-    }
-
-    (this as ExtensionAware).extensions.findByType(KotlinJvmOptions::class.java)?.apply {
-        if (version >= JavaVersion.VERSION_1_8) {
-            jvmTarget = "1.8"
-        }
-    }
-}
-
-/**
- * Add missing annotation processor dependencies to build on Java 11
- */
-fun Project.configureAnnotationProcessorDeps() {
-    dependencies {
-        configurations.whenObjectAdded {
-            when (name) {
-                "kapt" -> {
-                    add(name, "javax.xml.bind:jaxb-api:2.3.1")
-                    add(name, "com.sun.xml.bind:jaxb-core:2.3.0.1")
-                    add(name, "com.sun.xml.bind:jaxb-impl:2.3.2")
-                }
-
-                "annotationProcessor" -> add(name, "javax.xml.bind:jaxb-api:2.3.1")
-            }
-        }
-    }
-}
--- a/geekdroid-firebase/build.gradle.kts	Mon Apr 17 12:27:00 2023 -0400
+++ b/geekdroid-firebase/build.gradle.kts	Sat May 06 19:27:48 2023 -0400
@@ -1,5 +1,3 @@
-import com.geekorum.build.configureJavaVersion
-
 plugins {
     id("com.android.library")
     kotlin("android")
@@ -16,7 +14,10 @@
     defaultConfig {
         minSdk = 24
     }
-    configureJavaVersion()
+    compileOptions {
+        sourceCompatibility(JavaVersion.VERSION_11)
+        targetCompatibility(JavaVersion.VERSION_11)
+    }
 
     buildTypes {
         getByName("release") {
@@ -38,9 +39,13 @@
             withSourcesJar()
         }
     }
+}
 
+kotlin {
+    jvmToolchain(11)
 }
 
+
 dependencies {
     implementation(platform(kotlin("bom")))
     implementation(kotlin("stdlib-jdk8"))
--- a/geekdroid/build.gradle.kts	Mon Apr 17 12:27:00 2023 -0400
+++ b/geekdroid/build.gradle.kts	Sat May 06 19:27:48 2023 -0400
@@ -19,8 +19,6 @@
  * You should have received a copy of the GNU General Public License
  * along with Geekdroid.  If not, see <http://www.gnu.org/licenses/>.
  */
-import com.geekorum.build.configureJavaVersion
-import com.geekorum.build.daggerPlatform
 import groovy.util.Node
 import groovy.util.NodeList
 
@@ -42,7 +40,10 @@
     defaultConfig {
         minSdk = 24
     }
-    configureJavaVersion()
+    compileOptions {
+        sourceCompatibility(JavaVersion.VERSION_11)
+        targetCompatibility(JavaVersion.VERSION_11)
+    }
 
     buildTypes {
         getByName("release") {
@@ -70,6 +71,10 @@
     }
 }
 
+kotlin {
+    jvmToolchain(11)
+}
+
 dependencies {
     implementation("androidx.recyclerview:recyclerview:1.2.1")
     implementation("androidx.appcompat:appcompat:1.6.1")
--- a/gradle/wrapper/gradle-wrapper.properties	Mon Apr 17 12:27:00 2023 -0400
+++ b/gradle/wrapper/gradle-wrapper.properties	Sat May 06 19:27:48 2023 -0400
@@ -1,5 +1,6 @@
+#Sat May 06 19:25:31 AST 2023
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip