Delete resource attributes from objc_library and objc_import.
The incompatible flag to disable these resources will be enabled by default in Bazel 0.25.
RELNOTES: objc_library does not support resource attributes any more. Please read #7594 for more info.
PiperOrigin-RevId: 244026921
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/ObjcRules.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/ObjcRules.java
index 9569f28..47b8e95 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/ObjcRules.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/ObjcRules.java
@@ -75,17 +75,14 @@
builder.addRuleDefinition(new ObjcImportRule());
builder.addRuleDefinition(new ObjcLibraryRule());
builder.addRuleDefinition(new ObjcRuleClasses.CoptsRule());
- builder.addRuleDefinition(new ObjcRuleClasses.BundlingRule());
builder.addRuleDefinition(new ObjcRuleClasses.DylibDependingRule(objcProtoAspect));
builder.addRuleDefinition(new ObjcRuleClasses.CompilingRule());
builder.addRuleDefinition(new ObjcRuleClasses.LinkingRule(objcProtoAspect));
builder.addRuleDefinition(new ObjcRuleClasses.PlatformRule());
builder.addRuleDefinition(new ObjcRuleClasses.MultiArchPlatformRule(objcProtoAspect));
- builder.addRuleDefinition(new ObjcRuleClasses.ResourcesRule());
builder.addRuleDefinition(new ObjcRuleClasses.AlwaysLinkRule());
builder.addRuleDefinition(new ObjcRuleClasses.SdkFrameworksDependerRule());
builder.addRuleDefinition(new ObjcRuleClasses.CompileDependencyRule());
- builder.addRuleDefinition(new ObjcRuleClasses.ResourceToolsRule());
builder.addRuleDefinition(new ObjcRuleClasses.XcrunRule());
builder.addRuleDefinition(new ObjcRuleClasses.LibtoolRule());
builder.addRuleDefinition(new ObjcRuleClasses.CrosstoolRule());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
deleted file mode 100644
index 2172af0..0000000
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
+++ /dev/null
@@ -1,519 +0,0 @@
-// Copyright 2015 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.build.lib.rules.objc;
-
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.ASSET_CATALOG;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.BUNDLE_FILE;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STRINGS;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.XCASSETS_DIR;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Verify;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.CommandLine;
-import com.google.devtools.build.lib.analysis.FilesToRunProvider;
-import com.google.devtools.build.lib.analysis.RuleContext;
-import com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction;
-import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
-import com.google.devtools.build.lib.analysis.actions.SpawnAction;
-import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode;
-import com.google.devtools.build.lib.collect.nestedset.NestedSet;
-import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform;
-import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
-import com.google.devtools.build.lib.rules.apple.AppleToolchain;
-import com.google.devtools.build.lib.rules.apple.XcodeConfigProvider;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
-import com.google.devtools.build.lib.vfs.PathFragment;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Support for generating iOS bundles which contain metadata (a plist file), assets, resources and
- * optionally a binary: registers actions that assemble resources and merge plists, provides data
- * to providers and validates bundle-related attributes.
- *
- * <p>Methods on this class can be called in any order without impacting the result.
- */
-final class BundleSupport {
-
- /**
- * Iterable wrapper used to strongly type arguments eventually passed to {@code actool}.
- */
- static final class ExtraActoolArgs extends IterableWrapper<String> {
- ExtraActoolArgs(Iterable<String> args) {
- super(args);
- }
-
- ExtraActoolArgs(String... args) {
- super(args);
- }
- }
-
- // TODO(cparsons): Take restricted interfaces of RuleContext instead of RuleContext (such as
- // RuleErrorConsumer).
- private final RuleContext ruleContext;
- private final AppleConfiguration appleConfiguration;
- private final ApplePlatform platform;
- private final ExtraActoolArgs extraActoolArgs;
- private final Bundling bundling;
- private final Attributes attributes;
-
- /**
- * Creates a new bundle support.
- *
- * @param ruleContext context this bundle is constructed in
- * @param appleConfiguration the configuration this bundle is constructed in
- * @param platform the platform this bundle is built for
- * @param bundling bundle information as configured for this rule
- * @param extraActoolArgs any additional parameters to be used for invoking {@code actool}
- */
- public BundleSupport(
- RuleContext ruleContext,
- AppleConfiguration appleConfiguration,
- ApplePlatform platform,
- Bundling bundling,
- ExtraActoolArgs extraActoolArgs) {
- this.ruleContext = ruleContext;
- this.appleConfiguration = appleConfiguration;
- this.platform = platform;
- this.extraActoolArgs = extraActoolArgs;
- this.bundling = bundling;
- this.attributes = new Attributes(ruleContext);
- }
-
- /**
- * Registers actions required for constructing this bundle, namely merging all involved {@code
- * Info.plist} files and generating asset catalogues.
- *
- * @param objcProvider source of information from this rule's attributes and its dependencies
- * @return this bundle support
- */
- BundleSupport registerActions(ObjcProvider objcProvider) {
- registerConvertStringsActions(objcProvider);
- registerConvertXibsActions(objcProvider);
- registerMomczipActions(objcProvider);
- registerInterfaceBuilderActions(objcProvider);
- registerActoolActionIfNecessary(objcProvider);
-
- if (bundling.needsToMergeInfoplist()) {
- NestedSet<Artifact> mergingContentArtifacts = bundling.getMergingContentArtifacts();
- Artifact mergedPlist = bundling.getBundleInfoplist().get();
- registerMergeInfoplistAction(
- mergingContentArtifacts, PlMergeControlBytes.fromBundling(bundling, mergedPlist));
- }
- return this;
- }
-
- /**
- * Validates the platform for this build is either simulator or device, and does not
- * contain architectures for both platforms.
- *
- * @return this bundle support
- */
- public BundleSupport validatePlatform() {
- ApplePlatform platform = null;
- for (String architecture : appleConfiguration.getIosMultiCpus()) {
- if (platform == null) {
- platform = ApplePlatform.forTarget(PlatformType.IOS, architecture);
- } else if (platform != ApplePlatform.forTarget(PlatformType.IOS, architecture)) {
- ruleContext.ruleError(
- String.format("In builds which require bundling, --ios_multi_cpus does not currently "
- + "allow values for both simulator and device builds. Flag was %s",
- appleConfiguration.getIosMultiCpus()));
- }
- }
- return this;
- }
-
- /**
- * Validates that resources defined in this rule and its dependencies and written to this
- * bundle are legal (for example that they are not mapped to the same bundle location).
- *
- * @return this bundle support
- */
- public BundleSupport validateResources(ObjcProvider objcProvider) {
- Map<String, Artifact> bundlePathToFile = new HashMap<>();
- NestedSet<Artifact> artifacts = objcProvider.get(STRINGS);
-
- Iterable<BundleableFile> bundleFiles =
- Iterables.concat(
- objcProvider.get(BUNDLE_FILE), BundleableFile.flattenedRawResourceFiles(artifacts));
- for (BundleableFile bundleFile : bundleFiles) {
- String bundlePath = bundleFile.getBundlePath();
- Artifact bundled = bundleFile.getBundled();
-
- // Normally any two resources mapped to the same path in the bundle are illegal. However, we
- // currently don't have a good solution for resources generated by a genrule in
- // multi-architecture builds: They map to the same bundle path but have different owners (the
- // genrules targets in the various configurations) and roots (one for each architecture).
- // Since we know that architecture shouldn't matter for strings file generation we silently
- // ignore cases like this and pick one of the outputs at random to put in the bundle (see also
- // related filtering code in Bundling.Builder.build()).
- if (bundlePathToFile.containsKey(bundlePath)) {
- Artifact original = bundlePathToFile.get(bundlePath);
- if (!Objects.equals(original.getOwner(), bundled.getOwner())) {
- ruleContext.ruleError(
- String.format(
- "Two files map to the same path [%s] in this bundle but come from different "
- + "locations: %s and %s",
- bundlePath,
- original.getOwner(),
- bundled.getOwner()));
- } else {
- Verify.verify(
- !original.getRoot().equals(bundled.getRoot()),
- "%s and %s should have different roots but have %s and %s",
- original,
- bundleFile,
- original.getRoot(),
- bundled.getRoot());
- }
-
- } else {
- bundlePathToFile.put(bundlePath, bundled);
- }
- }
- // TODO(bazel-team): Do the same validation for storyboards and datamodels which could also be
- // generated by genrules or doubly defined.
-
- return this;
- }
-
- /**
- * Returns a set containing the {@link TargetDeviceFamily} values which this bundle is targeting.
- * Returns an empty set for any invalid value of the target device families attribute.
- */
- ImmutableSet<TargetDeviceFamily> targetDeviceFamilies() {
- return bundling.getTargetDeviceFamilies();
- }
-
- /**
- * Returns true if this bundle is targeted to {@link TargetDeviceFamily#WATCH}, false otherwise.
- */
- boolean isBuildingForWatch() {
- return targetDeviceFamilies()
- .stream()
- .anyMatch(
- targetDeviceFamily ->
- targetDeviceFamily
- .name()
- .equalsIgnoreCase(TargetDeviceFamily.WATCH.getNameInRule()));
- }
-
- /**
- * Returns a set containing the {@link TargetDeviceFamily} values the resources in this bundle
- * are targeting. When watch is included as one of the families, (for example [iphone, watch] for
- * simulator builds, assets should always be compiled for {@link TargetDeviceFamily#WATCH}.
- */
- private ImmutableSet<TargetDeviceFamily> targetDeviceFamiliesForResources() {
- if (isBuildingForWatch()) {
- return ImmutableSet.of(TargetDeviceFamily.WATCH);
- } else {
- return targetDeviceFamilies();
- }
- }
-
- private void registerInterfaceBuilderActions(ObjcProvider objcProvider) {
- for (Artifact storyboardInput : objcProvider.get(ObjcProvider.STORYBOARD)) {
- String archiveRoot = storyboardArchiveRoot(storyboardInput);
- Artifact zipOutput = bundling.getIntermediateArtifacts()
- .compiledStoryboardZip(storyboardInput);
-
- ruleContext.registerAction(
- ObjcRuleClasses.spawnAppleEnvActionBuilder(
- XcodeConfigProvider.fromRuleContext(ruleContext), platform)
- .setMnemonic("StoryboardCompile")
- .setExecutable(attributes.ibtoolWrapper())
- .addCommandLine(ibActionsCommandLine(archiveRoot, zipOutput, storyboardInput))
- .addOutput(zipOutput)
- .addInput(storyboardInput)
- .build(ruleContext));
- }
- }
-
- /**
- * Returns the root file path to which storyboard interfaces are compiled.
- */
- protected String storyboardArchiveRoot(Artifact storyboardInput) {
- // When storyboards are compiled for {@link TargetDeviceFamily#WATCH}, return the containing
- // directory if it ends with .lproj to account for localization or "." representing the bundle
- // root otherwise. Examples: Payload/Foo.app/Base.lproj/<compiled_file>,
- // Payload/Foo.app/<compile_file_1>
- if (isBuildingForWatch()) {
- String containingDir = storyboardInput.getExecPath().getParentDirectory().getBaseName();
- return containingDir.endsWith(".lproj") ? (containingDir + "/") : ".";
- } else {
- return BundleableFile.flatBundlePath(storyboardInput.getExecPath()) + "c";
- }
- }
-
- private CommandLine ibActionsCommandLine(String archiveRoot, Artifact zipOutput,
- Artifact storyboardInput) {
- CustomCommandLine.Builder commandLine =
- CustomCommandLine.builder()
- .addPath(zipOutput.getExecPath())
- .addDynamicString(archiveRoot)
- .add("--minimum-deployment-target", bundling.getMinimumOsVersion().toString())
- .add("--module", ruleContext.getLabel().getName());
-
- for (TargetDeviceFamily targetDeviceFamily : targetDeviceFamiliesForResources()) {
- commandLine.add("--target-device", targetDeviceFamily.name().toLowerCase(Locale.US));
- }
-
- return commandLine.addPath(storyboardInput.getExecPath()).build();
- }
-
- private void registerMomczipActions(ObjcProvider objcProvider) {
- Iterable<Xcdatamodel> xcdatamodels = Xcdatamodels.xcdatamodels(
- bundling.getIntermediateArtifacts(), objcProvider.get(ObjcProvider.XCDATAMODEL));
- for (Xcdatamodel datamodel : xcdatamodels) {
- Artifact outputZip = datamodel.getOutputZip();
- ruleContext.registerAction(
- ObjcRuleClasses.spawnAppleEnvActionBuilder(
- XcodeConfigProvider.fromRuleContext(ruleContext), platform)
- .setMnemonic("MomCompile")
- .setExecutable(attributes.momcWrapper())
- .addOutput(outputZip)
- .addInputs(datamodel.getInputs())
- .addCommandLine(
- CustomCommandLine.builder()
- .addExecPath(outputZip)
- .addDynamicString(datamodel.archiveRootForMomczip())
- .addDynamicString("-XD_MOMC_SDKROOT=" + AppleToolchain.sdkDir())
- .addDynamicString(
- "-XD_MOMC_IOS_TARGET_VERSION=" + bundling.getMinimumOsVersion())
- .add("-MOMC_PLATFORMS")
- .addDynamicString(
- appleConfiguration
- .getMultiArchPlatform(PlatformType.IOS)
- .getLowerCaseNameInPlist())
- .add("-XD_MOMC_TARGET_VERSION=10.6")
- .addPath(datamodel.getContainer())
- .build())
- .build(ruleContext));
- }
- }
-
- private void registerConvertXibsActions(ObjcProvider objcProvider) {
- for (Artifact original : objcProvider.get(ObjcProvider.XIB)) {
- Artifact zipOutput = bundling.getIntermediateArtifacts().compiledXibFileZip(original);
- String archiveRoot = BundleableFile.flatBundlePath(
- FileSystemUtils.replaceExtension(original.getExecPath(), ".nib"));
-
- ruleContext.registerAction(
- ObjcRuleClasses.spawnAppleEnvActionBuilder(
- XcodeConfigProvider.fromRuleContext(ruleContext), platform)
- .setMnemonic("XibCompile")
- .setExecutable(attributes.ibtoolWrapper())
- .addCommandLine(ibActionsCommandLine(archiveRoot, zipOutput, original))
- .addOutput(zipOutput)
- .addInput(original)
- // Disable sandboxing due to Bazel issue #2189.
- .disableSandboxing()
- .build(ruleContext));
- }
- }
-
- private void registerConvertStringsActions(ObjcProvider objcProvider) {
- for (Artifact strings : objcProvider.get(ObjcProvider.STRINGS)) {
- Artifact bundled = bundling.getIntermediateArtifacts().convertedStringsFile(strings);
- ruleContext.registerAction(
- ObjcRuleClasses.spawnAppleEnvActionBuilder(
- XcodeConfigProvider.fromRuleContext(ruleContext), platform)
- .setMnemonic("ConvertStringsPlist")
- .setExecutable(PathFragment.create("/usr/bin/plutil"))
- .addCommandLine(
- CustomCommandLine.builder()
- .add("-convert")
- .add("binary1")
- .addExecPath("-o", bundled)
- .add("--")
- .addPath(strings.getExecPath())
- .build())
- .addInput(strings)
- .addInput(CompilationSupport.xcrunwrapper(ruleContext).getExecutable())
- .addOutput(bundled)
- .build(ruleContext));
- }
- }
-
- /**
- * Creates action to merge multiple Info.plist files of a bundle into a single Info.plist. The
- * merge action is necessary if there are more than one input plist files or we have a bundle ID
- * to stamp on the merged plist.
- */
- private void registerMergeInfoplistAction(
- NestedSet<Artifact> mergingContentArtifacts, PlMergeControlBytes controlBytes) {
- if (!bundling.needsToMergeInfoplist()) {
- return; // Nothing to do here.
- }
-
- Artifact plMergeControlArtifact = baseNameArtifact(ruleContext, ".plmerge-control");
-
- ruleContext.registerAction(
- new BinaryFileWriteAction(
- ruleContext.getActionOwner(),
- plMergeControlArtifact,
- controlBytes,
- /*makeExecutable=*/ false));
-
- ruleContext.registerAction(
- new SpawnAction.Builder()
- .setMnemonic("MergeInfoPlistFiles")
- .setExecutable(attributes.plmerge())
- .addTransitiveInputs(mergingContentArtifacts)
- .addOutput(bundling.getIntermediateArtifacts().mergedInfoplist())
- .addInput(plMergeControlArtifact)
- .addCommandLine(
- CustomCommandLine.builder()
- .addExecPath("--control", plMergeControlArtifact)
- .build())
- .build(ruleContext));
- }
-
- /**
- * Returns an {@link Artifact} with name prefixed with prefix given in {@link Bundling} if
- * available. This helps in creating unique artifact name when multiple bundles are created
- * with a different name than the target name.
- */
- private Artifact baseNameArtifact(RuleContext ruleContext, String artifactName) {
- String prefixedArtifactName;
- if (bundling.getArtifactPrefix() != null) {
- prefixedArtifactName = String.format("-%s%s", bundling.getArtifactPrefix(), artifactName);
- } else {
- prefixedArtifactName = artifactName;
- }
- return ObjcRuleClasses.artifactByAppendingToBaseName(ruleContext, prefixedArtifactName);
- }
-
- private void registerActoolActionIfNecessary(ObjcProvider objcProvider) {
- Optional<Artifact> actoolzipOutput = bundling.getActoolzipOutput();
- if (!actoolzipOutput.isPresent()) {
- return;
- }
-
- Artifact actoolPartialInfoplist = actoolPartialInfoplist(objcProvider).get();
- Artifact zipOutput = actoolzipOutput.get();
-
- // TODO(bazel-team): Do not use the deploy jar explicitly here. There is currently a bug where
- // we cannot .setExecutable({java_binary target}) and set REQUIRES_DARWIN in the execution info.
- // Note that below we set the archive root to the empty string. This means that the generated
- // zip file will be rooted at the bundle root, and we have to prepend the bundle root to each
- // entry when merging it with the final .ipa file.
- ruleContext.registerAction(
- ObjcRuleClasses.spawnAppleEnvActionBuilder(
- XcodeConfigProvider.fromRuleContext(ruleContext), platform)
- .setMnemonic("AssetCatalogCompile")
- .setExecutable(attributes.actoolWrapper())
- .addTransitiveInputs(objcProvider.get(ASSET_CATALOG))
- .addOutput(zipOutput)
- .addOutput(actoolPartialInfoplist)
- .addCommandLine(actoolzipCommandLine(objcProvider, zipOutput, actoolPartialInfoplist))
- .disableSandboxing()
- .build(ruleContext));
- }
-
- private CommandLine actoolzipCommandLine(ObjcProvider provider, Artifact zipOutput,
- Artifact partialInfoPlist) {
- PlatformType platformType = PlatformType.IOS;
- // watchOS 1 and 2 use different platform arguments. It is likely that versions 2 and later will
- // use the watchos platform whereas watchOS 1 uses the iphone platform.
- if (isBuildingForWatch() && bundling.getBundleDir().startsWith("Watch")) {
- platformType = PlatformType.WATCHOS;
- }
- CustomCommandLine.Builder commandLine =
- CustomCommandLine.builder()
- .addPath(zipOutput.getExecPath())
- .add(
- "--platform",
- appleConfiguration.getMultiArchPlatform(platformType).getLowerCaseNameInPlist())
- .addExecPath("--output-partial-info-plist", partialInfoPlist)
- .add("--minimum-deployment-target", bundling.getMinimumOsVersion().toString());
-
- for (TargetDeviceFamily targetDeviceFamily : targetDeviceFamiliesForResources()) {
- commandLine.add("--target-device", targetDeviceFamily.name().toLowerCase(Locale.US));
- }
-
- return commandLine
- .addAll(
- ImmutableList.copyOf(
- Iterables.transform(provider.get(XCASSETS_DIR), PathFragment::getSafePathString)))
- .addAll(ImmutableList.copyOf(extraActoolArgs))
- .build();
- }
-
-
- /**
- * Returns the artifact that is a plist file generated by an invocation of {@code actool} or
- * {@link Optional#absent()} if no asset catalogues are present in this target and its
- * dependencies.
- *
- * <p>All invocations of {@code actool} generate this kind of plist file, which contains metadata
- * about the {@code app_icon} and {@code launch_image} if supplied. If neither an app icon or a
- * launch image was supplied, the plist file generated is empty.
- */
- private Optional<Artifact> actoolPartialInfoplist(ObjcProvider objcProvider) {
- if (objcProvider.hasAssetCatalogs()) {
- return Optional.of(bundling.getIntermediateArtifacts().actoolPartialInfoplist());
- } else {
- return Optional.absent();
- }
- }
-
- /**
- * Common rule attributes used by a bundle support.
- */
- private static class Attributes {
- private final RuleContext ruleContext;
-
- private Attributes(RuleContext ruleContext) {
- this.ruleContext = ruleContext;
- }
-
- /**
- * Returns a reference to the plmerge executable.
- */
- FilesToRunProvider plmerge() {
- return ruleContext.getExecutablePrerequisite("$plmerge", Mode.HOST);
- }
-
- /**
- * Returns the location of the ibtoolwrapper tool.
- */
- FilesToRunProvider ibtoolWrapper() {
- return ruleContext.getExecutablePrerequisite("$ibtoolwrapper", Mode.HOST);
- }
-
- /**
- * Returns the location of the momcwrapper.
- */
- FilesToRunProvider momcWrapper() {
- return ruleContext.getExecutablePrerequisite("$momcwrapper", Mode.HOST);
- }
-
- /**
- * Returns the location of the actoolwrapper.
- */
- FilesToRunProvider actoolWrapper() {
- return ruleContext.getExecutablePrerequisite("$actoolwrapper", Mode.HOST);
- }
- }
-}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java b/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
index bc7b2db..538e8e4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
@@ -28,8 +28,6 @@
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STRINGS;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.XCDATAMODEL;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.XIB;
-import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingRule.FAMILIES_ATTR;
-import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingRule.INFOPLIST_ATTR;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
@@ -39,8 +37,6 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.analysis.RuleContext;
-import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
@@ -144,27 +140,6 @@
return this;
}
- /**
- * Adds any info plists specified in the given rule's {@code infoplist} or {@code infoplists}
- * attribute as well as from its {@code options} as inputs to this bundle's {@code Info.plist}
- * (which is merged from any such added plists plus some additional information).
- */
- public Builder addInfoplistInputFromRule(RuleContext ruleContext) {
- Artifact infoplist =
- ruleContext.getPrerequisiteArtifact(INFOPLIST_ATTR, Mode.TARGET);
- if (infoplist != null) {
- infoplistInputs.add(infoplist);
- }
-
- Iterable<Artifact> infoplists =
- ruleContext.getPrerequisiteArtifacts("infoplists", Mode.TARGET).list();
- if (infoplists != null) {
- infoplistInputs.addAll(infoplists);
- }
-
- return this;
- }
-
public Builder setIntermediateArtifacts(IntermediateArtifacts intermediateArtifacts) {
this.intermediateArtifacts = intermediateArtifacts;
return this;
@@ -321,10 +296,10 @@
* set of files returned.
*
* <p>Files can have the same bundle path for various illegal reasons and errors are raised for
- * that separately (see {@link BundleSupport#validateResources}). There are situations though
- * where the same file exists multiple times (for example in multi-architecture builds) and
- * would conflict when creating the bundle. In all these cases it shouldn't matter which one is
- * included and this class will select the first one.
+ * that separately. There are situations though where the same file exists multiple times (for
+ * example in multi-architecture builds) and would conflict when creating the bundle. In all
+ * these cases it shouldn't matter which one is included and this class will select the first
+ * one.
*/
ImmutableList<BundleableFile> deduplicateByBundlePaths(
ImmutableList<BundleableFile> bundleFiles) {
@@ -339,8 +314,8 @@
}
public Bundling build() {
- Preconditions.checkNotNull(intermediateArtifacts, "intermediateArtifacts");
- Preconditions.checkNotNull(families, FAMILIES_ATTR);
+ Preconditions.checkNotNull(intermediateArtifacts, "intermediateArtifacts should not be null");
+ Preconditions.checkNotNull(families, "families should not be null");
NestedSet<Artifact> bundleInfoplistInputs = bundleInfoplistInputs();
Optional<Artifact> bundleInfoplist = bundleInfoplist(bundleInfoplistInputs);
Optional<Artifact> actoolzipOutput = actoolzipOutput();
@@ -631,8 +606,8 @@
}
/**
- * Returns the list of {@link TargetDeviceFamily} values this bundle is targeting.
- * If empty, the default values specified by {@link FAMILIES_ATTR} will be used.
+ * Returns the list of {@link TargetDeviceFamily} values this bundle is targeting. If empty, the
+ * default values specified by "families" will be used.
*/
public ImmutableSet<TargetDeviceFamily> getTargetDeviceFamilies() {
return families;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
index db7c4b5..fba2351 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
@@ -319,7 +319,7 @@
OptionMetadataTag.INCOMPATIBLE_CHANGE,
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
},
- help = "If enabled, objc_library resource attributes are disallowed.")
+ help = "Unused. Will be removed in future versions of Bazel.")
public boolean disableObjcLibraryResources;
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
index 39bdcda..fcf940a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
@@ -14,9 +14,6 @@
package com.google.devtools.build.lib.rules.objc;
-import static com.google.devtools.build.lib.packages.BuildType.LABEL;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.ASSET_CATALOG;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.BUNDLE_FILE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.CC_LIBRARY;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.DEFINE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.DYNAMIC_FRAMEWORK_DIR;
@@ -40,14 +37,9 @@
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.SDK_FRAMEWORK;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.SOURCE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STATIC_FRAMEWORK_FILE;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STORYBOARD;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STRINGS;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.TOP_LEVEL_MODULE_MAP;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.UMBRELLA_HEADER;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.WEAK_SDK_FRAMEWORK;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.XCASSETS_DIR;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.XCDATAMODEL;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.XIB;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
@@ -61,7 +53,6 @@
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
-import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.packages.BuiltinProvider;
import com.google.devtools.build.lib.packages.Info;
@@ -101,53 +92,11 @@
return inputs.build();
}
- /**
- * Provides a way to access attributes that are common to all resources rules.
- */
- // TODO(bazel-team): Delete and move into support-specific attributes classes once ObjcCommon is
- // gone.
- static final class ResourceAttributes {
- private final RuleContext ruleContext;
-
- ResourceAttributes(RuleContext ruleContext) {
- this.ruleContext = ruleContext;
- }
-
- ImmutableList<Artifact> strings() {
- return ruleContext.getPrerequisiteArtifacts("strings", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> xibs() {
- return ruleContext.getPrerequisiteArtifacts("xibs", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> storyboards() {
- return ruleContext.getPrerequisiteArtifacts("storyboards", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> resources() {
- return ruleContext.getPrerequisiteArtifacts("resources", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> structuredResources() {
- return ruleContext.getPrerequisiteArtifacts("structured_resources", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> datamodels() {
- return ruleContext.getPrerequisiteArtifacts("datamodels", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> assetCatalogs() {
- return ruleContext.getPrerequisiteArtifacts("asset_catalogs", Mode.TARGET).list();
- }
- }
-
static class Builder {
private final RuleContext context;
private final StarlarkSemantics semantics;
private final BuildConfiguration buildConfiguration;
private Optional<CompilationAttributes> compilationAttributes = Optional.absent();
- private Optional<ResourceAttributes> resourceAttributes = Optional.absent();
private Iterable<SdkFramework> extraSdkFrameworks = ImmutableList.of();
private Iterable<SdkFramework> extraWeakSdkFrameworks = ImmutableList.of();
private Iterable<String> extraSdkDylibs = ImmutableList.of();
@@ -199,15 +148,6 @@
return this;
}
- public Builder setResourceAttributes(ResourceAttributes baseResourceAttributes) {
- Preconditions.checkState(
- !this.resourceAttributes.isPresent(),
- "resourceAttributes is already set to: %s",
- this.resourceAttributes);
- this.resourceAttributes = Optional.of(baseResourceAttributes);
- return this;
- }
-
Builder addExtraSdkFrameworks(Iterable<SdkFramework> extraSdkFrameworks) {
this.extraSdkFrameworks = Iterables.concat(this.extraSdkFrameworks, extraSdkFrameworks);
return this;
@@ -398,12 +338,9 @@
ObjcCommon build() {
- Iterable<BundleableFile> bundleImports = BundleableFile.bundleImportsFromRule(context);
-
ObjcProvider.Builder objcProvider =
new ObjcProvider.Builder(semantics)
.addAll(IMPORTED_LIBRARY, extraImportLibraries)
- .addAll(BUNDLE_FILE, bundleImports)
.addAll(SDK_FRAMEWORK, extraSdkFrameworks)
.addAll(WEAK_SDK_FRAMEWORK, extraWeakSdkFrameworks)
.addAll(SDK_DYLIB, extraSdkDylibs)
@@ -485,33 +422,6 @@
.addAll(SDK_DYLIB, attributes.sdkDylibs());
}
- if (resourceAttributes.isPresent()) {
- ResourceAttributes attributes = resourceAttributes.get();
- objcProvider
- .addAll(BUNDLE_FILE, BundleableFile.flattenedRawResourceFiles(attributes.resources()))
- .addAll(
- BUNDLE_FILE,
- BundleableFile.structuredRawResourceFiles(attributes.structuredResources()))
- .addAll(
- XCASSETS_DIR,
- uniqueContainers(attributes.assetCatalogs(), ASSET_CATALOG_CONTAINER_TYPE))
- .addAll(ASSET_CATALOG, attributes.assetCatalogs())
- .addAll(XCDATAMODEL, attributes.datamodels())
- .addAll(XIB, attributes.xibs())
- .addAll(STRINGS, attributes.strings())
- .addAll(STORYBOARD, attributes.storyboards());
- }
-
- if (useLaunchStoryboard(context)) {
- Artifact launchStoryboard =
- context.getPrerequisiteArtifact("launch_storyboard", Mode.TARGET);
- if (ObjcRuleClasses.STORYBOARD_TYPE.matches(launchStoryboard.getPath())) {
- objcProvider.add(STORYBOARD, launchStoryboard);
- } else {
- objcProvider.add(XIB, launchStoryboard);
- }
- }
-
for (CompilationArtifacts artifacts : compilationArtifacts.asSet()) {
Iterable<Artifact> allSources =
Iterables.concat(artifacts.getSrcs(), artifacts.getNonArcSrcs());
@@ -608,18 +518,6 @@
return false;
}
}
-
- /**
- * Returns {@code true} if the given rule context has a launch storyboard set.
- */
- private static boolean useLaunchStoryboard(RuleContext ruleContext) {
- if (!ruleContext.attributes().has("launch_storyboard", LABEL)) {
- return false;
- }
- Artifact launchStoryboard =
- ruleContext.getPrerequisiteArtifact("launch_storyboard", Mode.TARGET);
- return launchStoryboard != null;
- }
}
static final FileType BUNDLE_CONTAINER_TYPE = FileType.of(".bundle");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcImport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcImport.java
index c01a04f..1f0901c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcImport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcImport.java
@@ -22,7 +22,6 @@
import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.rules.cpp.CppModuleMap;
-import com.google.devtools.build.lib.rules.objc.ObjcCommon.ResourceAttributes;
import com.google.devtools.build.lib.syntax.Type;
/**
@@ -36,15 +35,11 @@
new ObjcCommon.Builder(ruleContext)
.setCompilationAttributes(
CompilationAttributes.Builder.fromRuleContext(ruleContext).build())
- .setResourceAttributes(new ResourceAttributes(ruleContext))
.setIntermediateArtifacts(ObjcRuleClasses.intermediateArtifacts(ruleContext))
.setAlwayslink(ruleContext.attributes().get("alwayslink", Type.BOOLEAN))
.setHasModuleMap()
.addExtraImportLibraries(
ruleContext.getPrerequisiteArtifacts("archives", Mode.TARGET).list())
- .addDepObjcProviders(
- ruleContext.getPrerequisites(
- "bundles", Mode.TARGET, ObjcProvider.SKYLARK_CONSTRUCTOR))
.build();
NestedSetBuilder<Artifact> filesToBuild = NestedSetBuilder.stableOrder();
@@ -63,8 +58,6 @@
.registerGenerateModuleMapAction(moduleMap, publicHeaders)
.validateAttributes();
- new ResourceSupport(ruleContext).validateAttributes();
-
return ObjcRuleClasses.ruleConfiguredTarget(ruleContext, filesToBuild.build())
.addNativeDeclaredProvider(common.getObjcProvider())
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcLibrary.java
index 946614b..ed028c7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcLibrary.java
@@ -30,7 +30,6 @@
import com.google.devtools.build.lib.rules.cpp.LibraryToLink;
import com.google.devtools.build.lib.rules.cpp.LibraryToLink.CcLinkingContext;
import com.google.devtools.build.lib.rules.cpp.LibraryToLink.CcLinkingContext.LinkOptions;
-import com.google.devtools.build.lib.rules.objc.ObjcCommon.ResourceAttributes;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import java.util.Map;
@@ -48,13 +47,10 @@
return new ObjcCommon.Builder(ruleContext)
.setCompilationAttributes(
CompilationAttributes.Builder.fromRuleContext(ruleContext).build())
- .setResourceAttributes(new ResourceAttributes(ruleContext))
.addDefines(ruleContext.getExpander().withDataLocations().tokenized("defines"))
.setCompilationArtifacts(CompilationSupport.compilationArtifacts(ruleContext))
.addDeps(ruleContext.getPrerequisiteConfiguredTargetAndTargets("deps", Mode.TARGET))
.addRuntimeDeps(ruleContext.getPrerequisites("runtime_deps", Mode.TARGET))
- .addDepObjcProviders(
- ruleContext.getPrerequisites("bundles", Mode.TARGET, ObjcProvider.SKYLARK_CONSTRUCTOR))
.setIntermediateArtifacts(ObjcRuleClasses.intermediateArtifacts(ruleContext))
.setAlwayslink(ruleContext.attributes().get("alwayslink", Type.BOOLEAN))
.setHasModuleMap()
@@ -87,8 +83,6 @@
ruleContext.getImplicitOutputArtifact(CompilationSupport.FULLY_LINKED_LIB))
.validateAttributes();
- new ResourceSupport(ruleContext).validateAttributes();
-
J2ObjcMappingFileProvider j2ObjcMappingFileProvider = J2ObjcMappingFileProvider.union(
ruleContext.getPrerequisites("deps", Mode.TARGET, J2ObjcMappingFileProvider.class));
J2ObjcEntryClassProvider j2ObjcEntryClassProvider = new J2ObjcEntryClassProvider.Builder()
@@ -177,27 +171,6 @@
/** Throws errors or warnings for bad attribute state. */
private static void validateAttributes(RuleContext ruleContext) throws RuleErrorException {
- if (ObjcRuleClasses.objcConfiguration(ruleContext).disableObjcLibraryResources()) {
- ImmutableList<String> resourceAttributes =
- ImmutableList.of(
- "asset_catalogs",
- "bundles",
- "datamodels",
- "resources",
- "storyboards",
- "strings",
- "structured_resources",
- "xibs");
- for (String attribute : resourceAttributes) {
- if (ruleContext.attributes().isAttributeValueExplicitlySpecified(attribute)) {
- ruleContext.throwWithAttributeError(
- attribute,
- "objc_library resource attributes are not allowed. Please use the 'data' "
- + "attribute instead.");
- }
- }
- }
-
for (String copt : ObjcCommon.getNonCrosstoolCopts(ruleContext)) {
if (copt.contains("-fmodules-cache-path")) {
ruleContext.ruleWarning(CompilationSupport.MODULES_CACHE_PATH_WARNING);
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 3edb128..0f0260b 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
@@ -42,14 +42,12 @@
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.packages.Attribute;
import com.google.devtools.build.lib.packages.Attribute.LabelLateBoundDefault;
-import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.ImplicitOutputsFunction.SafeImplicitOutputsFunction;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
import com.google.devtools.build.lib.packages.SkylarkProviderIdentifier;
import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
import com.google.devtools.build.lib.rules.apple.ApplePlatform;
-import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.apple.AppleToolchain.RequiresXcodeConfigRule;
import com.google.devtools.build.lib.rules.apple.XcodeConfigProvider;
import com.google.devtools.build.lib.rules.cpp.CcToolchain;
@@ -353,158 +351,6 @@
static final FileType COVERAGE_NOTES = FileType.of(".gcno");
/**
- * Common attributes for {@code objc_*} rules that allow the definition of resources such as
- * storyboards. These resources are used during compilation of the declaring rule as well as when
- * bundling a dependent bundle (application, extension, etc.).
- */
- public static class ResourcesRule implements RuleDefinition {
- @Override
- public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
- return builder
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(strings) -->
- Files which are plists of strings, often localizable.
-
- These files are converted to binary plists (if they are not already)
- and placed in the bundle root of the final package. If this file's
- immediate containing directory is named *.lproj (e.g. en.lproj,
- Base.lproj), it will be placed under a directory of that name in the
- final bundle. This allows for localizable strings.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr("strings", LABEL_LIST)
- .allowedFileTypes(STRINGS_TYPE)
- .direct_compile_time_input())
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(xibs) -->
- Files which are .xib resources, possibly localizable.
-
- These files are compiled to .nib files and placed the bundle root of
- the final package. If this file's immediate containing directory is
- named *.lproj (e.g. en.lproj, Base.lproj), it will be placed under a
- directory of that name in the final bundle. This allows for
- localizable UI.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("xibs", LABEL_LIST).direct_compile_time_input().allowedFileTypes(XIB_TYPE))
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(storyboards) -->
- Files which are .storyboard resources, possibly localizable.
-
- These files are compiled to .storyboardc directories, which are
- placed in the bundle root of the final package. If the storyboards's
- immediate containing directory is named *.lproj (e.g. en.lproj,
- Base.lproj), it will be placed under a directory of that name in the
- final bundle. This allows for localizable UI.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("storyboards", LABEL_LIST).allowedFileTypes(STORYBOARD_TYPE))
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(resources) -->
- Files to include in the final application bundle.
-
- Files that are processable resources, like .xib, .storyboard, .strings, .png, and others,
- will be processed by the Apple bundling rules that have those files as dependencies. Other
- file types that are not processed will be copied verbatim.
-
- These files are placed in the root of the bundle (e.g. Payload/foo.app/...) in most cases.
- However, if they appear to be localized (i.e. are contained in a
- directory called *.lproj), they will be placed in a directory of the
- same name in the app bundle.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("resources", LABEL_LIST).legacyAllowAnyFileType().direct_compile_time_input())
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(structured_resources) -->
- Files to include in the final application bundle.
-
- They are not processed or compiled in any way besides the processing
- done by the rules that actually generate them. In differences to
- <code>resources</code> these files are placed in the bundle root in
- the same structure passed to this argument, so
- <code>["res/foo.png"]</code> will end up in
- <code>Payload/foo.app/res/foo.png</code>.
- <p>Note that in the generated Xcode project file, all files in the top directory of
- the specified files will be included in the Xcode-generated app bundle. So
- specifying <code>["res/foo.png"]</code> will lead to the inclusion of all files in
- directory <code>res</code>.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr("structured_resources", LABEL_LIST)
- .legacyAllowAnyFileType()
- .direct_compile_time_input())
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(datamodels) -->
- Files that comprise the data models of the final linked binary.
-
- Each file must have a containing directory named *.xcdatamodel, which
- is usually contained by another *.xcdatamodeld (note the added d)
- directory.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("datamodels", LABEL_LIST).legacyAllowAnyFileType().direct_compile_time_input())
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(asset_catalogs) -->
- Files that comprise the asset catalogs of the final linked binary.
-
- Each file must have a containing directory named *.xcassets. This
- containing directory becomes the root of one of the asset catalogs
- linked with any binary that depends directly or indirectly on this
- target.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr("asset_catalogs", LABEL_LIST)
- .legacyAllowAnyFileType()
- .direct_compile_time_input())
- /* <!-- #BLAZE_RULE($objc_resources_rule).ATTRIBUTE(bundles) -->
- The list of bundle targets that this target requires to be included
- in the final bundle.
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr("bundles", LABEL_LIST)
- .direct_compile_time_input()
- // TODO(b/33618143): The native resource attributes are deprecated and will be
- // removed in the near future. By adding the new rule names here, the migration
- // path towards the end state is easier, as it will allow breaking the migration
- // into smaller chunks.
- .allowedRuleClasses("apple_bundle_import", "apple_resource_bundle")
- .allowedFileTypes())
- .build();
- }
- @Override
- public Metadata getMetadata() {
- return RuleDefinition.Metadata.builder()
- .name("$objc_resources_rule")
- .type(RuleClassType.ABSTRACT)
- .ancestors(ResourceToolsRule.class, XcrunRule.class)
- .build();
- }
- }
-
- /**
- * Common attributes for {@code objc_*} rules that process resources (by defining or consuming
- * them).
- */
- public static class ResourceToolsRule implements RuleDefinition {
- @Override
- public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
- return builder
- .add(
- attr("$plmerge", LABEL)
- .cfg(HostTransition.createFactory())
- .exec()
- .value(env.getToolsLabel("//tools/objc:plmerge")))
- .add(
- attr("$actoolwrapper", LABEL)
- .cfg(HostTransition.createFactory())
- .exec()
- .value(env.getToolsLabel("//tools/objc:actoolwrapper")))
- .add(
- attr("$ibtoolwrapper", LABEL)
- .cfg(HostTransition.createFactory())
- .exec()
- .value(env.getToolsLabel("//tools/objc:ibtoolwrapper")))
- .build();
- }
- @Override
- public Metadata getMetadata() {
- return RuleDefinition.Metadata.builder()
- .name("$objc_resource_tools_rule")
- .type(RuleClassType.ABSTRACT)
- .build();
- }
- }
-
- /**
* Common attributes for {@code objc_*} rules that depend on a crosstool.
*/
public static class CrosstoolRule implements RuleDefinition {
@@ -594,7 +440,7 @@
return RuleDefinition.Metadata.builder()
.name("$objc_compile_dependency_rule")
.type(RuleClassType.ABSTRACT)
- .ancestors(ResourcesRule.class, SdkFrameworksDependerRule.class)
+ .ancestors(SdkFrameworksDependerRule.class)
.build();
}
}
@@ -1053,97 +899,6 @@
}
/**
- * Common attributes for {@code objc_*} rules that create a bundle. Specifically, for rules
- * which use the {@link Bundling} helper class.
- */
- public static class BundlingRule implements RuleDefinition {
- static final String INFOPLIST_ATTR = "infoplist";
- static final String FAMILIES_ATTR = "families";
-
- @Override
- public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
- return builder
- /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(infoplist)[DEPRECATED] -->
- The infoplist file. This corresponds to <i>appname</i>-Info.plist in Xcode projects.
-
- <p>Bazel will perform variable substitution on the plist file for the following values
- (if they are strings in the top-level <code>dict</code> of the plist):</p>
-
- <ul>
- <li><code>${EXECUTABLE_NAME}</code>: The name of the executable generated and included
- in the bundle by blaze, which can be used as the value for
- <code>CFBundleExecutable</code> within the plist.
- <li><code>${BUNDLE_NAME}</code>: This target's name and bundle suffix (.bundle or .app)
- in the form<code><var>name</var></code>.<code>suffix</code>.
- <li><code>${PRODUCT_NAME}</code>: This target's name.
- </ul>
-
- <p>The key in <code>${}</code> may be suffixed with <code>:rfc1034identifier</code> (for
- example <code>${PRODUCT_NAME::rfc1034identifier}</code>) in which case Bazel will
- replicate Xcode's behavior and replace non-RFC1034-compliant characters with
- <code>-</code>.</p>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr(INFOPLIST_ATTR, LABEL).allowedFileTypes(PLIST_TYPE))
- /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(infoplists) -->
- Infoplist files to be merged. The merged output corresponds to <i>appname</i>-Info.plist
- in Xcode projects. Duplicate keys between infoplist files will cause an error if
- and only if the values conflict. If both <code>infoplist</code> and
- <code>infoplists</code> are specified, the files defined in both attributes will be used.
-
- <p>Bazel will perform variable substitution on the plist file for the following values
- (if they are strings in the top-level <code>dict</code> of the plist):</p>
-
- <ul>
- <li><code>${EXECUTABLE_NAME}</code>: The name of the executable generated and included
- in the bundle by blaze, which can be used as the value for
- <code>CFBundleExecutable</code> within the plist.
- <li><code>${BUNDLE_NAME}</code>: This target's name and bundle suffix (.bundle or .app)
- in the form<code><var>name</var></code>.<code>suffix</code>.
- <li><code>${PRODUCT_NAME}</code>: This target's name.
- </ul>
-
- <p>The key in <code>${}</code> may be suffixed with <code>:rfc1034identifier</code> (for
- example <code>${PRODUCT_NAME::rfc1034identifier}</code>) in which case Bazel will
- replicate Xcode's behavior and replace non-RFC1034-compliant characters with
- <code>-</code>.</p>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("infoplists", BuildType.LABEL_LIST).allowedFileTypes(PLIST_TYPE))
- /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(families) -->
- The device families to which this bundle or binary is targeted.
-
- This is known as the <code>TARGETED_DEVICE_FAMILY</code> build setting
- in Xcode project files. It is a list of one or more of the strings
- <code>"iphone"</code> and <code>"ipad"</code>.
-
- <p>By default this is set to <code>"iphone"</code>, if explicitly specified may not be
- empty.</p>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(
- attr(FAMILIES_ATTR, STRING_LIST)
- .value(ImmutableList.of(TargetDeviceFamily.IPHONE.getNameInRule())))
- .add(
- attr("$momcwrapper", LABEL)
- .cfg(HostTransition.createFactory())
- .exec()
- .value(env.getToolsLabel("//tools/objc:momcwrapper")))
- .build();
- }
-
- @Override
- public Metadata getMetadata() {
- return RuleDefinition.Metadata.builder()
- .name("$objc_bundling_rule")
- .type(RuleClassType.ABSTRACT)
- .ancestors(
- AppleToolchain.RequiresXcodeConfigRule.class,
- ResourcesRule.class,
- ResourceToolsRule.class,
- XcrunRule.class)
- .build();
- }
- }
-
- /**
* Common attributes for {@code objc_*} rules that need to call xcrun.
*/
public static class XcrunRule implements RuleDefinition {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ResourceSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ResourceSupport.java
deleted file mode 100644
index 8d8b0bf..0000000
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ResourceSupport.java
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2015 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.build.lib.rules.objc;
-
-import com.google.common.collect.HashMultiset;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Multiset;
-import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.analysis.RuleContext;
-import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode;
-
-/**
- * Support for resource processing on Objc rules.
- *
- * <p>Methods on this class can be called in any order without impacting the result.
- */
-final class ResourceSupport {
- private final RuleContext ruleContext;
- private final Attributes attributes;
-
- /**
- * Creates a new resource support for the given context.
- */
- ResourceSupport(RuleContext ruleContext) {
- this.ruleContext = ruleContext;
- this.attributes = new Attributes(ruleContext);
- }
-
- /**
- * Validates resource attributes on this rule.
- *
- * @return this resource support
- */
- ResourceSupport validateAttributes() {
- Iterable<String> assetCatalogErrors = ObjcCommon.notInContainerErrors(
- attributes.assetCatalogs(), ObjcCommon.ASSET_CATALOG_CONTAINER_TYPE);
- for (String error : assetCatalogErrors) {
- ruleContext.attributeError("asset_catalogs", error);
- }
-
- Iterable<String> dataModelErrors =
- ObjcCommon.notInContainerErrors(attributes.datamodels(), Xcdatamodels.CONTAINER_TYPES);
- for (String error : dataModelErrors) {
- ruleContext.attributeError("datamodels", error);
- }
-
- Multiset<Artifact> resources = HashMultiset.create();
- resources.addAll(attributes.resources());
- resources.addAll(attributes.structuredResources());
- resources.addAll(attributes.strings());
- resources.addAll(attributes.assetCatalogs());
- resources.addAll(attributes.datamodels());
- resources.addAll(attributes.xibs());
- resources.addAll(attributes.storyboards());
-
- for (Multiset.Entry<Artifact> entry : resources.entrySet()) {
- if (entry.getCount() > 1) {
- ruleContext.ruleError(
- "The same file was included multiple times in this rule: "
- + entry.getElement().getRootRelativePathString());
- }
- }
-
- return this;
- }
-
- private static class Attributes {
- private final RuleContext ruleContext;
-
- Attributes(RuleContext ruleContext) {
- this.ruleContext = ruleContext;
- }
-
- ImmutableList<Artifact> datamodels() {
- return ruleContext.getPrerequisiteArtifacts("datamodels", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> assetCatalogs() {
- return ruleContext.getPrerequisiteArtifacts("asset_catalogs", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> strings() {
- return ruleContext.getPrerequisiteArtifacts("strings", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> xibs() {
- return ruleContext
- .getPrerequisiteArtifacts("xibs", Mode.TARGET)
- .errorsForNonMatching(ObjcRuleClasses.XIB_TYPE)
- .list();
- }
-
- ImmutableList<Artifact> storyboards() {
- return ruleContext.getPrerequisiteArtifacts("storyboards", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> resources() {
- return ruleContext.getPrerequisiteArtifacts("resources", Mode.TARGET).list();
- }
-
- ImmutableList<Artifact> structuredResources() {
- return ruleContext.getPrerequisiteArtifacts("structured_resources", Mode.TARGET).list();
- }
- }
-}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
index ebaf09e..751e9cf 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
@@ -99,38 +99,6 @@
}
@Test
- public void testAvoidDepsProviders() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=false");
- scratch.file(
- "package/BUILD",
- "apple_static_library(",
- " name = 'test',",
- " deps = [':objcLib'],",
- " platform_type = 'ios',",
- " avoid_deps = [':avoidLib'],",
- ")",
- "objc_library(name = 'objcLib', srcs = [ 'b.m' ], deps = [':avoidLib', ':baseLib'])",
- "objc_library(",
- " name = 'baseLib',",
- " srcs = [ 'base.m' ],",
- " sdk_frameworks = ['BaseSDK'],",
- " resources = [':base.png']",
- ")",
- "objc_library(",
- " name = 'avoidLib',",
- " srcs = [ 'c.m' ],",
- " sdk_frameworks = ['AvoidSDK'],",
- " resources = [':avoid.png']",
- ")");
-
- ObjcProvider provider = getConfiguredTarget("//package:test")
- .get(AppleStaticLibraryInfo.SKYLARK_CONSTRUCTOR).getDepsObjcProvider();
- // Do not remove SDK_FRAMEWORK values in avoid_deps.
- assertThat(provider.get(ObjcProvider.SDK_FRAMEWORK))
- .containsAllOf(new SdkFramework("AvoidSDK"), new SdkFramework("BaseSDK"));
- }
-
- @Test
public void testNoSrcs() throws Exception {
scratch.file("package/BUILD",
"apple_static_library(",
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcImportTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcImportTest.java
index e5c5227..6c1cfac 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcImportTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcImportTest.java
@@ -119,10 +119,6 @@
}
@Test
- public void testProvidesStoryboardObjects() throws Exception {
- checkProvidesStoryboardObjects(RULE_TYPE);
- }
- @Test
public void testSdkIncludesUsedInCompileActionsOfDependers() throws Exception {
checkSdkIncludesUsedInCompileActionsOfDependers(RULE_TYPE);
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
index 6810fd4..cbca300 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
@@ -20,14 +20,12 @@
import static com.google.devtools.build.lib.rules.objc.CompilationSupport.ABSOLUTE_INCLUDES_PATH_FORMAT;
import static com.google.devtools.build.lib.rules.objc.CompilationSupport.BOTH_MODULE_NAME_AND_MODULE_MAP_SPECIFIED;
import static com.google.devtools.build.lib.rules.objc.CompilationSupport.FILE_IN_SRCS_AND_HDRS_WARNING_FORMAT;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.ASSET_CATALOG;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.CC_LIBRARY;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.HEADER;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.LIBRARY;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.SDK_DYLIB;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.SDK_FRAMEWORK;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.WEAK_SDK_FRAMEWORK;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.XCASSETS_DIR;
import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.NON_ARC_SRCS_TYPE;
import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.SRCS_TYPE;
import static org.junit.Assert.fail;
@@ -993,40 +991,6 @@
}
@Test
- public void testAssetCatalogsAttributeErrorForNotInXcAssetsDir() throws Exception {
- useConfiguration(
- "--crosstool_top=" + MockObjcSupport.DEFAULT_OSX_CROSSTOOL,
- "--incompatible_disable_objc_library_resources=false");
- scratch.file("lib/ac/notinxcassets1");
- scratch.file("lib/ac/notinxcassets2");
- scratch.file("lib/ac/foo.xcassets/isinxcassets");
- checkError("lib", "lib",
- String.format(ObjcCommon.NOT_IN_CONTAINER_ERROR_FORMAT,
- "lib/ac/notinxcassets2", ImmutableList.of(ObjcCommon.ASSET_CATALOG_CONTAINER_TYPE)),
- "objc_library(name = 'lib', srcs = ['src.m'], asset_catalogs = glob(['ac/**']))");
- }
-
- @Test
- public void testXcdatamodelsAttributeErrorForNotInXcdatamodelDir() throws Exception {
- useConfiguration(
- "--crosstool_top=" + MockObjcSupport.DEFAULT_OSX_CROSSTOOL,
- "--incompatible_disable_objc_library_resources=false");
- scratch.file("lib/xcd/notinxcdatamodel1");
- scratch.file("lib/xcd/notinxcdatamodel2");
- scratch.file("lib/xcd/foo.xcdatamodel/isinxcdatamodel");
- scratch.file("lib/xcd/bar.xcdatamodeld/isinxcdatamodeld");
- checkError("lib", "lib",
- String.format(ObjcCommon.NOT_IN_CONTAINER_ERROR_FORMAT,
- "lib/xcd/notinxcdatamodel1", Xcdatamodels.CONTAINER_TYPES),
- "objc_library(name = 'lib', srcs = ['src.m'], datamodels = glob(['xcd/**']))");
- }
-
- @Test
- public void testProvidesStoryboardOptions() throws Exception {
- checkProvidesStoryboardObjects(RULE_TYPE);
- }
-
- @Test
public void testDoesNotUseCxxUnfilteredFlags() throws Exception {
useConfiguration("--crosstool_top=" + MockObjcSupport.DEFAULT_OSX_CROSSTOOL);
createLibraryTargetWriter("//lib:lib")
@@ -1146,42 +1110,6 @@
}
@Test
- public void testProvidesXcassetCatalogsTransitively() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=false");
- scratch.file("lib1/ac.xcassets/foo");
- scratch.file("lib1/ac.xcassets/bar");
- createLibraryTargetWriter("//lib1:lib1")
- .setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
- .set("asset_catalogs", "glob(['ac.xcassets/**'])")
- .write();
- scratch.file("lib2/ac.xcassets/baz");
- scratch.file("lib2/ac.xcassets/42");
- createLibraryTargetWriter("//lib2:lib2")
- .setAndCreateFiles("srcs", "a.m", "b.m", "private.h")
- .set("asset_catalogs", "glob(['ac.xcassets/**'])")
- .setList("deps", "//lib1:lib1")
- .write();
-
- ObjcProvider lib2Provider = providerForTarget("//lib2:lib2");
- assertThat(Artifact.toExecPaths(lib2Provider.get(ASSET_CATALOG)))
- .containsExactly(
- "lib1/ac.xcassets/foo",
- "lib1/ac.xcassets/bar",
- "lib2/ac.xcassets/baz",
- "lib2/ac.xcassets/42");
- assertThat(lib2Provider.get(XCASSETS_DIR))
- .containsExactly(
- PathFragment.create("lib1/ac.xcassets"), PathFragment.create("lib2/ac.xcassets"));
-
- ObjcProvider lib1Provider = providerForTarget("//lib1:lib1");
- assertThat(Artifact.toExecPaths(lib1Provider.get(ASSET_CATALOG)))
- .containsExactly("lib1/ac.xcassets/foo", "lib1/ac.xcassets/bar");
- assertThat(lib1Provider.get(XCASSETS_DIR))
- .containsExactly(PathFragment.create("lib1/ac.xcassets"))
- .inOrder();
- }
-
- @Test
public void testObjcListFileInArchiveGeneration() throws Exception {
scratch.file("lib/a.m");
scratch.file("lib/b.m");
@@ -2050,94 +1978,6 @@
.contains("cc/txt_dep/hdr.h");
}
- @Test
- public void testIncompatibleResourceAttributeFlag_assetCatalogs() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', asset_catalogs = ['fg'])");
- }
-
- @Test
- public void testIncompatibleResourceAttributeFlag_datamodels() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', datamodels = ['fg'])");
- }
-
- @Test
- public void testIncompatibleResourceAttributeFlag_resources() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', resources = ['fg'])");
- }
-
- @Test
- public void testIncompatibleResourceAttributeFlag_storyboards() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', storyboards = ['fg.storyboard'])");
- }
-
- @Test
- public void testIncompatibleResourceAttributeFlag_strings() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', strings = ['fg.strings'])");
- }
-
- @Test
- public void testIncompatibleResourceAttributeFlag_structuredResources() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', structured_resources = ['fg'])");
- }
-
- @Test
- public void testIncompatibleResourceAttributeFlag_xibs() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', xibs = ['fg.xib'])");
- }
-
- @Test
- public void testIncompatibleResourceAttributeFlag_resourcesEmpty() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=true");
-
- checkError(
- "x",
- "x",
- "objc_library resource attributes are not allowed. Please use the 'data' attribute instead",
- "objc_library(name = 'x', resources = [])");
- }
-
/** Regression test for https://github.com/bazelbuild/bazel/issues/7721. */
@Test
public void testToolchainRuntimeLibrariesSolibDir() throws Exception {
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
index f9b6ae2..28e7052 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
@@ -15,15 +15,11 @@
package com.google.devtools.build.lib.rules.objc;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.devtools.build.lib.actions.util.ActionsTestUtil.getFirstArtifactEndingWith;
import static com.google.devtools.build.lib.rules.objc.CompilationSupport.AUTOMATIC_SDK_FRAMEWORKS;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.HEADER;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.INCLUDE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.MODULE_MAP;
-import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STORYBOARD;
-import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingRule.FAMILIES_ATTR;
-import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingRule.INFOPLIST_ATTR;
import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.LIPO;
import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.SRCS_TYPE;
@@ -43,10 +39,6 @@
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.OutputGroupInfo;
-import com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction;
-import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
-import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorArg;
-import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.BuildOptions;
import com.google.devtools.build.lib.analysis.config.CompilationMode;
@@ -67,12 +59,9 @@
import com.google.devtools.build.lib.rules.objc.CompilationSupport.ExtraLinkArgs;
import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.build.lib.vfs.PathFragment;
-import com.google.devtools.build.xcode.plmerge.proto.PlMergeProtos;
import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -87,10 +76,6 @@
* simply call a check... method) across several rule types.
*/
public abstract class ObjcRuleTestCase extends BuildViewTestCase {
- protected static final String MOCK_ACTOOLWRAPPER_PATH =
- toolsRepoExecPath("tools/objc/actoolwrapper");
- protected static final String MOCK_IBTOOLWRAPPER_PATH =
- toolsRepoExecPath("tools/objc/ibtoolwrapper");
protected static final String MOCK_XCRUNWRAPPER_PATH =
toolsRepoExecPath("tools/objc/xcrunwrapper.sh");
protected static final String MOCK_XCRUNWRAPPER_EXECUTABLE_PATH =
@@ -981,178 +966,6 @@
return getGeneratingAction(linkedLibrary);
}
- protected void addTargetWithAssetCatalogs(RuleType ruleType) throws Exception {
- scratch.file("x/foo.xcassets/foo");
- scratch.file("x/bar.xcassets/bar");
- ruleType.scratchTarget(scratch,
- "asset_catalogs", "['foo.xcassets/foo', 'bar.xcassets/bar']");
- }
-
- /**
- * Checks that a target at {@code //x:x}, which is already created, registered a correct actool
- * action based on the given targetDevice and platform, setting certain arbitrary and default
- * values.
- */
- protected void checkActoolActionCorrectness(DottedVersion minimumOsVersion, String targetDevice,
- String platform) throws Exception {
- Artifact actoolZipOut = getBinArtifact("x" + artifactName(".actool.zip"),
- getConfiguredTarget("//x:x"));
- Artifact actoolPartialInfoplist =
- getBinArtifact(
- "x" + artifactName(".actool-PartialInfo.plist"), getConfiguredTarget("//x:x"));
- SpawnAction actoolZipAction = (SpawnAction) getGeneratingAction(actoolZipOut);
- assertThat(actoolZipAction.getArguments())
- .containsExactly(
- MOCK_ACTOOLWRAPPER_PATH,
- actoolZipOut.getExecPathString(),
- "--platform", platform,
- "--output-partial-info-plist", actoolPartialInfoplist.getExecPathString(),
- "--minimum-deployment-target", minimumOsVersion.toString(),
- "--target-device", targetDevice,
- "x/foo.xcassets", "x/bar.xcassets")
- .inOrder();
- assertRequiresDarwin(actoolZipAction);
-
- assertThat(Artifact.toExecPaths(actoolZipAction.getInputs()))
- .containsExactly(
- "x/foo.xcassets/foo",
- "x/bar.xcassets/bar",
- MOCK_ACTOOLWRAPPER_PATH);
- assertThat(Artifact.toExecPaths(actoolZipAction.getOutputs()))
- .containsExactly(
- actoolZipOut.getExecPathString(),
- actoolPartialInfoplist.getExecPathString());
- }
-
- /**
- * Checks that a target at {@code //x:x}, which is already created, registered a correct actool
- * action based on certain arbitrary and default values for iphone simulator.
- */
- protected void checkActoolActionCorrectness(DottedVersion minimumOsVersion) throws Exception {
- checkActoolActionCorrectness(minimumOsVersion, "iphone", "iphonesimulator");
- }
-
- /**
- * Verifies that targeted device family information is passed to ibtool for the given targeted
- * families.
- *
- * @param packageName where to place the rule during testing - this should be different every time
- * the method is invoked
- * @param buildFileContents contents of the BUILD file for the {@code packageName} package
- * @param targetDevices the values to {@code --target-device} expected in the ibtool invocation
- */
- private void checkPassesFamiliesToIbtool(String packageName, String buildFileContents,
- String... targetDevices) throws Exception {
- scratch.file(String.format("%s/BUILD", packageName), buildFileContents);
- ConfiguredTarget target = getConfiguredTarget(String.format("//%s:x", packageName));
-
- Artifact storyboardZipOut = getBinArtifact("x/foo.storyboard.zip", target);
- SpawnAction storyboardZipAction = (SpawnAction) getGeneratingAction(storyboardZipOut);
-
- List<String> arguments = storyboardZipAction.getArguments();
- for (String targetDevice : targetDevices) {
- assertContainsSublist(arguments, ImmutableList.of("--target-device", targetDevice));
- }
-
- assertWithMessage("Incorrect number of --target-device flags in arguments [" + arguments + "]")
- .that(Collections.frequency(arguments, "--target-device"))
- .isEqualTo(targetDevices.length);
- }
-
- private void checkPassesFamiliesToIbtool(RuleType ruleType, String packageName,
- String families, String... targetDevices) throws Exception {
- String buildFileContents = ruleType.target(scratch, packageName, "x",
- FAMILIES_ATTR, families,
- "storyboards", "['foo.storyboard']");
- checkPassesFamiliesToIbtool(packageName, buildFileContents, targetDevices);
- }
-
- protected void checkPassesFamiliesToIbtool(RuleType ruleType) throws Exception {
- checkPassesFamiliesToIbtool(ruleType, "iphone", "['iphone']", "iphone");
- checkPassesFamiliesToIbtool(ruleType, "ipad", "['ipad']", "ipad");
- checkPassesFamiliesToIbtool(ruleType, "both", "['iphone', 'ipad']",
- "ipad", "iphone");
- checkPassesFamiliesToIbtool(ruleType, "both_reverse", "['ipad', 'iphone']",
- "ipad", "iphone");
- }
-
- protected ConfiguredTarget createTargetWithStoryboards(RuleType ruleType) throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=false");
- scratch.file("x/1.storyboard");
- scratch.file("x/2.storyboard");
- scratch.file("x/subdir_for_no_reason/en.lproj/loc.storyboard");
- scratch.file("x/ja.lproj/loc.storyboard");
- ruleType.scratchTarget(scratch, "storyboards", "glob(['*.storyboard', '**/*.storyboard'])");
- return getConfiguredTarget("//x:x");
- }
-
-
- protected void checkProvidesStoryboardObjects(RuleType ruleType) throws Exception {
- createTargetWithStoryboards(ruleType);
- ObjcProvider provider = providerForTarget("//x:x");
- ImmutableList<Artifact> storyboardInputs = ImmutableList.of(
- getSourceArtifact("x/1.storyboard"),
- getSourceArtifact("x/2.storyboard"),
- getSourceArtifact("x/subdir_for_no_reason/en.lproj/loc.storyboard"),
- getSourceArtifact("x/ja.lproj/loc.storyboard"));
-
- assertThat(provider.get(STORYBOARD))
- .containsExactlyElementsIn(storyboardInputs);
- }
-
- protected void checkRegistersStoryboardCompileActions(RuleType ruleType,
- String platformName) throws Exception {
- checkRegistersStoryboardCompileActions(
- createTargetWithStoryboards(ruleType), DEFAULT_IOS_SDK_VERSION,
- ImmutableList.of(platformName));
- }
-
- private void checkRegistersStoryboardCompileActions(
- ConfiguredTarget target, DottedVersion minimumOsVersion, ImmutableList<String> targetDevices)
- throws Exception {
- Artifact storyboardZip = getBinArtifact("x/1.storyboard.zip", target);
- CommandAction compileAction = (CommandAction) getGeneratingAction(storyboardZip);
- assertThat(Artifact.toExecPaths(compileAction.getInputs()))
- .containsExactly(MOCK_IBTOOLWRAPPER_PATH, "x/1.storyboard");
- String archiveRoot = targetDevices.contains("watch") ? "." : "1.storyboardc";
- assertThat(compileAction.getOutputs()).containsExactly(storyboardZip);
- assertThat(compileAction.getArguments())
- .containsExactlyElementsIn(
- new CustomCommandLine.Builder()
- .addDynamicString(MOCK_IBTOOLWRAPPER_PATH)
- .addExecPath(storyboardZip)
- .addDynamicString(archiveRoot) // archive root
- .add("--minimum-deployment-target", minimumOsVersion.toString())
- .add("--module")
- .add("x")
- .addAll(VectorArg.addBefore("--target-device").each(targetDevices))
- .add("x/1.storyboard")
- .build()
- .arguments())
- .inOrder();
-
- storyboardZip = getBinArtifact("x/ja.lproj/loc.storyboard.zip", target);
- compileAction = (CommandAction) getGeneratingAction(storyboardZip);
- assertThat(Artifact.toExecPaths(compileAction.getInputs()))
- .containsExactly(MOCK_IBTOOLWRAPPER_PATH, "x/ja.lproj/loc.storyboard");
- assertThat(compileAction.getOutputs()).containsExactly(storyboardZip);
- archiveRoot = targetDevices.contains("watch") ? "ja.lproj/" : "ja.lproj/loc.storyboardc";
- assertThat(compileAction.getArguments())
- .containsExactlyElementsIn(
- new CustomCommandLine.Builder()
- .addDynamicString(MOCK_IBTOOLWRAPPER_PATH)
- .addExecPath(storyboardZip)
- .addDynamicString(archiveRoot) // archive root
- .add("--minimum-deployment-target", minimumOsVersion.toString())
- .add("--module")
- .add("x")
- .addAll(VectorArg.addBefore("--target-device").each(targetDevices))
- .add("x/ja.lproj/loc.storyboard")
- .build()
- .arguments())
- .inOrder();
- }
-
protected List<String> rootedIncludePaths(
BuildConfiguration configuration, String... unrootedPaths) {
ImmutableList.Builder<String> rootedPaths = new ImmutableList.Builder<>();
@@ -1329,48 +1142,6 @@
assertThat(compileBArgs).contains("-I" + sdkIncludeDir + "/bar/baz");
}
- protected void checkCompileXibActions(RuleType ruleType) throws Exception {
- ruleType.scratchTarget(scratch, "xibs", "['foo.xib', 'es.lproj/bar.xib']");
- checkCompileXibActions(DEFAULT_IOS_SDK_VERSION, "iphone");
- }
-
- private void checkCompileXibActions(DottedVersion minimumOsVersion,
- String platformType) throws Exception {
- scratch.file("x/foo.xib");
- scratch.file("x/es.lproj/bar.xib");
- ConfiguredTarget target = getConfiguredTarget("//x:x");
- Artifact fooNibZip = getBinArtifact("x/x/foo.nib.zip", target);
- Artifact barNibZip = getBinArtifact("x/x/es.lproj/bar.nib.zip", target);
- CommandAction fooCompile = (CommandAction) getGeneratingAction(fooNibZip);
- CommandAction barCompile = (CommandAction) getGeneratingAction(barNibZip);
-
- assertThat(Artifact.toExecPaths(fooCompile.getInputs()))
- .containsExactly(MOCK_IBTOOLWRAPPER_PATH, "x/foo.xib");
- assertThat(Artifact.toExecPaths(barCompile.getInputs()))
- .containsExactly(MOCK_IBTOOLWRAPPER_PATH, "x/es.lproj/bar.xib");
-
- assertThat(fooCompile.getArguments())
- .containsExactly(
- MOCK_IBTOOLWRAPPER_PATH,
- fooNibZip.getExecPathString(),
- "foo.nib", // archive root
- "--minimum-deployment-target", minimumOsVersion.toString(),
- "--module", "x",
- "--target-device", platformType,
- "x/foo.xib")
- .inOrder();
- assertThat(barCompile.getArguments())
- .containsExactly(
- MOCK_IBTOOLWRAPPER_PATH,
- barNibZip.getExecPathString(),
- "es.lproj/bar.nib", // archive root
- "--minimum-deployment-target", minimumOsVersion.toString(),
- "--module", "x",
- "--target-device", platformType,
- "x/es.lproj/bar.xib")
- .inOrder();
- }
-
public void checkAllowVariousNonBlacklistedTypesInHeaders(RuleType ruleType) throws Exception {
ruleType.scratchTarget(scratch, "hdrs", "['foo.foo', 'NoExtension', 'bar.inc', 'baz.hpp']");
assertThat(view.hasErrors(getConfiguredTarget("//x:x"))).isFalse();
@@ -1385,106 +1156,6 @@
ruleType.target(scratch, "x2", "x2", "hdrs", "['bar.o']"));
}
- protected void checkTwoStringsOneBundlePath(RuleType ruleType) throws Exception {
- String targets = ruleType.target(scratch, "x", "bndl",
- "strings", "['Resources/en.lproj/foo.strings', 'FooBar/en.lproj/foo.strings']");
- checkTwoStringsOneBundlePath(targets, "bndl");
- }
-
- private void checkTwoStringsOneBundlePath(String targets, String errorTarget) throws Exception {
- checkError(
- "x",
- errorTarget,
- "Two files map to the same path [en.lproj/foo.strings] in this bundle but come from "
- + "different locations: //x:Resources/en.lproj/foo.strings and "
- + "//x:FooBar/en.lproj/foo.strings",
- targets);
- }
-
- protected void checkTwoResourcesOneBundlePath(RuleType ruleType) throws Exception {
- String targets = ruleType.target(scratch, "x", "bndl", "resources", "['baz/foo', 'bar/foo']");
- checkTwoResourcesOneBundlePath(targets, "bndl");
- }
-
- private void checkTwoResourcesOneBundlePath(String targets, String errorTarget) throws Exception {
- checkError(
- "x",
- errorTarget,
- "Two files map to the same path [foo] in this bundle but come from "
- + "different locations: //x:baz/foo and //x:bar/foo",
- targets);
- }
-
- protected void checkSameStringsTwice(RuleType ruleType) throws Exception {
- String targets =
- ruleType.target(
- scratch,
- "x",
- "bndl",
- "resources",
- "['Resources/en.lproj/foo.strings']",
- "strings",
- "['Resources/en.lproj/foo.strings']");
- checkSameStringsTwice(targets, "bndl");
- }
-
- private void checkSameStringsTwice(String targets, String errorTarget) throws Exception {
- checkError(
- "x",
- errorTarget,
- "The same file was included multiple times in this rule: x/Resources/en.lproj/foo.strings",
- targets);
- }
-
- protected void checkMultipleInfoPlists(RuleType ruleType) throws Exception {
- scratch.file("x/a.plist");
- scratch.file("x/b.plist");
- ruleType.scratchTarget(scratch, "infoplists", "['a.plist', 'b.plist']");
-
- String targetName = "//x:x";
- PlMergeProtos.Control control = plMergeControl(targetName);
-
- assertThat(control.getSourceFileList())
- .contains(getSourceArtifact("x/a.plist").getExecPathString());
- assertThat(control.getSourceFileList())
- .contains(getSourceArtifact("x/b.plist").getExecPathString());
- }
-
- protected void checkInfoplistAndInfoplistsTogether(RuleType ruleType) throws Exception {
- scratch.file("x/a.plist");
- scratch.file("x/b.plist");
- scratch.file("x/c.plist");
- ruleType.scratchTarget(scratch, "infoplists", "['a.plist', 'b.plist']", INFOPLIST_ATTR,
- "'c.plist'");
-
- String targetName = "//x:x";
- PlMergeProtos.Control control = plMergeControl(targetName);
-
- assertThat(control.getSourceFileList())
- .contains(getSourceArtifact("x/a.plist").getExecPathString());
- assertThat(control.getSourceFileList())
- .contains(getSourceArtifact("x/b.plist").getExecPathString());
- assertThat(control.getSourceFileList())
- .contains(getSourceArtifact("x/c.plist").getExecPathString());
- }
-
- private BinaryFileWriteAction plMergeAction(String binaryLabelString) throws Exception {
- Label binaryLabel = Label.parseAbsolute(binaryLabelString, ImmutableMap.of());
- ConfiguredTarget binary = getConfiguredTarget(binaryLabelString);
- return (BinaryFileWriteAction)
- getGeneratingAction(getBinArtifact(binaryLabel.getName()
- + artifactName(".plmerge-control"), binary));
- }
-
- protected PlMergeProtos.Control plMergeControl(String binaryLabelString) throws Exception {
- InputStream in = plMergeAction(binaryLabelString).getSource().openStream();
- return PlMergeProtos.Control.parseFrom(in);
- }
-
- private String artifactName(String artifactName) {
- return artifactName;
- }
-
/**
* Normalizes arguments to a bash action into a space-separated list.
*
@@ -2073,26 +1744,26 @@
*
* All libraries prefixed with "avoid" shouldn't be statically linked in the top level target.
*/
- useConfiguration("--incompatible_disable_objc_library_resources=false");
ruleType.scratchTarget(scratch,
"deps", "['//package:objcLib']",
"dylibs", "['//package:avoidLib']");
scratchFrameworkSkylarkStub("frameworkstub/framework_stub.bzl");
- scratch.file("package/BUILD",
+ scratch.file(
+ "package/BUILD",
"load('//frameworkstub:framework_stub.bzl', 'framework_stub_rule')",
"objc_library(name = 'objcLib', srcs = [ 'b.m' ],",
" deps = [':avoidLibDep', ':baseLib'])",
"objc_library(name = 'baseLib', srcs = [ 'base.m' ],",
" deps = [':baseLibDep', ':avoidLibDepTwo'])",
"objc_library(name = 'baseLibDep', srcs = [ 'basedep.m' ],",
- " sdk_frameworks = ['BaseSDK'], resources = [':base.png'])",
+ " sdk_frameworks = ['BaseSDK'])",
"framework_stub_rule(name = 'avoidLib', binary = ':avoidLibBinary')",
"apple_binary(name = 'avoidLibBinary', binary_type = 'dylib',",
" platform_type = 'ios',",
" deps = [':avoidLibDep'])",
"objc_library(name = 'avoidLibDep', srcs = [ 'd.m' ], deps = [':avoidLibDepTwo'])",
"objc_library(name = 'avoidLibDepTwo', srcs = [ 'e.m' ],",
- " sdk_frameworks = ['AvoidSDK'], resources = [':avoid.png'])");
+ " sdk_frameworks = ['AvoidSDK'])");
Action lipobinAction = lipoBinAction("//x:x");
Artifact binArtifact = getFirstArtifactEndingWith(lipobinAction.getInputs(), "x/x_bin");
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcSkylarkTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcSkylarkTest.java
index 67c168e..3ec56a8 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcSkylarkTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcSkylarkTest.java
@@ -15,11 +15,8 @@
package com.google.devtools.build.lib.rules.objc;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.devtools.build.lib.rules.objc.BundleableFile.BUNDLED_FIELD;
-import static com.google.devtools.build.lib.rules.objc.BundleableFile.BUNDLE_PATH_FIELD;
import static org.junit.Assert.fail;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.ObjectArrays;
import com.google.devtools.build.lib.actions.Artifact;
@@ -1078,67 +1075,6 @@
}
@Test
- public void testSkylarkCanAccessProvidedBundleFiles() throws Exception {
- useConfiguration("--incompatible_disable_objc_library_resources=false");
- // Since the collections of structs with Artifact values are extremely difficult to test with
- // Truth, we fudge them in the Skylark side to return easily comparable dictionaries instead.
- scratch.file("examples/rule/BUILD");
- scratch.file(
- "examples/rule/apple_rules.bzl",
- "def _simplify_bundle_file(bf):",
- " return {'file': bf.file.path, 'bundle_path': bf.bundle_path}",
- "def _test_rule_impl(ctx):",
- " dep = ctx.attr.deps[0]",
- " objc_provider = dep.objc",
- " bundle_file = [_simplify_bundle_file(bf) for bf in list(objc_provider.bundle_file)]",
- " return struct(",
- " bundle_file=bundle_file,",
- " )",
- "test_rule = rule(implementation = _test_rule_impl,",
- " attrs = {",
- " 'deps': attr.label_list(allow_files = False, mandatory = False, providers = ['objc'])",
- "})");
-
- scratch.file("examples/apple_skylark/a.m");
- scratch.file("examples/apple_skylark/flattened/a/a.txt");
- scratch.file("examples/apple_skylark/flattened/b.lproj/b.txt");
- scratch.file("examples/apple_skylark/structured/c/c.txt");
- scratch.file("examples/apple_skylark/structured/d/d.txt");
- scratch.file(
- "examples/apple_skylark/BUILD",
- "package(default_visibility = ['//visibility:public'])",
- "load('//examples/rule:apple_rules.bzl', 'test_rule')",
- "objc_library(",
- " name = 'lib',",
- " srcs = ['a.m'],",
- " resources = glob(['flattened/**']),",
- " structured_resources = glob(['structured/**']),",
- ")",
- "test_rule(",
- " name = 'my_target',",
- " deps = [':lib'],",
- ")");
-
- ConfiguredTarget skylarkTarget = getConfiguredTarget("//examples/apple_skylark:my_target");
-
- Iterable<?> bundleFiles = (Iterable<?>)
- skylarkTarget.get("bundle_file");
- assertThat(bundleFiles).containsAllOf(ImmutableMap.of(
- BUNDLE_PATH_FIELD, "a.txt",
- BUNDLED_FIELD, "examples/apple_skylark/flattened/a/a.txt"
- ), ImmutableMap.of(
- BUNDLE_PATH_FIELD, "b.lproj/b.txt",
- BUNDLED_FIELD, "examples/apple_skylark/flattened/b.lproj/b.txt"
- ), ImmutableMap.of(
- BUNDLE_PATH_FIELD, "structured/c/c.txt",
- BUNDLED_FIELD, "examples/apple_skylark/structured/c/c.txt"
- ), ImmutableMap.of(
- BUNDLE_PATH_FIELD, "structured/d/d.txt",
- BUNDLED_FIELD, "examples/apple_skylark/structured/d/d.txt"
- ));
- }
-
- @Test
public void testSkylarkCanAccessSdkFrameworks() throws Exception {
scratch.file("examples/rule/BUILD");
scratch.file(
@@ -1520,7 +1456,6 @@
"objc_import(",
" name='bundle_lib',",
" archives = ['bar.a'],",
- " strings=['foo.strings'],",
")");
setSkylarkSemanticsOptions("--incompatible_disable_objc_provider_resources=true");
@@ -1556,14 +1491,12 @@
"objc_import(",
" name='bundle_lib',",
" archives = ['bar.a'],",
- " strings=['foo.strings'],",
")");
setSkylarkSemanticsOptions("--incompatible_disable_objc_provider_resources=false");
ConfiguredTarget skylarkTarget = getConfiguredTarget("//examples/apple_skylark:my_target");
- assertThat(skylarkTarget.get("strings"))
- .isEqualTo("depset([<source file examples/apple_skylark/foo.strings>])");
+ assertThat(skylarkTarget.get("strings")).isEqualTo("depset([])");
}
private void checkSkylarkRunMemleaksWithExpectedValue(boolean expectedValue) throws Exception {