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

extra javac opts should override default ones #1613

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

thomasbao12
Copy link
Contributor

Description

Fixes #1550

Currently the default javac flags will be appended last, overriding the manual ones.

Motivation

Copy link

google-cla bot commented Sep 9, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@liucijus
Copy link
Collaborator

liucijus commented Sep 9, 2024

@thomasbao12 could you add a test to prevent regressions?

@thomasbao12 thomasbao12 force-pushed the tbao--fix-javac_opts_ordering branch 2 times, most recently from b09a48b to 0fc657a Compare September 9, 2024 18:54
@thomasbao12
Copy link
Contributor Author

thomasbao12 commented Sep 9, 2024

@liucijus I added a test and verified it fails on master #1615.

I tried to follow the pattern established in other javac flag tests.

One issue though is I assume the default java toolchain sets a -target flag.

3 potential options:

  1. merge as is
  2. I could rename the test to clarify that I actually am only testing that I want to be able to override the java target version. This is actually the behavior I want to fix.
  3. I could try a more elaborate unit-test that verifies that two javac flags exist, one from the default toolchain and one from javacopts and that the javacopt one is ordered after the default toolchain.

I'm okay with 0 & 1. I worry 2 is not worth doing and overly specific.

@liucijus
Copy link
Collaborator

3 potential options:

0. merge as is

1. I could rename the test to clarify that I actually am only testing that I want to be able to override the java target version.  This is actually the behavior I want to fix.

2. I could try a more elaborate unit-test that verifies that two javac flags exist, one from the default toolchain and one from javacopts and that the javacopt one is ordered after the default toolchain.

@thomasbao12 if I haven't missed anything, option 0 seems the best to me - it communicates your need plus the name implies generic expectation

Copy link
Collaborator

@liucijus liucijus left a comment

Choose a reason for hiding this comment

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

Thanks, @thomasbao12!

@thomasbao12
Copy link
Contributor Author

@liucijus Can you merge?

@simuons simuons merged commit e53a43b into bazelbuild:master Sep 11, 2024
2 checks passed
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.

javacopts order differs from java_library
3 participants