diff options
author | Dave MacLachlan <dmaclach@google.com> | 2016-02-19 22:45:47 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2016-02-22 16:06:26 +0000 |
commit | ba5c2128064fb97462cf85c768dcd083c39935c6 (patch) | |
tree | 78fe128a14da3e242fecfc7e3ce940e4097b4e36 /src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java | |
parent | b14c24b10497904bcdc3884fd102f70ddb20c591 (diff) |
Get rid of duplicated strings for IosTest attributes because I'm always paranoid of missing one when changing them, and it makes things so much easier when coding.
R_FUTURE=schmitt,cparsons
--
MOS_MIGRATED_REVID=115101461
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java index 8f3ed37fc5..eecd2b5083 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java @@ -18,6 +18,7 @@ import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTran import static com.google.devtools.build.lib.packages.Attribute.attr; import static com.google.devtools.build.lib.packages.BuildType.LABEL; import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST; +import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingRule; import static com.google.devtools.build.lib.syntax.Type.BOOLEAN; import static com.google.devtools.build.lib.syntax.Type.STRING_LIST; @@ -74,19 +75,19 @@ public class IosTestRule implements RuleDefinition { /* <!-- #BLAZE_RULE(ios_test ).ATTRIBUTE(xctest) --> Whether this target contains tests using the XCTest testing framework. <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ - .add(attr(IosTest.IS_XCTEST, BOOLEAN).value(true)) + .add(attr(IosTest.IS_XCTEST_ATTR, BOOLEAN).value(true)) /* <!-- #BLAZE_RULE(ios_test ).ATTRIBUTE(xctest_app) --> A <code>objc_binary</code> or <code>ios_application</code> target that contains the app bundle to test against in XCTest. This attribute is only valid if <code>xctest</code> is true. <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ .add( - attr(IosTest.XCTEST_APP, LABEL) + attr(IosTest.XCTEST_APP_ATTR, LABEL) .value( - new ComputedDefault(IosTest.IS_XCTEST) { + new ComputedDefault(IosTest.IS_XCTEST_ATTR) { @Override public Object getDefault(AttributeMap rule) { - return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN) + return rule.get(IosTest.IS_XCTEST_ATTR, Type.BOOLEAN) // No TOOLS_REPOSITORY prefix for the xctest_app tool; xcode projects // referencing a dependency under a repository do not work. Thus, // this target must be available in the target depot. @@ -98,12 +99,12 @@ public class IosTestRule implements RuleDefinition { // TODO(bazel-team): Remove objc_binary once it stops exporting XcTestAppProvider. .allowedRuleClasses("objc_binary", "ios_application")) .override( - attr("infoplist", LABEL) + attr(BundlingRule.INFOPLIST_ATTR, LABEL) .value( - new ComputedDefault(IosTest.IS_XCTEST) { + new ComputedDefault(IosTest.IS_XCTEST_ATTR) { @Override public Object getDefault(AttributeMap rule) { - return rule.get(IosTest.IS_XCTEST, Type.BOOLEAN) + return rule.get(IosTest.IS_XCTEST_ATTR, Type.BOOLEAN) // No TOOLS_REPOSITORY prefix for the xctest_app tool; xcode projects // referencing a dependency under a repository do not work. Thus, // this target must be available in the target depot. @@ -117,7 +118,7 @@ public class IosTestRule implements RuleDefinition { the lab device. Otherwise, the test will run on simulator. <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ .add( - attr("ios_test_target_device", LABEL) + attr(IosTest.TEST_TARGET_DEVICE_ATTR, LABEL) .allowedFileTypes() .allowedRuleClasses("ios_lab_device")) /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(ios_device_arg) --> @@ -125,25 +126,25 @@ public class IosTestRule implements RuleDefinition { in the form KEY=VALUE or simply KEY (check your device's documentation for allowed parameters). <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ - .add(attr("ios_device_arg", STRING_LIST)) + .add(attr(IosTest.DEVICE_ARG_ATTR, STRING_LIST)) /* <!-- #BLAZE_RULE(ios_test).ATTRIBUTE(plugins) --> Plugins to pass to the test runner. <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ - .add(attr("plugins", LABEL_LIST).allowedFileTypes(FileType.of("_deploy.jar"))) + .add(attr(IosTest.PLUGINS_ATTR, LABEL_LIST).allowedFileTypes(FileType.of("_deploy.jar"))) .add( - attr("$test_template", LABEL) + attr(IosTest.TEST_TEMPLATE_ATTR, LABEL) .value(env.getToolsLabel("//tools/objc:ios_test.sh.bazel_template"))) .add( - attr("$test_runner", LABEL) + attr(IosTest.TEST_RUNNER_ATTR, LABEL) .value(env.getToolsLabel("//tools/objc:testrunner"))) .add( - attr(IosTest.MEMLEAKS_DEP, LABEL) + attr(IosTest.MEMLEAKS_DEP_ATTR, LABEL) .value(env.getToolsLabel("//tools/objc/memleaks:memleaks"))) .add( - attr(IosTest.MEMLEAKS_PLUGIN, LABEL) + attr(IosTest.MEMLEAKS_PLUGIN_ATTR, LABEL) .value(env.getToolsLabel("//tools/objc:memleaks_plugin"))) .override( - attr(":gcov", LABEL_LIST) + attr(IosTest.GCOV_ATTR, LABEL_LIST) .cfg(HOST) .value( new LateBoundLabelList<BuildConfiguration>(gcov) { |