From 63570924746274c128e80d3a43558e0d3fad3051 Mon Sep 17 00:00:00 2001 From: kchodorow Date: Tue, 11 Jul 2017 22:22:22 +0200 Subject: Automated rollback of commit 937350211dcd55a4714ec32ebbf33fffcc42cdf2. *** Reason for rollback *** Broke the go rules (of course) See http://ci.bazel.io/job/rules_go/BAZEL_VERSION=HEAD,PLATFORM_NAME=linux-x86_64/1044/console. *** Original change description *** Resolve references to @main-repo//foo to //foo Bazel was creating an dummy external repository for @main-repo, which doesn't work with package paths and will cause conflicts once @main-repo//foo and //foo refer to the same path. This adds a "soft pull" option to WorkspaceNameFunction: it can either parse the entire WORKSPACE file to find the name or just the first section. That way PackageLookupFunction can find the repository name without causing a circular dependency. This should have no ch... *** PiperOrigin-RevId: 161572272 --- .../devtools/build/lib/packages/Package.java | 11 ++---- .../build/lib/packages/PackageFactory.java | 5 ++- .../build/lib/packages/WorkspaceFactory.java | 20 ++++++++++ .../build/lib/skyframe/PackageLookupFunction.java | 15 +------- .../build/lib/skyframe/WorkspaceNameFunction.java | 39 ++------------------ .../build/lib/skyframe/WorkspaceNameValue.java | 43 +++++++++++++++------- .../skylark/SkylarkRepositoryIntegrationTest.java | 4 +- .../lib/skyframe/PackageLookupFunctionTest.java | 1 - 8 files changed, 63 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java index 9132208b0e..4ec65dd3b0 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/Package.java +++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java @@ -207,13 +207,9 @@ public class Package { * @precondition {@code name} must be a suffix of * {@code filename.getParentDirectory())}. */ - protected Package(PackageIdentifier packageId, String workspaceName) { - this.workspaceName = workspaceName; - if (workspaceName.equals(packageId.getRepository().strippedName())) { - this.packageIdentifier = PackageIdentifier.createInMainRepo(packageId.getPackageFragment()); - } else { - this.packageIdentifier = packageId; - } + protected Package(PackageIdentifier packageId, String runfilesPrefix) { + this.packageIdentifier = packageId; + this.workspaceName = runfilesPrefix; this.nameFragment = Canonicalizer.fragments().intern(packageId.getPackageFragment()); this.name = nameFragment.getPathString(); } @@ -304,6 +300,7 @@ public class Package { throw new IllegalArgumentException( "Invalid BUILD file name for package '" + packageIdentifier + "': " + filename); } + this.makeEnv = builder.makeEnv.build(); this.targets = ImmutableSortedKeyMap.copyOf(builder.targets); this.defaultVisibility = builder.defaultVisibility; diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java index da4d3e3163..cab4a4f6d6 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java +++ b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java @@ -1667,7 +1667,7 @@ public final class PackageFactory { ImmutableList