Skip to content

Commit

Permalink
Revert "Identify and re-throw our dependency checking errors in `flut…
Browse files Browse the repository at this point in the history
…ter.groovy` (flutter#149609)" (flutter#149918)

This reverts commit 9d1de7b.

Reverts due to log spam and crashing of the dependency version checker (which doesn't block the build but still isn't the desired outcome).
  • Loading branch information
gmackall authored Jun 7, 2024
1 parent b5697a0 commit 15307a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 35 deletions.
34 changes: 3 additions & 31 deletions packages/flutter_tools/gradle/src/main/groovy/flutter.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class FlutterExtension {

return flutterVersionName
}

}

// This buildscript block supplies dependencies for this file's own import
Expand Down Expand Up @@ -339,27 +340,10 @@ class FlutterPlugin implements Plugin<Project> {
"packages", "flutter_tools", "gradle", "src", "main", "kotlin",
"dependency_version_checker.gradle.kts")
project.apply from: dependencyCheckerPluginPath
} catch (Exception e) {
// If the exception was thrown by us in the dependency version checker plugin then
// re-throw it.
Exception outer = e.getCause()
if (outer != null) {
Exception inner = outer.getCause()
if (inner != null) {
Exception unwrapped = inner.getCause()
if (unwrapped != null) {
if (unwrapped instanceof DependencyValidationException) {
throw e
}
}
}
}

// Otherwise, dependency version checking has failed. Log and continue
// the build.
} catch (Exception ignored) {
project.logger.error("Warning: Flutter was unable to detect project Gradle, Java, " +
"AGP, and KGP versions. Skipping dependency version checking. Error was: "
+ e)
+ ignored)
}
}

Expand Down Expand Up @@ -1830,15 +1814,3 @@ class FlutterTask extends BaseFlutterTask {
}

}

// Custom error for when the dependency_version_checker.kts script finds a dependency out of
// the defined support range.
class DependencyValidationException extends Exception {
public DependencyValidationException(String errorMessage) {
super(errorMessage);
}

public DependencyValidationException(String errorMessage, Throwable cause) {
super(errorMessage, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class DependencyVersionChecker {
errorGradleVersion.toString(),
getPotentialGradleFix(project.getRootDir().getPath())
)
throw DependencyValidationException(errorMessage)
throw GradleException(errorMessage)
} else if (version < warnGradleVersion) {
val warnMessage: String =
getWarnMessage(
Expand All @@ -260,7 +260,7 @@ class DependencyVersionChecker {
errorJavaVersion.toString(),
POTENTIAL_JAVA_FIX
)
throw DependencyValidationException(errorMessage)
throw GradleException(errorMessage)
} else if (version < warnJavaVersion) {
val warnMessage: String =
getWarnMessage(
Expand All @@ -285,7 +285,7 @@ class DependencyVersionChecker {
errorAGPVersion.toString(),
getPotentialAGPFix(project.getRootDir().getPath())
)
throw DependencyValidationException(errorMessage)
throw GradleException(errorMessage)
} else if (version < warnAGPVersion) {
val warnMessage: String =
getWarnMessage(
Expand All @@ -310,7 +310,7 @@ class DependencyVersionChecker {
errorKGPVersion.toString(),
getPotentialKGPFix(project.getRootDir().getPath())
)
throw DependencyValidationException(errorMessage)
throw GradleException(errorMessage)
} else if (version < warnKGPVersion) {
val warnMessage: String =
getWarnMessage(
Expand Down

0 comments on commit 15307a9

Please sign in to comment.