Last active
August 17, 2019 03:53
-
-
Save gildor/0a83105479b49a7ebf6b466ed0d5aa6d to your computer and use it in GitHub Desktop.
Assert for Gradle to check that configuration is not resolved on configuration time
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
def afterEvaluation = false | |
gradle.projectsEvaluated { | |
afterEvaluation = true | |
} | |
allprojects { project -> | |
configurations.all { configuration -> | |
configuration.incoming.beforeResolve { | |
if (!afterEvaluation) { | |
throw new Exception("Configuration $configuration.name of project $project.name is being resolved at configuration time.") | |
} | |
} | |
} | |
} | |
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS_FULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment