-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Update sorting out of starlark flags to also identify external repo starlark flags #11510
Conversation
@@ -314,4 +319,16 @@ public void testOptionsAreParsedWithBuildTestsOnly() throws Exception { | |||
|
|||
assertThat(result.getStarlarkOptions().get("//test:my_int_setting")).isEqualTo(15); | |||
} | |||
|
|||
@Test | |||
public void testRemoveStarlarkOptionsWorks() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a test for the --@//external/starlark/option
main repo case please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! added
@@ -228,7 +228,7 @@ private Target loadBuildSetting( | |||
ImmutableList.Builder<String> keep = ImmutableList.builder(); | |||
ImmutableList.Builder<String> remove = ImmutableList.builder(); | |||
for (String name : list) { | |||
((name.startsWith("--//") || name.startsWith("--no//")) ? remove : keep).add(name); | |||
(name.matches("--(no)?(@.*)?//.*") ? remove : keep).add(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex-based parsing is going to fall into difficulties. Can this just strip off the -- and the no (if present), and call LabelValidator.validateAbsoluteLabel, and check for exceptions being thrown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much better. Done.
@@ -228,7 +230,21 @@ private Target loadBuildSetting( | |||
ImmutableList.Builder<String> keep = ImmutableList.builder(); | |||
ImmutableList.Builder<String> remove = ImmutableList.builder(); | |||
for (String name : list) { | |||
((name.startsWith("--//") || name.startsWith("--no//")) ? remove : keep).add(name); | |||
if (!name.startsWith("--")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is great, but needs comments. More comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! added a description to the javadoc as well
Fixes #11506