diff options
author | 2018-02-23 11:11:20 -0800 | |
---|---|---|
committer | 2018-02-23 11:13:31 -0800 | |
commit | d829236e9feee234fde3a4aed36e1349b7e9ee16 (patch) | |
tree | 5714779886376791014eda84cdb6f8cc438ba9cf /src/main/java/com/google/devtools/build/lib/analysis | |
parent | 61aa6b7634394c7674d04da8206cf35f2aae976a (diff) |
Apply @AutoCodec to ExecutableSymlinkAction and SymlinkAction.
AbstractAction had getPrimaryInput() and getPrimaryOutput()
which is why arguments are renamed.
PiperOrigin-RevId: 186795064
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/actions/ExecutableSymlinkAction.java | 11 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkAction.java | 37 |
2 files changed, 25 insertions, 23 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ExecutableSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ExecutableSymlinkAction.java index 74131b1295..1be6ad2ea1 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ExecutableSymlinkAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ExecutableSymlinkAction.java @@ -20,17 +20,20 @@ import com.google.devtools.build.lib.actions.ActionExecutionException; import com.google.devtools.build.lib.actions.ActionOwner; import com.google.devtools.build.lib.actions.ActionResult; import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.lib.vfs.Path; import java.io.IOException; /** - * Action to create an executable symbolic link. It includes additional - * validation that symlink target is indeed an executable file. + * Action to create an executable symbolic link. It includes additional validation that symlink + * target is indeed an executable file. */ +@AutoCodec public final class ExecutableSymlinkAction extends SymlinkAction { - public ExecutableSymlinkAction(ActionOwner owner, Artifact input, Artifact output) { - super(owner, input, output, "Symlinking " + owner.getLabel()); + @AutoCodec.Instantiator + public ExecutableSymlinkAction(ActionOwner owner, Artifact primaryInput, Artifact primaryOutput) { + super(owner, primaryInput, primaryOutput, "Symlinking " + owner.getLabel()); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkAction.java index 645cd6f974..5a74e0b8b3 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SymlinkAction.java @@ -24,23 +24,21 @@ import com.google.devtools.build.lib.actions.ActionKeyContext; import com.google.devtools.build.lib.actions.ActionOwner; import com.google.devtools.build.lib.actions.ActionResult; import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.lib.util.Fingerprint; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; import java.io.IOException; import javax.annotation.Nullable; -/** - * Action to create a symbolic link. - */ +/** Action to create a symbolic link. */ +@AutoCodec public class SymlinkAction extends AbstractAction { - private static final String GUID = "349675b5-437c-4da8-891a-7fb98fba6ab5"; /** Null when {@link #getPrimaryInput} is the target of the symlink. */ @Nullable private final PathFragment inputPath; - private final Artifact output; private final String progressMessage; /** @@ -57,27 +55,29 @@ public class SymlinkAction extends AbstractAction { // become the sole and primary in their respective lists. super(owner, ImmutableList.of(input), ImmutableList.of(output)); this.inputPath = null; - this.output = Preconditions.checkNotNull(output); this.progressMessage = progressMessage; } /** - * Creates a new SymlinkAction instance, where the inputPath - * may be different than that input artifact's path. This is - * only useful when dealing with runfiles trees where - * link target is a directory. + * Creates a new SymlinkAction instance, where the inputPath may be different than that input + * artifact's path. This is only useful when dealing with runfiles trees where link target is a + * directory. * * @param owner the action owner. * @param inputPath the Path that will be the src of the symbolic link. - * @param input the Artifact that is required to build the inputPath. - * @param output the Artifact that will be created by executing this Action. + * @param primaryInput the Artifact that is required to build the inputPath. + * @param primaryOutput the Artifact that will be created by executing this Action. * @param progressMessage the progress message. */ - public SymlinkAction(ActionOwner owner, PathFragment inputPath, Artifact input, - Artifact output, String progressMessage) { - super(owner, ImmutableList.of(input), ImmutableList.of(output)); - this.inputPath = Preconditions.checkNotNull(inputPath); - this.output = Preconditions.checkNotNull(output); + @AutoCodec.Instantiator + public SymlinkAction( + ActionOwner owner, + PathFragment inputPath, + Artifact primaryInput, + Artifact primaryOutput, + String progressMessage) { + super(owner, ImmutableList.of(primaryInput), ImmutableList.of(primaryOutput)); + this.inputPath = inputPath; this.progressMessage = progressMessage; } @@ -96,7 +96,6 @@ public class SymlinkAction extends AbstractAction { ActionOwner owner, PathFragment inputPath, Artifact output, String progressMessage) { super(owner, Artifact.NO_ARTIFACTS, ImmutableList.of(output)); this.inputPath = Preconditions.checkNotNull(inputPath); - this.output = Preconditions.checkNotNull(output); this.progressMessage = progressMessage; } @@ -105,7 +104,7 @@ public class SymlinkAction extends AbstractAction { } public Path getOutputPath() { - return output.getPath(); + return getPrimaryOutput().getPath(); } @Override |