Add the repository name as a parameter to the output path functions
This doesn't do anything yet, it's in preparation for the execroot rearranging
change. The execroot will have one bazel-out per repo, so it'll look like:
execroot/
repo1/
bazel-out/
local-fastbuild/
bin/
repo2/
bazel-out/
local-fastbuild/
bin/
genfiles/
repo3/
bazel-out/
local-fastbuild/
testlogs/
and so on. Thus, any output path (getBinDirectory() & friends) needs to know
what the repo name is. This changes so many places in the code I thought it
would be good to do separately, then just flip the functionality in the
execroot-rearranging commit.
While I was poking around, I changed all of the refs I could from getPackageRelativeArtifact() to getBin/GenfilesArtifact(), so that 1) rule implementation don't have to know as much about roots and 2) they'll be more isolated from other output dir changes.
`bazel info` and similar just return roots for the main repository.
The only "change" is passing around a target label in the Java rules.
Continues work on #1262.
--
MOS_MIGRATED_REVID=129985336
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CompilationHelper.java b/src/main/java/com/google/devtools/build/lib/analysis/CompilationHelper.java
index dbf9a57..8a1fddc 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/CompilationHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/CompilationHelper.java
@@ -55,7 +55,8 @@
MiddlemanFactory factory = env.getMiddlemanFactory();
return ImmutableList.of(factory.createMiddlemanAllowMultiple(
env, actionOwner, ruleContext.getPackageDirectory(), purpose, filesToBuild,
- ruleContext.getConfiguration().getMiddlemanDirectory()));
+ ruleContext.getConfiguration().getMiddlemanDirectory(
+ ruleContext.getRule().getRepository())));
}
// TODO(bazel-team): remove this duplicated code after the ConfiguredTarget migration
@@ -87,6 +88,7 @@
Iterable<Artifact> artifacts = dep.getProvider(FileProvider.class).getFilesToBuild();
return ImmutableList.of(
factory.createMiddlemanAllowMultiple(env, actionOwner, ruleContext.getPackageDirectory(),
- purpose, artifacts, ruleContext.getConfiguration().getMiddlemanDirectory()));
+ purpose, artifacts, ruleContext.getConfiguration().getMiddlemanDirectory(
+ ruleContext.getRule().getRepository())));
}
}