diff options
Diffstat (limited to 'src/main/java/com')
3 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java index 3f9172b993..01a2c15dd3 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java @@ -270,7 +270,7 @@ public class BazelRuleClassProvider { .addBuildInfoFactory(new ObjcBuildInfoFactory()) .setConfigurationCollectionFactory(new BazelConfigurationCollection()) .setPrelude("//tools/build_rules:prelude_bazel") - .setRunfilesPrefix("__main__") + .setRunfilesPrefix(Label.DEFAULT_REPOSITORY_DIRECTORY) .setToolsRepository(TOOLS_REPOSITORY) .setPrerequisiteValidator(new BazelPrerequisiteValidator()) .setSkylarkAccessibleTopLevels(SKYLARK_BUILT_IN_JAVA_OBJECTS) diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java index 19f346f48b..9ca11b6e07 100644 --- a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java +++ b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java @@ -52,6 +52,7 @@ import java.io.Serializable; public final class Label implements Comparable<Label>, Serializable, SkylarkPrintableValue { public static final PathFragment EXTERNAL_PACKAGE_NAME = new PathFragment("external"); public static final PathFragment EXTERNAL_PACKAGE_FILE_NAME = new PathFragment("WORKSPACE"); + public static final String DEFAULT_REPOSITORY_DIRECTORY = "__main__"; /** * Package names that aren't made relative to the current repository because they mean special diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryLoaderFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryLoaderFunction.java index 9b40f7c342..19af038d62 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryLoaderFunction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryLoaderFunction.java @@ -14,6 +14,7 @@ package com.google.devtools.build.lib.rules.repository; +import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.cmdline.LabelSyntaxException; import com.google.devtools.build.lib.cmdline.RepositoryName; import com.google.devtools.build.lib.events.Event; @@ -34,6 +35,7 @@ import javax.annotation.Nullable; * Creates a local or remote repository and checks its WORKSPACE file. */ public class RepositoryLoaderFunction implements SkyFunction { + @Nullable @Override public SkyValue compute(SkyKey skyKey, Environment env) @@ -65,7 +67,9 @@ public class RepositoryLoaderFunction implements SkyFunction { throw new IllegalStateException(e); } - if (!workspaceName.isDefault() && !nameFromRule.equals(workspaceName)) { + if (!workspaceName.isDefault() + && !workspaceName.strippedName().equals(Label.DEFAULT_REPOSITORY_DIRECTORY) + && !nameFromRule.equals(workspaceName)) { Path workspacePath = repository.getPath().getRelative("WORKSPACE"); env.getListener().handle(Event.warn(Location.fromFile(workspacePath), "Workspace name in " + workspacePath + " (" + workspaceName + ") does not match the " |