diff options
author | 2017-05-26 20:58:56 +0200 | |
---|---|---|
committer | 2017-05-29 14:07:42 +0200 | |
commit | 77f12de356958b9beb99fa12d89fd74848a8aa90 (patch) | |
tree | be39adbbaca7cbe9447b911b1571ff415a27e587 /src | |
parent | d87fc98694b846f39e8c37541fa52bafa5daee67 (diff) |
Delete ios_framework native rule.
RELNOTES: ios_framework native rule has been removed. This rule had been essentially broken for several months now; users should be using the skylark ios framework rule. https://github.com/bazelbuild/rules_apple has details.
PiperOrigin-RevId: 157246539
Diffstat (limited to 'src')
6 files changed, 0 insertions, 437 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java index f09fb1679e..3788c3a909 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java @@ -126,8 +126,6 @@ import com.google.devtools.build.lib.rules.objc.IosApplicationRule; import com.google.devtools.build.lib.rules.objc.IosDeviceRule; import com.google.devtools.build.lib.rules.objc.IosExtensionBinaryRule; import com.google.devtools.build.lib.rules.objc.IosExtensionRule; -import com.google.devtools.build.lib.rules.objc.IosFrameworkBinaryRule; -import com.google.devtools.build.lib.rules.objc.IosFrameworkRule; import com.google.devtools.build.lib.rules.objc.IosTestRule; import com.google.devtools.build.lib.rules.objc.J2ObjcAspect; import com.google.devtools.build.lib.rules.objc.J2ObjcCommandLineOptions; @@ -571,8 +569,6 @@ public class BazelRuleClassProvider { builder.addRuleDefinition(new IosDeviceRule()); builder.addRuleDefinition(new IosExtensionBinaryRule()); builder.addRuleDefinition(new IosExtensionRule()); - builder.addRuleDefinition(new IosFrameworkBinaryRule()); - builder.addRuleDefinition(new IosFrameworkRule()); builder.addRuleDefinition(new IosTestRule()); builder.addRuleDefinition(new ObjcBinaryRule()); builder.addRuleDefinition(new ObjcBundleRule()); diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFramework.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosFramework.java deleted file mode 100644 index 3e295fffba..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFramework.java +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2014 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.common.base.Preconditions.checkNotNull; -import static com.google.devtools.build.lib.rules.objc.ObjcCommon.uniqueContainers; -import static com.google.devtools.build.lib.rules.objc.ObjcProvider.MERGE_ZIP; -import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STATIC_FRAMEWORK_DIR; -import static com.google.devtools.build.lib.rules.objc.ObjcProvider.STATIC_FRAMEWORK_FILE; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Ordering; -import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode; -import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; -import com.google.devtools.build.lib.analysis.RuleContext; -import com.google.devtools.build.lib.analysis.actions.SymlinkAction; -import com.google.devtools.build.lib.cmdline.Label; -import com.google.devtools.build.lib.rules.apple.AppleConfiguration; -import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher; -import com.google.devtools.build.lib.rules.apple.DottedVersion; -import com.google.devtools.build.lib.rules.apple.Platform.PlatformType; -import com.google.devtools.build.lib.rules.cpp.CcCommon; -import com.google.devtools.build.lib.util.Pair; -import com.google.devtools.build.lib.vfs.PathFragment; - -/** - * Implementation for {@code ios_framework}. - * - * @deprecated The native bundling rules have been deprecated. This class will be removed in the - * future. - */ -@Deprecated -public class IosFramework extends ReleaseBundlingTargetFactory { - - @VisibleForTesting - static final DottedVersion MINIMUM_OS_VERSION = DottedVersion.fromString("8.0"); - - public IosFramework() { - super( - ReleaseBundlingSupport.FRAMEWORK_BUNDLE_DIR_FORMAT, - XcodeProductType.FRAMEWORK, - ImmutableSet.of(new Attribute("binary", Mode.SPLIT)), - ConfigurationDistinguisher.FRAMEWORK); - } - - @Override - protected String bundleName(RuleContext ruleContext) { - String frameworkName = null; - - for (IosFrameworkProvider provider : - ruleContext.getPrerequisites("binary", Mode.SPLIT, IosFrameworkProvider.class)) { - frameworkName = provider.getFrameworkName(); - } - - - return checkNotNull(frameworkName); - } - - @Override - protected DottedVersion bundleMinimumOsVersion(RuleContext ruleContext) { - // Frameworks are not accepted by Apple below version 8.0. While applications built with a - // minimum iOS version of less than 8.0 may contain frameworks in their bundle, the framework - // itself needs to be built with 8.0 or higher. This logic overrides (if necessary) any - // flag-set minimum iOS version for framework only so that this requirement is not violated. - DottedVersion fromFlag = ruleContext.getFragment(AppleConfiguration.class) - .getMinimumOsForPlatformType(PlatformType.IOS); - return Ordering.natural().max(fromFlag, MINIMUM_OS_VERSION); - } - - /** - * Returns a map of original {@code Artifact} to symlinked {@code Artifact} inside framework - * bundle. - */ - private ImmutableMap<Artifact, Artifact> getExtraArtifacts(RuleContext ruleContext) { - IntermediateArtifacts intermediateArtifacts = - ObjcRuleClasses.intermediateArtifacts(ruleContext); - - ImmutableList<Pair<Artifact, Label>> headers = - ImmutableList.copyOf(CcCommon.getHeaders(ruleContext)); - - ImmutableMap.Builder<Artifact, Artifact> builder = new ImmutableMap.Builder<>(); - - // Create framework binary - Artifact frameworkBinary = - outputArtifact(ruleContext, PathFragment.create(bundleName(ruleContext))); - builder.put(intermediateArtifacts.combinedArchitectureBinary(), frameworkBinary); - - // Create framework headers - for (Pair<Artifact, Label> header : headers) { - Artifact frameworkHeader = - outputArtifact(ruleContext, PathFragment.create("Headers/" + header.first.getFilename())); - - builder.put(header.first, frameworkHeader); - } - - return builder.build(); - } - - @Override - protected ObjcProvider exposedObjcProvider( - RuleContext ruleContext, ReleaseBundlingSupport releaseBundlingSupport) - throws InterruptedException { - // Assemble framework binary and headers in the label-scoped location, so that it's possible to - // pass -F X.framework to the compiler and -framework X to the linker. This mimics usage of - // frameworks when built from Xcode. - - // To do this, we symlink all required artifacts into destination and pass them to - // FRAMEWORK_IMPORTS list, thus utilizing ObjcFramework rule to do the work of propagating - // them correctly. - Iterable<Artifact> frameworkImports = getExtraArtifacts(ruleContext).values(); - - ObjcProvider frameworkProvider = - new ObjcProvider.Builder() - .add(MERGE_ZIP, ruleContext.getImplicitOutputArtifact(ReleaseBundlingSupport.IPA)) - // TODO(dmishe): The framework returned by this rule is dynamic, not static. But because - // this rule (incorrectly?) propagates its contents as a bundle (see "IPA" above) we - // cannot declare its files as dynamic framework files because they would then be copied - // into the final IPA, conflicting with the exported bundle. Instead we propagate using - // the static frameworks key which will see the files correctly added to compile and - // linker actions but not added to the final bundle. - .addAll(STATIC_FRAMEWORK_FILE, frameworkImports) - .addAll( - STATIC_FRAMEWORK_DIR, - uniqueContainers(frameworkImports, ObjcCommon.FRAMEWORK_CONTAINER_TYPE)) - .build(); - - return frameworkProvider; - } - - @Override - protected void configureTarget( - RuleConfiguredTargetBuilder target, - RuleContext ruleContext, - ReleaseBundlingSupport releaseBundlingSupport) { - // Create generating actions for framework artifacts - for (ImmutableMap.Entry<Artifact, Artifact> entry : getExtraArtifacts(ruleContext).entrySet()) { - ruleContext.registerAction( - new SymlinkAction( - ruleContext.getActionOwner(), - entry.getKey(), - entry.getValue(), - "Symlinking framework artifact")); - } - } - - /** - * Returns an artifact at given path under "package/_frameworks/bundleName.framework" directory. - */ - private Artifact outputArtifact(RuleContext ruleContext, PathFragment path) { - PathFragment frameworkRoot = - PathFragment.create( - PathFragment.create("_frameworks"), - PathFragment.create(bundleName(ruleContext) + ".framework"), - path); - - return ruleContext.getPackageRelativeArtifact( - frameworkRoot, ruleContext.getBinOrGenfilesDirectory()); - } -} diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkBinary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkBinary.java deleted file mode 100644 index a306498f96..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkBinary.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 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.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; -import com.google.devtools.build.lib.analysis.RuleContext; -import com.google.devtools.build.lib.rules.objc.CompilationSupport.ExtraLinkArgs; - -/** - * Implementation for the "ios_framework_binary" rule. - * - * @deprecated The native bundling rules have been deprecated. This class will be removed in the - * future. - */ -@Deprecated -public class IosFrameworkBinary extends BinaryLinkingTargetFactory { - public IosFrameworkBinary() { - super(HasReleaseBundlingSupport.NO, XcodeProductType.LIBRARY_STATIC); - } - - @Override - protected ExtraLinkArgs getExtraLinkArgs(RuleContext ruleContext) { - String frameworkName = getFrameworkName(ruleContext); - - return new ExtraLinkArgs( - "-dynamiclib", - String.format("-install_name @rpath/%1$s.framework/%1$s", frameworkName)); - } - - private String getFrameworkName(RuleContext ruleContext) { - return ruleContext.getLabel().getName(); - } - - @Override - protected void configureTarget(RuleConfiguredTargetBuilder target, RuleContext ruleContext) { - IosFrameworkProvider frameworkProvider = - new IosFrameworkProvider(getFrameworkName(ruleContext)); - - target.addProvider(IosFrameworkProvider.class, frameworkProvider); - } -} diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkBinaryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkBinaryRule.java deleted file mode 100644 index 63f9845cb1..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkBinaryRule.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 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.devtools.build.lib.analysis.BaseRuleClasses; -import com.google.devtools.build.lib.analysis.RuleDefinition; -import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; -import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; -import com.google.devtools.build.lib.rules.apple.AppleConfiguration; -import com.google.devtools.build.lib.rules.cpp.CppConfiguration; - -/** - * Rule definition for ios_framework_binary. - * - * @deprecated The native bundling rules have been deprecated. This class will be removed in the - * future. - */ -@Deprecated -public class IosFrameworkBinaryRule implements RuleDefinition { - - @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { - return builder - .requiresConfigurationFragments(ObjcConfiguration.class, J2ObjcConfiguration.class, - AppleConfiguration.class, CppConfiguration.class) - // TODO(bazel-team): Add version fields that are passed to the linker as - // -compatibility_version X -current_version Y and then embedded into dynamic library. - .cfg(AppleCrosstoolTransition.APPLE_CROSSTOOL_TRANSITION) - .build(); - } - - @Override - public Metadata getMetadata() { - return RuleDefinition.Metadata.builder() - .name("ios_framework_binary") - .factoryClass(IosFrameworkBinary.class) - .ancestors(BaseRuleClasses.BaseRule.class, ObjcRuleClasses.LinkingRule.class, - ObjcRuleClasses.XcodegenRule.class) - .build(); - } -} - -/*<!-- #BLAZE_RULE (NAME = ios_framework_binary, TYPE = BINARY, FAMILY = Objective-C) --> - -<p><strong>This rule is deprecated.</strong> Please use the new Apple build rules -(<a href="https://github.com/bazelbuild/rules_apple">https://github.com/bazelbuild/rules_apple</a>) -to build Apple targets.</p> - -<p>This rule produces a dynamic library for a framework by linking one or more Objective-C -libraries.</p> - -${IMPLICIT_OUTPUTS} - -<!-- #END_BLAZE_RULE -->*/ diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkProvider.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkProvider.java deleted file mode 100644 index a23bade8e3..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkProvider.java +++ /dev/null @@ -1,39 +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.devtools.build.lib.analysis.TransitiveInfoProvider; -import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; -import com.google.devtools.build.lib.util.Preconditions; - -/** - * Provider for iOS Framework info. - */ -@Immutable -public final class IosFrameworkProvider implements TransitiveInfoProvider { - - private final String frameworkName; - - public IosFrameworkProvider(String frameworkName) { - this.frameworkName = Preconditions.checkNotNull(frameworkName); - } - - /** - * Returns the name of the framework. - */ - public String getFrameworkName() { - return frameworkName; - } -} diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkRule.java deleted file mode 100644 index 7bca8cc5a3..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosFrameworkRule.java +++ /dev/null @@ -1,99 +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.packages.Attribute.attr; -import static com.google.devtools.build.lib.packages.BuildType.LABEL; -import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST; - -import com.google.devtools.build.lib.analysis.BaseRuleClasses; -import com.google.devtools.build.lib.analysis.RuleDefinition; -import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; -import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; -import com.google.devtools.build.lib.rules.apple.AppleConfiguration; - -/** - * Rule definition for ios_framework. - * - * @deprecated The native bundling rules have been deprecated. This class will be removed in the - * future. - */ -@Deprecated -public class IosFrameworkRule implements RuleDefinition { - - @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { - return builder - .requiresConfigurationFragments(ObjcConfiguration.class, AppleConfiguration.class) - // TODO(blaze-team): IPA is not right here, should probably be just zipped framework bundle. - .setImplicitOutputsFunction(ReleaseBundlingSupport.IPA) - /* <!-- #BLAZE_RULE(ios_framework).ATTRIBUTE(binary) --> - The binary target included in the framework bundle. - <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ - .add( - attr("binary", LABEL) - .allowedRuleClasses("ios_framework_binary") - .allowedFileTypes() - .mandatory() - .direct_compile_time_input() - .cfg(IosExtension.MINIMUM_OS_AND_SPLIT_ARCH_TRANSITION)) - /* <!-- #BLAZE_RULE(ios_framework).ATTRIBUTE(hdrs) --> - Public headers to include in the framework bundle. - <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ - .add( - attr("hdrs", LABEL_LIST) - .direct_compile_time_input() - .allowedFileTypes(ObjcRuleClasses.HDRS_TYPE)) - .build(); - } - - @Override - public Metadata getMetadata() { - return RuleDefinition.Metadata.builder() - .name("ios_framework") - .factoryClass(IosFramework.class) - .ancestors(BaseRuleClasses.BaseRule.class, ObjcRuleClasses.ReleaseBundlingRule.class, - ObjcRuleClasses.XcodegenRule.class) - .build(); - } -} - -/*<!-- #BLAZE_RULE (NAME = ios_framework, TYPE = BINARY, FAMILY = Objective-C) --> - -<p><strong>This rule is deprecated.</strong> Please use the new Apple build rules -(<a href="https://github.com/bazelbuild/rules_apple">https://github.com/bazelbuild/rules_apple</a>) -to build Apple targets.</p> - -<p>This rule produces a bundled binary for a framework from a compiled binary and bundle -metadata. It is still highly experimental and has significant outstanding issues.</p> - -<p>A framework is a bundle that contains a dynamic library (the "binary"), public headers (that -clients of the framework can use) and any resources.</p> - -<p>Bundles generated by this rule use a bundle directory called -<code>Frameworks/<var>framework_name</var>.framework</code>.</p> - -<p>Please be aware that in the current implementation, frameworks created by this rule can only be -used during compilation and linking phase of the app with the intention of including the framework -in the app bundle, not for standalone distribution.</p> - -<p>Due to this, when built as a direct target, the resulting bundle will not have headers, only the -dynamic library.</p> - -<p>Please also be aware that this rule currently does not work for use in multi-architecture -application builds (for instance, using the <code>--ios_multi_cpus</code> flag).</p> - -<!-- #END_BLAZE_RULE -->*/ |