Skip to content

Commit

Permalink
Remove trailing commas in android dependency version checking gradle …
Browse files Browse the repository at this point in the history
  • Loading branch information
gmackall authored Mar 29, 2024
1 parent 1a2f34a commit 8528881
Showing 1 changed file with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class DependencyVersionChecker {
} else {
project.logger.error(
"Warning: unable to detect project AGP version. Skipping " +
"version checking. \nThis may be because you have applied AGP after the Flutter Gradle Plugin.",
"version checking. \nThis may be because you have applied AGP after the Flutter Gradle Plugin."
)
}

Expand All @@ -125,7 +125,7 @@ class DependencyVersionChecker {
} else {
project.logger.error(
"Warning: unable to detect project KGP version. Skipping " +
"version checking. \nThis may be because you have applied KGP after the Flutter Gradle Plugin.",
"version checking. \nThis may be because you have applied KGP after the Flutter Gradle Plugin."
)
}
}
Expand Down Expand Up @@ -154,19 +154,19 @@ class DependencyVersionChecker {
agpVersion =
Version.fromString(
project.plugins.getPlugin(agpPluginName)::class.java.classLoader.loadClass(
com.android.Version::class.java.name,
com.android.Version::class.java.name
).fields.find { it.name == agpVersionFieldName }!!
.get(null) as String,
.get(null) as String
)
} catch (ignored: ClassNotFoundException) {
// Use deprecated Version class as it exists in older AGP (com.android.Version) does
// not exist in those versions.
agpVersion =
Version.fromString(
project.plugins.getPlugin(agpPluginName)::class.java.classLoader.loadClass(
com.android.builder.model.Version::class.java.name,
com.android.builder.model.Version::class.java.name
).fields.find { it.name == agpVersionFieldName }!!
.get(null) as String,
.get(null) as String
)
}
return agpVersion
Expand Down Expand Up @@ -200,7 +200,7 @@ class DependencyVersionChecker {
dependencyName: String,
versionString: String,
errorVersion: String,
potentialFix: String,
potentialFix: String
): String {
return "Error: Your project's $dependencyName version ($versionString) is lower " +
"than Flutter's minimum supported version of $errorVersion. Please upgrade " +
Expand All @@ -213,7 +213,7 @@ class DependencyVersionChecker {
dependencyName: String,
versionString: String,
warnVersion: String,
potentialFix: String,
potentialFix: String
): String {
return "Warning: Flutter support for your project's $dependencyName version " +
"($versionString) will soon be dropped. Please upgrade your $dependencyName " +
Expand All @@ -224,15 +224,15 @@ class DependencyVersionChecker {

fun checkGradleVersion(
version: Version,
project: Project,
project: Project
) {
if (version < errorGradleVersion) {
val errorMessage: String =
getErrorMessage(
GRADLE_NAME,
version.toString(),
errorGradleVersion.toString(),
getPotentialGradleFix(project.getRootDir().getPath()),
getPotentialGradleFix(project.getRootDir().getPath())
)
throw GradleException(errorMessage)
} else if (version < warnGradleVersion) {
Expand All @@ -241,23 +241,23 @@ class DependencyVersionChecker {
GRADLE_NAME,
version.toString(),
warnGradleVersion.toString(),
getPotentialGradleFix(project.getRootDir().getPath()),
getPotentialGradleFix(project.getRootDir().getPath())
)
project.logger.error(warnMessage)
}
}

fun checkJavaVersion(
version: JavaVersion,
project: Project,
project: Project
) {
if (version < errorJavaVersion) {
val errorMessage: String =
getErrorMessage(
JAVA_NAME,
version.toString(),
errorJavaVersion.toString(),
POTENTIAL_JAVA_FIX,
POTENTIAL_JAVA_FIX
)
throw GradleException(errorMessage)
} else if (version < warnJavaVersion) {
Expand All @@ -266,23 +266,23 @@ class DependencyVersionChecker {
JAVA_NAME,
version.toString(),
warnJavaVersion.toString(),
POTENTIAL_JAVA_FIX,
POTENTIAL_JAVA_FIX
)
project.logger.error(warnMessage)
}
}

fun checkAGPVersion(
version: Version,
project: Project,
project: Project
) {
if (version < errorAGPVersion) {
val errorMessage: String =
getErrorMessage(
AGP_NAME,
version.toString(),
errorAGPVersion.toString(),
getPotentialAGPFix(project.getRootDir().getPath()),
getPotentialAGPFix(project.getRootDir().getPath())
)
throw GradleException(errorMessage)
} else if (version < warnAGPVersion) {
Expand All @@ -291,23 +291,23 @@ class DependencyVersionChecker {
AGP_NAME,
version.toString(),
warnAGPVersion.toString(),
getPotentialAGPFix(project.getRootDir().getPath()),
getPotentialAGPFix(project.getRootDir().getPath())
)
project.logger.error(warnMessage)
}
}

fun checkKGPVersion(
version: Version,
project: Project,
project: Project
) {
if (version < errorKGPVersion) {
val errorMessage: String =
getErrorMessage(
KGP_NAME,
version.toString(),
errorKGPVersion.toString(),
getPotentialKGPFix(project.getRootDir().getPath()),
getPotentialKGPFix(project.getRootDir().getPath())
)
throw GradleException(errorMessage)
} else if (version < warnKGPVersion) {
Expand All @@ -316,7 +316,7 @@ class DependencyVersionChecker {
KGP_NAME,
version.toString(),
warnKGPVersion.toString(),
getPotentialKGPFix(project.getRootDir().getPath()),
getPotentialKGPFix(project.getRootDir().getPath())
)
project.logger.error(warnMessage)
}
Expand All @@ -336,7 +336,7 @@ class Version(val major: Int, val minor: Int, val patch: Int) : Comparable<Versi
return Version(
major = convertedToNumbers.getOrElse(0, { 0 }),
minor = convertedToNumbers.getOrElse(1, { 0 }),
patch = convertedToNumbers.getOrElse(2, { 0 }),
patch = convertedToNumbers.getOrElse(2, { 0 })
)
}
}
Expand Down

0 comments on commit 8528881

Please sign in to comment.