/** Registers an action to copy Swift standard library dylibs into app bundle. */ private void registerSwiftStdlibActionsIfNecessary() { if (!objcProvider.is(USES_SWIFT)) { return; } ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext); CustomCommandLine.Builder commandLine = CustomCommandLine.builder() .addPath(intermediateArtifacts.swiftFrameworksFileZip().getExecPath()) .add("--platform") .add(IosSdkCommands.swiftPlatform(objcConfiguration)) .addExecPath("--scan-executable", intermediateArtifacts.combinedArchitectureBinary()); ruleContext.registerAction( ObjcRuleClasses.spawnOnDarwinActionBuilder(ruleContext) .setMnemonic("SwiftStdlibCopy") .setExecutable(attributes.swiftStdlibToolWrapper()) .setCommandLine(commandLine.build()) .addOutput(intermediateArtifacts.swiftFrameworksFileZip()) .addInput(intermediateArtifacts.combinedArchitectureBinary()) // TODO(dmaclach): Adding realpath and xcrunwrapper should not be required once // https://github.com/google/bazel/issues/285 is fixed. .addInput(attributes.realpath()) .addInput(CompilationSupport.xcrunwrapper(ruleContext).getExecutable()) .build(ruleContext)); }