aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar Benjamin Peterson <bp@benjamin.pe>2018-02-15 01:19:37 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-15 01:21:29 -0800
commite4336da1f25e12f7fdc705c0531a86f5d4c13b95 (patch)
treef2bc6b2aa1291b11bb7647d667496b831054ef10 /src/main/java/com/google
parente9c885a88137fa10ea0ac95ff33dcfdc79c6cf0a (diff)
Remove code that allows RunfilesSupport.owningExecutable to be null.
RunfilesSupport.owningExecutable can clearly never be null because the first thing the constructor does is reject it if it's null. Change-Id: Ie861d96a2a2ab6937f1e27a6745cf1cb2f50e0fb PiperOrigin-RevId: 185806352
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java
index 5302e5297e..8456ffd9de 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupport.java
@@ -85,15 +85,11 @@ public final class RunfilesSupport {
* Creates the RunfilesSupport helper with the given executable and runfiles.
*
* @param ruleContext the rule context to create the runfiles support for
- * @param executable the executable for whose runfiles this runfiles support is responsible, may
- * be null
+ * @param executable the executable for whose runfiles this runfiles support is responsible
* @param runfiles the runfiles
*/
private RunfilesSupport(
- RuleContext ruleContext,
- Artifact executable,
- Runfiles runfiles,
- CommandLine args) {
+ RuleContext ruleContext, Artifact executable, Runfiles runfiles, CommandLine args) {
owningExecutable = Preconditions.checkNotNull(executable);
boolean createManifest = ruleContext.getConfiguration().buildRunfilesManifests();
createSymlinks = createManifest && ruleContext.getConfiguration().buildRunfiles();
@@ -116,7 +112,7 @@ public final class RunfilesSupport {
Preconditions.checkState(!runfiles.isEmpty());
Map<PathFragment, Artifact> symlinks = getRunfilesSymlinks();
- if (executable != null && !symlinks.containsValue(executable)) {
+ if (!symlinks.containsValue(executable)) {
throw new IllegalStateException("main program " + executable + " not included in runfiles");
}
@@ -142,9 +138,8 @@ public final class RunfilesSupport {
}
/**
- * Returns the exec path of the directory where the runfiles contained in this
- * RunfilesSupport are generated. When the owning rule has no executable,
- * returns null.
+ * Returns the exec path of the directory where the runfiles contained in this RunfilesSupport are
+ * generated.
*/
public PathFragment getRunfilesDirectoryExecPath() {
PathFragment executablePath = owningExecutable.getExecPath();
@@ -176,10 +171,7 @@ public final class RunfilesSupport {
}
private Artifact createRunfilesInputManifestArtifact(RuleContext context) {
- // The executable may be null for emptyRunfiles
- PathFragment relativePath = (owningExecutable != null)
- ? owningExecutable.getRootRelativePath()
- : context.getPackageDirectory().getRelative(context.getLabel().getName());
+ PathFragment relativePath = owningExecutable.getRootRelativePath();
String basename = relativePath.getBaseName();
PathFragment inputManifestPath = relativePath.replaceName(basename + ".runfiles_manifest");
return context.getDerivedArtifact(inputManifestPath,