forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ios_extension rule. See IosExtensionRule.java for informati…
…on on how app extensions are built and how they differ from application bundles. RELNOTES: Support ios_extension and ios_extension_binary rules for creating iOS app extensions. -- MOS_MIGRATED_REVID=86788086
- Loading branch information
Showing
19 changed files
with
284 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/main/java/com/google/devtools/build/lib/rules/objc/IosExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2014 Google Inc. 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.MERGE_ZIP; | ||
|
||
import com.google.common.base.Optional; | ||
import com.google.devtools.build.lib.actions.Artifact; | ||
import com.google.devtools.build.lib.analysis.ConfiguredTarget; | ||
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode; | ||
import com.google.devtools.build.lib.analysis.RuleContext; | ||
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; | ||
import com.google.devtools.build.lib.rules.RuleConfiguredTargetFactory; | ||
import com.google.devtools.build.lib.rules.objc.ReleaseBundlingSupport.LinkedBinary; | ||
|
||
/** | ||
* Implementation for {@code ios_extension}. | ||
*/ | ||
public class IosExtension implements RuleConfiguredTargetFactory { | ||
|
||
@Override | ||
public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException { | ||
ObjcCommon common = common(ruleContext); | ||
|
||
XcodeProvider.Builder xcodeProviderBuilder = new XcodeProvider.Builder(); | ||
NestedSetBuilder<Artifact> filesToBuild = NestedSetBuilder.stableOrder(); | ||
|
||
ReleaseBundlingSupport releaseBundlingSupport = new ReleaseBundlingSupport( | ||
ruleContext, common.getObjcProvider(), optionsProvider(ruleContext), | ||
LinkedBinary.DEPENDENCIES_ONLY, "PlugIns/%s.appex"); | ||
releaseBundlingSupport | ||
.registerActions() | ||
.addXcodeSettings(xcodeProviderBuilder) | ||
.addFilesToBuild(filesToBuild) | ||
.validateAttributes(); | ||
|
||
new XcodeSupport(ruleContext) | ||
.addFilesToBuild(filesToBuild) | ||
.addXcodeSettings( | ||
xcodeProviderBuilder, common.getObjcProvider(), XcodeProductType.EXTENSION) | ||
.addDependencies(xcodeProviderBuilder, "binary") | ||
.registerActions(xcodeProviderBuilder.build()); | ||
|
||
ObjcProvider nestedBundleProvider = new ObjcProvider.Builder() | ||
.add(MERGE_ZIP, ruleContext.getImplicitOutputArtifact(ReleaseBundlingSupport.IPA)) | ||
.build(); | ||
|
||
return common.configuredTarget( | ||
filesToBuild.build(), | ||
Optional.of(xcodeProviderBuilder.build()), | ||
Optional.of(nestedBundleProvider), | ||
Optional.<XcTestAppProvider>absent(), | ||
Optional.<J2ObjcSrcsProvider>absent()); | ||
} | ||
|
||
private OptionsProvider optionsProvider(RuleContext ruleContext) { | ||
return new OptionsProvider.Builder() | ||
.addInfoplists(ruleContext.getPrerequisiteArtifacts("infoplist", Mode.TARGET).list()) | ||
.build(); | ||
} | ||
|
||
private ObjcCommon common(RuleContext ruleContext) { | ||
return new ObjcCommon.Builder(ruleContext) | ||
.setIntermediateArtifacts(ObjcRuleClasses.intermediateArtifacts(ruleContext)) | ||
.addDepObjcProviders( | ||
ruleContext.getPrerequisites("binary", Mode.TARGET, ObjcProvider.class)) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.