File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
embrace-gradle-plugin-integration-tests/src/test/java/io/embrace/android/gradle/integration/testcases
embrace-gradle-plugin/src/main/java/io/embrace/android/gradle/plugin Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,14 @@ class AgpSupportTest {
3434 fun `maximum supported version` () = runTest(MaxVersion )
3535
3636 @Test
37- fun `unsupported old version` () {
37+ fun `unsupported old gradle version` () {
3838 rule.runTest(
3939 fixture = " android-version-support" ,
4040 task = " assembleRelease" ,
4141 testMatrix = TestMatrix .UnsupportedOldGradleVersion ,
4242 projectType = ProjectType .ANDROID ,
43- expectedExceptionMessage = " Embrace Gradle Plugin requires Gradle version ${GradleVersion .MIN_VERSION } or newer" ,
43+ expectedExceptionMessage =
44+ " Embrace requires Gradle version ${GradleVersion .MIN_VERSION } or higher. Please update your Gradle version." ,
4445 assertions = {
4546 verifyNoUploads()
4647 }
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class EmbraceGradlePlugin : Plugin<Project> {
4646
4747 private fun validateMinGradleVersion () {
4848 if (! isAtLeast(GradleVersion .MIN_VERSION )) {
49- error(" Embrace Gradle Plugin requires Gradle version ${GradleVersion .MIN_VERSION } or newer " )
49+ error(" Embrace requires Gradle version ${GradleVersion .MIN_VERSION } or higher. Please update your Gradle version. " )
5050 }
5151 }
5252}
Original file line number Diff line number Diff line change @@ -28,9 +28,11 @@ class EmbraceGradlePluginDelegate {
2828 variantConfigurationsListProperty : ListProperty <VariantConfig >,
2929 extension : SwazzlerExtension ,
3030 ) {
31+ val agpWrapper = AgpWrapperImpl (project)
32+ validateMinAgpVersion(agpWrapper)
33+
3134 val behavior = PluginBehaviorImpl (project, extension)
3235 Logger .setPluginLogLevel(behavior.logLevel)
33- val agpWrapper = AgpWrapperImpl (project)
3436 val networkService = OkHttpNetworkService (behavior.baseUrl)
3537
3638 BuildTelemetryService .register(
@@ -127,4 +129,10 @@ class EmbraceGradlePluginDelegate {
127129 }
128130 }
129131 }
132+
133+ private fun validateMinAgpVersion (agpWrapper : AgpWrapper ) {
134+ if (agpWrapper.version < AgpVersion .MIN_VERSION ) {
135+ error(" Embrace requires AGP version ${AgpVersion .MIN_VERSION } or higher. Please update your AGP version." )
136+ }
137+ }
130138}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import com.android.build.api.AndroidPluginVersion
55sealed class AgpVersion (private val version : AndroidPluginVersion ) : Comparable<AgpVersion> {
66
77 class CURRENT (version : AndroidPluginVersion ) : AgpVersion(version)
8+ object MIN_VERSION : AgpVersion(AndroidPluginVersion (7, 4, 2))
89 object AGP_8_3_0 : AgpVersion(AndroidPluginVersion (8, 3, 0))
910 object AGP_8_0_0 : AgpVersion(AndroidPluginVersion (8, 0, 0))
1011
You can’t perform that action at this time.
0 commit comments