Skip to content

Commit

Permalink
Turn applicable_licenses on platforms into a no-op. (#18082)
Browse files Browse the repository at this point in the history
Backport of Ic12306f5a405c88bd65acf3b8ec419328ce663f3
  • Loading branch information
aiuto authored Apr 13, 2023
1 parent de749dd commit 906812c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.devtools.build.lib.analysis.PlatformConfiguration;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.RuleClass.ToolchainResolutionMode;
import com.google.devtools.build.lib.packages.Type;
Expand All @@ -41,6 +42,13 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
// No need to show up in ":all", etc. target patterns.
.value(ImmutableList.of("manual"))
.nonconfigurable("low-level attribute, used in platform configuration"))
.override(
// A platform is essentially a constant which is never linked into a target.
// This will, in a very hacky way, suppress picking up default_applicable_licenses
attr("applicable_licenses", BuildType.LABEL_LIST)
.value(ImmutableList.of())
.allowedFileTypes()
.nonconfigurable("fundamental constant, used in platform configuration"))
.exemptFromConstraintChecking("this rule helps *define* a constraint")
.useToolchainResolution(ToolchainResolutionMode.DISABLED)
.removeAttribute("deps")
Expand All @@ -57,5 +65,4 @@ public Metadata getMetadata() {
.ancestors(BaseRuleClasses.NativeActionCreatingRule.class)
.build();
}

}

0 comments on commit 906812c

Please sign in to comment.