diff options
author | 2016-11-04 16:44:29 +0000 | |
---|---|---|
committer | 2016-11-07 09:51:33 +0000 | |
commit | fa4371274eaa2a28337630cc58192c4a2b14f67f (patch) | |
tree | 6b30a4e561f718a343076096c8b4d02fd7d2896e | |
parent | 851a034a39126bcbda033df5521bec9c259028e8 (diff) |
Improve cfg-related warning messages by including a link to the relevant documentation.
Fixes #1877.
--
MOS_MIGRATED_REVID=138199724
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/SkylarkAttr.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkAttr.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkAttr.java index 71f176dc21..310b23d4d0 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkAttr.java +++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkAttr.java @@ -91,7 +91,8 @@ public final class SkylarkAttr { private static final String CONFIGURATION_ARG = "cfg"; private static final String CONFIGURATION_DOC = - "configuration of the attribute. It can be either \"data\" or \"host\"."; + "configuration of the attribute. It can be either \"data\" or \"host\". This parameter is " + + "required if <code>executable</code> is True."; private static final String DEFAULT_ARG = "default"; private static final String DEFAULT_DOC = "the default value of the attribute."; @@ -202,8 +203,10 @@ public final class SkylarkAttr { if (containsNonNoneKey(arguments, EXECUTABLE_ARG) && (Boolean) arguments.get(EXECUTABLE_ARG)) { builder.setPropertyFlag("EXECUTABLE"); if (!containsNonNoneKey(arguments, CONFIGURATION_ARG)) { - String message = "Argument `cfg = \"host\"` or `cfg = \"data\"` is required if" - + " `executable = True` is provided for a label"; + String message = "Argument `cfg = \"host\"` or `cfg = \"data\"` is required if " + + "`executable = True` is provided for a label. Please see " + + "https://www.bazel.build/versions/master/docs/skylark/rules.html#configurations " + + "for more details."; env.handleEvent(Event.warn(loc, message)); } } @@ -270,8 +273,8 @@ public final class SkylarkAttr { Object trans = arguments.get(CONFIGURATION_ARG); if (trans instanceof ConfigurationTransition) { // TODO(laurentlb): Deprecated, to be removed in August 2016. - String message = "Variables HOST_CFG and DATA_CFG are deprecated in favor of strings" - + " \"host\" and \"data\" correspondingly"; + String message = "Variables HOST_CFG and DATA_CFG are deprecated in favor of strings " + + "\"host\" and \"data\" correspondingly"; env.handleEvent(Event.warn(loc, message)); builder.cfg((ConfigurationTransition) trans); } else if (trans.equals("data")) { @@ -1255,8 +1258,8 @@ public final class SkylarkAttr { name = "attr_defintion", category = SkylarkModuleCategory.NONE, doc = - "Representation of a definition of an attribute; constructed by <code>attr.*</code>" - + " functions. They are only for use with <a href=\"globals.html#rule\">rule</a> or " + "Representation of a definition of an attribute; constructed by <code>attr.*</code> " + + "functions. They are only for use with <a href=\"globals.html#rule\">rule</a> or " + "<a href=\"globals.html#aspect\">aspect</a>." ) |