use of com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction in project bazel by bazelbuild.
the class XcodeSupport method registerXcodegenActions.
private void registerXcodegenActions(XcodeProvider.Project project) throws InterruptedException {
Artifact controlFile = intermediateArtifacts.pbxprojControlArtifact();
ruleContext.registerAction(new BinaryFileWriteAction(ruleContext.getActionOwner(), controlFile, xcodegenControlFileBytes(project), /*makeExecutable=*/
false));
ruleContext.registerAction(new SpawnAction.Builder().setMnemonic("GenerateXcodeproj").setExecutable(ruleContext.getExecutablePrerequisite("$xcodegen", Mode.HOST)).addArgument("--control").addInputArgument(controlFile).addOutput(ruleContext.getImplicitOutputArtifact(XcodeSupport.PBXPROJ)).addTransitiveInputs(project.getInputsToXcodegen()).addTransitiveInputs(project.getAdditionalSources()).build(ruleContext));
}
use of com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction in project bazel by bazelbuild.
the class ReleaseBundlingSupport method registerMergeEntitlementsAction.
private void registerMergeEntitlementsAction(NestedSet<Artifact> entitlements) {
PlMergeControlBytes controlBytes = PlMergeControlBytes.fromPlists(entitlements, intermediateArtifacts.entitlements(), PlMergeControlBytes.OutputFormat.XML);
Artifact plMergeControlArtifact = ObjcRuleClasses.artifactByAppendingToBaseName(ruleContext, artifactName(".merge-entitlements-control"));
ruleContext.registerAction(new BinaryFileWriteAction(ruleContext.getActionOwner(), plMergeControlArtifact, controlBytes, /*makeExecutable=*/
false));
ruleContext.registerAction(new SpawnAction.Builder().setMnemonic("MergeEntitlementsFiles").setExecutable(attributes.plmerge()).addArgument("--control").addInputArgument(plMergeControlArtifact).addTransitiveInputs(entitlements).addOutput(intermediateArtifacts.entitlements()).build(ruleContext));
}
use of com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction in project bazel by bazelbuild.
the class ReleaseBundlingSupport method registerBundleMergeActions.
private void registerBundleMergeActions() {
Artifact bundleMergeControlArtifact = ObjcRuleClasses.artifactByAppendingToBaseName(ruleContext, artifactName(".ipa-control"));
BundleMergeControlBytes controlBytes = new BundleMergeControlBytes(bundling, intermediateArtifacts.unprocessedIpa(), ruleContext.getFragment(AppleConfiguration.class));
ruleContext.registerAction(new BinaryFileWriteAction(ruleContext.getActionOwner(), bundleMergeControlArtifact, controlBytes, /*makeExecutable=*/
false));
ruleContext.registerAction(new SpawnAction.Builder().setMnemonic("IosBundle").setProgressMessage("Bundling iOS application: " + ruleContext.getLabel()).setExecutable(attributes.bundleMergeExecutable()).addInputArgument(bundleMergeControlArtifact).addTransitiveInputs(bundling.getBundleContentArtifacts()).addOutput(intermediateArtifacts.unprocessedIpa()).build(ruleContext));
}
use of com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction in project bazel by bazelbuild.
the class BundleSupport method registerMergeInfoplistAction.
/**
* 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()) {
// Nothing to do here.
return;
}
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()).addArgument("--control").addInputArgument(plMergeControlArtifact).addTransitiveInputs(mergingContentArtifacts).addOutput(bundling.getIntermediateArtifacts().mergedInfoplist()).build(ruleContext));
}
use of com.google.devtools.build.lib.analysis.actions.BinaryFileWriteAction in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTestBase method buildIdeInfo.
/**
* Returns a map of (label as string) -> TargetIdeInfo for each rule in the transitive closure of
* the passed target.
*/
protected Map<String, TargetIdeInfo> buildIdeInfo(String target) throws Exception {
buildTarget(target);
AndroidStudioInfoFilesProvider provider = configuredAspect.getProvider(AndroidStudioInfoFilesProvider.class);
Iterable<Artifact> artifacts = provider.getIdeInfoFiles();
Map<String, TargetIdeInfo> ruleIdeInfos = new HashMap<>();
for (Artifact artifact : artifacts) {
Action generatingAction = getGeneratingAction(artifact);
if (generatingAction instanceof BinaryFileWriteAction) {
BinaryFileWriteAction writeAction = (BinaryFileWriteAction) generatingAction;
TargetIdeInfo ruleIdeInfo = TargetIdeInfo.parseFrom(writeAction.getSource().openStream());
ruleIdeInfos.put(ruleIdeInfo.getLabel(), ruleIdeInfo);
} else {
verifyPackageManifestSpawnAction(generatingAction);
}
}
return ruleIdeInfos;
}
Aggregations