Skip to content

Commit 82a0f71

Browse files
authored
Merge pull request #15 from gradle/lptr/support-android-3.1.0-alpha04
Support Android 3.1.0-alpha04
2 parents edc6313 + ff1bb5a commit 82a0f71

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ android:
2020

2121
# The BuildTools version used by your project
2222
- build-tools-26.0.2
23+
- build-tools-27.0.1
2324

2425
# The SDK version used to compile your project
2526
- android-26

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +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 should support it
2424
def supportedVersions = [
25+
"3.1.0-alpha04": ["4.4-20171031235950+0000"],
2526
"3.0.0": ["4.1", "4.2", "4.2.1", "4.3", "4.3.1"],
26-
"3.1.0-alpha03": ["4.3.1"],
2727
]
2828

2929
repositories {

src/main/groovy/org/gradle/android/AndroidCacheFixPlugin.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ class AndroidCacheFixPlugin implements Plugin<Project> {
3838

3939
@Override
4040
void apply(Project project) {
41-
def currentGradleVersion = GradleVersion.current().baseVersion
41+
def currentGradleVersion = GradleVersion.current()
4242
def currentAndroidVersion = android(Version.ANDROID_GRADLE_PLUGIN_VERSION)
4343

4444
if (!Boolean.getBoolean(IGNORE_VERSION_CHECK_PROPERTY)) {
4545
if (!Versions.SUPPORTED_ANDROID_VERSIONS.contains(currentAndroidVersion)) {
4646
throw new RuntimeException("Android plugin $currentAndroidVersion is not supported by Android cache fix plugin. Supported Android plugin versions: ${Versions.SUPPORTED_ANDROID_VERSIONS.join(", ")}. Override with -D${IGNORE_VERSION_CHECK_PROPERTY}=true.")
4747
}
48-
if (!Versions.SUPPORTED_GRADLE_VERSIONS.contains(currentGradleVersion)) {
48+
if (!Versions.SUPPORTED_GRADLE_VERSIONS*.baseVersion.contains(currentGradleVersion.baseVersion)) {
4949
throw new RuntimeException("$currentGradleVersion is not supported by Android cache fix plugin. Supported Gradle versions: ${Versions.SUPPORTED_GRADLE_VERSIONS*.version.join(", ")}. Override with -D${IGNORE_VERSION_CHECK_PROPERTY}=true.")
5050
}
5151
}
@@ -67,7 +67,7 @@ class AndroidCacheFixPlugin implements Plugin<Project> {
6767
/**
6868
* Fix {@link org.gradle.api.tasks.compile.CompileOptions#getBootClasspath()} introducing relocatability problems for {@link AndroidJavaCompile}.
6969
*/
70-
@AndroidIssue(introducedIn = "3.0.0", fixedIn = ["3.1.0-alpha02", "3.1.0-alpha03"], link = "https://issuetracker.google.com/issues/68392933")
70+
@AndroidIssue(introducedIn = "3.0.0", fixedIn = ["3.1.0-alpha02", "3.1.0-alpha03", "3.1.0-alpha04"], link = "https://issuetracker.google.com/issues/68392933")
7171
static class AndroidJavaCompile_BootClasspath_Workaround implements Workaround {
7272
@Override
7373
@CompileStatic(TypeCheckingMode.SKIP)

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,35 @@ package org.gradle.android
22

33
import spock.lang.Unroll
44

5+
import static java.util.regex.Pattern.quote
6+
57
class PluginApplicationTest extends AbstractTest {
68

7-
def "does not apply workarounds with Gradle 4.4"() {
9+
@Unroll
10+
def "does not apply workarounds with Gradle #gradleVersion"() {
811
def projectDir = temporaryFolder.newFolder()
912
new SimpleAndroidApp(projectDir, cacheDir, "3.0.0").writeProject()
1013
expect:
11-
def result = withGradleVersion("4.4-20171105235948+0000")
14+
def result = withGradleVersion(gradleVersion)
1215
.withProjectDir(projectDir)
1316
.withArguments("tasks")
1417
.buildAndFail()
15-
result.output =~ /Gradle 4.4 is not supported by Android cache fix plugin. Supported Gradle versions: .*. Override with -Dorg.gradle.android.cache-fix.ignoreVersionCheck=true./
18+
result.output =~ /Gradle ${quote(gradleVersion)} is not supported by Android cache fix plugin. Supported Gradle versions: .*. Override with -Dorg.gradle.android.cache-fix.ignoreVersionCheck=true./
19+
20+
where:
21+
gradleVersion << ["4.5-20171119235929+0000"]
1622
}
1723

1824
@Unroll
1925
def "does not apply workarounds with Android #androidVersion"() {
2026
def projectDir = temporaryFolder.newFolder()
21-
new SimpleAndroidApp(projectDir, cacheDir, "2.3.0").writeProject()
27+
new SimpleAndroidApp(projectDir, cacheDir, androidVersion).writeProject()
2228
expect:
2329
def result = withGradleVersion("4.1")
2430
.withProjectDir(projectDir)
2531
.withArguments("tasks")
2632
.buildAndFail()
27-
result.output =~ /Android plugin 2.3.0 is not supported by Android cache fix plugin. Supported Android plugin versions: .*. Override with -Dorg.gradle.android.cache-fix.ignoreVersionCheck=true./
33+
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./
2834

2935
where:
3036
androidVersion << ["2.3.0", "3.1.0-alpha01"]

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ class RelocationTest extends AbstractTest {
178178
builder.put(':library:compileReleaseShaders', FROM_CACHE)
179179
builder.put(':library:compileReleaseSources', UP_TO_DATE)
180180
builder.put(':library:extractDebugAnnotations', FROM_CACHE)
181-
builder.put(':library:extractReleaseAnnotations', SUCCESS)
181+
builder.put(':library:extractReleaseAnnotations', androidVersion >= VersionNumber.parse("3.1.0-alpha04")
182+
? FROM_CACHE
183+
: SUCCESS
184+
)
182185
builder.put(':library:generateDebugAssets', UP_TO_DATE)
183186
builder.put(':library:generateDebugBuildConfig', FROM_CACHE)
184187
builder.put(':library:generateDebugResources', UP_TO_DATE)

0 commit comments

Comments
 (0)