Cleanup CppLinkActionBuilder
Remove (output != null) check which is always true and cleanup dependent
conditionals.
MOS_MIGRATED_REVID=145409269
@@ -1432,10 +1432,8 @@ public class CppLinkActionBuilder {
|| (linkType == LinkTargetType.EXECUTABLE
&& linkStaticness == LinkStaticness.DYNAMIC));
- String rpathRoot = null;
ImmutableList.Builder<String> runtimeRpathEntries = ImmutableList.builder();
- if (output != null) {
String origin =
useTestOnlyFlags && cppConfiguration.supportsExecOrigin()
? "$EXEC_ORIGIN/"
@@ -1444,6 +1442,7 @@ public class CppLinkActionBuilder {
runtimeRpathEntries.add("-Wl,-rpath," + origin + runtimeSolibName + "/");
}
+ String rpathRoot;
// Calculate the correct relative value for the "-rpath" link option (which sets
// the search path for finding shared libraries).
if (isSharedNativeLibrary()) {
@@ -1493,7 +1492,6 @@ public class CppLinkActionBuilder {
rpathRoot += ":" + origin;
}
}
- }
boolean includeSolibDir = false;
@@ -1557,7 +1555,7 @@ public class CppLinkActionBuilder {
}
// rpath ordering matters for performance; first add the one where most libraries are found.
- if (includeSolibDir && rpathRoot != null) {
+ if (includeSolibDir) {
linkArgCollector.setRpathRoot(rpathRoot);
}
if (includeRuntimeSolibDir) {
@@ -1592,8 +1590,7 @@ public class CppLinkActionBuilder {
Artifact inputArtifact = input.getArtifact();
PathFragment libDir = inputArtifact.getExecPath().getParentDirectory();
- if (rpathRoot != null
- && !libDir.equals(solibDir)
+ if (!libDir.equals(solibDir)
&& (runtimeSolibDir == null || !runtimeSolibDir.equals(libDir))) {
String dotdots = "";
PathFragment commonParent = solibDir;
