Skip to content

Commit

Permalink
Remove the flag incompatible_disallow_filetype
Browse files Browse the repository at this point in the history
bazelbuild#5831

RELNOTES: None.
PiperOrigin-RevId: 253027470
  • Loading branch information
laurentlb authored and siberex committed Jul 4, 2019
1 parent 7df45eb commit f9840b7
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 209 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ private static void setAllowedFileTypes(
builder.allowedFileTypes(FileTypeSet.ANY_FILE);
} else if (fileTypesObj == Boolean.FALSE) {
builder.allowedFileTypes(FileTypeSet.NO_FILE);
} else if (fileTypesObj instanceof SkylarkFileType) {
// TODO(laurentlb): deprecated, to be removed
builder.allowedFileTypes(((SkylarkFileType) fileTypesObj).getFileTypeSet());
} else if (fileTypesObj instanceof SkylarkList) {
List<String> arg =
SkylarkList.castSkylarkListOrNoneToList(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -799,17 +799,4 @@ public Label label(
throw new EvalException(loc, "Illegal absolute label syntax: " + labelString);
}
}

@Override
public SkylarkFileType fileType(SkylarkList types, Location loc, Environment env)
throws EvalException {
if (env.getSemantics().incompatibleDisallowFileType()) {
throw new EvalException(
loc,
"FileType function is not available. You may use a list of strings instead. "
+ "You can temporarily reenable the function by passing the flag "
+ "--incompatible_disallow_filetype=false");
}
return SkylarkFileType.of(types.getContents(String.class, "types"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
help = "If set to true, the default value of the `allow_empty` argument of glob() is False.")
public boolean incompatibleDisallowEmptyGlob;

@Option(
name = "incompatible_disallow_filetype",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
metadataTags = {
OptionMetadataTag.INCOMPATIBLE_CHANGE,
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
},
help = "If set to true, function `FileType` is not available.")
public boolean incompatibleDisallowFileType;

@Option(
name = "incompatible_disallow_legacy_java_provider",
defaultValue = "false",
Expand Down Expand Up @@ -659,7 +647,6 @@ public StarlarkSemantics toSkylarkSemantics() {
.incompatibleDisableObjcProviderResources(incompatibleDisableObjcProviderResources)
.incompatibleDisallowDictPlus(incompatibleDisallowDictPlus)
.incompatibleDisallowEmptyGlob(incompatibleDisallowEmptyGlob)
.incompatibleDisallowFileType(incompatibleDisallowFileType)
.incompatibleDisallowLegacyJavaInfo(incompatibleDisallowLegacyJavaInfo)
.incompatibleDisallowLegacyJavaProvider(incompatibleDisallowLegacyJavaProvider)
.incompatibleDisallowLoadLabelsToCrossPackageBoundaries(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -527,27 +527,4 @@ public Label label(
Environment env,
StarlarkContext context)
throws EvalException;

@SkylarkCallable(
name = "FileType",
doc =
"Deprecated. Creates a file filter from a list of strings. For example, to match "
+ "files ending with .cc or .cpp, use: "
+ "<pre class=language-python>FileType([\".cc\", \".cpp\"])</pre>",
parameters = {
@Param(
name = "types",
type = SkylarkList.class,
legacyNamed = true,
generic1 = String.class,
defaultValue = "[]",
doc = "a list of the accepted file extensions."
)
},
useLocation = true,
useEnvironment = true
)
@SkylarkConstructor(objectType = FileTypeApi.class)
public FileTypeApi<FileApiT> fileType(SkylarkList<?> types, Location loc, Environment env)
throws EvalException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ public boolean flagValue(FlagIdentifier flagIdentifier) {

public abstract boolean incompatibleDisallowEmptyGlob();

public abstract boolean incompatibleDisallowFileType();

public abstract boolean incompatibleDisallowLegacyJavaProvider();

public abstract boolean incompatibleDisallowLegacyJavaInfo();
Expand Down Expand Up @@ -255,7 +253,6 @@ public static Builder builderWithDefaults() {
.incompatibleDisableObjcProviderResources(true)
.incompatibleDisallowDictPlus(true)
.incompatibleDisallowEmptyGlob(false)
.incompatibleDisallowFileType(true)
.incompatibleDisallowLegacyJavaProvider(false)
.incompatibleDisallowLegacyJavaInfo(false)
.incompatibleDisallowLoadLabelsToCrossPackageBoundaries(true)
Expand Down Expand Up @@ -321,8 +318,6 @@ public abstract static class Builder {

public abstract Builder incompatibleDisallowDictPlus(boolean value);

public abstract Builder incompatibleDisallowFileType(boolean value);

public abstract Builder incompatibleDisallowEmptyGlob(boolean value);

public abstract Builder incompatibleDisallowLegacyJavaProvider(boolean value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.skylarkbuildapi.FileApi;
import com.google.devtools.build.lib.skylarkbuildapi.FileTypeApi;
import com.google.devtools.build.lib.skylarkbuildapi.ProviderApi;
import com.google.devtools.build.lib.skylarkbuildapi.SkylarkAspectApi;
import com.google.devtools.build.lib.skylarkbuildapi.SkylarkRuleFunctionsApi;
Expand Down Expand Up @@ -181,12 +180,6 @@ public Label label(
}
}

@Override
public FileTypeApi<FileApi> fileType(SkylarkList<?> types, Location loc, Environment env)
throws EvalException {
return null;
}

@Override
public SkylarkAspectApi aspect(BaseFunction implementation, SkylarkList<?> attributeAspects,
Object attrs, SkylarkList<?> requiredAspectProvidersArg, SkylarkList<?> providesArg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E
"--incompatible_disable_third_party_license_checking=" + rand.nextBoolean(),
"--incompatible_disallow_dict_plus=" + rand.nextBoolean(),
"--incompatible_disallow_empty_glob=" + rand.nextBoolean(),
"--incompatible_disallow_filetype=" + rand.nextBoolean(),
"--incompatible_disallow_legacy_javainfo=" + rand.nextBoolean(),
"--incompatible_disallow_legacy_java_provider=" + rand.nextBoolean(),
"--incompatible_disallow_load_labels_to_cross_package_boundaries=" + rand.nextBoolean(),
Expand Down Expand Up @@ -197,7 +196,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
.incompatibleDisableThirdPartyLicenseChecking(rand.nextBoolean())
.incompatibleDisallowDictPlus(rand.nextBoolean())
.incompatibleDisallowEmptyGlob(rand.nextBoolean())
.incompatibleDisallowFileType(rand.nextBoolean())
.incompatibleDisallowLegacyJavaInfo(rand.nextBoolean())
.incompatibleDisallowLegacyJavaProvider(rand.nextBoolean())
.incompatibleDisallowLoadLabelsToCrossPackageBoundaries(rand.nextBoolean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,15 +846,6 @@ public void testIntDefaultValue() throws Exception {
assertThat(a.getDefaultValueUnchecked()).isEqualTo(42);
}

@Test
public void testFileTypeIsDisabled() throws Exception {
StarlarkSemantics semantics =
StarlarkSemantics.DEFAULT_SEMANTICS.toBuilder().incompatibleDisallowFileType(true).build();
EvalException expected =
assertThrows(EvalException.class, () -> evalRuleClassCode(semantics, "FileType(['.css'])"));
assertThat(expected).hasMessageThat().contains("FileType function is not available.");
}

@Test
public void testRuleInheritsBaseRuleAttributes() throws Exception {
evalAndExport("def impl(ctx): return None", "r1 = rule(impl)");
Expand Down

0 comments on commit f9840b7

Please sign in to comment.