Skip to content

Commit

Permalink
Don't expose includeGlobs in PackageSerializer public interface
Browse files Browse the repository at this point in the history
We always set this false when calling from outside PackageSerializer.
Hide it away since we don't need it and so that we don't get tempted.

--
MOS_MIGRATED_REVID=102864146
  • Loading branch information
michajlo authored and jhfield committed Sep 11, 2015
1 parent 171fe3e commit 88f26c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ public class PackageSerializer {
* @param values the possible values of the attribute (can be a multi-value list for
* configurable attributes)
* @param explicitlySpecified whether the attribute was explicitly specified or not
* @param includeGlobs add glob expression for attributes that contain them
*/
public static Build.Attribute getAttributeProto(Attribute attr, Iterable<Object> values,
Boolean explicitlySpecified, boolean includeGlobs) {
return DEFAULT.serializeAttribute(attr, values, explicitlySpecified, includeGlobs);
Boolean explicitlySpecified) {
return DEFAULT.serializeAttribute(attr, values, explicitlySpecified, /*includeGlobs=*/ false);
}

/**
Expand Down Expand Up @@ -176,6 +175,10 @@ private void serializePackageInternal(Package pkg, OutputStream out) throws IOEx
emitTargets(pkg.getTargets(), out);
}

/**
* Convert Attribute to proto representation. If {@code includeGlobs} is true then include
* globs expressions when present, omit otherwise.
*/
@SuppressWarnings("unchecked")
private Build.Attribute serializeAttribute(Attribute attr, Iterable<Object> values,
Boolean explicitlySpecified, boolean includeGlobs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected Build.Target toTargetProtoBuffer(Target target)
}
rulePb.addAttribute(PackageSerializer.getAttributeProto(attr,
PackageSerializer.getAttributeValues(rule, attr),
rule.isAttributeValueExplicitlySpecified(attr), /*includeGlobs=*/ false));
rule.isAttributeValueExplicitlySpecified(attr)));
}

Environment env = rule.getRuleClassObject().getRuleDefinitionEnvironment();
Expand All @@ -159,7 +159,7 @@ protected Build.Target toTargetProtoBuffer(Target target)
for (Entry<Attribute, Collection<Label>> entry : aspectsDependencies.asMap().entrySet()) {
rulePb.addAttribute(PackageSerializer.getAttributeProto(entry.getKey(),
Lists.<Object>newArrayList(entry.getValue()),
/*explicitlySpecified=*/ false, /*includeGlobs=*/ false));
/*explicitlySpecified=*/ false));
}
// Add all deps from aspects as rule inputs of current target.
for (Label label : aspectsDependencies.values()) {
Expand Down

0 comments on commit 88f26c7

Please sign in to comment.