Skip to content

Commit

Permalink
Create an incompatibleApplicableLicenses flag.
Browse files Browse the repository at this point in the history
RELNOTES:
Create the incompatibleApplicableLicenses flag.
We plan to flip this from false to true in Bazel 4.x.
Implementation to follow.

#10687
#7444

PiperOrigin-RevId: 292603753
  • Loading branch information
aiuto authored and copybara-github committed Jan 31, 2020
1 parent 869bd70 commit 8ea115e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
help = "If set to true, disables the function `attr.license`.")
public boolean incompatibleNoAttrLicense;

@Option(
name = "incompatible_applicable_licenses",
defaultValue = "false",
// TODO(aiuto): change to OptionDocumentationCategory.STARLARK_SEMANTICS,
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
metadataTags = {
OptionMetadataTag.INCOMPATIBLE_CHANGE,
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
},
help = "If set to true, enables the function `attr.applicable_licenses`.")
public boolean incompatibleApplicableLicenses;

@Option(
name = "incompatible_no_implicit_file_export",
defaultValue = "false",
Expand Down Expand Up @@ -620,6 +633,7 @@ public StarlarkSemantics toSkylarkSemantics() {
.experimentalStarlarkUnusedInputsList(experimentalStarlarkUnusedInputsList)
.experimentalCcSharedLibrary(experimentalCcSharedLibrary)
.experimentalRepoRemoteExec(experimentalRepoRemoteExec)
.incompatibleApplicableLicenses(incompatibleApplicableLicenses)
.incompatibleBzlDisallowLoadAfterStatement(incompatibleBzlDisallowLoadAfterStatement)
.incompatibleDepsetUnion(incompatibleDepsetUnion)
.incompatibleDisableTargetProviderFields(incompatibleDisableTargetProviderFields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public enum FlagIdentifier {
StarlarkSemantics::experimentalStarlarkUnusedInputsList),
EXPERIMENTAL_CC_SHARED_LIBRARY(StarlarkSemantics::experimentalCcSharedLibrary),
EXPERIMENTAL_REPO_REMOTE_EXEC(StarlarkSemantics::experimentalRepoRemoteExec),
INCOMPATIBLE_APPLICABLE_LICENSES(StarlarkSemantics::incompatibleApplicableLicenses),
INCOMPATIBLE_DISABLE_DEPSET_INPUTS(StarlarkSemantics::incompatibleDisableDepsetItems),
INCOMPATIBLE_NO_OUTPUT_ATTR_DEFAULT(StarlarkSemantics::incompatibleNoOutputAttrDefault),
INCOMPATIBLE_NO_RULE_OUTPUTS_PARAM(StarlarkSemantics::incompatibleNoRuleOutputsParam),
Expand Down Expand Up @@ -162,6 +163,8 @@ public boolean flagValue(FlagIdentifier flagIdentifier) {

public abstract boolean incompatibleAlwaysCheckDepsetElements();

public abstract boolean incompatibleApplicableLicenses();

public abstract boolean incompatibleBzlDisallowLoadAfterStatement();

public abstract boolean incompatibleDepsetUnion();
Expand Down Expand Up @@ -261,6 +264,7 @@ public static Builder builderWithDefaults() {
.experimentalCcSharedLibrary(false)
.experimentalRepoRemoteExec(false)
.incompatibleAlwaysCheckDepsetElements(false)
.incompatibleApplicableLicenses(false)
.incompatibleBzlDisallowLoadAfterStatement(true)
.incompatibleDepsetUnion(true)
.incompatibleDisableTargetProviderFields(false)
Expand Down Expand Up @@ -324,6 +328,8 @@ public abstract static class Builder {

public abstract Builder incompatibleAlwaysCheckDepsetElements(boolean value);

public abstract Builder incompatibleApplicableLicenses(boolean value);

public abstract Builder incompatibleBzlDisallowLoadAfterStatement(boolean value);

public abstract Builder incompatibleDepsetUnion(boolean value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E
"--experimental_cc_shared_library=" + rand.nextBoolean(),
"--experimental_repo_remote_exec=" + rand.nextBoolean(),
"--incompatible_always_check_depset_elements=" + rand.nextBoolean(),
"--incompatible_applicable_licenses=" + rand.nextBoolean(),
"--incompatible_bzl_disallow_load_after_statement=" + rand.nextBoolean(),
"--incompatible_depset_for_libraries_to_link_getter=" + rand.nextBoolean(),
"--incompatible_depset_union=" + rand.nextBoolean(),
Expand Down Expand Up @@ -188,6 +189,7 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
.experimentalCcSharedLibrary(rand.nextBoolean())
.experimentalRepoRemoteExec(rand.nextBoolean())
.incompatibleAlwaysCheckDepsetElements(rand.nextBoolean())
.incompatibleApplicableLicenses(rand.nextBoolean())
.incompatibleBzlDisallowLoadAfterStatement(rand.nextBoolean())
.incompatibleDepsetForLibrariesToLinkGetter(rand.nextBoolean())
.incompatibleDepsetUnion(rand.nextBoolean())
Expand Down

0 comments on commit 8ea115e

Please sign in to comment.