Skip to content

Commit

Permalink
Enable --incompatible_no_attr_license by default
Browse files Browse the repository at this point in the history
Fixes #6420

#7444

RELNOTES: --incompatible_no_attr_license is enabled by default
PiperOrigin-RevId: 240617932
  • Loading branch information
laurentlb authored and copybara-github committed Mar 27, 2019
1 parent 5535538 commit ce4b73e
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl

@Option(
name = "incompatible_no_attr_license",
defaultValue = "false",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
metadataTags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static Builder builderWithDefaults() {
.incompatibleDisallowStructProviderSyntax(false)
.incompatibleExpandDirectories(true)
.incompatibleNewActionsApi(false)
.incompatibleNoAttrLicense(false)
.incompatibleNoAttrLicense(true)
.incompatibleNoOutputAttrDefault(false)
.incompatibleNoSupportToolsInActionInputs(false)
.incompatibleNoTargetOutputGroup(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2806,6 +2806,7 @@ public void testLicenseType() throws Exception {
// Note that attr.license is deprecated, and thus this test is subject to imminent removal.
// (See --incompatible_no_attr_license). However, this verifies that until the attribute
// is removed, values of the attribute are a valid Starlark type.
setSkylarkSemanticsOptions("--incompatible_no_attr_license=false");
scratch.file(
"test/rule.bzl",
"def _my_rule_impl(ctx): ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ public void testAttrDoc() throws Exception {
buildAttribute("a4", "attr.label(doc='foo')");
buildAttribute("a5", "attr.label_keyed_string_dict(doc='foo')");
buildAttribute("a6", "attr.label_list(doc='foo')");
buildAttribute("a7", "attr.license(doc='foo')");
buildAttribute("a8", "attr.output(doc='foo')");
buildAttribute("a9", "attr.output_list(doc='foo')");
buildAttribute("a10", "attr.string(doc='foo')");
Expand All @@ -637,14 +636,6 @@ public void testAttrDoc() throws Exception {

@Test
public void testNoAttrLicense() throws Exception {
ev =
createEvaluationTestCase(
StarlarkSemantics.DEFAULT_SEMANTICS
.toBuilder()
.incompatibleNoAttrLicense(true)
.build());
ev.initialize();

EvalException expected = assertThrows(EvalException.class, () -> eval("attr.license()"));
assertThat(expected)
.hasMessageThat()
Expand Down Expand Up @@ -1025,29 +1016,6 @@ public void testLabelGetRelativeSyntaxError() throws Exception {
"Label('//foo:bar').relative('bad//syntax')");
}

@Test
public void testLicenseAttributesNonconfigurable() throws Exception {
scratch.file("test/BUILD");
scratch.file("test/rule.bzl",
"def _impl(ctx):",
" return",
"some_rule = rule(",
" implementation = _impl,",
" attrs = {",
" 'licenses': attr.license()",
" }",
")");
scratch.file("third_party/foo/BUILD",
"load('//test:rule.bzl', 'some_rule')",
"some_rule(",
" name='r',",
" licenses = ['unencumbered']",
")");
invalidatePackages();
// Should succeed without a "licenses attribute is potentially configurable" loading error:
createRuleContext("//third_party/foo:r");
}

@Test
public void testStructCreation() throws Exception {
// TODO(fwe): cannot be handled by current testing suite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ public void testStringRepresentations_Attr() throws Exception {
assertStringRepresentation("attr.output_list()", "<attr.output_list>");
assertStringRepresentation("attr.string_dict()", "<attr.string_dict>");
assertStringRepresentation("attr.string_list_dict()", "<attr.string_list_dict>");
assertStringRepresentation("attr.license()", "<attr.license>");
}

@Test
Expand Down

0 comments on commit ce4b73e

Please sign in to comment.