Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rolling release #24513

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -27,22 +28,17 @@ public class AppleBootstrap implements Bootstrap {
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public final class XcodeVersionTest extends BuildViewTestCase {

@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()

Expand Down Expand Up @@ -72,7 +72,7 @@ def my_rule_impl(ctx):
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"])

Expand All @@ -95,7 +95,7 @@ def my_rule_impl(ctx):
(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");
Expand Down
Loading
Loading