Skip to content

Commit

Permalink
update compatibility tests (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredsburrows authored Jan 29, 2024
1 parent 307edcb commit 7065966
Show file tree
Hide file tree
Showing 2 changed files with 314 additions and 7 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ file(`open_source_licenses.html`) in the `<project>/build/reports/licenses/`.

Also, for Android projects the license HTML file will be copied to `<project>/src/main/assets/`.


## Compatibility Matrix

| Plugin Version | Minimum [AGP](https://developer.android.com/build/releases/gradle-plugin) Version |
|----------------|----------------------------------------------------------------------------------:|
| <= 0.9.4 | 3.6.4+ |

## Download

**Release:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ final class LicensePluginVersionSpec extends Specification {
'7.1.1',
'7.2',
'7.3.3',
'7.4.2' // Always have latest
'7.4.2',
'8.0.2',
'8.1.1',
'8.2.1',
]
}

Expand Down Expand Up @@ -114,7 +117,7 @@ final class LicensePluginVersionSpec extends Specification {
where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 5.6.4+, 3.6.0-3.6.4
// 7+, 3.6.4
[gradleVersion, agpVersion] << [
[
'7.0.2',
Expand Down Expand Up @@ -174,7 +177,7 @@ final class LicensePluginVersionSpec extends Specification {
where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 6.1.1+, 4.0.0+
// 7+, 4
[gradleVersion, agpVersion] << [
[
'7.0.2',
Expand Down Expand Up @@ -234,7 +237,7 @@ final class LicensePluginVersionSpec extends Specification {
where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 6.5+, 4.1.0+
// 7+, 4.1.0+
[gradleVersion, agpVersion] << [
[
'7.0.2',
Expand Down Expand Up @@ -294,7 +297,7 @@ final class LicensePluginVersionSpec extends Specification {
where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 6.7.1+, 4.2.0+
// 7+, 4.2
[gradleVersion, agpVersion] << [
[
'7.0.2',
Expand Down Expand Up @@ -420,14 +423,14 @@ final class LicensePluginVersionSpec extends Specification {
'7.2',
'7.3.3',
'7.4.2',
'7.6.1',
],
[
'7.1.3',
]
].combinations()
}


@Unroll
def 'agp version 7.2+, gradle: #gradleVersion and agp: #agpVersion'() {
given:
Expand Down Expand Up @@ -478,9 +481,306 @@ final class LicensePluginVersionSpec extends Specification {
[
'7.3.3',
'7.4.2',
'7.5.1',
'7.6.1',
],
[
'7.2.2',
]
].combinations()
}

@Unroll
def 'agp version 7.3+, gradle: #gradleVersion and agp: #agpVersion'() {
given:
buildFile <<
"""
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:${agpVersion}"
classpath files($classpathString)
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.license'
android {
compileSdkVersion $compileSdkVersion
defaultConfig {
applicationId 'com.example'
}
}
"""

when:
def result = GradleRunner.create()
.withGradleVersion(gradleVersion as String)
.withProjectDir(testProjectDir.root)
.withArguments('licenseDebugReport', '-s')
.build()

then:
result.task(':licenseDebugReport').outcome == SUCCESS
result.output.find("Wrote CSV report to .*${reportFolder}/licenseDebugReport.csv.")
result.output.find("Wrote HTML report to .*${reportFolder}/licenseDebugReport.html.")
result.output.find("Wrote JSON report to .*${reportFolder}/licenseDebugReport.json.")

where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 7.3+, 7.2
[gradleVersion, agpVersion] << [
[
'7.3.3',
'7.4.2',
'7.5.1',
'7.6.1',
],
[
'7.3.1',
]
].combinations()
}

@Unroll
def 'agp version 7.4+, gradle: #gradleVersion and agp: #agpVersion'() {
given:
buildFile <<
"""
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:${agpVersion}"
classpath files($classpathString)
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.license'
android {
compileSdkVersion $compileSdkVersion
defaultConfig {
applicationId 'com.example'
}
}
"""

when:
def result = GradleRunner.create()
.withGradleVersion(gradleVersion as String)
.withProjectDir(testProjectDir.root)
.withArguments('licenseDebugReport', '-s')
.build()

then:
result.task(':licenseDebugReport').outcome == SUCCESS
result.output.find("Wrote CSV report to .*${reportFolder}/licenseDebugReport.csv.")
result.output.find("Wrote HTML report to .*${reportFolder}/licenseDebugReport.html.")
result.output.find("Wrote JSON report to .*${reportFolder}/licenseDebugReport.json.")

where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 7.3+, 7.2
[gradleVersion, agpVersion] << [
[
'7.3.3',
'7.4.2',
'7.5.1',
'7.6.1',
],
[
'7.4.2',
]
].combinations()
}

@Unroll
def 'agp version 8+, gradle: #gradleVersion and agp: #agpVersion'() {
given:
buildFile <<
"""
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:${agpVersion}"
classpath files($classpathString)
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.license'
android {
compileSdkVersion $compileSdkVersion
defaultConfig {
applicationId 'com.example'
}
}
"""

when:
def result = GradleRunner.create()
.withGradleVersion(gradleVersion as String)
.withProjectDir(testProjectDir.root)
.withArguments('licenseDebugReport', '-s')
.build()

then:
result.task(':licenseDebugReport').outcome == SUCCESS
result.output.find("Wrote CSV report to .*${reportFolder}/licenseDebugReport.csv.")
result.output.find("Wrote HTML report to .*${reportFolder}/licenseDebugReport.html.")
result.output.find("Wrote JSON report to .*${reportFolder}/licenseDebugReport.json.")

where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 7.3+, 7.2
[gradleVersion, agpVersion] << [
[
'7.3.3',
'7.4.2',
'7.5.1',
'7.6.1',
],
[
'8.0.2',
]
].combinations()
}

@Unroll
def 'agp version 8.1+, gradle: #gradleVersion and agp: #agpVersion'() {
given:
buildFile <<
"""
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:${agpVersion}"
classpath files($classpathString)
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.license'
android {
compileSdkVersion $compileSdkVersion
defaultConfig {
applicationId 'com.example'
}
}
"""

when:
def result = GradleRunner.create()
.withGradleVersion(gradleVersion as String)
.withProjectDir(testProjectDir.root)
.withArguments('licenseDebugReport', '-s')
.build()

then:
result.task(':licenseDebugReport').outcome == SUCCESS
result.output.find("Wrote CSV report to .*${reportFolder}/licenseDebugReport.csv.")
result.output.find("Wrote HTML report to .*${reportFolder}/licenseDebugReport.html.")
result.output.find("Wrote JSON report to .*${reportFolder}/licenseDebugReport.json.")

where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 7.3+, 7.2
[gradleVersion, agpVersion] << [
[
'7.3.3',
'7.4.2',
'7.5.1',
'7.6.1',
],
[
'8.1.4',
]
].combinations()
}

@Unroll
def 'agp version 8.2+, gradle: #gradleVersion and agp: #agpVersion'() {
given:
buildFile <<
"""
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:${agpVersion}"
classpath files($classpathString)
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.license'
android {
compileSdkVersion $compileSdkVersion
defaultConfig {
applicationId 'com.example'
}
}
"""

when:
def result = GradleRunner.create()
.withGradleVersion(gradleVersion as String)
.withProjectDir(testProjectDir.root)
.withArguments('licenseDebugReport', '-s')
.build()

then:
result.task(':licenseDebugReport').outcome == SUCCESS
result.output.find("Wrote CSV report to .*${reportFolder}/licenseDebugReport.csv.")
result.output.find("Wrote HTML report to .*${reportFolder}/licenseDebugReport.html.")
result.output.find("Wrote JSON report to .*${reportFolder}/licenseDebugReport.json.")

where:
// https://docs.gradle.org/current/userguide/compatibility.html
// https://developer.android.com/studio/releases/gradle-plugin
// 7.3+, 7.2
[gradleVersion, agpVersion] << [
[
'7.3.3',
'7.4.2',
'7.5.1',
'7.6.1',
],
[
'7.2.1',
'8.2.2',
]
].combinations()
}
Expand Down

0 comments on commit 7065966

Please sign in to comment.