Skip to content

Keep the SCIP javac plugin attached when builds replace compiler arguments - #1047

Open
christoph-sg wants to merge 3 commits into
mainfrom
gradle-compiler-argument-provider
Open

christoph-sg wants to merge 3 commits into
mainfrom
gradle-compiler-argument-provider

Conversation

@christoph-sg

@christoph-sg christoph-sg commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Spring Framework's Java sources were silently not indexed: the build and scip-java index succeeded, but produced no Java documents.

Builds that replace compilerArgs drop the plugin. Spring's build conventions call options.setCompilerArgs(...) in afterEvaluate, which runs after the plugin's own afterEvaluate and replaces the list holding -Xplugin:scip. The argument now comes from a CommandLineArgumentProvider in options.compilerArgumentProviders, which setCompilerArgs doesn't touch.
With the argument surviving, two existing bugs that Spring's override had hidden made compilation fail with plug-in not found: scip:

  • Inherited annotation processors. The jar was only added to annotationProcessor when that configuration declared dependencies directly. The Error Prone Gradle plugin, which Spring applies, makes it extend errorprone. It now checks inherited dependencies too.
  • Source sets other than main and test. The argument goes to every JavaCompile task, but the jar only went to compileOnly and testCompileOnly. It now goes to every source set, which covers Spring's multi-release java21 source set and retrofit's extra source set. Retrofit at dce3fe08 failed in :retrofit:compileExtraJava before and now indexes 302 of its 307 Java files.

christoph-sg and others added 3 commits October 27, 2026 15:22
Builds that replace JavaCompile.options.compilerArgs after the plugin has
configured the task silently dropped -Xplugin:scip, so their Java sources
were not indexed. Spring Framework's build conventions call
setCompilerArgs in afterEvaluate, which runs after the plugin's own
afterEvaluate. Pass the argument through compilerArgumentProviders
instead, which setCompilerArgs does not touch. The provider still skips
the argument when the build already passes -Xplugin:scip itself.

Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-01a178a8-3c2c-75e0-bfa6-7417585d4372
The plugin only added itself to annotationProcessor when that
configuration declared dependencies directly. The Error Prone Gradle
plugin makes annotationProcessor extend its own errorprone
configuration, so Gradle passed -processorpath without the plugin jar
and compilation failed with "plug-in not found: scip". Check inherited
dependencies too.

Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-01a178a8-3c2c-75e0-bfa6-7417585d4372
-Xplugin:scip is passed to every JavaCompile task, but the plugin jar
was only added to the main and test source sets, so tasks of other
source sets failed with "plug-in not found: scip". Examples are
retrofit's extra source set and Spring Framework's multi-release java21
source set. Spring only got away with it because its conventions
replaced the compiler arguments of those tasks too. Add the jar to the
compileOnly and, when it has processors, the annotation processor
configuration of every source set.

Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-01a178a8-3c2c-75e0-bfa6-7417585d4372

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant