Skip to content

Commit 2c2a26c

Browse files
committed
[Build] Updated to AGP 8.7.3, Gradle 8.9, Java 21
PiperOrigin-RevId: 733023271
1 parent 828c932 commit 2c2a26c

File tree

11 files changed

+104
-74
lines changed

11 files changed

+104
-74
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:7.4.2'
7+
classpath 'com.android.tools.build:gradle:8.7.3'
88
}
99
}
1010

@@ -49,7 +49,7 @@ ext {
4949
espressoVersion = '3.1.0'
5050
mockitoCoreVersion = '2.25.0'
5151
truthVersion = '0.45'
52-
robolectricVersion = '4.9'
52+
robolectricVersion = '4.13'
5353

5454
// Enforce the use of prebuilt dependencies in all sub-projects. This is
5555
// required for the doclava dependency.
@@ -207,8 +207,8 @@ subprojects {
207207
// This disables the builds tools automatic vector -> PNG generation
208208
defaultConfig.generatedDensities = []
209209

210-
compileOptions.sourceCompatibility JavaVersion.VERSION_1_8
211-
compileOptions.targetCompatibility JavaVersion.VERSION_1_8
210+
compileOptions.sourceCompatibility JavaVersion.VERSION_17
211+
compileOptions.targetCompatibility JavaVersion.VERSION_17
212212

213213
aaptOptions.additionalParameters "--no-version-vectors"
214214

catalog/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def srcDirs = [
104104
]
105105

106106
android {
107+
namespace "io.material.catalog"
107108
defaultConfig {
108109
manifestPlaceholders = [
109110
application_name : 'CatalogApplication',
@@ -143,8 +144,8 @@ android {
143144
}
144145

145146
compileOptions {
146-
sourceCompatibility JavaVersion.VERSION_1_8
147-
targetCompatibility JavaVersion.VERSION_1_8
147+
sourceCompatibility JavaVersion.VERSION_17
148+
targetCompatibility JavaVersion.VERSION_17
148149
}
149150
androidResources {
150151
additionalParameters '--no-version-vectors'

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ org.gradle.parallel=true
1818

1919
android.useAndroidX=true
2020
android.enableUnitTestBinaryResources=true
21+
# (b/379121671) Non-transitive R classes were enabled by default in AGP 8+
22+
android.nonTransitiveRClass=false
2123

2224
# Disable "The option setting 'android.enableUnitTestBinaryResources=true' is experimental and unsupported" warning
2325
android.suppressUnsupportedOptionWarnings=android.suppressUnsupportedOptionWarnings,android.enableUnitTestBinaryResources
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-7.6.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

lib/build.gradle

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def srcDirs = [
101101
]
102102

103103
android {
104+
namespace "com.google.android.material"
104105
sourceSets {
105106
main.manifest.srcFile 'java/com/google/android/material/AndroidManifest.xml'
106107
main.java.srcDir 'java'
@@ -126,6 +127,10 @@ android {
126127
defaultConfig {
127128
minSdkVersion 21
128129
}
130+
131+
publishing {
132+
singleVariant("release")
133+
}
129134
}
130135

131136
task getVersion {
@@ -143,48 +148,47 @@ task androidSourcesJar(type: Jar) {
143148
}
144149
}
145150

146-
afterEvaluate {
147-
publishing {
148-
repositories {
149-
maven {
150-
url = "$mavenRepoUrl"
151-
}
151+
publishing {
152+
repositories {
153+
maven {
154+
url = "$mavenRepoUrl"
152155
}
156+
}
153157

154-
publications {
155-
release(MavenPublication) {
156-
from components.release
157-
158-
artifact androidSourcesJar
159-
160-
groupId = 'com.google.android.material'
161-
artifactId = 'material'
162-
version project.version
163-
pom {
164-
name = 'Material Components for Android'
165-
description = 'Material Components for Android is a static library ' +
166-
'that you can add to your Android application in order to use ' +
167-
'APIs that provide implementations of the Material Design specification. ' +
168-
'Compatible on devices running API 21 or later.'
169-
url = 'https://github.com/material-components/material-components-android'
170-
inceptionYear = '2015'
171-
licenses {
172-
license {
173-
name = 'The Apache Software License, Version 2.0'
174-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
175-
distribution = 'repo'
176-
}
177-
}
178-
developers {
179-
developer {
180-
name = 'The Android Open Source Project'
181-
}
158+
publications {
159+
release(MavenPublication) {
160+
artifact androidSourcesJar
161+
groupId = 'com.google.android.material'
162+
artifactId = 'material'
163+
version project.version
164+
pom {
165+
name = 'Material Components for Android'
166+
description = 'Material Components for Android is a static library ' +
167+
'that you can add to your Android application in order to use ' +
168+
'APIs that provide implementations of the Material Design specification. ' +
169+
'Compatible on devices running API 21 or later.'
170+
url = 'https://github.com/material-components/material-components-android'
171+
inceptionYear = '2015'
172+
licenses {
173+
license {
174+
name = 'The Apache Software License, Version 2.0'
175+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
176+
distribution = 'repo'
182177
}
183-
scm {
184-
connection = 'scm:git:https://github.com/material-components/material-components-android.git'
185-
url = 'https://github.com/material-components/material-components-android'
178+
}
179+
developers {
180+
developer {
181+
name = 'The Android Open Source Project'
186182
}
187183
}
184+
scm {
185+
connection = 'scm:git:https://github.com/material-components/material-components-android.git'
186+
url = 'https://github.com/material-components/material-components-android'
187+
}
188+
}
189+
190+
afterEvaluate {
191+
from components.release
188192
}
189193
}
190194
}

testing/java/com/google/android/material/testapp/animation/build.gradle

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@ dependencies {
2323
api project(fromPath("lib"))
2424
api project(fromPath("testing/java/com/google/android/material/testapp/base"))
2525

26-
api 'androidx.multidex:multidex:2.0.0'
26+
api 'androidx.multidex:multidex:2.0.1'
2727
}
2828

2929
android {
30+
namespace "com.google.android.material.testapp.animation"
3031
sourceSets {
3132
main.manifest.srcFile 'AndroidManifest.xml'
32-
main.java.srcDirs = [ '.' ]
33-
main.java.excludes = [
34-
'**/build/**',
35-
]
36-
// Only include things in this directory, not subdirectories
37-
main.java.includes = [ '*.java' ]
3833
main.res.srcDirs = [ 'res' ]
3934
}
4035
defaultConfig {

testing/java/com/google/android/material/testapp/base/build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ dependencies {
2323
}
2424

2525
android {
26+
namespace "com.google.android.material.testapp.base"
2627
sourceSets {
2728
main.manifest.srcFile 'AndroidManifest.xml'
28-
main.java.srcDirs = [ '.' ]
29-
main.java.excludes = [
30-
'**/build/**',
29+
// Manually add src files. Gradle 8 doesn't work well with
30+
// a flat source directory (src = [ '.' ]) where java source, a gradle
31+
// file, and a build output directory are all in the same location.
32+
main.java.srcDirs = [
33+
'BaseTestActivity.java',
34+
'RecreatableAppCompatActivity.java'
3135
]
32-
// Only include things in this directory, not subdirectories
33-
main.java.includes = [ '*.java' ]
3436
}
3537
defaultConfig {
3638
minSdkVersion 21

testing/java/com/google/android/material/testapp/build.gradle

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ dependencies {
99
api project(fromPath("testing/java/com/google/android/material/testapp/base"))
1010
api project(fromPath("testing/java/com/google/android/material/testapp/custom"))
1111

12-
api 'androidx.multidex:multidex:2.0.0'
12+
api 'androidx.multidex:multidex:2.0.1'
1313
}
1414

1515
android {
16+
namespace "com.google.android.material.testapp"
1617
defaultConfig {
1718
multiDexEnabled true
1819
minSdkVersion 21
@@ -21,12 +22,31 @@ android {
2122

2223
sourceSets {
2324
main.manifest.srcFile 'AndroidManifest.xml'
24-
main.java.srcDirs = [ '.' ]
25-
main.java.excludes = [
26-
'**/build/**',
25+
// Manually add src files. Gradle 8 doesn't work well with
26+
// a flat source directory (src = [ '.' ]) where java source, a gradle
27+
// file, and a build output directory are all in the same location.
28+
main.java.srcDirs = [
29+
'AppBarHorizontalScrollingActivity.java',
30+
'AppBarLayoutCollapsePinActivity.java',
31+
'AppBarWithScrollbarsActivity.java',
32+
'BottomNavigationViewActivity.java',
33+
'BottomSheetBehaviorActivity.java',
34+
'BottomSheetBehaviorWithInsetsActivity.java',
35+
'BottomSheetDialogActivity.java',
36+
'CoordinatorLayoutActivity.java',
37+
'DynamicCoordinatorLayoutActivity.java',
38+
'ExpandableTransformationActivity.java',
39+
'ExposedDropdownMenuActivity.java',
40+
'FloatingActionButtonActivity.java',
41+
'NavigationViewActivity.java',
42+
'SnackbarActivity.java',
43+
'SnackbarWithFabActivity.java',
44+
'SnackbarWithTranslucentNavBarActivity.java',
45+
'TabLayoutPoolingActivity.java',
46+
'TabLayoutWithViewPagerActivity.java',
47+
'TextInputLayoutActivity.java',
48+
'TextInputLayoutWithIconsActivity.java'
2749
]
28-
// Only include things in this directory, not subdirectories
29-
main.java.includes = [ '*.java' ]
3050
main.res.srcDirs = [ 'res' ]
3151
}
3252

testing/java/com/google/android/material/testapp/custom/build.gradle

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ dependencies {
1010
}
1111

1212
android {
13+
namespace "com.google.android.material.testapp.custom"
1314
sourceSets {
1415
main.manifest.srcFile 'AndroidManifest.xml'
15-
main.java.srcDirs = [ '.' ]
16-
main.java.excludes = [
17-
'**/build/**',
16+
// Manually add src files. Gradle 8 doesn't work well with
17+
// a flat source directory (src = [ '.' ]) where java source, a gradle
18+
// file, and a build output directory are all in the same location.
19+
main.java.srcDirs = [
20+
'CustomSnackbar.java',
21+
'CustomSnackbarMainContent.java',
22+
'CustomTextView.java',
23+
'NavigationTestView.java',
24+
'TestFloatingBehavior.java'
1825
]
19-
// Only include things in this directory, not subdirectories
20-
main.java.includes = [ '*.java' ]
2126
main.res.srcDirs = [ 'res' ]
2227
}
2328
defaultConfig {

testing/java/com/google/android/material/testapp/theme/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ dependencies {
3232
}
3333

3434
android {
35+
namespace "com.google.android.material.testapp.theme"
3536
sourceSets {
3637
main.manifest.srcFile 'AndroidManifest.xml'
37-
main.java.srcDirs = [ '.' ]
38-
main.java.excludes = [
39-
'**/build/**',
38+
// Manually add src files. Gradle 8 doesn't work well with
39+
// a flat source directory (src = [ '.' ]) where java source, a gradle
40+
// file, and a build output directory are all in the same location.
41+
main.java.srcDirs = [
42+
'MaterialComponentsViewInflaterActivity.java'
4043
]
41-
// Only include things in this directory, not subdirectories
42-
main.java.includes = [ '*.java' ]
4344
main.res.srcDirs = [ 'res' ]
4445
}
4546
defaultConfig {

0 commit comments

Comments
 (0)