-
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
Add incompatible_disallow_rule_execution_platform_constraints_allowed flag. #8145
Changes from 1 commit
34b77b7
9e98b45
ff760aa
dfea49a
ad3d17b
c5b3b75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,6 +329,20 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl | |
+ "Use for example `cc_library` instead of `native.cc_library`.") | ||
public boolean incompatibleDisallowNativeInBuildFile; | ||
|
||
@Option( | ||
name = "incompatible_disallow_rule_execution_platform_constraints_allowed", | ||
defaultValue = "False", | ||
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS, | ||
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS}, | ||
metadataTags = { | ||
OptionMetadataTag.INCOMPATIBLE_CHANGE, | ||
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES | ||
}, | ||
help = | ||
"If set to true, disallow the use of the execution_platform_constraints_allowed " | ||
+ "attribute on rule().") | ||
public boolean incompatibleDisallowRuleExecutionPlatformConstraintsAllowed; | ||
|
||
@Option( | ||
name = "incompatible_string_join_requires_strings", | ||
defaultValue = "false", | ||
|
@@ -623,6 +637,8 @@ public StarlarkSemantics toSkylarkSemantics() { | |
.incompatibleDisallowOldOctalNotation(incompatibleDisallowOldOctalNotation) | ||
.incompatibleDisallowOldStyleArgsAdd(incompatibleDisallowOldStyleArgsAdd) | ||
.incompatibleDisallowStructProviderSyntax(incompatibleDisallowStructProviderSyntax) | ||
.incompatibleDisallowRuleExecutionPlatformConstraintsAllowed( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When introducing new flags, you also need to update SkylarkSemanticsConsistencyTest.java There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
incompatibleDisallowRuleExecutionPlatformConstraintsAllowed) | ||
.incompatibleExpandDirectories(incompatibleExpandDirectories) | ||
.incompatibleNewActionsApi(incompatibleNewActionsApi) | ||
.incompatibleNoAttrLicense(incompatibleNoAttrLicense) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,6 +164,8 @@ public boolean flagValue(FlagIdentifier flagIdentifier) { | |
|
||
public abstract boolean incompatibleDisallowStructProviderSyntax(); | ||
|
||
public abstract boolean incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is nitty, but the docs above mandate listing variables here and in the other places alphabetically, and I know there's some precedent for enforcing that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I'll fix that on the imported version. |
||
|
||
public abstract boolean incompatibleExpandDirectories(); | ||
|
||
public abstract boolean incompatibleNewActionsApi(); | ||
|
@@ -235,6 +237,7 @@ public static Builder builderWithDefaults() { | |
.incompatibleDisallowOldOctalNotation(false) | ||
.incompatibleDisallowOldStyleArgsAdd(true) | ||
.incompatibleDisallowStructProviderSyntax(false) | ||
.incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(false) | ||
.incompatibleExpandDirectories(true) | ||
.incompatibleNewActionsApi(false) | ||
.incompatibleNoAttrLicense(true) | ||
|
@@ -306,6 +309,9 @@ public abstract static class Builder { | |
|
||
public abstract Builder incompatibleDisallowStructProviderSyntax(boolean value); | ||
|
||
public abstract Builder incompatibleDisallowRuleExecutionPlatformConstraintsAllowed( | ||
boolean value); | ||
|
||
public abstract Builder incompatibleExpandDirectories(boolean value); | ||
|
||
public abstract Builder incompatibleNewActionsApi(boolean value); | ||
|
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 doesn't look like the fully incompatible change you want -- a user can still specify rule(..., execution_platform_constraints_allowed = False), it just would have no effect.
I'd recommend the following instead of any change in this class:
A. disableWithFlag = [new flag identifier]
B. valueWhenDisabled = "True"
This should work out-of-the-box (but you should write a specific test for it, just in case :)) Let me know if you run into any issues!
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.
Thanks, this is much cleaner.
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.
Don't forget to add a test~!