-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify errors when AGP isn't available (#779)
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
- Loading branch information
1 parent
fcc0a40
commit a9a6bee
Showing
5 changed files
with
40 additions
and
17 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...on/src/main/kotlin/com/github/triplet/gradle/common/validation/RuntimeValidationPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.triplet.gradle.common.validation | ||
|
||
import com.android.Version | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.util.GradleVersion | ||
import org.gradle.util.VersionNumber | ||
|
||
internal class RuntimeValidationPlugin : Plugin<Project> { | ||
override fun apply(project: Project) { | ||
check(project === project.rootProject) | ||
|
||
val agpVersion = try { | ||
VersionNumber.parse(Version.ANDROID_GRADLE_PLUGIN_VERSION) | ||
} catch (e: NoClassDefFoundError) { | ||
null | ||
} | ||
val validator = RuntimeValidator( | ||
GradleVersion.current(), MIN_GRADLE_VERSION, agpVersion, MIN_AGP_VERSION) | ||
|
||
validator.validate() | ||
} | ||
|
||
private companion object { | ||
val MIN_GRADLE_VERSION = GradleVersion.version("6.2") | ||
val MIN_AGP_VERSION = VersionNumber.parse("3.6.0") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 4 additions & 12 deletions
16
common/validation/src/main/kotlin/com/github/triplet/gradle/common/validation/Validation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters