Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove builtin Starlark apple_static_library from Bazel.
This CL also marks the --experimental_apple_mandatory_minimum_version option as a no-op, as the only Bazel rule it affected before this change was the native/builtin Starlark apple_static_library, which has been removed with this change.

PiperOrigin-RevId: 458254042
Change-Id: Ie810ec12b992e3820e7b28ce1551b0c44e077334
  • Loading branch information
Googler authored and Copybara-Service committed Jun 30, 2022
1 parent 361ce67 commit 589354c
Show file tree
Hide file tree
Showing 17 changed files with 321 additions and 792 deletions.
Expand Up @@ -19,7 +19,6 @@
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider.RuleSet;
import com.google.devtools.build.lib.bazel.rules.cpp.BazelCppSemantics;
import com.google.devtools.build.lib.bazel.rules.objc.BazelAppleStaticLibraryRule;
import com.google.devtools.build.lib.bazel.rules.objc.BazelObjcImportRule;
import com.google.devtools.build.lib.bazel.rules.objc.BazelObjcLibraryRule;
import com.google.devtools.build.lib.cmdline.RepositoryName;
Expand All @@ -33,7 +32,6 @@
import com.google.devtools.build.lib.rules.apple.swift.SwiftConfiguration;
import com.google.devtools.build.lib.rules.core.CoreRules;
import com.google.devtools.build.lib.rules.objc.AppleStarlarkCommon;
import com.google.devtools.build.lib.rules.objc.AppleStaticLibraryBaseRule;
import com.google.devtools.build.lib.rules.objc.J2ObjcConfiguration;
import com.google.devtools.build.lib.rules.objc.ObjcConfiguration;
import com.google.devtools.build.lib.rules.objc.ObjcImportBaseRule;
Expand All @@ -59,11 +57,8 @@ public void init(ConfiguredRuleClassProvider.Builder builder) {
// j2objc shouldn't be here!
builder.addConfigurationFragment(J2ObjcConfiguration.class);

builder.addRuleDefinition(new AppleStaticLibraryBaseRule());

builder.addRuleDefinition(new AppleCcToolchainRule());
builder.addRuleDefinition(new AppleToolchain.RequiresXcodeConfigRule(toolsRepository));
builder.addRuleDefinition(new BazelAppleStaticLibraryRule());
builder.addRuleDefinition(new BazelObjcImportRule());
builder.addRuleDefinition(new BazelObjcLibraryRule());
builder.addRuleDefinition(new ObjcImportBaseRule());
Expand Down

This file was deleted.

Expand Up @@ -44,13 +44,14 @@
/** Command-line options for building for Apple platforms. */
public class AppleCommandLineOptions extends FragmentOptions {
@Option(
name = "experimental_apple_mandatory_minimum_version",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.BUILD_FILE_SEMANTICS},
help = "Whether Apple rules must have a mandatory minimum_os_version attribute."
)
// TODO(b/37096178): This flag should be default-on and then be removed.
name = "experimental_apple_mandatory_minimum_version",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.LOSES_INCREMENTAL_STATE, OptionEffectTag.BUILD_FILE_SEMANTICS},
help =
"No-op. Kept here for backwards compatibility. This field will be removed in a "
+ "future release.")
// TODO(b/37096178): This flag should be removed.
public boolean mandatoryMinimumVersion;

@Option(
Expand Down
Expand Up @@ -45,7 +45,6 @@
import com.google.devtools.build.lib.rules.objc.ObjcProvider.Flag;
import com.google.devtools.build.lib.starlarkbuildapi.SplitTransitionProviderApi;
import com.google.devtools.build.lib.starlarkbuildapi.apple.AppleCommonApi;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import net.starlark.java.eval.Dict;
Expand Down Expand Up @@ -149,11 +148,6 @@ public Provider getAppleExecutableBinaryConstructor() {
return AppleExecutableBinaryInfo.STARLARK_CONSTRUCTOR;
}

@Override
public AppleStaticLibraryInfo.Provider getAppleStaticLibraryProvider() {
return AppleStaticLibraryInfo.STARLARK_CONSTRUCTOR;
}

@Override
public Provider getAppleDebugOutputsConstructor() {
return AppleDebugOutputsInfo.STARLARK_CONSTRUCTOR;
Expand Down Expand Up @@ -292,8 +286,12 @@ public StructImpl linkMultiArchStaticLibrary(
return (StructImpl)
ruleContext.callStarlarkOrThrowRuleError(
linkMultiArchLibrary,
ImmutableList.of(ruleContext.getStarlarkRuleContext(), splitTargetTriplets),
new HashMap<>());
ImmutableList.of(),
ImmutableMap.of(
"ctx",
ruleContext.getStarlarkRuleContext(),
"split_target_triplets",
splitTargetTriplets));
} catch (RuleErrorException exception) {
throw new EvalException(exception);
}
Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -54,11 +54,8 @@
import com.google.devtools.build.lib.util.FileType;
import com.google.devtools.build.lib.util.FileTypeSet;

/**
* Shared rule classes and associated utility code for Objective-C rules.
*/
/** Shared rule classes and associated utility code for Objective-C rules. */
public class ObjcRuleClasses {
static final String LIPO = "lipo";
static final String STRIP = "strip";

private ObjcRuleClasses() {
Expand Down
Expand Up @@ -21,7 +21,6 @@
import com.google.devtools.build.lib.starlarkbuildapi.FileApi;
import com.google.devtools.build.lib.starlarkbuildapi.SplitTransitionProviderApi;
import com.google.devtools.build.lib.starlarkbuildapi.StarlarkRuleContextApi;
import com.google.devtools.build.lib.starlarkbuildapi.apple.AppleStaticLibraryInfoApi.AppleStaticLibraryInfoProvider;
import com.google.devtools.build.lib.starlarkbuildapi.core.ProviderApi;
import com.google.devtools.build.lib.starlarkbuildapi.core.StructApi;
import com.google.devtools.build.lib.starlarkbuildapi.platform.ConstraintValueInfoApi;
Expand Down Expand Up @@ -155,19 +154,6 @@ public interface AppleCommonApi<
structField = true)
ProviderApi getAppleExecutableBinaryConstructor();

@StarlarkMethod(
name = "AppleStaticLibrary",
doc =
"The constructor/key for the <code>AppleStaticLibrary</code> provider.<p>"
+ "If a target propagates the <code>AppleStaticLibrary</code> provider, use "
+ "this as the key with which to retrieve it. Example:<br>"
+ "<pre class='language-python'>\n"
+ "dep = ctx.attr.deps[0]\n"
+ "p = dep[apple_common.AppleStaticLibrary]\n"
+ "</pre>",
structField = true)
AppleStaticLibraryInfoProvider<?, ?> getAppleStaticLibraryProvider();

@StarlarkMethod(
name = "AppleDebugOutputs",
doc =
Expand Down Expand Up @@ -395,8 +381,9 @@ StructApi linkMultiArchBinary(
name = "link_multi_arch_static_library",
doc =
"Links a (potentially multi-architecture) static library targeting Apple platforms."
+ " This method comprises a part of the <code>apple_static_library</code> rule logic,"
+ " and is exposed as an API to iterate on XCFrameworks support on Starlark.\n"
+ " This method comprises a part of the Starlark <code>apple_static_library</code>"
+ " rule logic, in the rules_apple domain and exists to aid in the migration of its"
+ " linking logic to Starlark in rules_apple.\n"
+ "<p>This API is <b>highly experimental</b> and subject to change at any time."
+ " Do not depend on the stability of this function at this time.",
parameters = {
Expand Down

0 comments on commit 589354c

Please sign in to comment.