aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar felly <felly@google.com>2017-05-04 17:10:18 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-05-04 23:05:26 +0200
commit444b86319a901603a1030c484dac9f87501bad9d (patch)
tree7cd2a3b95dba556280069fb869f8d87eeed9d2b6 /src/main/java/com/google/devtools/build/lib/rules
parent9547eeb45854fc194aad20495d202c11f8e96b84 (diff)
Cleanup SolibSymlinkAction: "target" is never null, and no need to re-implement what we get for free in the base class.
RELNOTES: None PiperOrigin-RevId: 155080289
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java25
1 files changed, 1 insertions, 24 deletions
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 e524b1e12c..9d564d551d 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
@@ -28,7 +28,6 @@ import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.util.Preconditions;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.io.IOException;
@@ -43,7 +42,6 @@ import java.io.IOException;
*/
@Immutable
public final class SolibSymlinkAction extends AbstractAction {
- private final Artifact library;
private final Path target;
private final Artifact symlink;
@@ -51,25 +49,15 @@ public final class SolibSymlinkAction extends AbstractAction {
super(owner, ImmutableList.of(library), ImmutableList.of(symlink));
Preconditions.checkArgument(Link.SHARED_LIBRARY_FILETYPES.matches(library.getFilename()));
- this.library = Preconditions.checkNotNull(library);
this.symlink = Preconditions.checkNotNull(symlink);
this.target = library.getPath();
}
@Override
- protected void deleteOutputs(Path execRoot) throws IOException {
- // Do not delete outputs if action does not intend to do anything.
- if (target != null) {
- super.deleteOutputs(execRoot);
- }
- }
-
- @Override
public void execute(
ActionExecutionContext actionExecutionContext) throws ActionExecutionException {
Path mangledPath = symlink.getPath();
try {
- FileSystemUtils.createDirectoryAndParents(mangledPath.getParentDirectory());
mangledPath.createSymbolicLink(target);
} catch (IOException e) {
throw new ActionExecutionException("failed to create _solib symbolic link '"
@@ -77,23 +65,12 @@ public final class SolibSymlinkAction extends AbstractAction {
}
}
- @Override
- public Artifact getPrimaryInput() {
- return library;
- }
-
- @Override
- public Artifact getPrimaryOutput() {
- return symlink;
- }
@Override
protected String computeKey() {
Fingerprint f = new Fingerprint();
f.addPath(symlink.getPath());
- if (target != null) {
- f.addPath(target);
- }
+ f.addPath(target);
return f.hexDigestAndReset();
}