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

Allow passing JVM argsto javac in ScipBuildTool #728

Merged
merged 5 commits into from
Aug 1, 2024

Conversation

antonsviridov-src
Copy link
Contributor

@antonsviridov-src antonsviridov-src commented Aug 1, 2024

A canonical usage for this is passing --add-opens flags to the launcher of javac to make sure annotation processors work.

To pass these arguments to the launcher, they have to be perfixed with -J – but arguments like this cannot be passed through the argfile that we use for javacOptions (see https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#command-line-argument-files) so we need to pass them to the command itself.

For that purpose, we add a jvmOptions field to scip-java.json config – these options will have -J added to them and passed to the javac command.

The test to verify this behaviour relies on an old version of lombok that requires these options

Additionally, a hidden option --strict-compilation is added to the CLI, to prevent error recovery: sometimes scip-java can just ignore javac errors and produce semanticdb artifacts regardless. This complicates testing, so I need an escape hatch).

Test plan

  • New test to ScipBuildToolSuite

javac cannot extract -J flags from the argfile because these flags need
to be passed to the launcher, which is already running by the time the
argfile comes into play.

See
https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#command-line-argument-files
for reference.
@antonsviridov-src antonsviridov-src changed the title WIP: Allow passing JVM args to javac bypassing the argsfile Allow passing JVM argsto javac in ScipBuildTool Aug 1, 2024
Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a lot of sense. LGTM 👍🏻

@antonsviridov-src antonsviridov-src merged commit b8c11c4 into main Aug 1, 2024
13 checks passed
@antonsviridov-src antonsviridov-src deleted the graph-788-scip-java-and-jdk-17-issue branch August 1, 2024 15:32
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.

2 participants