Roll forward of https://github.com/bazelbuild/bazel/commit/d1da69661fb86f3f13d68747ab1a5a5184df1ba6: Change Fileset to use providers rather than the FilesetEntry
Starlark value type. This allows aspects to traverse Fileset deps correctly and
allows constraints to propagate as well. This change removes FilesetEntry
completely from the output build graph, and allows all references to this
special type to be removed from the core Bazel code, leaving it as just a
Google-specific extension.
Note that this does not remove the SkyFunction support for Filesets.
PiperOrigin-RevId: 398672223
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index 0b9bbe7..415f82c 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -65,7 +65,6 @@
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.collect.ImmutableSortedKeyListMultimap;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
-import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
import com.google.devtools.build.lib.packages.Aspect;
@@ -78,7 +77,6 @@
import com.google.devtools.build.lib.packages.ConfigurationFragmentPolicy;
import com.google.devtools.build.lib.packages.ConfiguredAttributeMapper;
import com.google.devtools.build.lib.packages.FileTarget;
-import com.google.devtools.build.lib.packages.FilesetEntry;
import com.google.devtools.build.lib.packages.ImplicitOutputsFunction;
import com.google.devtools.build.lib.packages.Info;
import com.google.devtools.build.lib.packages.InputFile;
@@ -150,40 +148,6 @@
Builder contextBuilder, ConfiguredTargetAndData prerequisite, Attribute attribute);
}
- /** The configured version of FilesetEntry. */
- @Immutable
- public static final class ConfiguredFilesetEntry {
- private final FilesetEntry entry;
- private final TransitiveInfoCollection src;
- private final ImmutableList<TransitiveInfoCollection> files;
-
- ConfiguredFilesetEntry(FilesetEntry entry, TransitiveInfoCollection src) {
- this.entry = entry;
- this.src = src;
- this.files = null;
- }
-
- ConfiguredFilesetEntry(FilesetEntry entry, ImmutableList<TransitiveInfoCollection> files) {
- this.entry = entry;
- this.src = null;
- this.files = files;
- }
-
- public FilesetEntry getEntry() {
- return entry;
- }
-
- public TransitiveInfoCollection getSrc() {
- return src;
- }
-
- /** Targets from FilesetEntry.files, or null if the user omitted it. */
- @Nullable
- public ImmutableList<TransitiveInfoCollection> getFiles() {
- return files;
- }
- }
-
private static final String HOST_CONFIGURATION_PROGRESS_TAG = "for host";
private final Rule rule;
@@ -197,7 +161,6 @@
private final ImmutableList<AspectDescriptor> aspectDescriptors;
private final ListMultimap<String, ConfiguredTargetAndData> targetMap;
- private final ListMultimap<String, ConfiguredFilesetEntry> filesetEntryMap;
private final ImmutableMap<Label, ConfigMatchingProvider> configConditions;
private final AspectAwareAttributeMapper attributes;
private final ImmutableSet<String> enabledFeatures;
@@ -248,7 +211,6 @@
Builder builder,
AttributeMap attributes,
ListMultimap<String, ConfiguredTargetAndData> targetMap,
- ListMultimap<String, ConfiguredFilesetEntry> filesetEntryMap,
ImmutableMap<Label, ConfigMatchingProvider> configConditions,
FragmentClassSet universalFragments,
String ruleClassNameForLogging,
@@ -274,7 +236,6 @@
this.configurationFragmentPolicy = builder.configurationFragmentPolicy;
this.universalFragments = universalFragments;
this.targetMap = targetMap;
- this.filesetEntryMap = filesetEntryMap;
this.configConditions = configConditions;
this.attributes = new AspectAwareAttributeMapper(attributes, aspectAttributes);
Set<String> allEnabledFeatures = new HashSet<>();
@@ -472,11 +433,6 @@
return targetMap.get(attributeName);
}
- /** Returns an immutable map from attribute name to list of fileset entries. */
- public ListMultimap<String, ConfiguredFilesetEntry> getFilesetEntryMap() {
- return filesetEntryMap;
- }
-
@Override
public ActionOwner getActionOwner() {
return getActionOwner(DEFAULT_EXEC_GROUP_NAME);
@@ -1745,14 +1701,11 @@
validateDirectPrerequisite(configSettingAttr, condition);
}
}
- ListMultimap<String, ConfiguredFilesetEntry> filesetEntryMap =
- createFilesetEntryMap(target.getAssociatedRule(), configConditions.asProviders());
return new RuleContext(
this,
attributes,
targetMap,
- filesetEntryMap,
configConditions.asProviders(),
universalFragments,
getRuleClassNameForLogging(),
@@ -1909,85 +1862,6 @@
return this;
}
- private boolean validateFilesetEntry(FilesetEntry filesetEntry, ConfiguredTargetAndData src) {
- NestedSet<Artifact> filesToBuild =
- src.getConfiguredTarget().getProvider(FileProvider.class).getFilesToBuild();
- if (filesToBuild.isSingleton() && filesToBuild.getSingleton().isFileset()) {
- return true;
- }
-
- if (filesetEntry.isSourceFileset()) {
- return true;
- }
-
- Target srcTarget = src.getTarget();
- if (!(srcTarget instanceof FileTarget)) {
- attributeError(
- "entries",
- String.format(
- "Invalid 'srcdir' target '%s'. Must be another Fileset or package",
- srcTarget.getLabel()));
- return false;
- }
-
- if (srcTarget instanceof OutputFile) {
- attributeWarning(
- "entries",
- String.format(
- "'srcdir' target '%s' is not an input file. "
- + "This forces the Fileset to be executed unconditionally",
- srcTarget.getLabel()));
- }
-
- return true;
- }
-
- /**
- * Determines and returns a map from attribute name to list of configured fileset entries, based
- * on a PrerequisiteMap instance.
- */
- private ListMultimap<String, ConfiguredFilesetEntry> createFilesetEntryMap(
- final Rule rule, ImmutableMap<Label, ConfigMatchingProvider> configConditions) {
- if (!target.getTargetKind().equals("Fileset rule")) {
- return ImmutableSortedKeyListMultimap.<String, ConfiguredFilesetEntry>builder().build();
- }
-
- final ImmutableSortedKeyListMultimap.Builder<String, ConfiguredFilesetEntry> mapBuilder =
- ImmutableSortedKeyListMultimap.builder();
- for (Attribute attr : rule.getAttributes()) {
- if (attr.getType() != BuildType.FILESET_ENTRY_LIST) {
- continue;
- }
- String attributeName = attr.getName();
- Map<Label, ConfiguredTargetAndData> ctMap = new HashMap<>();
- for (ConfiguredTargetAndData prerequisite : prerequisiteMap.get(attr)) {
- ctMap.put(
- AliasProvider.getDependencyLabel(prerequisite.getConfiguredTarget()), prerequisite);
- }
- List<FilesetEntry> entries =
- ConfiguredAttributeMapper.of(rule, configConditions, configuration.checksum())
- .get(attributeName, BuildType.FILESET_ENTRY_LIST);
- for (FilesetEntry entry : entries) {
- if (entry.getFiles() == null) {
- Label label = entry.getSrcLabel();
- ConfiguredTargetAndData src = ctMap.get(label);
- if (!validateFilesetEntry(entry, src)) {
- continue;
- }
-
- mapBuilder.put(
- attributeName, new ConfiguredFilesetEntry(entry, src.getConfiguredTarget()));
- } else {
- ImmutableList.Builder<TransitiveInfoCollection> files = ImmutableList.builder();
- for (Label file : entry.getFiles()) {
- files.add(ctMap.get(file).getConfiguredTarget());
- }
- mapBuilder.put(attributeName, new ConfiguredFilesetEntry(entry, files.build()));
- }
- }
- }
- return mapBuilder.build();
- }
/** Determines and returns a map from attribute name to list of configured targets. */
private ImmutableSortedKeyListMultimap<String, ConfiguredTargetAndData> createTargetMap() {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java b/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java
index 4ce98be..fc5d038 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.packages;
import static com.google.devtools.build.lib.packages.BuildType.DISTRIBUTIONS;
-import static com.google.devtools.build.lib.packages.BuildType.FILESET_ENTRY_LIST;
import static com.google.devtools.build.lib.packages.BuildType.LABEL;
import static com.google.devtools.build.lib.packages.BuildType.LABEL_DICT_UNARY;
import static com.google.devtools.build.lib.packages.BuildType.LABEL_KEYED_STRING_DICT;
@@ -239,32 +238,6 @@
.setValue(dictEntry.getValue());
builder.addLabelKeyedStringDictValue(entry);
}
- } else if (type == FILESET_ENTRY_LIST) {
- @SuppressWarnings("unchecked")
- List<FilesetEntry> filesetEntries = (List<FilesetEntry>) value;
- for (FilesetEntry filesetEntry : filesetEntries) {
- Build.FilesetEntry.Builder filesetEntryPb =
- Build.FilesetEntry.newBuilder()
- .setSource(filesetEntry.getSrcLabel().toString())
- .setDestinationDirectory(filesetEntry.getDestDir().getPathString())
- .setSymlinkBehavior(symlinkBehaviorToPb(filesetEntry.getSymlinkBehavior()))
- .setStripPrefix(filesetEntry.getStripPrefix())
- .setFilesPresent(filesetEntry.getFiles() != null);
-
- if (filesetEntry.getFiles() != null) {
- for (Label file : filesetEntry.getFiles()) {
- filesetEntryPb.addFile(file.toString());
- }
- }
-
- if (filesetEntry.getExcludes() != null) {
- for (String exclude : filesetEntry.getExcludes()) {
- filesetEntryPb.addExclude(exclude);
- }
- }
-
- builder.addFilesetListValue(filesetEntryPb);
- }
} else {
throw new AssertionError("Unknown type: " + type);
}
@@ -283,21 +256,6 @@
}
}
- // This is needed because I do not want to use the SymlinkBehavior from the
- // protocol buffer all over the place, so there are two classes that do
- // essentially the same thing.
- private static Build.FilesetEntry.SymlinkBehavior symlinkBehaviorToPb(
- FilesetEntry.SymlinkBehavior symlinkBehavior) {
- switch (symlinkBehavior) {
- case COPY:
- return Build.FilesetEntry.SymlinkBehavior.COPY;
- case DEREFERENCE:
- return Build.FilesetEntry.SymlinkBehavior.DEREFERENCE;
- default:
- throw new AssertionError("Unhandled FilesetEntry.SymlinkBehavior");
- }
- }
-
/**
* An adapter used by {@link #writeAttributeValueToBuilder} in order to reuse the same code for
* writing to both {@link Build.Attribute.Builder} and {@link SelectorEntry.Builder} objects.
diff --git a/src/main/java/com/google/devtools/build/lib/packages/BuildType.java b/src/main/java/com/google/devtools/build/lib/packages/BuildType.java
index aeaa2a1..6999256 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/BuildType.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/BuildType.java
@@ -117,11 +117,7 @@
@AutoCodec public static final Type<Label> OUTPUT = new OutputType();
/** The type of a list of {@linkplain #OUTPUT outputs}. */
@AutoCodec public static final ListType<Label> OUTPUT_LIST = ListType.create(OUTPUT);
- /** The type of a FilesetEntry attribute inside a Fileset. */
- @AutoCodec public static final Type<FilesetEntry> FILESET_ENTRY = new FilesetEntryType();
- /** The type of a list of {@linkplain #FILESET_ENTRY FilesetEntries}. */
- @AutoCodec
- public static final ListType<FilesetEntry> FILESET_ENTRY_LIST = ListType.create(FILESET_ENTRY);
+
/** The type of a TriState with values: true (x>0), false (x==0), auto (x<0). */
@AutoCodec public static final Type<TriState> TRISTATE = new TriStateType();
@@ -158,44 +154,6 @@
}
}
- private static final class FilesetEntryType extends Type<FilesetEntry> {
- @Override
- public FilesetEntry cast(Object value) {
- return (FilesetEntry) value;
- }
-
- @Override
- public FilesetEntry convert(Object x, Object what, Object context)
- throws ConversionException {
- if (!(x instanceof FilesetEntry)) {
- throw new ConversionException(this, x, what);
- }
- return (FilesetEntry) x;
- }
-
- @Override
- public String toString() {
- return "FilesetEntry";
- }
-
- @Override
- public LabelClass getLabelClass() {
- return LabelClass.FILESET_ENTRY;
- }
-
- @Override
- public FilesetEntry getDefaultValue() {
- return null;
- }
-
- @Override
- public void visitLabels(LabelVisitor visitor, FilesetEntry value, @Nullable Attribute context) {
- for (Label label : value.getLabels()) {
- visitor.visit(label, context);
- }
- }
- }
-
/** Context in which to evaluate a label with repository remappings */
public static class LabelConversionContext {
private final Label label;
diff --git a/src/main/java/com/google/devtools/build/lib/packages/BuiltinRestriction.java b/src/main/java/com/google/devtools/build/lib/packages/BuiltinRestriction.java
new file mode 100644
index 0000000..8189590
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/packages/BuiltinRestriction.java
@@ -0,0 +1,36 @@
+// Copyright 2015 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package com.google.devtools.build.lib.packages;
+
+import com.google.devtools.build.lib.cmdline.RepositoryName;
+import net.starlark.java.eval.EvalException;
+import net.starlark.java.eval.Module;
+import net.starlark.java.eval.Starlark;
+import net.starlark.java.eval.StarlarkThread;
+
+/** Static utility methods pertaining to restricting Starlark method invocations */
+public final class BuiltinRestriction {
+ /** Throws if the calling Starlark function is not in the builtins repository */
+ public static void throwIfNotBuiltinUsage(StarlarkThread thread) throws EvalException {
+ RepositoryName repository =
+ BazelModuleContext.of(Module.ofInnermostEnclosingStarlarkFunction(thread))
+ .label()
+ .getRepository();
+ if (!"@_builtins".equals(repository.getName())) {
+ throw Starlark.errorf("private API only for use in builtins");
+ }
+ }
+
+ private BuiltinRestriction() {}
+}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java b/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java
index b02e40c..fb1c508 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java
@@ -30,7 +30,10 @@
import java.util.Locale;
import java.util.Set;
import javax.annotation.Nullable;
+import net.starlark.java.annot.StarlarkMethod;
+import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Printer;
+import net.starlark.java.eval.StarlarkThread;
import net.starlark.java.eval.StarlarkValue;
/**
@@ -126,6 +129,13 @@
return srcLabel;
}
+ /** Returns the source label. */
+ @StarlarkMethod(name = "srcdir", documented = false, useStarlarkThread = true)
+ public Label getSrcStarlark(StarlarkThread thread) throws EvalException {
+ BuiltinRestriction.throwIfNotBuiltinUsage(thread);
+ return getSrcLabel();
+ }
+
/**
* @return the destDir. Non null.
*/
@@ -133,6 +143,12 @@
return destDir;
}
+ @StarlarkMethod(name = "destdir", documented = false, useStarlarkThread = true)
+ public String getStarlarkDestDir(StarlarkThread thread) throws EvalException {
+ BuiltinRestriction.throwIfNotBuiltinUsage(thread);
+ return getDestDir().toString();
+ }
+
/**
* @return how symlinks should be handled.
*/
@@ -140,22 +156,46 @@
return symlinkBehavior;
}
- /**
- * @return an immutable set of excludes. Null if none specified.
- */
+ @StarlarkMethod(name = "symlinks", documented = false, useStarlarkThread = true)
+ public String getSymlinkBehaviorStarlark(StarlarkThread thread) throws EvalException {
+ BuiltinRestriction.throwIfNotBuiltinUsage(thread);
+ return getSymlinkBehavior().toString();
+ }
+
+ /** Returns an immutable set of excludes. Null if none specified. */
+ @StarlarkMethod(
+ name = "excludes",
+ documented = false,
+ useStarlarkThread = true,
+ allowReturnNones = true)
@Nullable
+ public ImmutableList<String> getExcludesStarlark(StarlarkThread thread) throws EvalException {
+ BuiltinRestriction.throwIfNotBuiltinUsage(thread);
+ return getExcludes() == null ? null : getExcludes().asList();
+ }
+
+ /** Returns an immutable set of excludes. Null if none specified. */
public ImmutableSet<String> getExcludes() {
return excludes;
}
- /**
- * @return an immutable list of file labels. Null if none specified.
- */
+ /** Returns an immutable list of file labels. Null if none specified. */
+ @StarlarkMethod(
+ name = "files",
+ documented = false,
+ useStarlarkThread = true,
+ allowReturnNones = true)
+ @Nullable
+ public ImmutableList<Label> getFilesStarlark(StarlarkThread thread) throws EvalException {
+ BuiltinRestriction.throwIfNotBuiltinUsage(thread);
+ return getFiles();
+ }
+
+ /** Returns an immutable list of file labels. Null if none specified. */
@Nullable
public ImmutableList<Label> getFiles() {
return files;
}
-
/**
* @return true if this Fileset should get files from the source directory.
*/
@@ -176,9 +216,13 @@
return labels;
}
- /**
- * @return the prefix that should be stripped from package-relative path names.
- */
+ /** Returns the prefix that should be stripped from package-relative path names. */
+ @StarlarkMethod(name = "strip_prefix", documented = false, useStarlarkThread = true)
+ public String getStripPrefixStarlark(StarlarkThread thread) throws EvalException {
+ BuiltinRestriction.throwIfNotBuiltinUsage(thread);
+ return getStripPrefix();
+ }
+
public String getStripPrefix() {
return stripPrefix;
}
@@ -245,6 +289,4 @@
&& Objects.equal(symlinkBehavior, that.symlinkBehavior)
&& Objects.equal(stripPrefix, that.stripPrefix);
}
-
-
}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java b/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java
index 4b82982..aac5775 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java
@@ -15,7 +15,6 @@
package com.google.devtools.build.lib.packages;
import static com.google.devtools.build.lib.packages.BuildType.DISTRIBUTIONS;
-import static com.google.devtools.build.lib.packages.BuildType.FILESET_ENTRY_LIST;
import static com.google.devtools.build.lib.packages.BuildType.LABEL;
import static com.google.devtools.build.lib.packages.BuildType.LABEL_DICT_UNARY;
import static com.google.devtools.build.lib.packages.BuildType.LABEL_KEYED_STRING_DICT;
@@ -57,7 +56,6 @@
.put(OUTPUT_LIST, Discriminator.OUTPUT_LIST)
.put(LICENSE, Discriminator.LICENSE)
.put(STRING_DICT, Discriminator.STRING_DICT)
- .put(FILESET_ENTRY_LIST, Discriminator.FILESET_ENTRY_LIST)
.put(LABEL_DICT_UNARY, Discriminator.LABEL_DICT_UNARY)
.put(STRING_LIST_DICT, Discriminator.STRING_LIST_DICT)
.put(BOOLEAN, Discriminator.BOOLEAN)
diff --git a/src/main/java/com/google/devtools/build/lib/query2/query/output/ProtoOutputFormatter.java b/src/main/java/com/google/devtools/build/lib/query2/query/output/ProtoOutputFormatter.java
index 7b352d2..d8fea9d 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/query/output/ProtoOutputFormatter.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/query/output/ProtoOutputFormatter.java
@@ -507,8 +507,7 @@
|| attrType == BuildType.NODEP_LABEL_LIST
|| attrType == BuildType.OUTPUT_LIST
|| attrType == BuildType.DISTRIBUTIONS
- || attrType == Type.INTEGER_LIST
- || attrType == BuildType.FILESET_ENTRY_LIST) {
+ || attrType == Type.INTEGER_LIST) {
ImmutableList.Builder<Object> builder = ImmutableList.builder();
for (Object possibleValue : possibleValues) {
Collection<Object> collection = (Collection<Object>) possibleValue;
diff --git a/src/main/java/com/google/devtools/build/lib/query2/query/output/XmlOutputFormatter.java b/src/main/java/com/google/devtools/build/lib/query2/query/output/XmlOutputFormatter.java
index b5171cd..901908d 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/query/output/XmlOutputFormatter.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/query/output/XmlOutputFormatter.java
@@ -22,7 +22,6 @@
import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.DependencyFilter;
import com.google.devtools.build.lib.packages.EnvironmentGroup;
-import com.google.devtools.build.lib.packages.FilesetEntry;
import com.google.devtools.build.lib.packages.InputFile;
import com.google.devtools.build.lib.packages.License;
import com.google.devtools.build.lib.packages.OutputFile;
@@ -307,7 +306,6 @@
*/
private static Element createValueElement(Document doc, Type<?> type, Iterable<Object> values) {
// "Import static" with method scope:
- Type<?> FILESET_ENTRY = BuildType.FILESET_ENTRY;
Type<?> LABEL_LIST = BuildType.LABEL_LIST;
Type<?> LICENSE = BuildType.LICENSE;
Type<?> STRING_LIST = Type.STRING_LIST;
@@ -351,26 +349,6 @@
licenseTypes.setAttribute("name", "license-types");
elem.appendChild(licenseTypes);
}
- } else if (type == FILESET_ENTRY) {
- // Fileset entries: not configurable.
- FilesetEntry filesetEntry = (FilesetEntry) Iterables.getOnlyElement(values);
- elem = doc.createElement("fileset-entry");
- elem.setAttribute("srcdir", filesetEntry.getSrcLabel().toString());
- elem.setAttribute("destdir", filesetEntry.getDestDir().toString());
- elem.setAttribute("symlinks", filesetEntry.getSymlinkBehavior().toString());
- elem.setAttribute("strip_prefix", filesetEntry.getStripPrefix());
-
- if (filesetEntry.getExcludes() != null) {
- Element excludes =
- createValueElement(doc, LABEL_LIST, filesetEntry.getExcludes());
- excludes.setAttribute("name", "excludes");
- elem.appendChild(excludes);
- }
- if (filesetEntry.getFiles() != null) {
- Element files = createValueElement(doc, LABEL_LIST, filesetEntry.getFiles());
- files.setAttribute("name", "files");
- elem.appendChild(files);
- }
} else { // INTEGER STRING LABEL DISTRIBUTION OUTPUT
elem = createSingleValueElement(doc, type.toString(), hasMultipleValues);
if (!hasMultipleValues && !Iterables.isEmpty(values)) {
diff --git a/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java b/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java
index f7f12eb..316936d 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java
@@ -270,47 +270,6 @@
}
@Test
- public void testFilesetEntry() throws Exception {
- Label srcDir = Label.create("foo", "src");
- Label entryLabel = Label.create("foo", "entry");
- FilesetEntry input =
- new FilesetEntry(
- /* srcLabel */ srcDir,
- /* files */ ImmutableList.of(entryLabel),
- /* excludes */ null,
- /* destDir */ null,
- /* symlinkBehavior */ null,
- /* stripPrefix */ null);
- assertThat(BuildType.FILESET_ENTRY.convert(input, null, currentRule)).isEqualTo(input);
- assertThat(collectLabels(BuildType.FILESET_ENTRY, input)).containsExactly(entryLabel);
- }
-
- @Test
- public void testFilesetEntryList() throws Exception {
- Label srcDir = Label.create("foo", "src");
- Label entry1Label = Label.create("foo", "entry1");
- Label entry2Label = Label.create("foo", "entry");
- List<FilesetEntry> input = ImmutableList.of(
- new FilesetEntry(
- /* srcLabel */ srcDir,
- /* files */ ImmutableList.of(entry1Label),
- /* excludes */ null,
- /* destDir */ null,
- /* symlinkBehavior */ null,
- /* stripPrefix */ null),
- new FilesetEntry(
- /* srcLabel */ srcDir,
- /* files */ ImmutableList.of(entry2Label),
- /* excludes */ null,
- /* destDir */ null,
- /* symlinkBehavior */ null,
- /* stripPrefix */ null));
- assertThat(BuildType.FILESET_ENTRY_LIST.convert(input, null, currentRule)).isEqualTo(input);
- assertThat(collectLabels(BuildType.FILESET_ENTRY_LIST, input)).containsExactly(
- entry1Label, entry2Label);
- }
-
- @Test
public void testLabelWithRemapping() throws Exception {
LabelConversionContext context =
new LabelConversionContext(
diff --git a/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java b/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java
index 6f863ff..8ac9cbf 100644
--- a/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/query2/testutil/AbstractQueryTest.java
@@ -1379,9 +1379,11 @@
"Fileset(name='x',",
" entries=[FilesetEntry(files=['a'])],",
" out='y')");
- assertEqualsFiltered("//x:x + //x:a", "deps(//x:x)");
- assertEqualsFiltered("//x:x + //x:a", "deps(//x:x)", Setting.ONLY_TARGET_DEPS);
- assertEqualsFiltered("//x:x + //x:a", "deps(//x:x)", Setting.NO_IMPLICIT_DEPS);
+ assertEqualsFiltered("//x:x + //x:a + //x:x_fileset_entry_1", "deps(//x:x)");
+ assertEqualsFiltered(
+ "//x:x + //x:a + //x:x_fileset_entry_1", "deps(//x:x)", Setting.ONLY_TARGET_DEPS);
+ assertEqualsFiltered(
+ "//x:x + //x:a + //x:x_fileset_entry_1", "deps(//x:x)", Setting.NO_IMPLICIT_DEPS);
}
@Test