diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/apple')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java | 11 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java | 30 |
2 files changed, 26 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java index 3bf0afc5a4..bd7a0b78d8 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleCommandLineOptions.java @@ -24,8 +24,10 @@ import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher; import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType; +import com.google.devtools.build.lib.skyframe.serialization.DeserializationContext; import com.google.devtools.build.lib.skyframe.serialization.EnumCodec; import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.SerializationContext; import com.google.devtools.build.lib.skyframe.serialization.SerializationException; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; @@ -508,13 +510,14 @@ public class AppleCommandLineOptions extends FragmentOptions { return host; } - void serialize(CodedOutputStream out) throws IOException, SerializationException { - CODEC.serialize(this, out); + void serialize(SerializationContext context, CodedOutputStream out) + throws IOException, SerializationException { + CODEC.serialize(context, this, out); } - static AppleCommandLineOptions deserialize(CodedInputStream in) + static AppleCommandLineOptions deserialize(DeserializationContext context, CodedInputStream in) throws IOException, SerializationException { - return CODEC.deserialize(in); + return CODEC.deserialize(context, in); } /** Converter for the Apple configuration distinguisher. */ diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java b/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java index 569c8e1c4a..12e236c2fa 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java +++ b/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java @@ -21,7 +21,9 @@ import com.google.common.collect.ComparisonChain; import com.google.common.collect.ImmutableList; import com.google.common.collect.Ordering; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.skyframe.serialization.DeserializationContext; import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.SerializationContext; import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory; @@ -161,9 +163,12 @@ public final class DottedVersion implements Comparable<DottedVersion>, SkylarkVa } @Override - @SkylarkCallable(name = "compare_to", - doc = "Compares based on most signifigant (first) not-matching version component. " - + "So, for example, 1.2.3 < 1.2.4") + @SkylarkCallable( + name = "compare_to", + doc = + "Compares based on most signifigant (first) not-matching version component. " + + "So, for example, 1.2.3 < 1.2.4" + ) public int compareTo(DottedVersion other) { int maxComponents = Math.max(components.size(), other.components.size()); for (int componentIndex = 0; componentIndex < maxComponents; componentIndex++) { @@ -180,16 +185,16 @@ public final class DottedVersion implements Comparable<DottedVersion>, SkylarkVa /** * Returns the string representation of this dotted version, padded to a minimum number of * components if the string representation does not already contain that many components. - * + * * <p>For example, a dotted version of "7.3" will return "7.3" with either one or two components * requested, "7.3.0" if three are requested, and "7.3.0.0" if four are requested. - * + * * <p>Trailing zero components at the end of a string representation will not be removed. For - * example, a dotted version of "1.0.0" will return "1.0.0" if only one or two components - * are requested. + * example, a dotted version of "1.0.0" will return "1.0.0" if only one or two components are + * requested. * - * @param numMinComponents the minimum number of dot-separated numbers that should be present - * in the returned string representation + * @param numMinComponents the minimum number of dot-separated numbers that should be present in + * the returned string representation */ public String toStringWithMinimumComponents(int numMinComponents) { ImmutableList.Builder<Component> stringComponents = ImmutableList.builder(); @@ -260,7 +265,9 @@ public final class DottedVersion implements Comparable<DottedVersion>, SkylarkVa public static final ObjectCodec<DottedVersion> CODEC = new ObjectCodec<DottedVersion>() { @Override - public void serialize(DottedVersion obj, CodedOutputStream codedOut) throws IOException { + public void serialize( + SerializationContext context, DottedVersion obj, CodedOutputStream codedOut) + throws IOException { codedOut.writeInt32NoTag(obj.components.size()); for (Component component : obj.components) { component.serialize(codedOut); @@ -270,7 +277,8 @@ public final class DottedVersion implements Comparable<DottedVersion>, SkylarkVa } @Override - public DottedVersion deserialize(CodedInputStream codedIn) throws IOException { + public DottedVersion deserialize(DeserializationContext context, CodedInputStream codedIn) + throws IOException { int numComponents = codedIn.readInt32(); // TODO(janakr: Presize this if/when https://github.com/google/guava/issues/196 is // resolved. |