Skip to content

Commit

Permalink
feat: Bump AGP to 3.6.3 and add functional test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
davidburstromspotify committed May 14, 2020
1 parent d932b66 commit aa587bf
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ext {
errorproneVersion = '2.3.4'
spotBugsVersion = '4.0.2'
slf4jVersion = '1.8.0-beta4'
androidGradlePluginVersion = '3.5.3'
androidGradlePluginVersion = '3.6.3'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AndroidFunctionalTest extends Specification {
}

@Requires({env['ANDROID_SDK_ROOT']})
def "can generate spotbugsRelease depending on variant compilation task"() {
def "can generate spotbugsRelease depending on variant compilation task with AGP 3.5.3"() {
given: "a Gradle project to build an Android app"
GradleRunner runner =
GradleRunner.create()
Expand Down Expand Up @@ -73,6 +73,79 @@ repositories {
jcenter()
}
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
buildTypes {
release {
minifyEnabled false
}
}
}
"""

File sourceDir = new File(rootDir, "src/main/java")
sourceDir.mkdirs()
File sourceFile = new File(sourceDir, "Foo.java")
sourceFile << """
public class Foo {
public static void main(String... args) {
System.out.println("Hello, SpotBugs!");
}
}
"""
File manifestFile = new File(rootDir, "src/main/AndroidManifest.xml")
manifestFile << """
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="test.spotbugs" />
"""

when: "the spotbugsRelease task is executed"
BuildResult result = runner
.withArguments(":spotbugsRelease", '-s')
.withGradleVersion(version)
.build()

then: "gradle runs spotbugsMain successfully"
assertEquals(SUCCESS, result.task(":spotbugsRelease").outcome)
}

@Requires({env['ANDROID_SDK_ROOT']})
def "can generate spotbugsRelease depending on variant compilation task with AGP 3.6.3"() {
given: "a Gradle project to build an Android app"
GradleRunner runner =
GradleRunner.create()
.withProjectDir(rootDir)
.withPluginClasspath()
.forwardOutput()
.withGradleVersion(version)

buildFile << """
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
"""
runner.pluginClasspath.forEach({ file ->
buildFile << """
classpath files('${file.absolutePath}')
"""
})
buildFile << """
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.github.spotbugs'
repositories {
google()
jcenter()
}
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
Expand Down

0 comments on commit aa587bf

Please sign in to comment.