Skip to content

Commit f5a69ae

Browse files
committed
Add early support for AGP 4.1
Note that AGP 4.1.0-alpha10 is only compatible with Gradle 6.5 milestone 1. Bump publish plugin to include signatures. Add local.properties to gitignore. The travis property is removed since the build scan plugin is now applied to the tests. Remove unused guava dependency.
1 parent 7681928 commit f5a69ae

File tree

8 files changed

+64
-27
lines changed

8 files changed

+64
-27
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ bin/
2525
# Logs
2626
# ----
2727
*.log
28+
29+
# Android Studio
30+
local.properties

build.gradle

+5-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88
}
99
dependencies {
10-
classpath "com.gradle.publish:plugin-publish-plugin:0.11.0"
10+
classpath "com.gradle.publish:plugin-publish-plugin:0.12.0"
1111
}
1212
}
1313

@@ -22,6 +22,8 @@ version = ["git", "describe", "--match", "[0-9]*", "--dirty"].execute().text.tri
2222

2323
// Maps supported Android plugin versions to the versions of Gradle that support it
2424
def supportedVersions = [
25+
// 4.1.0-alpha10 is *only* compatible with milestone 1
26+
"4.1.0-alpha10": ["6.5-milestone-1"],
2527
"4.0.0": ["6.1.1", "6.3", "6.4.1"],
2628
"3.6.3": ["5.6.4", "6.3", "6.4.1"],
2729
"3.6.2": ["5.6.4"],
@@ -39,10 +41,9 @@ repositories {
3941
}
4042

4143
dependencies {
42-
compileOnly 'com.android.tools.build:gradle:3.5.0'
43-
compile 'com.google.guava:guava:22.0'
44+
compileOnly 'com.android.tools.build:gradle:3.5.3'
4445
compile gradleApi()
45-
testCompile 'com.android.tools.build:gradle:3.5.0'
46+
testCompile 'com.android.tools.build:gradle:3.5.3'
4647
testCompile gradleTestKit()
4748
testCompile "junit:junit:4.12"
4849
testCompile "org.spockframework:spock-core:1.1-groovy-2.4@jar"
@@ -107,15 +108,9 @@ task install(type: Upload) {
107108
configuration = configurations.runtime
108109
}
109110

110-
def travis = System.getenv("TRAVIS") == "true"
111-
112111
test {
113112
dependsOn install
114113
systemProperty "local.repo", localRepo.toURI()
115-
systemProperty "travis", travis
116-
if (travis) {
117-
testLogging.showStandardStreams = true
118-
}
119114
}
120115

121116
if (!JavaVersion.current().java8) {

gradle/buildScanInit.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import com.gradle.scan.plugin.BuildScanPlugin
33
import org.gradle.util.GradleVersion
44

55
initscript {
6-
def pluginVersion = "3.3"
6+
def pluginVersion = "3.3.3"
77

88
repositories {
99
gradlePluginPortal()

src/main/groovy/org/gradle/android/workarounds/MergeJavaResourcesWorkaround.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import java.lang.reflect.Method
1212
* absolute path sensitivity. This mostly comes up when the kotlin plugin has been applied, which puts the
1313
* kotlin_module files into this input.
1414
*/
15-
@AndroidIssue(introducedIn = "3.5.0", fixedIn = ["4.1.0"], link = "https://issuetracker.google.com/issues/140602655")
15+
@AndroidIssue(introducedIn = "3.5.0", fixedIn = ["4.1.0-alpha09"], link = "https://issuetracker.google.com/issues/140602655")
1616
class MergeJavaResourcesWorkaround extends AbstractAbsolutePathWorkaround {
1717
Class<?> androidTaskClass = MergeJavaResourceTask.class
1818
String propertyName = "projectJavaRes"

src/main/groovy/org/gradle/android/workarounds/MergeNativeLibsWorkaround.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import java.lang.reflect.Field
1616
* method that calculates a new FileCollection from variantScope every time it is called. So we only
1717
* support this workaround for 3.6.x and 4.0.x.
1818
*/
19-
@AndroidIssue(introducedIn = "3.6.0", fixedIn = ["4.1.0"], link = "https://issuetracker.google.com/issues/140602655")
19+
@AndroidIssue(introducedIn = "3.6.0", fixedIn = ["4.1.0-alpha09"], link = "https://issuetracker.google.com/issues/140602655")
2020
class MergeNativeLibsWorkaround extends AbstractAbsolutePathWorkaround {
2121
Class<?> androidTaskClass = MergeNativeLibsTask.class
2222
String propertyName = "projectNativeLibs"

src/test/groovy/org/gradle/android/CrossVersionOutcomeAndRelocationTest.groovy

+50-13
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,13 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
133133
def isAndroid35xOrHigher = androidVersion >= android("3.5.0")
134134
def isAndroid350to352 = androidVersion >= android("3.5.0") && androidVersion <= android("3.5.2")
135135
def isAndroid35x = androidVersion >= android("3.5.0") && androidVersion < android("3.6.0")
136-
def isAndroid35xTo36x= androidVersion >= android("3.5.0") && androidVersion <= android("3.6.3")
136+
def isAndroid35xTo36x = androidVersion >= android("3.5.0") && androidVersion <= android("3.6.3")
137+
def isAndroid35xTo40x = androidVersion >= android("3.5.0") && androidVersion <= android("4.1.0-alpha01")
137138
def isAndroid36x = androidVersion >= android("3.6.0") && androidVersion < android("4.0.0-alpha01")
138139
def isAndroid36xOrHigher = androidVersion >= android("3.6.0")
139140
def isAndroid40xOrHigher = androidVersion >= android("4.0.0-beta01")
141+
def isAndroid40x = androidVersion >= android("4.0.0") && androidVersion < android("4.1.0-alpha01")
142+
def isAndroid41xOrHigher = androidVersion >= android("4.1.0-alpha01")
140143
def builder = new ExpectedOutcomeBuilder()
141144

142145
// Applies to anything 3.5.0 or higher
@@ -174,6 +177,19 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
174177
android40xOrHigherExpectations(builder)
175178
}
176179

180+
if (isAndroid35xTo40x) {
181+
android35xTo40xExpectations(builder)
182+
}
183+
184+
if (isAndroid40x) {
185+
android40xOnlyExpectations(builder)
186+
}
187+
188+
// Applies to anything 4.1.0 or higher
189+
if (isAndroid41xOrHigher) {
190+
android41xOrHigherExpectations(builder)
191+
}
192+
177193
new ExpectedResults(
178194
builder.build()
179195
)
@@ -197,8 +213,6 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
197213
builder.expect(':app:compileReleaseSources', UP_TO_DATE)
198214
builder.expect(':app:createDebugCompatibleScreenManifests', FROM_CACHE)
199215
builder.expect(':app:createReleaseCompatibleScreenManifests', FROM_CACHE)
200-
builder.expect(':app:dataBindingExportFeaturePackageIdsDebug', FROM_CACHE)
201-
builder.expect(':app:dataBindingExportFeaturePackageIdsRelease', FROM_CACHE)
202216
builder.expect(':app:dataBindingGenBaseClassesDebug', FROM_CACHE)
203217
builder.expect(':app:dataBindingGenBaseClassesRelease', FROM_CACHE)
204218
builder.expect(':app:dataBindingMergeDependencyArtifactsDebug', FROM_CACHE)
@@ -207,12 +221,10 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
207221
builder.expect(':app:generateDebugBuildConfig', FROM_CACHE)
208222
builder.expect(':app:generateDebugResValues', FROM_CACHE)
209223
builder.expect(':app:generateDebugResources', UP_TO_DATE)
210-
builder.expect(':app:generateDebugSources', SUCCESS)
211224
builder.expect(':app:generateReleaseAssets', UP_TO_DATE)
212225
builder.expect(':app:generateReleaseBuildConfig', FROM_CACHE)
213226
builder.expect(':app:generateReleaseResValues', FROM_CACHE)
214227
builder.expect(':app:generateReleaseResources', UP_TO_DATE)
215-
builder.expect(':app:generateReleaseSources', SUCCESS)
216228
builder.expect(':app:javaPreCompileDebug', FROM_CACHE)
217229
builder.expect(':app:javaPreCompileRelease', FROM_CACHE)
218230
builder.expect(':app:kaptGenerateStubsDebugKotlin', FROM_CACHE)
@@ -240,7 +252,6 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
240252
builder.expect(':app:preDebugBuild', UP_TO_DATE)
241253
builder.expect(':app:preReleaseBuild', UP_TO_DATE)
242254
builder.expect(':app:prepareLintJar', SUCCESS)
243-
builder.expect(':app:prepareLintJarForPublish', SUCCESS)
244255
builder.expect(':app:processDebugJavaRes', NO_SOURCE)
245256
builder.expect(':app:processDebugManifest', FROM_CACHE)
246257
builder.expect(':app:processReleaseJavaRes', NO_SOURCE)
@@ -274,13 +285,11 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
274285
builder.expect(':library:generateDebugRFile', FROM_CACHE)
275286
builder.expect(':library:generateDebugResValues', FROM_CACHE)
276287
builder.expect(':library:generateDebugResources', UP_TO_DATE)
277-
builder.expect(':library:generateDebugSources', SUCCESS)
278288
builder.expect(':library:generateReleaseAssets', UP_TO_DATE)
279289
builder.expect(':library:generateReleaseBuildConfig', FROM_CACHE)
280290
builder.expect(':library:generateReleaseRFile', FROM_CACHE)
281291
builder.expect(':library:generateReleaseResValues', FROM_CACHE)
282292
builder.expect(':library:generateReleaseResources', UP_TO_DATE)
283-
builder.expect(':library:generateReleaseSources', SUCCESS)
284293
builder.expect(':library:javaPreCompileDebug', FROM_CACHE)
285294
builder.expect(':library:javaPreCompileRelease', FROM_CACHE)
286295
builder.expect(':library:kaptGenerateStubsDebugKotlin', FROM_CACHE)
@@ -304,7 +313,6 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
304313
builder.expect(':library:preBuild', UP_TO_DATE)
305314
builder.expect(':library:preDebugBuild', UP_TO_DATE)
306315
builder.expect(':library:preReleaseBuild', UP_TO_DATE)
307-
builder.expect(':library:prepareLintJar', SUCCESS)
308316
builder.expect(':library:prepareLintJarForPublish', SUCCESS)
309317
builder.expect(':library:processDebugJavaRes', NO_SOURCE)
310318
builder.expect(':library:processDebugManifest', FROM_CACHE)
@@ -348,6 +356,17 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
348356
builder.expect(':library:mergeReleaseGeneratedProguardFiles', SUCCESS)
349357
}
350358

359+
static void android35xTo40xExpectations(ExpectedOutcomeBuilder builder) {
360+
builder.expect(':app:prepareLintJarForPublish', SUCCESS)
361+
builder.expect(':app:dataBindingExportFeaturePackageIdsDebug', FROM_CACHE)
362+
builder.expect(':app:dataBindingExportFeaturePackageIdsRelease', FROM_CACHE)
363+
builder.expect(':app:generateDebugSources', SUCCESS)
364+
builder.expect(':app:generateReleaseSources', SUCCESS)
365+
builder.expect(':library:generateDebugSources', SUCCESS)
366+
builder.expect(':library:generateReleaseSources', SUCCESS)
367+
builder.expect(':library:prepareLintJar', SUCCESS)
368+
}
369+
351370
static void android35xOnlyExpectations(ExpectedOutcomeBuilder builder) {
352371
builder.expect(':app:checkDebugManifest', SUCCESS)
353372
builder.expect(':app:checkReleaseManifest', SUCCESS)
@@ -405,8 +424,6 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
405424
static void android40xOrHigherExpectations(ExpectedOutcomeBuilder builder) {
406425
builder.expect(':app:compileDebugShaders', NO_SOURCE)
407426
builder.expect(':app:compileReleaseShaders', NO_SOURCE)
408-
builder.expect(':app:dataBindingExportBuildInfoDebug', FROM_CACHE)
409-
builder.expect(':app:dataBindingExportBuildInfoRelease', FROM_CACHE)
410427
builder.expect(':app:dataBindingMergeGenClassesDebug', FROM_CACHE)
411428
builder.expect(':app:dataBindingMergeGenClassesRelease', FROM_CACHE)
412429
builder.expect(':app:mergeDebugResources', SUCCESS)
@@ -417,8 +434,6 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
417434
builder.expect(':library:compileDebugShaders', NO_SOURCE)
418435
builder.expect(':library:compileReleaseLibraryResources', SUCCESS)
419436
builder.expect(':library:compileReleaseShaders', NO_SOURCE)
420-
builder.expect(':library:dataBindingExportBuildInfoDebug', FROM_CACHE)
421-
builder.expect(':library:dataBindingExportBuildInfoRelease', FROM_CACHE)
422437
builder.expect(':library:dataBindingMergeGenClassesDebug', FROM_CACHE)
423438
builder.expect(':library:dataBindingMergeGenClassesRelease', FROM_CACHE)
424439
builder.expect(':library:mergeDebugConsumerProguardFiles', FROM_CACHE)
@@ -434,4 +449,26 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest {
434449
builder.expect(':app:collectReleaseDependencies', SUCCESS)
435450
builder.expect(':app:sdkReleaseDependencyData', SUCCESS)
436451
}
452+
453+
static void android41xOrHigherExpectations(ExpectedOutcomeBuilder builder) {
454+
builder.expect(':library:dataBindingTriggerDebug', FROM_CACHE)
455+
builder.expect(':library:dataBindingTriggerRelease', FROM_CACHE)
456+
builder.expect(':app:dataBindingTriggerDebug', FROM_CACHE)
457+
builder.expect(':app:processDebugMainManifest', FROM_CACHE)
458+
builder.expect(':app:processDebugManifestForPackage', FROM_CACHE)
459+
builder.expect(':app:dataBindingTriggerRelease', FROM_CACHE)
460+
builder.expect(':app:processReleaseMainManifest', FROM_CACHE)
461+
builder.expect(':app:processReleaseManifestForPackage', FROM_CACHE)
462+
builder.expect(':app:compressDebugAssets', FROM_CACHE)
463+
builder.expect(':app:compressReleaseAssets', FROM_CACHE)
464+
builder.expect(':app:mergeDebugNativeDebugMetadata', NO_SOURCE)
465+
builder.expect(':app:mergeReleaseNativeDebugMetadata', NO_SOURCE)
466+
}
467+
468+
static void android40xOnlyExpectations(ExpectedOutcomeBuilder builder) {
469+
builder.expect(':app:dataBindingExportBuildInfoDebug', FROM_CACHE)
470+
builder.expect(':app:dataBindingExportBuildInfoRelease', FROM_CACHE)
471+
builder.expect(':library:dataBindingExportBuildInfoDebug', FROM_CACHE)
472+
builder.expect(':library:dataBindingExportBuildInfoRelease', FROM_CACHE)
473+
}
437474
}

src/test/groovy/org/gradle/android/PluginApplicationTest.groovy

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class PluginApplicationTest extends AbstractTest {
2323
result.output =~ /Android plugin ${quote(androidVersion)} is not supported by Android cache fix plugin. Supported Android plugin versions: .*. Override with -Dorg.gradle.android.cache-fix.ignoreVersionCheck=true./
2424

2525
where:
26-
androidVersion << ["3.4.1", "4.1.0-alpha01"]
26+
androidVersion << ["3.4.1"] // TODO https://github.com/gradle/android-cache-fix-gradle-plugin/issues/95 Add 4.2.x when released.
27+
2728
}
2829

2930
// Temporarily ignored until we come up with a better way of testing this that doesn't introduce flakiness

src/test/groovy/org/gradle/android/WorkaroundTest.groovy

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class WorkaroundTest extends Specification {
1212
workarounds.collect { it.class.simpleName.replaceAll(/Workaround/, "") }.sort() == expectedWorkarounds.sort()
1313
where:
1414
androidVersion | expectedWorkarounds
15+
"4.1.0-alpha10" | ['RoomSchemaLocation']
1516
"4.0.0-beta04" | ['MergeJavaResources', 'MergeNativeLibs', 'RoomSchemaLocation']
1617
"3.6.2" | ['MergeJavaResources', 'MergeNativeLibs', 'RoomSchemaLocation']
1718
"3.6.1" | ['MergeJavaResources', 'MergeNativeLibs', 'RoomSchemaLocation']

0 commit comments

Comments
 (0)