aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar cpeyser <cpeyser@google.com>2018-02-23 07:31:22 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-23 07:34:59 -0800
commitbb489a78ed41a2d1faaaf9d3d158d4150661cb52 (patch)
treee0cf66190c9ddb9c3cfbf70af5e3dae8a7893f0c /src/main/java/com/google/devtools/build/lib
parent4736217174e91e2997484349eaae35818d437629 (diff)
@AutoCodec for CreateIncSymlinkAction, ExtractInclusionAction, and
SolibSymlinkAction. PiperOrigin-RevId: 186765454
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/ExtractInclusionAction.java26
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java27
3 files changed, 32 insertions, 27 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java
index d2849481a8..ce7824cdc8 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkAction.java
@@ -26,6 +26,7 @@ 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.concurrent.ThreadSafety.Immutable;
+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.FileSystem;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
@@ -35,9 +36,8 @@ import java.io.IOException;
import java.util.Map;
import java.util.SortedMap;
-/**
- * This action creates a set of symbolic links.
- */
+/** This action creates a set of symbolic links. */
+@AutoCodec
@Immutable
public final class CreateIncSymlinkAction extends AbstractAction {
private final ImmutableSortedMap<Artifact, Artifact> symlinks;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtractInclusionAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtractInclusionAction.java
index aa69b13bf2..93e6b19e52 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtractInclusionAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/ExtractInclusionAction.java
@@ -24,30 +24,30 @@ import com.google.devtools.build.lib.actions.ActionResult;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
+import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import java.io.IOException;
/**
- * An action which greps for includes over a given .cc or .h file.
- * This is a part of the work required for C++ include scanning.
+ * An action which greps for includes over a given .cc or .h file. This is a part of the work
+ * required for C++ include scanning.
*
- * <p>For generated files, it is advantageous to do this remotely, to avoid having to download
- * the generated file.
+ * <p>For generated files, it is advantageous to do this remotely, to avoid having to download the
+ * generated file.
*
- * <p>Note that this may run grep-includes over-optimistically, where we previously
- * had not. For example, consider a cc_library of generated headers. If another
- * library depends on it, and only references one of the headers, the other
- * grep-includes will have been wasted.
+ * <p>Note that this may run grep-includes over-optimistically, where we previously had not. For
+ * example, consider a cc_library of generated headers. If another library depends on it, and only
+ * references one of the headers, the other grep-includes will have been wasted.
*/
+@AutoCodec
@Immutable
final class ExtractInclusionAction extends AbstractAction {
private static final String GUID = "45b43e5a-4734-43bb-a05e-012313808142";
- /**
- * Constructs a new action.
- */
- public ExtractInclusionAction(ActionOwner owner, Artifact input, Artifact output) {
- super(owner, ImmutableList.of(input), ImmutableList.of(output));
+ /** Constructs a new action. */
+ public ExtractInclusionAction(
+ ActionOwner owner, Artifact primaryInput, Artifact primaryOutput) {
+ super(owner, ImmutableList.of(primaryInput), ImmutableList.of(primaryOutput));
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java
index 7d60680cec..cfbe99a26e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java
@@ -29,30 +29,34 @@ import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
+import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
+import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization;
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;
/**
- * Creates mangled symlinks in the solib directory for all shared libraries.
- * Libraries that have a potential to contain SONAME field rely on the mangled
- * symlink to the parent directory instead.
+ * Creates mangled symlinks in the solib directory for all shared libraries. Libraries that have a
+ * potential to contain SONAME field rely on the mangled symlink to the parent directory instead.
*
- * Such symlinks are used by the linker to ensure that all rpath entries can be
- * specified relative to the $ORIGIN.
+ * <p>Such symlinks are used by the linker to ensure that all rpath entries can be specified
+ * relative to the $ORIGIN.
*/
+@AutoCodec
@Immutable
public final class SolibSymlinkAction extends AbstractAction {
private final Path target;
private final Artifact symlink;
- private SolibSymlinkAction(ActionOwner owner, Artifact library, Artifact symlink) {
- super(owner, ImmutableList.of(library), ImmutableList.of(symlink));
+ @VisibleForSerialization
+ SolibSymlinkAction(
+ ActionOwner owner, Artifact primaryInput, Artifact primaryOutput) {
+ super(owner, ImmutableList.of(primaryInput), ImmutableList.of(primaryOutput));
- Preconditions.checkArgument(Link.SHARED_LIBRARY_FILETYPES.matches(library.getFilename()));
- this.symlink = Preconditions.checkNotNull(symlink);
- this.target = library.getPath();
+ Preconditions.checkArgument(Link.SHARED_LIBRARY_FILETYPES.matches(primaryInput.getFilename()));
+ this.symlink = Preconditions.checkNotNull(primaryOutput);
+ this.target = primaryInput.getPath();
}
@Override
@@ -152,7 +156,8 @@ public final class SolibSymlinkAction extends AbstractAction {
ArtifactRoot root = configuration.getBinDirectory(ruleContext.getRule().getRepository());
Artifact symlink = ruleContext.getShareableArtifact(symlinkName, root);
ruleContext.registerAction(
- new SolibSymlinkAction(ruleContext.getActionOwner(), library, symlink));
+ new SolibSymlinkAction(
+ ruleContext.getActionOwner(), library, symlink));
return symlink;
}