Remove Path from Location, ParserInputSource and bunch of other low-level classes.
This makes the code cleaner because a lot of places never read the file and thus never needed a Path in the first place. I got to this change in a bit convoluted way:
- I wanted the default tools in Android rules to point to //external:
- I wanted to make sure that that doesn't cause an error is no Android rules are built, thus I had to add some binding for them in the default WORKSPACE file
- I wanted the Android rules not to depend on Bazel core with an eye towards eventually moving them to a separate jar / Skylark code
- The default WORKSPACE file is currently composed from files extracted by the Bazel launcher which would make the Android rules depend on a very core mechanism
- I couldn't simply pass in jdk.WORKSPACE as a String because Location, ParserInputSource and a bunch of other things needed a Path, which a simple string doesn't have.
Thus, this change.
--
MOS_MIGRATED_REVID=95828839
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
index 862e87b..8aac499 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
@@ -712,7 +712,7 @@
List<Statement> preludeStatements, SkylarkImportResult importResult)
throws InterruptedException {
ParserInputSource replacementSource = replacementContents == null ? null
- : ParserInputSource.create(replacementContents, buildFilePath);
+ : ParserInputSource.create(replacementContents, buildFilePath.asFragment());
Package.LegacyBuilder pkgBuilder = packageFunctionCache.getIfPresent(packageId);
if (pkgBuilder == null) {
profiler.startTask(ProfilerTask.CREATE_PACKAGE, packageId.toString());