Skip to content

Commit 30f11e6

Browse files
committed
build: updated AGP
1 parent abece5c commit 30f11e6

9 files changed

Lines changed: 48 additions & 30 deletions

File tree

build-logic/convention/src/main/kotlin/PublishingConventionPlugin.kt

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,62 @@ import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
33
import com.vanniktech.maven.publish.MavenPublishBaseExtension
44
import org.gradle.api.Plugin
55
import org.gradle.api.Project
6-
import org.gradle.api.tasks.testing.Test
7-
import org.gradle.kotlin.dsl.apply
8-
import org.gradle.kotlin.dsl.configure
9-
import org.gradle.kotlin.dsl.withType
6+
import org.gradle.kotlin.dsl.*
107
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
8+
import org.gradle.api.tasks.testing.Test
119
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
10+
import org.gradle.testing.jacoco.tasks.JacocoReport
1211

1312
class PublishingConventionPlugin : Plugin<Project> {
1413
override fun apply(project: Project) {
1514
project.run {
15+
1616
applyPlugins()
1717
configureJacoco()
18-
configureMavenPublishing()
18+
configureVanniktechPublishing()
1919
}
2020
}
2121

2222
private fun Project.applyPlugins() {
2323
apply(plugin = "com.android.library")
24-
apply(plugin = "com.mxalbert.gradle.jacoco-android")
2524
apply(plugin = "org.jetbrains.dokka")
25+
apply(plugin = "org.gradle.jacoco")
2626
apply(plugin = "com.vanniktech.maven.publish")
2727
}
2828

2929
private fun Project.configureJacoco() {
3030
configure<JacocoPluginExtension> {
31-
toolVersion = "0.8.7"
31+
toolVersion = "0.8.11" // Compatible with newer JDKs
3232
}
3333

34-
tasks.withType<Test>().configureEach {
35-
extensions.configure(JacocoTaskExtension::class.java) {
36-
isIncludeNoLocationClasses = true
37-
excludes = listOf("jdk.internal.*")
38-
}
34+
// AGP 9.0+ built-in Jacoco support or manual configuration.
35+
// We create a "jacocoTestReport" task to match the CI workflow.
36+
37+
tasks.register<JacocoReport>("jacocoTestReport") {
38+
// Dependencies
39+
dependsOn("testDebugUnitTest")
40+
41+
reports {
42+
xml.required.set(true)
43+
html.required.set(true)
44+
}
45+
46+
// Source directories
47+
val mainSrc = "${layout.projectDirectory}/src/main/java"
48+
sourceDirectories.setFrom(files(mainSrc))
49+
50+
// Class directories - we need to point to where Kotlin compiles to
51+
val debugTree = fileTree("${layout.buildDirectory.get()}/tmp/kotlin-classes/debug")
52+
classDirectories.setFrom(files(debugTree))
53+
54+
// Execution data from the unit test task
55+
executionData.setFrom(fileTree(layout.buildDirectory.get()) {
56+
include("outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec")
57+
})
3958
}
4059
}
4160

42-
private fun Project.configureMavenPublishing() {
61+
private fun Project.configureVanniktechPublishing() {
4362
extensions.configure<MavenPublishBaseExtension> {
4463
configure(
4564
AndroidSingleVariantLibrary(
@@ -48,8 +67,10 @@ class PublishingConventionPlugin : Plugin<Project> {
4867
publishJavadocJar = true
4968
)
5069
)
70+
5171
publishToMavenCentral()
5272
signAllPublications()
73+
5374
pom {
5475
name.set(project.name)
5576
description.set("Jetpack Compose components for the Places SDK for Android")
@@ -66,17 +87,17 @@ class PublishingConventionPlugin : Plugin<Project> {
6687
developerConnection.set("scm:git@github.com:googlemaps/android-places-compose.git")
6788
url.set("https://github.com/googlemaps/android-places-compose")
6889
}
69-
organization {
70-
name.set("Google Inc")
71-
url.set("http://developers.google.com/maps")
72-
}
7390
developers {
7491
developer {
7592
id.set("google")
7693
name.set("Google Inc.")
7794
}
7895
}
96+
organization {
97+
name.set("Google Inc")
98+
url.set("http://developers.google.com/maps")
99+
}
79100
}
80101
}
81102
}
82-
}
103+
}

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
33
dependencies {
4-
classpath(libs.jacoco.android.plugin)
54
}
65
}
76
plugins {

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ mavenCentralPassword=
3131

3232
# Add a property to enable automatic release to Maven Central (optional, but good for CI)
3333
# If true, publishToMavenCentral will also close and release the staging repository
34-
mavenCentralAutomaticRelease=false
34+
mavenCentralAutomaticRelease=false
35+
android.builtInKotlin=false
36+
android.newDsl=false

gradle/libs.versions.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
[versions]
22
accompanistPermissions = "0.37.3"
33
activityCompose = "1.12.1"
4-
agp = "8.13.1"
4+
agp = "9.1.0"
55
appcompat = "1.7.1"
66
composeBom = "2025.12.00"
77
coreKtx = "1.17.0"
88
dokka = "2.1.0"
99
espressoCore = "3.7.0"
1010
gson = "2.13.2"
1111
hiltVersion = "2.57.2"
12-
jacoco-plugin = "0.2.1"
1312
junit = "4.13.2"
1413
junitVersion = "1.3.0"
1514
kotlin = "2.2.21"
@@ -60,7 +59,6 @@ google-truth = { group = "com.google.truth", name = "truth", version.ref = "trut
6059
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
6160
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hiltVersion" }
6261
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hiltVersion" }
63-
jacoco-android-plugin = { module = "com.mxalbert.gradle:jacoco-android", version.ref = "jacoco-plugin", version.require = "0.2.1" }
6462
junit = { group = "junit", name = "junit", version.ref = "junit" }
6563
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
6664
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlinReflect" }

gradle/wrapper/gradle-wrapper.jar

3.43 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

places-compose/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ android {
2323

2424
buildTypes {
2525
release {
26+
enableUnitTestCoverage = true
27+
enableAndroidTestCoverage = true
2628
isMinifyEnabled = false
2729
proguardFiles(
2830
getDefaultProguardFile("proguard-android-optimize.txt"),

0 commit comments

Comments
 (0)