Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build crash trying to add Checker Framework Gradle Plugin #1454

Open
msridhar opened this issue Sep 27, 2024 · 3 comments
Open

Build crash trying to add Checker Framework Gradle Plugin #1454

msridhar opened this issue Sep 27, 2024 · 3 comments

Comments

@msridhar
Copy link
Member

I wanted to play around with running the Checker Framework on WALA code, so I tried adding its Gradle plugin. My WIP change is here. With these changes, when I try to run Gradle I get a crash:

$ ./gradlew --dry-run --stacktrace
[...]
FAILURE: Build failed with an exception.
[...]
Caused by: org.gradle.api.InvalidUserDataException: Cannot change resolution strategy of dependency configuration ':checkerFramework' after it has been resolved.
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.preventIllegalMutation(DefaultConfiguration.java:1507)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:1452)
        at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy.eachDependency(DefaultResolutionStrategy.java:233)
        at com.diffplug.gradle.eclipse.MavenCentralExtension$ReleaseConfigurer.lambda$constrainTransitivesToThisReleaseExcept$5(MavenCentralExtension.java:127)
        at com.diffplug.gradle.eclipse.MavenCentralExtension$ReleaseConfigurer.constrainTransitivesToThisReleaseExcept(MavenCentralExtension.java:126)
        at com.diffplug.gradle.eclipse.MavenCentralExtension$ReleaseConfigurer.constrainTransitivesToThisRelease(MavenCentralExtension.java:121)
        at com.ibm.wala.gradle.Eclipse_maven_central_gradle$WalaMavenCentralReleaseConfigurerExtension.defaults$build_logic(eclipse-maven-central.gradle.kts:73)
        at com.ibm.wala.gradle.Eclipse_maven_central_gradle$2$1.invoke(eclipse-maven-central.gradle.kts:124)
        at com.ibm.wala.gradle.Eclipse_maven_central_gradle$2$1.invoke(eclipse-maven-central.gradle.kts:124)
        at com.ibm.wala.gradle.Eclipse_maven_central_gradle$2.execute(eclipse-maven-central.gradle.kts:128)
        at com.ibm.wala.gradle.Eclipse_maven_central_gradle$2.execute(eclipse-maven-central.gradle.kts:124)

Not too sure what the root cause would be. @liblit do you have any ideas? Nothing urgent.

Incidentally, we should probably document somewhere how to add new Gradle plugins to the WALA build. The set of changes I had to do seemed rather non-standard compared to any docs I found.

@liblit
Copy link
Contributor

liblit commented Sep 27, 2024

@liblit do you have any ideas?

I do not. ☹️

we should probably document somewhere how to add new Gradle plugins to the WALA build. The set of changes I had to do seemed rather non-standard compared to any docs I found.

That's a fine idea. The changes you made look correct to me, but they certainly grew complicated due to interactions with two advanced Gradle features we are already using: version catalogs and script plugins.

@msridhar
Copy link
Member Author

@liblit do you have any ideas?

I do not. ☹️

Ok, will see when I can investigate.

we should probably document somewhere how to add new Gradle plugins to the WALA build. The set of changes I had to do seemed rather non-standard compared to any docs I found.

That's a fine idea. The changes you made look correct to me, but they certainly grew complicated due to interactions with two advanced Gradle features we are already using: version catalogs and script plugins.

Yup, ideally, we should have instructions for translating steps like these for adding a plugin to what needs to be done with our build config. Figuring out what should go in this line in particular was non-obvious to me.

@liblit
Copy link
Contributor

liblit commented Sep 29, 2024

Figuring out what should go in this line in particular was non-obvious to me.

Yeah, I can understand why. A simpler project would use the version catalog's [plugins] section, not the [libraries] section, to describe Gradle plugins. But in our case, you're not really using Checker Framework as a plugin. Rather, you are using it as a library in the implementation of java.gradle.kts, which is itself a so-called "script plugin". I think that's why quite a few other Gradle plugins are already listed in [libraries] rather than [plugins].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants