aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Luis Fernando Pino Duque <lpino@google.com>2016-02-03 14:04:13 +0000
committerGravatar David Chen <dzc@google.com>2016-02-03 22:06:35 +0000
commit38a8341a4cf5877ddbab6145829a0271cbe9fe50 (patch)
tree2de1a73b2b7661ff452807d211c5288c78b7164d
parent9446e9b55e01aee0425a1f21b47b98df55043c6f (diff)
Replace occurrences of Constants.TOOLS_REPOSITORY in places where it can be referenced via the rule class provider (using the RuleDefinitionEnvironment).
This is the second phase of the removal of the TOOLS_REPOSITORY constants. -- MOS_MIGRATED_REVID=113734334
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/android/BazelAndroidBinaryRule.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java73
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/IosTestRule.java23
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryBaseRule.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java31
15 files changed, 77 insertions, 98 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
index fa134f23fb..9f592faf62 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
@@ -29,7 +29,6 @@ import static com.google.devtools.build.lib.syntax.Type.STRING_LIST;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.RunUnder;
import com.google.devtools.build.lib.analysis.constraints.EnvironmentRule;
@@ -165,7 +164,7 @@ public class BaseRuleClasses {
.add(attr("args", STRING_LIST)
.nonconfigurable("policy decision: should be consistent across configurations"))
.add(attr("$test_runtime", LABEL_LIST).cfg(HOST).value(ImmutableList.of(
- env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/test:runtime"))))
+ env.getLabel(env.getToolsRepository() + "//tools/test:runtime"))))
// TODO(bazel-team): TestActions may need to be run with coverage, so all tests
// implicitly depend on crosstool, which provides gcov. We could add gcov to
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/BazelAndroidBinaryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/BazelAndroidBinaryRule.java
index 0b9720e0a6..dc35d690c5 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/BazelAndroidBinaryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/BazelAndroidBinaryRule.java
@@ -16,7 +16,6 @@ package com.google.devtools.build.lib.bazel.rules.android;
import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.HOST;
import static com.google.devtools.build.lib.packages.Attribute.attr;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.bazel.rules.cpp.BazelCppRuleClasses;
@@ -44,7 +43,7 @@ public class BazelAndroidBinaryRule implements RuleDefinition {
.cfg(HOST)
.singleArtifact()
.value(environment.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/android:debug_keystore")))
+ environment.getToolsRepository() + "//tools/android:debug_keystore")))
.add(attr(":cc_toolchain_split", BuildType.LABEL)
.cfg(AndroidRuleClasses.ANDROID_SPLIT_TRANSITION)
.value(BazelCppRuleClasses.CC_TOOLCHAIN))
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java
index 6c63c3eeec..4667e67f30 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java
@@ -22,7 +22,6 @@ import static com.google.devtools.build.lib.packages.BuildType.OUTPUT_LIST;
import static com.google.devtools.build.lib.syntax.Type.BOOLEAN;
import static com.google.devtools.build.lib.syntax.Type.STRING;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -36,8 +35,7 @@ import com.google.devtools.build.lib.packages.RuleClass.Builder;
* Rule definition for the genrule rule.
*/
public final class BazelGenRuleRule implements RuleDefinition {
- public static final String GENRULE_SETUP_LABEL =
- Constants.TOOLS_REPOSITORY + "//tools/genrule:genrule-setup.sh";
+ public static final String GENRULE_SETUP_LABEL = "//tools/genrule:genrule-setup.sh";
@Override
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
@@ -83,7 +81,8 @@ public final class BazelGenRuleRule implements RuleDefinition {
</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr("tools", LABEL_LIST).cfg(HOST).legacyAllowAnyFileType())
- .add(attr("$genrule_setup", LABEL).cfg(HOST).value(env.getLabel(GENRULE_SETUP_LABEL)))
+ .add(attr("$genrule_setup", LABEL).cfg(HOST).value(
+ env.getLabel(env.getToolsRepository() + GENRULE_SETUP_LABEL)))
/* <!-- #BLAZE_RULE(genrule).ATTRIBUTE(outs) -->
A list of files generated by this rule.
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java
index 0d8ea541cc..20aad81c9d 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java
@@ -25,7 +25,6 @@ import static com.google.devtools.build.lib.syntax.Type.STRING;
import static com.google.devtools.build.lib.syntax.Type.STRING_LIST;
import com.google.common.collect.ImmutableSet;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -54,8 +53,7 @@ public class BazelJavaRuleClasses {
public static final PredicateWithMessage<Rule> JAVA_PACKAGE_NAMES = new PackageNameConstraint(
PackageNameConstraint.ANY_SEGMENT, "java", "javatests");
- protected static final String JUNIT_TESTRUNNER =
- Constants.TOOLS_REPOSITORY + "//tools/jdk:TestRunner_deploy.jar";
+ protected static final String JUNIT_TESTRUNNER = "//tools/jdk:TestRunner_deploy.jar";
public static final ImplicitOutputsFunction JAVA_BINARY_IMPLICIT_OUTPUTS =
fromFunctions(
@@ -340,7 +338,7 @@ public class BazelJavaRuleClasses {
@Override
public Object getDefault(AttributeMap rule) {
return rule.get("use_testrunner", Type.BOOLEAN)
- ? env.getLabel(JUNIT_TESTRUNNER)
+ ? env.getLabel(env.getToolsRepository() + JUNIT_TESTRUNNER)
: null;
}
}))
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java
index dc6c2b8b3b..c73a22e297 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java
@@ -21,7 +21,6 @@ import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST;
import static com.google.devtools.build.lib.packages.BuildType.TRISTATE;
import static com.google.devtools.build.lib.syntax.Type.STRING;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -84,7 +83,7 @@ public final class BazelPyRuleClasses {
// do not depend on lib2to3:2to3 rule, because it creates circular dependencies
// 2to3 is itself written in Python and depends on many libraries.
.add(attr("$python2to3", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/python:2to3")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/python:2to3")))
.setPreferredDependencyPredicate(PyRuleClasses.PYTHON_SOURCE)
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
index 8556879f0f..18616cd61f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
@@ -87,7 +87,8 @@ public final class AndroidBinaryOnlyRule implements RuleDefinition {
.add(attr("$android_manifest_merge_tool", LABEL)
.cfg(HOST)
.exec()
- .value(env.getLabel(AndroidRuleClasses.MANIFEST_MERGE_TOOL_LABEL)))
+ .value(env.getLabel(env.getToolsRepository()
+ + AndroidRuleClasses.MANIFEST_MERGE_TOOL_LABEL)))
/* <!-- #BLAZE_RULE(android_binary).ATTRIBUTE(multidex) -->
Whether to split code into multiple dex files.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
index ab6f02b830..e385c3c39f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
@@ -126,7 +126,7 @@ public final class AndroidLibraryBaseRule implements RuleDefinition {
.add(attr("idl_parcelables", LABEL_LIST).direct_compile_time_input()
.allowedFileTypes(AndroidRuleClasses.ANDROID_IDL))
.add(attr("$android_manifest_merge_tool", LABEL).cfg(HOST).exec().value(env.getLabel(
- AndroidRuleClasses.MANIFEST_MERGE_TOOL_LABEL)))
+ env.getToolsRepository() + AndroidRuleClasses.MANIFEST_MERGE_TOOL_LABEL)))
.advertiseProvider(JavaCompilationArgsProvider.class)
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java
index f9bf55dd9b..ef3a4b35b8 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java
@@ -124,33 +124,24 @@ public final class AndroidRuleClasses {
fromTemplates("%{name}_files/dexmanifest.txt");
public static final SafeImplicitOutputsFunction JAVA_RESOURCES_JAR =
fromTemplates("%{name}_files/java_resources.jar");
- public static final String MANIFEST_MERGE_TOOL_LABEL =
- Constants.TOOLS_REPOSITORY + "//tools/android:merge_manifests";
+ public static final String MANIFEST_MERGE_TOOL_LABEL = "//tools/android:merge_manifests";
public static final String BUILD_INCREMENTAL_DEXMANIFEST_LABEL =
- Constants.TOOLS_REPOSITORY + "//tools/android:build_incremental_dexmanifest";
- public static final String STUBIFY_MANIFEST_LABEL =
- Constants.TOOLS_REPOSITORY + "//tools/android:stubify_manifest";
- public static final String INCREMENTAL_INSTALL_LABEL =
- Constants.TOOLS_REPOSITORY + "//tools/android:incremental_install";
- public static final String BUILD_SPLIT_MANIFEST_LABEL =
- Constants.TOOLS_REPOSITORY + "//tools/android:build_split_manifest";
- public static final String STRIP_RESOURCES_LABEL =
- Constants.TOOLS_REPOSITORY + "//tools/android:strip_resources";
+ "//tools/android:build_incremental_dexmanifest";
+ public static final String STUBIFY_MANIFEST_LABEL = "//tools/android:stubify_manifest";
+ public static final String INCREMENTAL_INSTALL_LABEL = "//tools/android:incremental_install";
+ public static final String BUILD_SPLIT_MANIFEST_LABEL = "//tools/android:build_split_manifest";
+ public static final String STRIP_RESOURCES_LABEL = "//tools/android:strip_resources";
+ public static final String DEFAULT_INCREMENTAL_STUB_APPLICATION =
+ "//tools/android:incremental_stub_application";
+ public static final String DEFAULT_INCREMENTAL_SPLIT_STUB_APPLICATION =
+ "//tools/android:incremental_split_stub_application";
+ public static final String DEFAULT_RESOURCES_PROCESSOR =
+ "//tools/android:resources_processor";
+ public static final String DEFAULT_AAR_GENERATOR = "//tools/android:aar_generator";
public static final Label DEFAULT_ANDROID_SDK =
Label.parseAbsoluteUnchecked(
Constants.ANDROID_DEFAULT_SDK);
- public static final Label DEFAULT_INCREMENTAL_STUB_APPLICATION =
- Label.parseAbsoluteUnchecked(
- Constants.TOOLS_REPOSITORY + "//tools/android:incremental_stub_application");
- public static final Label DEFAULT_INCREMENTAL_SPLIT_STUB_APPLICATION =
- Label.parseAbsoluteUnchecked(
- Constants.TOOLS_REPOSITORY + "//tools/android:incremental_split_stub_application");
- public static final Label DEFAULT_RESOURCES_PROCESSOR =
- Label.parseAbsoluteUnchecked(
- Constants.TOOLS_REPOSITORY + "//tools/android:resources_processor");
- public static final Label DEFAULT_AAR_GENERATOR =
- Label.parseAbsoluteUnchecked(Constants.TOOLS_REPOSITORY + "//tools/android:aar_generator");
public static final LateBoundLabel<BuildConfiguration> ANDROID_SDK =
new LateBoundLabel<BuildConfiguration>(DEFAULT_ANDROID_SDK, AndroidConfiguration.class) {
@@ -327,7 +318,7 @@ public final class AndroidRuleClasses {
// TODO(bazel-team): Remove defaults and make mandatory when android_sdk targets
// have been updated to include manually specified Jack attributes.
.value(environment.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/android/jack:android_jack")))
+ environment.getToolsRepository() + "//tools/android/jack:android_jack")))
.add(attr("annotations_jar", LABEL).mandatory().cfg(HOST).allowedFileTypes(ANY_FILE))
.add(attr("main_dex_classes", LABEL).mandatory().cfg(HOST).allowedFileTypes(ANY_FILE))
.add(attr("apkbuilder", LABEL).mandatory().cfg(HOST).allowedFileTypes(ANY_FILE).exec())
@@ -338,21 +329,21 @@ public final class AndroidRuleClasses {
.allowedFileTypes(ANY_FILE)
.exec()
.value(environment.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/android/jack:jack")))
+ environment.getToolsRepository() + "//tools/android/jack:jack")))
.add(
attr("jill", LABEL)
.cfg(HOST)
.allowedFileTypes(ANY_FILE)
.exec()
.value(environment.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/android/jack:jill")))
+ environment.getToolsRepository() + "//tools/android/jack:jill")))
.add(
attr("resource_extractor", LABEL)
.cfg(HOST)
.allowedFileTypes(ANY_FILE)
.exec()
- .value(environment.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/android/jack:resource_extractor")))
+ .value(environment.getLabel(environment.getToolsRepository()
+ + "//tools/android/jack:resource_extractor")))
.build();
}
@@ -374,9 +365,9 @@ public final class AndroidRuleClasses {
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
return builder
.add(attr("$android_resources_processor", LABEL).cfg(HOST).exec().value(
- AndroidRuleClasses.DEFAULT_RESOURCES_PROCESSOR))
+ env.getLabel(env.getToolsRepository() + DEFAULT_RESOURCES_PROCESSOR)))
.add(attr("$android_aar_generator", LABEL).cfg(HOST).exec().value(
- AndroidRuleClasses.DEFAULT_AAR_GENERATOR))
+ env.getLabel(env.getToolsRepository() + DEFAULT_AAR_GENERATOR)))
.build();
}
@@ -498,9 +489,9 @@ public final class AndroidRuleClasses {
// like all the rest of android tools.
.add(attr("$jarjar_bin", LABEL).cfg(HOST).exec()
.value(env.getLabel(
- Constants.TOOLS_REPOSITORY + "//third_party/java/jarjar:jarjar_bin")))
+ env.getToolsRepository() + "//third_party/java/jarjar:jarjar_bin")))
.add(attr("$idlclass", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/android:IdlClass")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/android:IdlClass")))
.build();
}
@@ -554,23 +545,25 @@ public final class AndroidRuleClasses {
.aspect(JackAspect.class))
// Proguard rule specifying master list of classes to keep during legacy multidexing.
.add(attr("$build_incremental_dexmanifest", LABEL).cfg(HOST).exec()
- .value(env.getLabel(AndroidRuleClasses.BUILD_INCREMENTAL_DEXMANIFEST_LABEL)))
+ .value(env.getLabel(env.getToolsRepository() + BUILD_INCREMENTAL_DEXMANIFEST_LABEL)))
.add(attr("$stubify_manifest", LABEL).cfg(HOST).exec()
- .value(env.getLabel(AndroidRuleClasses.STUBIFY_MANIFEST_LABEL)))
+ .value(env.getLabel(env.getToolsRepository() + STUBIFY_MANIFEST_LABEL)))
.add(attr("$shuffle_jars", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/android:shuffle_jars")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/android:shuffle_jars")))
.add(attr("$merge_dexzips", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/android:merge_dexzips")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/android:merge_dexzips")))
.add(attr("$incremental_install", LABEL).cfg(HOST).exec()
- .value(env.getLabel(INCREMENTAL_INSTALL_LABEL)))
+ .value(env.getLabel(env.getToolsRepository() + INCREMENTAL_INSTALL_LABEL)))
.add(attr("$build_split_manifest", LABEL).cfg(HOST).exec()
- .value(env.getLabel(BUILD_SPLIT_MANIFEST_LABEL)))
+ .value(env.getLabel(env.getToolsRepository() + BUILD_SPLIT_MANIFEST_LABEL)))
.add(attr("$strip_resources", LABEL).cfg(HOST).exec()
- .value(env.getLabel(AndroidRuleClasses.STRIP_RESOURCES_LABEL)))
+ .value(env.getLabel(env.getToolsRepository() + STRIP_RESOURCES_LABEL)))
.add(attr("$incremental_stub_application", LABEL)
- .value(DEFAULT_INCREMENTAL_STUB_APPLICATION))
+ .value(env.getLabel(env.getToolsRepository()
+ + DEFAULT_INCREMENTAL_STUB_APPLICATION)))
.add(attr("$incremental_split_stub_application", LABEL)
- .value(DEFAULT_INCREMENTAL_SPLIT_STUB_APPLICATION))
+ .value(env.getLabel(env.getToolsRepository()
+ + DEFAULT_INCREMENTAL_SPLIT_STUB_APPLICATION)))
/* <!-- #BLAZE_RULE($android_binary_base).ATTRIBUTE(dexopts) -->
Additional command-line flags for the dx tool when generating classes.dex.
Subject to <a href="make-variables.html">"Make variable"</a> substitution and
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java
index 84efb12468..5a7958b905 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java
@@ -19,7 +19,6 @@ 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 com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.packages.Attribute;
@@ -52,7 +51,7 @@ public final class ProguardLibraryRule implements RuleDefinition {
public Object getDefault(AttributeMap rule) {
return rule.isAttributeValueExplicitlySpecified("proguard_specs")
? environment.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/jdk:proguard_whitelister")
+ environment.getToolsRepository() + "//tools/jdk:proguard_whitelister")
: null;
}
}))
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
index ce4cbf2a01..bc0183d84b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplicationRule.java
@@ -20,7 +20,6 @@ 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.syntax.Type.BOOLEAN;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -66,7 +65,7 @@ public class IosApplicationRule implements RuleDefinition {
.direct_compile_time_input())
.add(attr("$runner_script_template", LABEL).cfg(HOST)
.value(env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:ios_runner.sh.mac_template")))
+ env.getToolsRepository() + "//tools/objc:ios_runner.sh.mac_template")))
.add(attr("$is_executable", BOOLEAN).value(true)
.nonconfigurable("Called from RunCommand.isExecutable, which takes a Target"))
.build();
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 b22c9f0a91..75cff59cce 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
@@ -22,7 +22,6 @@ import static com.google.devtools.build.lib.syntax.Type.BOOLEAN;
import static com.google.devtools.build.lib.syntax.Type.STRING_LIST;
import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -47,12 +46,10 @@ import java.util.List;
*/
public class IosTestRule implements RuleDefinition {
- private static final ImmutableList<Label> GCOV =
- ImmutableList.of(
- Label.parseAbsoluteUnchecked(Constants.TOOLS_REPOSITORY + "//tools/objc:gcov"));
-
@Override
public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironment env) {
+ final ImmutableList<Label> gcov =
+ ImmutableList.of(env.getLabel(env.getToolsRepository() + "//tools/objc:gcov"));
return builder
.requiresConfigurationFragments(
ObjcConfiguration.class, J2ObjcConfiguration.class, AppleConfiguration.class)
@@ -74,7 +71,7 @@ public class IosTestRule implements RuleDefinition {
.allowedFileTypes()
.allowedRuleClasses("ios_device")
.value(
- env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc/sim_devices:default")))
+ env.getLabel(env.getToolsRepository() + "//tools/objc/sim_devices:default")))
/* <!-- #BLAZE_RULE(ios_test ).ATTRIBUTE(xctest) -->
Whether this target contains tests using the XCTest testing framework.
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
@@ -138,32 +135,32 @@ public class IosTestRule implements RuleDefinition {
attr("$test_template", LABEL)
.value(
env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:ios_test.sh.bazel_template")))
+ env.getToolsRepository() + "//tools/objc:ios_test.sh.bazel_template")))
.add(
attr("$test_runner", LABEL)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:testrunner")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:testrunner")))
.add(
attr(IosTest.MEMLEAKS_DEP, LABEL)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc/memleaks:memleaks")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc/memleaks:memleaks")))
.add(
attr(IosTest.MEMLEAKS_PLUGIN, LABEL)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:memleaks_plugin")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:memleaks_plugin")))
.override(
attr(":gcov", LABEL_LIST)
.cfg(HOST)
.value(
- new LateBoundLabelList<BuildConfiguration>(GCOV) {
+ new LateBoundLabelList<BuildConfiguration>(gcov) {
@Override
public List<Label> getDefault(Rule rule, BuildConfiguration configuration) {
if (!configuration.isCodeCoverageEnabled()) {
return ImmutableList.of();
}
- return GCOV;
+ return gcov;
}
}))
.build();
}
-
+
@Override
public Metadata getMetadata() {
return RuleDefinition.Metadata.builder()
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryBaseRule.java
index e22bcb3796..2da4068f1e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryBaseRule.java
@@ -18,7 +18,6 @@ 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.syntax.Type.STRING_LIST;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -47,10 +46,10 @@ public class J2ObjcLibraryBaseRule implements RuleDefinition {
.add(attr("entry_classes", STRING_LIST))
.add(attr("$jre_emul_lib", LABEL)
.value(env.getLabel(
- Constants.TOOLS_REPOSITORY + "//third_party/java/j2objc:jre_emul_lib")))
+ env.getToolsRepository() + "//third_party/java/j2objc:jre_emul_lib")))
.add(attr("$protobuf_lib", LABEL)
.value(env.getLabel(
- Constants.TOOLS_REPOSITORY + "//third_party/java/j2objc:proto_runtime")))
+ env.getToolsRepository() + "//third_party/java/j2objc:proto_runtime")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java
index 647af87d8a..d8fde99a6f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcBinaryRule.java
@@ -19,7 +19,6 @@ 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.syntax.Type.BOOLEAN;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -53,7 +52,7 @@ public class ObjcBinaryRule implements RuleDefinition {
// TODO(bazel-team): Remove these when this rule no longer produces a bundle.
.add(attr("$runner_script_template", LABEL).cfg(HOST)
.value(env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:ios_runner.sh.mac_template")))
+ env.getToolsRepository() + "//tools/objc:ios_runner.sh.mac_template")))
.add(attr("$is_executable", BOOLEAN).value(true)
.nonconfigurable("Called from RunCommand.isExecutable, which takes a Target"))
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
index cb4a1ba59a..598edcf575 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
@@ -21,7 +21,6 @@ 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.syntax.Type.BOOLEAN;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
@@ -77,11 +76,11 @@ public class ObjcProtoLibraryRule implements RuleDefinition {
.allowedFileTypes(FileType.of(".py"))
.cfg(HOST)
.singleArtifact()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:compile_protos")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:compile_protos")))
.add(attr(PROTO_SUPPORT_ATTR, LABEL)
.legacyAllowAnyFileType()
.cfg(HOST)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:proto_support")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:proto_support")))
.add(attr(USE_OBJC_HEADER_NAMES_ATTR, BOOLEAN).value(false))
.add(attr(LIBPROTOBUF_ATTR, LABEL).allowedRuleClasses("objc_library")
.value(new ComputedDefault(OUTPUT_CPP_ATTR) {
@@ -93,7 +92,7 @@ public class ObjcProtoLibraryRule implements RuleDefinition {
}
}))
.add(attr("$xcodegen", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:xcodegen")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:xcodegen")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
index 23acbd12ad..4f1cd369b9 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
@@ -26,7 +26,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.devtools.build.lib.Constants;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode;
@@ -513,15 +512,15 @@ public class ObjcRuleClasses {
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
.add(attr("$plmerge", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:plmerge")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:plmerge")))
.add(attr("$actoolwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:actoolwrapper")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:actoolwrapper")))
.add(attr("$ibtoolwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:ibtoolwrapper")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:ibtoolwrapper")))
// TODO(dmaclach): Adding realpath here should not be required once
// https://github.com/bazelbuild/bazel/issues/285 is fixed.
.add(attr("$realpath", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:realpath")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:realpath")))
.build();
}
@Override
@@ -541,9 +540,9 @@ public class ObjcRuleClasses {
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
.add(attr("$xcodegen", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:xcodegen")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:xcodegen")))
.add(attr("$dummy_source", LABEL)
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:dummy.c")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:dummy.c")))
.build();
}
@Override
@@ -760,14 +759,14 @@ public class ObjcRuleClasses {
.add(attr("$dumpsyms", LABEL)
.cfg(HOST)
.singleArtifact()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:dump_syms")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:dump_syms")))
.add(attr("$j2objc_dead_code_pruner", LABEL)
.allowedFileTypes(FileType.of(".py"))
.cfg(HOST)
.exec()
.singleArtifact()
.value(env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:j2objc_dead_code_pruner")))
+ env.getToolsRepository() + "//tools/objc:j2objc_dead_code_pruner")))
.build();
}
@Override
@@ -833,14 +832,14 @@ public class ObjcRuleClasses {
attr("$momcwrapper", LABEL)
.cfg(HOST)
.exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:momcwrapper")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:momcwrapper")))
.add(
attr("$swiftstdlibtoolwrapper", LABEL)
.cfg(HOST)
.exec()
.value(
env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:swiftstdlibtoolwrapper")))
+ env.getToolsRepository() + "//tools/objc:swiftstdlibtoolwrapper")))
.build();
}
@@ -978,13 +977,13 @@ public class ObjcRuleClasses {
attr("$bundlemerge", LABEL)
.cfg(HOST)
.exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:bundlemerge")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:bundlemerge")))
.add(
attr("$environment_plist_sh", LABEL)
.cfg(HOST)
.value(
env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:environment_plist.sh")))
+ env.getToolsRepository() + "//tools/objc:environment_plist.sh")))
.build();
}
@Override
@@ -1006,9 +1005,9 @@ public class ObjcRuleClasses {
return builder
// Needed to run the binary in the simulator.
.add(attr("$iossim", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//third_party/iossim:iossim")))
+ .value(env.getLabel(env.getToolsRepository() + "//third_party/iossim:iossim")))
.add(attr("$std_redirect_dylib", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:StdRedirect.dylib")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:StdRedirect.dylib")))
.build();
}
@Override
@@ -1028,7 +1027,7 @@ public class ObjcRuleClasses {
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
.add(attr("$xcrunwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:xcrunwrapper")))
+ .value(env.getLabel(env.getToolsRepository() + "//tools/objc:xcrunwrapper")))
.build();
}
@Override