diff options
author | Kristina Chodorow <kchodorow@google.com> | 2016-06-30 14:26:11 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2016-07-01 07:08:28 +0000 |
commit | dd7bd50ad1f6cdddea218c704c933239e31ce7bf (patch) | |
tree | 9b410f58d334cf57d8a00270c17df4178dcc6870 /src/main/java/com/google | |
parent | 6b6ff76945c80fb8b11b71d402b5146c85b86859 (diff) |
Make repository name warning less noisy
This way it won't print if the repo maintainer doesn't set the repo name.
--
MOS_MIGRATED_REVID=126300205
Diffstat (limited to 'src/main/java/com/google')
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 " |