Skip to content

Commit

Permalink
Merge pull request #15 from gradle/lptr/support-android-3.1.0-alpha04
Browse files Browse the repository at this point in the history
Support Android 3.1.0-alpha04
  • Loading branch information
lptr authored Nov 20, 2017
2 parents edc6313 + ff1bb5a commit 82a0f71
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android:

# The BuildTools version used by your project
- build-tools-26.0.2
- build-tools-27.0.1

# The SDK version used to compile your project
- android-26
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ version = ["git", "describe", "--match", "[0-9]*", "--dirty"].execute().text.tri

// Maps supported Android plugin versions to the versions of Gradle that should support it
def supportedVersions = [
"3.1.0-alpha04": ["4.4-20171031235950+0000"],
"3.0.0": ["4.1", "4.2", "4.2.1", "4.3", "4.3.1"],
"3.1.0-alpha03": ["4.3.1"],
]

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class AndroidCacheFixPlugin implements Plugin<Project> {

@Override
void apply(Project project) {
def currentGradleVersion = GradleVersion.current().baseVersion
def currentGradleVersion = GradleVersion.current()
def currentAndroidVersion = android(Version.ANDROID_GRADLE_PLUGIN_VERSION)

if (!Boolean.getBoolean(IGNORE_VERSION_CHECK_PROPERTY)) {
if (!Versions.SUPPORTED_ANDROID_VERSIONS.contains(currentAndroidVersion)) {
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.")
}
if (!Versions.SUPPORTED_GRADLE_VERSIONS.contains(currentGradleVersion)) {
if (!Versions.SUPPORTED_GRADLE_VERSIONS*.baseVersion.contains(currentGradleVersion.baseVersion)) {
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.")
}
}
Expand All @@ -67,7 +67,7 @@ class AndroidCacheFixPlugin implements Plugin<Project> {
/**
* Fix {@link org.gradle.api.tasks.compile.CompileOptions#getBootClasspath()} introducing relocatability problems for {@link AndroidJavaCompile}.
*/
@AndroidIssue(introducedIn = "3.0.0", fixedIn = ["3.1.0-alpha02", "3.1.0-alpha03"], link = "https://issuetracker.google.com/issues/68392933")
@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")
static class AndroidJavaCompile_BootClasspath_Workaround implements Workaround {
@Override
@CompileStatic(TypeCheckingMode.SKIP)
Expand Down
16 changes: 11 additions & 5 deletions src/test/groovy/org/gradle/android/PluginApplicationTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@ package org.gradle.android

import spock.lang.Unroll

import static java.util.regex.Pattern.quote

class PluginApplicationTest extends AbstractTest {

def "does not apply workarounds with Gradle 4.4"() {
@Unroll
def "does not apply workarounds with Gradle #gradleVersion"() {
def projectDir = temporaryFolder.newFolder()
new SimpleAndroidApp(projectDir, cacheDir, "3.0.0").writeProject()
expect:
def result = withGradleVersion("4.4-20171105235948+0000")
def result = withGradleVersion(gradleVersion)
.withProjectDir(projectDir)
.withArguments("tasks")
.buildAndFail()
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./
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./

where:
gradleVersion << ["4.5-20171119235929+0000"]
}

@Unroll
def "does not apply workarounds with Android #androidVersion"() {
def projectDir = temporaryFolder.newFolder()
new SimpleAndroidApp(projectDir, cacheDir, "2.3.0").writeProject()
new SimpleAndroidApp(projectDir, cacheDir, androidVersion).writeProject()
expect:
def result = withGradleVersion("4.1")
.withProjectDir(projectDir)
.withArguments("tasks")
.buildAndFail()
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./
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./

where:
androidVersion << ["2.3.0", "3.1.0-alpha01"]
Expand Down
5 changes: 4 additions & 1 deletion src/test/groovy/org/gradle/android/RelocationTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ class RelocationTest extends AbstractTest {
builder.put(':library:compileReleaseShaders', FROM_CACHE)
builder.put(':library:compileReleaseSources', UP_TO_DATE)
builder.put(':library:extractDebugAnnotations', FROM_CACHE)
builder.put(':library:extractReleaseAnnotations', SUCCESS)
builder.put(':library:extractReleaseAnnotations', androidVersion >= VersionNumber.parse("3.1.0-alpha04")
? FROM_CACHE
: SUCCESS
)
builder.put(':library:generateDebugAssets', UP_TO_DATE)
builder.put(':library:generateDebugBuildConfig', FROM_CACHE)
builder.put(':library:generateDebugResources', UP_TO_DATE)
Expand Down

0 comments on commit 82a0f71

Please sign in to comment.