Automated rollback of commit b406bdcbe95dd23ca623f807d5113f18b724611a.
*** Reason for rollback ***
This breaks rules_go and rules_swift because they refer to themselves by alias depot names: https://github.com/bazelbuild/bazel/issues/24375
*** Original change description ***
In AppleBootstrap.java give several rule repos access to apple_common that need it, and activate the access restriction independent of INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES
PiperOrigin-RevId: 698310431
Change-Id: I88973163cadca29021af9575d410fcae1eb6c066
diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/objc/AppleBootstrap.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/objc/AppleBootstrap.java
index d6ff639..c71c0d4 100644
--- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/objc/AppleBootstrap.java
+++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/objc/AppleBootstrap.java
@@ -17,8 +17,9 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions;
import com.google.devtools.build.lib.starlarkbuildapi.core.Bootstrap;
-import com.google.devtools.build.lib.starlarkbuildapi.core.ContextGuardedValue;
+import com.google.devtools.build.lib.starlarkbuildapi.core.ContextAndFlagGuardedValue;
import net.starlark.java.eval.Starlark;
/** {@link Bootstrap} for Starlark objects related to apple rules. */
@@ -27,22 +28,17 @@
private static final ImmutableSet<PackageIdentifier> allowedRepositories =
ImmutableSet.of(
PackageIdentifier.createUnchecked("_builtins", ""),
- PackageIdentifier.createUnchecked("apple_support", ""),
PackageIdentifier.createUnchecked("bazel_tools", ""),
- PackageIdentifier.createUnchecked("local_config_cc", ""),
PackageIdentifier.createUnchecked("rules_apple", ""),
- PackageIdentifier.createUnchecked("rules_cc", ""),
- PackageIdentifier.createUnchecked("rules_go", ""),
- PackageIdentifier.createUnchecked("rules_ios", ""),
- PackageIdentifier.createUnchecked("rules_swift", ""),
- PackageIdentifier.createUnchecked("stardoc", ""),
- PackageIdentifier.createUnchecked("tulsi", ""),
- PackageIdentifier.createUnchecked("", "test_starlark"),
- PackageIdentifier.createUnchecked("", "tools/osx"));
+ PackageIdentifier.createUnchecked("", "tools/build_defs/apple"));
@Override
public void addBindingsToBuilder(ImmutableMap.Builder<String, Object> builder) {
builder.put(
- "apple_common", ContextGuardedValue.onlyInAllowedRepos(Starlark.NONE, allowedRepositories));
+ "apple_common",
+ ContextAndFlagGuardedValue.onlyInAllowedReposOrWhenIncompatibleFlagIsFalse(
+ BuildLanguageOptions.INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES,
+ Starlark.NONE,
+ allowedRepositories));
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeVersionTest.java b/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeVersionTest.java
index 336e99b..fa2ac1c 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeVersionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/apple/XcodeVersionTest.java
@@ -41,9 +41,9 @@
@Test
public void testXcodeVersionCanBeReadFromStarlark() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
MyInfo = provider()
@@ -72,7 +72,7 @@
scratch.file(
"examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "my_rule")
+ load("//examples/rule:apple_rules.bzl", "my_rule")
package(default_visibility = ["//visibility:public"])
@@ -95,7 +95,7 @@
(RuleConfiguredTarget) getConfiguredTarget("//examples/apple_starlark:my_target");
Provider.Key key =
new StarlarkProvider.Key(
- keyForBuild(Label.parseCanonical("//test_starlark/rule:apple_rules.bzl")), "MyInfo");
+ keyForBuild(Label.parseCanonical("//examples/rule:apple_rules.bzl")), "MyInfo");
StructImpl myInfo = (StructImpl) starlarkTarget.get(key);
assertThat((String) myInfo.getValue("xcode_version")).isEqualTo("8");
assertThat((String) myInfo.getValue("ios_version")).isEqualTo("9.0");
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java
index 241cbfd..7a6aa70 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java
@@ -65,9 +65,9 @@
@Test
@SuppressWarnings("unchecked")
public void testStarlarkRuleCanDependOnNativeAppleRule() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -90,11 +90,11 @@
},
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "my_rule")
+ load("//examples/rule:apple_rules.bzl", "my_rule")
package(default_visibility = ["//visibility:public"])
@@ -110,8 +110,7 @@
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
StructImpl myInfo = getMyInfoFromTarget(starlarkTarget);
List<Artifact> starlarkHdrs = (List<Artifact>) myInfo.getValue("found_hdrs");
List<Artifact> starlarkLibraries = (List<Artifact>) myInfo.getValue("found_libs");
@@ -122,9 +121,9 @@
@Test
public void testStarlarkProviderRetrievalNoneIfNoProvider() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
def my_rule_impl(ctx):
dep = ctx.attr.deps[0]
@@ -138,11 +137,11 @@
},
)
""");
- scratch.file("test_starlark/apple_starlark/a.cc");
+ scratch.file("examples/apple_starlark/a.cc");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "my_rule")
+ load("//examples/rule:apple_rules.bzl", "my_rule")
package(default_visibility = ["//visibility:public"])
my_rule(
@@ -158,29 +157,27 @@
""");
AssertionError e =
assertThrows(
- AssertionError.class,
- () -> getConfiguredTarget("//test_starlark/apple_starlark:my_target"));
+ AssertionError.class, () -> getConfiguredTarget("//examples/apple_starlark:my_target"));
+ assertThat(e)
+ .hasMessageThat()
+ .contains("apple_starlark/BUILD:4:8: in my_rule rule //examples/apple_starlark:my_target:");
assertThat(e)
.hasMessageThat()
.contains(
- "apple_starlark/BUILD:4:8: in my_rule rule //test_starlark/apple_starlark:my_target:");
- assertThat(e)
- .hasMessageThat()
- .contains(
- "File \"/workspace/test_starlark/rule/apple_rules.bzl\", line 3, column 24, in"
+ "File \"/workspace/examples/rule/apple_rules.bzl\", line 3, column 24, in"
+ " my_rule_impl");
assertThat(e)
.hasMessageThat()
.contains(
- "<target //test_starlark/apple_starlark:lib> (rule 'cc_library') "
+ "<target //examples/apple_starlark:lib> (rule 'cc_library') "
+ "doesn't contain declared provider 'ObjcInfo'");
}
@Test
public void testStarlarkProviderCanCheckForExistenceOfObjcProvider() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -196,12 +193,12 @@
},
)
""");
- scratch.file("test_starlark/apple_starlark/a.cc");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.cc");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "my_rule")
+ load("//examples/rule:apple_rules.bzl", "my_rule")
package(default_visibility = ["//visibility:public"])
@@ -223,8 +220,7 @@
srcs = ["a.cc"],
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
StructImpl myInfo = getMyInfoFromTarget(starlarkTarget);
boolean ccResult = (boolean) myInfo.getValue("cc_has_provider");
boolean objcResult = (boolean) myInfo.getValue("objc_has_provider");
@@ -234,9 +230,9 @@
@Test
public void testStarlarkExportsObjcProviderToNativeRule() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
def my_rule_impl(ctx):
dep = ctx.attr.deps[0]
@@ -254,12 +250,12 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
addAppleBinaryStarlarkRule(scratch);
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "swift_library")
+ load("//examples/rule:apple_rules.bzl", "swift_library")
load("//test_starlark:apple_binary_starlark.bzl", "apple_binary_starlark")
package(default_visibility = ["//visibility:public"])
@@ -281,7 +277,7 @@
)
""");
- ConfiguredTarget binaryTarget = getConfiguredTarget("//test_starlark/apple_starlark:bin");
+ ConfiguredTarget binaryTarget = getConfiguredTarget("//examples/apple_starlark:bin");
StructImpl executableProvider =
(StructImpl) binaryTarget.get(APPLE_EXECUTABLE_BINARY_PROVIDER_KEY);
CcLinkingContext ccLinkingContext =
@@ -290,14 +286,14 @@
assertThat(
Artifact.toRootRelativePaths(
ccLinkingContext.getStaticModeParamsForDynamicLibraryLibraries()))
- .contains("test_starlark/apple_starlark/liblib.a");
+ .contains("examples/apple_starlark/liblib.a");
}
@Test
public void testObjcRuleCanDependOnArbitraryStarlarkRuleThatProvidesCcInfo() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
def my_rule_impl(ctx):
return [CcInfo()]
@@ -308,12 +304,12 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
addAppleBinaryStarlarkRule(scratch);
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "my_rule")
+ load("//examples/rule:apple_rules.bzl", "my_rule")
load("//test_starlark:apple_binary_starlark.bzl", "apple_binary_starlark")
package(default_visibility = ["//visibility:public"])
@@ -335,15 +331,15 @@
)
""");
- ConfiguredTarget libTarget = getConfiguredTarget("//test_starlark/apple_starlark:lib");
+ ConfiguredTarget libTarget = getConfiguredTarget("//examples/apple_starlark:lib");
assertThat(libTarget.get(CcInfo.PROVIDER)).isNotNull();
}
@Test
public void testStarlarkCanAccessAppleConfiguration() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -390,11 +386,11 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "swift_binary")
+ load("//examples/rule:apple_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -404,8 +400,7 @@
""");
useConfiguration("--apple_platform_type=ios", "--ios_multi_cpus=x86_64", "--xcode_version=7.3");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
StructImpl myInfo = getMyInfoFromTarget(starlarkTarget);
Object iosCpu = myInfo.getValue("cpu");
@@ -426,9 +421,9 @@
@Test
public void testDefaultJ2objcDeadCodeReport() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -452,11 +447,11 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "swift_binary")
+ load("//examples/rule:apple_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -466,17 +461,16 @@
""");
useConfiguration();
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
assertThat(getMyInfoFromTarget(starlarkTarget).getValue("dead_code_report")).isEqualTo("None");
}
@Test
public void testCustomJ2objcDeadCodeReport() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -506,11 +500,11 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "dead_code_report", "swift_binary")
+ load("//examples/rule:apple_rules.bzl", "dead_code_report", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -521,18 +515,17 @@
dead_code_report(name = "dead_code_report")
""");
- useConfiguration("--j2objc_dead_code_report=//test_starlark/apple_starlark:dead_code_report");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ useConfiguration("--j2objc_dead_code_report=//examples/apple_starlark:dead_code_report");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
assertThat(getMyInfoFromTarget(starlarkTarget).getValue("dead_code_report")).isEqualTo("bar");
}
@Test
public void testStarlarkCanAccessJ2objcTranslationFlags() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -548,11 +541,11 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "swift_binary")
+ load("//examples/rule:apple_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -562,8 +555,7 @@
""");
useConfiguration("--j2objc_translation_flags=-DTestJ2ObjcFlag");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
@SuppressWarnings("unchecked")
List<String> flags =
@@ -574,9 +566,9 @@
@Test
public void testStarlarkCanAccessApplePlatformNames() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -593,9 +585,9 @@
""");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "test_rule")
+ load("//examples/rule:apple_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -605,8 +597,7 @@
""");
useConfiguration("--ios_multi_cpus=x86_64", "--apple_platform_type=ios");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
Object name = getMyInfoFromTarget(starlarkTarget).getValue("name");
assertThat(name).isEqualTo("iPhoneSimulator");
@@ -614,9 +605,9 @@
@Test
public void testStarlarkCanAccessAppleToolchain() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -636,11 +627,11 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "swift_binary")
+ load("//examples/rule:apple_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -650,8 +641,7 @@
""");
useConfiguration("--apple_platform_type=ios", "--ios_multi_cpus=x86_64");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
StructImpl myInfo = getMyInfoFromTarget(starlarkTarget);
String platformDevFrameworksDir = (String) myInfo.getValue("platform_developer_framework_dir");
@@ -666,9 +656,9 @@
@Test
public void testStarlarkCanAccessSdkAndMinimumOs() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -706,11 +696,11 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "swift_binary")
+ load("//examples/rule:apple_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -728,8 +718,7 @@
"--tvos_minimum_os=3.0",
"--macos_sdk_version=4.1",
"--minimum_os_version=5.1");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
StructImpl myInfo = getMyInfoFromTarget(starlarkTarget);
assertThat(myInfo.getValue("ios_sdk_version")).isEqualTo("1.1");
@@ -746,7 +735,7 @@
"--watchos_sdk_version=2.1",
"--tvos_sdk_version=3.1",
"--macos_sdk_version=4.1");
- starlarkTarget = getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
myInfo = getMyInfoFromTarget(starlarkTarget);
assertThat(myInfo.getValue("ios_sdk_version")).isEqualTo("1.1");
@@ -760,9 +749,9 @@
@Test
public void testStarlarkCanAccessObjcConfiguration() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/objc_rules.bzl",
+ "examples/rule/objc_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -784,11 +773,11 @@
)
""");
- scratch.file("test_starlark/objc_starlark/a.m");
+ scratch.file("examples/objc_starlark/a.m");
scratch.file(
- "test_starlark/objc_starlark/BUILD",
+ "examples/objc_starlark/BUILD",
"""
- load("//test_starlark/rule:objc_rules.bzl", "swift_binary")
+ load("//examples/rule:objc_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -802,8 +791,7 @@
"--ios_simulator_device='iPhone 6'",
"--ios_simulator_version=8.4",
"--ios_signing_cert_name='Apple Developer'");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/objc_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/objc_starlark:my_target");
StructImpl myInfo = getMyInfoFromTarget(starlarkTarget);
@SuppressWarnings("unchecked")
@@ -820,9 +808,9 @@
@Test
public void testSigningCertificateNameCanReturnNone() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/objc_rules.bzl",
+ "examples/rule/objc_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -838,11 +826,11 @@
)
""");
- scratch.file("test_starlark/objc_starlark/a.m");
+ scratch.file("examples/objc_starlark/a.m");
scratch.file(
- "test_starlark/objc_starlark/BUILD",
+ "examples/objc_starlark/BUILD",
"""
- load("//test_starlark/rule:objc_rules.bzl", "my_rule")
+ load("//examples/rule:objc_rules.bzl", "my_rule")
package(default_visibility = ["//visibility:public"])
@@ -851,8 +839,7 @@
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/objc_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/objc_starlark:my_target");
Object signingCertificateName =
getMyInfoFromTarget(starlarkTarget).getValue("signing_certificate_name");
@@ -861,9 +848,9 @@
@Test
public void testUsesDebugEntitlementsIsTrueIfCompilationModeIsNotOpt() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/objc_rules.bzl",
+ "examples/rule/objc_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -879,11 +866,11 @@
)
""");
- scratch.file("test_starlark/objc_starlark/a.m");
+ scratch.file("examples/objc_starlark/a.m");
scratch.file(
- "test_starlark/objc_starlark/BUILD",
+ "examples/objc_starlark/BUILD",
"""
- load("//test_starlark/rule:objc_rules.bzl", "test_rule")
+ load("//examples/rule:objc_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -893,8 +880,7 @@
""");
useConfiguration("--compilation_mode=dbg");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/objc_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/objc_starlark:my_target");
boolean usesDeviceDebugEntitlements =
(boolean) getMyInfoFromTarget(starlarkTarget).getValue("uses_device_debug_entitlements");
@@ -903,9 +889,9 @@
@Test
public void testUsesDebugEntitlementsIsFalseIfFlagIsExplicitlyFalse() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/objc_rules.bzl",
+ "examples/rule/objc_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -921,11 +907,11 @@
)
""");
- scratch.file("test_starlark/objc_starlark/a.m");
+ scratch.file("examples/objc_starlark/a.m");
scratch.file(
- "test_starlark/objc_starlark/BUILD",
+ "examples/objc_starlark/BUILD",
"""
- load("//test_starlark/rule:objc_rules.bzl", "test_rule")
+ load("//examples/rule:objc_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -935,8 +921,7 @@
""");
useConfiguration("--compilation_mode=dbg", "--nodevice_debug_entitlements");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/objc_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/objc_starlark:my_target");
boolean usesDeviceDebugEntitlements =
(boolean) getMyInfoFromTarget(starlarkTarget).getValue("uses_device_debug_entitlements");
@@ -945,9 +930,9 @@
@Test
public void testUsesDebugEntitlementsIsFalseIfCompilationModeIsOpt() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/objc_rules.bzl",
+ "examples/rule/objc_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -963,11 +948,11 @@
)
""");
- scratch.file("test_starlark/objc_starlark/a.m");
+ scratch.file("examples/objc_starlark/a.m");
scratch.file(
- "test_starlark/objc_starlark/BUILD",
+ "examples/objc_starlark/BUILD",
"""
- load("//test_starlark/rule:objc_rules.bzl", "test_rule")
+ load("//examples/rule:objc_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -977,8 +962,7 @@
""");
useConfiguration("--compilation_mode=opt");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/objc_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/objc_starlark:my_target");
boolean usesDeviceDebugEntitlements =
(boolean) getMyInfoFromTarget(starlarkTarget).getValue("uses_device_debug_entitlements");
@@ -999,12 +983,12 @@
},
String.class);
- scratch.file("test_starlark/rule/BUILD");
- scratch.file("test_starlark/rule/objc_rules.bzl", impl);
+ scratch.file("examples/rule/BUILD");
+ scratch.file("examples/rule/objc_rules.bzl", impl);
scratch.file(
- "test_starlark/objc_starlark/BUILD",
+ "examples/objc_starlark/BUILD",
"""
- load("//test_starlark/rule:objc_rules.bzl", "swift_binary")
+ load("//examples/rule:objc_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -1019,7 +1003,7 @@
)
""");
- return getConfiguredTarget("//test_starlark/objc_starlark:my_target");
+ return getConfiguredTarget("//examples/objc_starlark:my_target");
}
@Test
@@ -1048,24 +1032,24 @@
assertThat(getStrictInclude(starlarkProvider)).containsExactly("path");
scratch.file(
- "test_starlark/objc_starlark2/BUILD",
+ "examples/objc_starlark2/BUILD",
"""
objc_library(
name = "direct_dep",
- deps = ["//test_starlark/objc_starlark:my_target"],
+ deps = ["//examples/objc_starlark:my_target"],
)
""");
StarlarkInfo starlarkProviderDirectDepender =
- getObjcInfo(getConfiguredTarget("//test_starlark/objc_starlark2:direct_dep"));
+ getObjcInfo(getConfiguredTarget("//examples/objc_starlark2:direct_dep"));
assertThat(getStrictInclude(starlarkProviderDirectDepender)).isEmpty();
}
@Test
public void testStarlarkCanCreateObjcProviderFromObjcProvider() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/objc_rules.bzl",
+ "examples/rule/objc_rules.bzl",
"""
def library_impl(ctx):
lib = ctx.label.name + ".a"
@@ -1099,9 +1083,9 @@
""");
scratch.file(
- "test_starlark/objc_starlark/BUILD",
+ "examples/objc_starlark/BUILD",
"""
- load("//test_starlark/rule:objc_rules.bzl", "binary", "library")
+ load("//examples/rule:objc_rules.bzl", "binary", "library")
package(default_visibility = ["//visibility:public"])
@@ -1115,7 +1099,7 @@
)
""");
- ConfiguredTarget starlarkTarget = getConfiguredTarget("//test_starlark/objc_starlark:bin");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/objc_starlark:bin");
StarlarkInfo dependerProvider = getObjcInfo(starlarkTarget);
ImmutableList<Artifact> libraries =
@@ -1142,9 +1126,9 @@
@Test
public void testEmptyObjcProviderKeysArePresent() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -1167,11 +1151,11 @@
)
""");
- scratch.file("test_starlark/apple_starlark/a.m");
+ scratch.file("examples/apple_starlark/a.m");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "swift_binary")
+ load("//examples/rule:apple_rules.bzl", "swift_binary")
package(default_visibility = ["//visibility:public"])
@@ -1185,8 +1169,7 @@
srcs = ["a.m"],
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
NestedSet<Artifact> emptyValue =
Depset.cast(
getMyInfoFromTarget(starlarkTarget).getValue("empty_value"),
@@ -1197,9 +1180,9 @@
@Test
public void testStarlarkCanAccessAndUseApplePlatformTypes() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -1221,9 +1204,9 @@
""");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "test_rule")
+ load("//examples/rule:apple_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -1233,8 +1216,7 @@
""");
useConfiguration("--ios_multi_cpus=arm64,armv7", "--watchos_cpus=armv7k", "--tvos_cpus=arm64");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
StructImpl myInfo = getMyInfoFromTarget(starlarkTarget);
Object iosPlatform = myInfo.getValue("ios_platform");
@@ -1248,9 +1230,9 @@
@Test
public void testPlatformIsDeviceReturnsTrueForDevicePlatforms() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -1268,9 +1250,9 @@
""");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "test_rule")
+ load("//examples/rule:apple_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -1280,8 +1262,7 @@
""");
useConfiguration("--ios_multi_cpus=arm64,armv7");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
Boolean isDevice = (Boolean) getMyInfoFromTarget(starlarkTarget).getValue("is_device");
assertThat(isDevice).isTrue();
@@ -1289,9 +1270,9 @@
@Test
public void testPlatformIsDeviceReturnsFalseForSimulatorPlatforms() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -1309,9 +1290,9 @@
""");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "test_rule")
+ load("//examples/rule:apple_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -1320,8 +1301,7 @@
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
Boolean isDevice = (Boolean) getMyInfoFromTarget(starlarkTarget).getValue("is_device");
assertThat(isDevice).isFalse();
@@ -1340,9 +1320,9 @@
@Test
public void testDottedVersion() throws Exception {
- scratch.file("test_starlark/rule/BUILD", "exports_files(['test_artifact'])");
+ scratch.file("examples/rule/BUILD", "exports_files(['test_artifact'])");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -1356,9 +1336,9 @@
""");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "test_rule")
+ load("//examples/rule:apple_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -1367,8 +1347,7 @@
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
DottedVersion version = (DottedVersion) getMyInfoFromTarget(starlarkTarget).getValue("version");
assertThat(version).isEqualTo(DottedVersion.fromString("5.4"));
@@ -1376,9 +1355,9 @@
@Test
public void testDottedVersion_invalid() throws Exception {
- scratch.file("test_starlark/rule/BUILD", "exports_files(['test_artifact'])");
+ scratch.file("examples/rule/BUILD", "exports_files(['test_artifact'])");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -1392,9 +1371,9 @@
""");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "test_rule")
+ load("//examples/rule:apple_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -1405,8 +1384,7 @@
AssertionError e =
assertThrows(
- AssertionError.class,
- () -> getConfiguredTarget("//test_starlark/apple_starlark:my_target"));
+ AssertionError.class, () -> getConfiguredTarget("//examples/apple_starlark:my_target"));
assertThat(e)
.hasMessageThat()
.contains("Dotted version components must all start with the form");
@@ -1420,9 +1398,9 @@
*/
@Test
public void testObjcProviderStarlarkConstructor() throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
def my_rule_impl(ctx):
dep = ctx.attr.deps[0]
@@ -1436,11 +1414,11 @@
},
)
""");
- scratch.file("test_starlark/apple_starlark/a.cc");
+ scratch.file("examples/apple_starlark/a.cc");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "my_rule")
+ load("//examples/rule:apple_rules.bzl", "my_rule")
package(default_visibility = ["//visibility:public"])
@@ -1456,16 +1434,15 @@
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
StarlarkInfo dependerProvider = getObjcInfo(starlarkTarget);
assertThat(dependerProvider).isNotNull();
}
private void checkStarlarkRunMemleaksWithExpectedValue(boolean expectedValue) throws Exception {
- scratch.file("test_starlark/rule/BUILD");
+ scratch.file("examples/rule/BUILD");
scratch.file(
- "test_starlark/rule/apple_rules.bzl",
+ "examples/rule/apple_rules.bzl",
"""
load("//myinfo:myinfo.bzl", "MyInfo")
@@ -1480,9 +1457,9 @@
""");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
- load("//test_starlark/rule:apple_rules.bzl", "test_rule")
+ load("//examples/rule:apple_rules.bzl", "test_rule")
package(default_visibility = ["//visibility:public"])
@@ -1491,8 +1468,7 @@
)
""");
- ConfiguredTarget starlarkTarget =
- getConfiguredTarget("//test_starlark/apple_starlark:my_target");
+ ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
boolean runMemleaks = (boolean) getMyInfoFromTarget(starlarkTarget).getValue("run_memleaks");
assertThat(runMemleaks).isEqualTo(expectedValue);
@@ -1503,7 +1479,7 @@
useConfiguration("--incompatible_disallow_sdk_frameworks_attributes");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
objc_library(
name = "lib",
@@ -1516,12 +1492,12 @@
""");
AssertionError e =
assertThrows(
- AssertionError.class, () -> getConfiguredTarget("//test_starlark/apple_starlark:lib"));
+ AssertionError.class, () -> getConfiguredTarget("//examples/apple_starlark:lib"));
assertThat(e)
.hasMessageThat()
.contains(
- "ERROR /workspace/test_starlark/apple_starlark/BUILD:1:13: "
- + "in objc_library rule //test_starlark/apple_starlark:lib:");
+ "ERROR /workspace/examples/apple_starlark/BUILD:1:13: "
+ + "in objc_library rule //examples/apple_starlark:lib:");
assertContainsEvent(
"sdk_frameworks attribute is disallowed. Use explicit dependencies instead.");
@@ -1532,7 +1508,7 @@
useConfiguration("--incompatible_disallow_sdk_frameworks_attributes");
scratch.file(
- "test_starlark/apple_starlark/BUILD",
+ "examples/apple_starlark/BUILD",
"""
objc_library(
name = "lib",
@@ -1542,12 +1518,12 @@
""");
AssertionError e =
assertThrows(
- AssertionError.class, () -> getConfiguredTarget("//test_starlark/apple_starlark:lib"));
+ AssertionError.class, () -> getConfiguredTarget("//examples/apple_starlark:lib"));
assertThat(e)
.hasMessageThat()
.contains(
- "ERROR /workspace/test_starlark/apple_starlark/BUILD:1:13: "
- + "in objc_library rule //test_starlark/apple_starlark:lib:");
+ "ERROR /workspace/examples/apple_starlark/BUILD:1:13: "
+ + "in objc_library rule //examples/apple_starlark:lib:");
assertContainsEvent(
"weak_sdk_frameworks attribute is disallowed. Use explicit dependencies instead.");
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/XcodeConfigTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/XcodeConfigTest.java
index 1b6e08c..85c2d59 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/XcodeConfigTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/XcodeConfigTest.java
@@ -446,7 +446,7 @@
@Test
public void xcodeVersionConfigConstructor() throws Exception {
scratch.file(
- "test_starlark/extension.bzl",
+ "foo/extension.bzl",
"""
result = provider()
@@ -471,19 +471,19 @@
my_rule = rule(_impl, attrs = {"dep": attr.label()})
""");
scratch.file(
- "test_starlark/BUILD",
+ "foo/BUILD",
"""
load(":extension.bzl", "my_rule")
my_rule(name = "test")
""");
assertNoEvents();
- ConfiguredTarget myRuleTarget = getConfiguredTarget("//test_starlark:test");
+ ConfiguredTarget myRuleTarget = getConfiguredTarget("//foo:test");
StructImpl info =
(StructImpl)
myRuleTarget.get(
new StarlarkProvider.Key(
- keyForBuild(Label.parseCanonical("//test_starlark:extension.bzl")), "result"));
+ keyForBuild(Label.parseCanonical("//foo:extension.bzl")), "result"));
StructImpl actual = info.getValue("xcode_version", StructImpl.class);
assertThat(
callProviderMethod(actual, "sdk_version_for_platform", ApplePlatform.IOS_DEVICE)
@@ -563,7 +563,7 @@
@Test
public void xcodeVersionConfig_throwsOnBadInput() throws Exception {
scratch.file(
- "test_starlark/extension.bzl",
+ "foo/extension.bzl",
"""
result = provider()
@@ -588,14 +588,14 @@
my_rule = rule(_impl, attrs = {"dep": attr.label()})
""");
scratch.file(
- "test_starlark/BUILD",
+ "foo/BUILD",
"""
load(":extension.bzl", "my_rule")
my_rule(name = "test")
""");
assertNoEvents();
- assertThrows(AssertionError.class, () -> getConfiguredTarget("//test_starlark:test"));
+ assertThrows(AssertionError.class, () -> getConfiguredTarget("//foo:test"));
assertContainsEvent("Dotted version components must all start with the form");
assertContainsEvent("got 'not a valid dotted version'");
}
@@ -603,7 +603,7 @@
@Test
public void xcodeVersionConfig_exposesExpectedAttributes() throws Exception {
scratch.file(
- "test_starlark/extension.bzl",
+ "foo/extension.bzl",
"""
result = provider()
@@ -638,28 +638,28 @@
)
""");
scratch.file(
- "test_starlark/BUILD",
+ "foo/BUILD",
"""
load(":extension.bzl", "my_rule")
my_rule(name = "test")
""");
assertNoEvents();
- ConfiguredTarget myRuleTarget = getConfiguredTarget("//test_starlark:test");
+ ConfiguredTarget myRuleTarget = getConfiguredTarget("//foo:test");
StructImpl info =
(StructImpl)
myRuleTarget.get(
new StarlarkProvider.Key(
- keyForBuild(Label.parseCanonical("//test_starlark:extension.bzl")), "result"));
+ keyForBuild(Label.parseCanonical("//foo:extension.bzl")), "result"));
assertThat(info.getValue("xcode_version").toString()).isEqualTo("1.11");
assertThat(info.getValue("min_os").toString()).isEqualTo("1.8");
}
@Test
public void testConfigAlias_configSetting() throws Exception {
- scratch.file("test_starlark/BUILD");
+ scratch.file("starlark/BUILD");
scratch.file(
- "test_starlark/version_retriever.bzl",
+ "starlark/version_retriever.bzl",
"""
def _version_retriever_impl(ctx):
xcode_properties = ctx.attr.dep[apple_common.XcodeProperties]
@@ -675,7 +675,7 @@
scratch.file(
"xcode/BUILD",
"""
- load("//test_starlark:version_retriever.bzl", "version_retriever")
+ load("//starlark:version_retriever.bzl", "version_retriever")
version_retriever(
name = "flag_propagator",
@@ -757,9 +757,9 @@
@Test
public void testDefaultVersion_configSetting() throws Exception {
- scratch.file("test_starlark/BUILD");
+ scratch.file("starlark/BUILD");
scratch.file(
- "test_starlark/version_retriever.bzl",
+ "starlark/version_retriever.bzl",
"""
def _version_retriever_impl(ctx):
xcode_properties = ctx.attr.dep[apple_common.XcodeProperties]
@@ -775,7 +775,7 @@
scratch.file(
"xcode/BUILD",
"""
- load("//test_starlark:version_retriever.bzl", "version_retriever")
+ load("//starlark:version_retriever.bzl", "version_retriever")
version_retriever(
name = "flag_propagator",
@@ -1226,9 +1226,9 @@
@Test
public void testXcodeVersionFromStarlarkByAlias() throws Exception {
scratch.file(
- "test_starlark/BUILD",
+ "x/BUILD",
"""
- load("//test_starlark:r.bzl", "r")
+ load("//x:r.bzl", "r")
xcode_config_alias(name = "a")
@@ -1250,7 +1250,7 @@
r(name = "r")
""");
scratch.file(
- "test_starlark/r.bzl",
+ "x/r.bzl",
"""
MyInfo = provider()
@@ -1274,19 +1274,16 @@
r = rule(
implementation = _impl,
- attrs = {"_xcode": attr.label(default = Label("//test_starlark:a"))},
+ attrs = {"_xcode": attr.label(default = Label("//x:a"))},
fragments = ["apple"],
)
""");
useConfiguration(
- "--xcode_version_config=//test_starlark:c",
- "--tvos_sdk_version=2.5",
- "--watchos_minimum_os=4.5");
- ConfiguredTarget r = getConfiguredTarget("//test_starlark:r");
+ "--xcode_version_config=//x:c", "--tvos_sdk_version=2.5", "--watchos_minimum_os=4.5");
+ ConfiguredTarget r = getConfiguredTarget("//x:r");
Provider.Key key =
- new StarlarkProvider.Key(
- keyForBuild(Label.parseCanonical("//test_starlark:r.bzl")), "MyInfo");
+ new StarlarkProvider.Key(keyForBuild(Label.parseCanonical("//x:r.bzl")), "MyInfo");
StructImpl info = (StructImpl) r.get(key);
assertThat(info.getValue("xcode").toString()).isEqualTo("0.0");
@@ -1304,9 +1301,9 @@
@Test
public void testMutualXcodeFromStarlarkByAlias() throws Exception {
scratch.file(
- "test_starlark/BUILD",
+ "x/BUILD",
"""
- load("//test_starlark:r.bzl", "r")
+ load("//x:r.bzl", "r")
xcode_config_alias(name = "a")
@@ -1348,7 +1345,7 @@
r(name = "r")
""");
scratch.file(
- "test_starlark/r.bzl",
+ "x/r.bzl",
"""
MyInfo = provider()
@@ -1372,16 +1369,15 @@
r = rule(
implementation = _impl,
- attrs = {"_xcode": attr.label(default = Label("//test_starlark:a"))},
+ attrs = {"_xcode": attr.label(default = Label("//x:a"))},
fragments = ["apple"],
)
""");
- useConfiguration("--xcode_version_config=//test_starlark:c");
- ConfiguredTarget r = getConfiguredTarget("//test_starlark:r");
+ useConfiguration("--xcode_version_config=//x:c");
+ ConfiguredTarget r = getConfiguredTarget("//x:r");
Provider.Key key =
- new StarlarkProvider.Key(
- keyForBuild(Label.parseCanonical("//test_starlark:r.bzl")), "MyInfo");
+ new StarlarkProvider.Key(keyForBuild(Label.parseCanonical("//x:r.bzl")), "MyInfo");
StructImpl info = (StructImpl) r.get(key);
assertThat((Map<?, ?>) info.getValue("execution_info"))
.containsKey(ExecutionRequirements.REQUIRES_DARWIN);
@@ -1392,9 +1388,9 @@
@Test
public void testLocalXcodeFromStarlarkByAlias() throws Exception {
scratch.file(
- "test_starlark/BUILD",
+ "x/BUILD",
"""
- load("//test_starlark:r.bzl", "r")
+ load("//x:r.bzl", "r")
xcode_config_alias(name = "a")
@@ -1433,7 +1429,7 @@
r(name = "r")
""");
scratch.file(
- "test_starlark/r.bzl",
+ "x/r.bzl",
"""
MyInfo = provider()
@@ -1456,16 +1452,15 @@
r = rule(
implementation = _impl,
- attrs = {"_xcode": attr.label(default = Label("//test_starlark:a"))},
+ attrs = {"_xcode": attr.label(default = Label("//x:a"))},
fragments = ["apple"],
)
""");
- useConfiguration("--xcode_version_config=//test_starlark:c");
- ConfiguredTarget r = getConfiguredTarget("//test_starlark:r");
+ useConfiguration("--xcode_version_config=//x:c");
+ ConfiguredTarget r = getConfiguredTarget("//x:r");
Provider.Key key =
- new StarlarkProvider.Key(
- keyForBuild(Label.parseCanonical("//test_starlark:r.bzl")), "MyInfo");
+ new StarlarkProvider.Key(keyForBuild(Label.parseCanonical("//x:r.bzl")), "MyInfo");
StructImpl info = (StructImpl) r.get(key);
assertThat(info.getValue("xcode").toString()).isEqualTo("8.4");
@@ -1535,7 +1530,7 @@
@Test
public void testConfigurationFieldForRule() throws Exception {
scratch.file(
- "test_starlark/provider_grabber.bzl",
+ "x/provider_grabber.bzl",
"""
def _impl(ctx):
conf = ctx.attr._xcode_dep[apple_common.XcodeVersionConfig]
@@ -1556,9 +1551,9 @@
""");
scratch.file(
- "test_starlark/BUILD",
+ "x/BUILD",
"""
- load("//test_starlark:provider_grabber.bzl", "provider_grabber")
+ load("//x:provider_grabber.bzl", "provider_grabber")
xcode_config(
name = "config1",
@@ -1585,11 +1580,11 @@
provider_grabber(name = "provider_grabber")
""");
- useConfiguration("--xcode_version_config=//test_starlark:config1");
- assertXcodeVersion("1.0", "//test_starlark:provider_grabber");
+ useConfiguration("--xcode_version_config=//x:config1");
+ assertXcodeVersion("1.0", "//x:provider_grabber");
- useConfiguration("--xcode_version_config=//test_starlark:config2");
- assertXcodeVersion("2.0", "//test_starlark:provider_grabber");
+ useConfiguration("--xcode_version_config=//x:config2");
+ assertXcodeVersion("2.0", "//x:provider_grabber");
}
// Verifies that the --xcode_version_config configuration value can be accessed via the
@@ -1597,7 +1592,7 @@
@Test
public void testConfigurationFieldForAspect() throws Exception {
scratch.file(
- "test_starlark/provider_grabber.bzl",
+ "x/provider_grabber.bzl",
"""
def _aspect_impl(target, ctx):
conf = ctx.attr._xcode_dep[apple_common.XcodeVersionConfig]
@@ -1631,10 +1626,10 @@
""");
scratch.file(
- "test_starlark/BUILD",
+ "x/BUILD",
"""
load("@rules_java//java:defs.bzl", "java_library")
- load("//test_starlark:provider_grabber.bzl", "provider_grabber")
+ load("//x:provider_grabber.bzl", "provider_grabber")
xcode_config(
name = "config1",
@@ -1668,11 +1663,11 @@
)
""");
- useConfiguration("--xcode_version_config=//test_starlark:config1");
- assertXcodeVersion("1.0", "//test_starlark:provider_grabber");
+ useConfiguration("--xcode_version_config=//x:config1");
+ assertXcodeVersion("1.0", "//x:provider_grabber");
- useConfiguration("--xcode_version_config=//test_starlark:config2");
- assertXcodeVersion("2.0", "//test_starlark:provider_grabber");
+ useConfiguration("--xcode_version_config=//x:config2");
+ assertXcodeVersion("2.0", "//x:provider_grabber");
}
@Test