private CustomCommandLine getProtobufCommandLine() { CustomCommandLine.Builder commandLineBuilder = new CustomCommandLine.Builder() .add(attributes.getProtoCompiler().getExecPathString()) .add("--input-file-list") .add(getProtoInputListFile().getExecPathString()) .add("--output-dir") .add(getWorkspaceRelativeOutputDir().getSafePathString()) .add("--force") .add("--proto-root-dir") .add("."); boolean configAdded = false; for (Artifact portableProtoFilter : getPortableProtoFilters()) { String configFlag; if (!configAdded) { configFlag = "--config"; configAdded = true; } else { configFlag = "--extra-filter-config"; } commandLineBuilder.add(configFlag).add(portableProtoFilter.getExecPathString()); } return commandLineBuilder.build(); }
private CustomCommandLine getPb2CommandLine() { CustomCommandLine.Builder commandLineBuilder = new CustomCommandLine.Builder() .add(attributes.getProtoCompiler().getExecPathString()) .add("--input-file-list") .add(getProtoInputListFile().getExecPathString()) .add("--output-dir") .add(getWorkspaceRelativeOutputDir().getSafePathString()) .add("--working-dir") .add("."); if (attributes.getOptionsFile() != null) { commandLineBuilder .add("--compiler-options-path") .add(attributes.getOptionsFile().getExecPathString()); } if (attributes.outputsCpp()) { commandLineBuilder.add("--generate-cpp"); } if (attributes.usesObjcHeaderNames()) { commandLineBuilder.add("--use-objc-header-names"); } return commandLineBuilder.build(); }
/** 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)); }
public static CustomCommandLine.Builder defaultSingleJarCommandLine( Artifact outputJar, String javaMainClass, ImmutableList<String> deployManifestLines, Iterable<Artifact> buildInfoFiles, ImmutableList<Artifact> classpathResources, Iterable<Artifact> runtimeClasspath, boolean includeBuildData, Compression compress, Artifact launcher) { CustomCommandLine.Builder args = CustomCommandLine.builder(); args.addExecPath("--output", outputJar); if (compress == Compression.COMPRESSED) { args.add("--compression"); } args.add("--normalize"); if (javaMainClass != null) { args.add("--main_class"); args.add(javaMainClass); } if (!deployManifestLines.isEmpty()) { args.add("--deploy_manifest_lines"); args.add(deployManifestLines); } if (buildInfoFiles != null) { for (Artifact artifact : buildInfoFiles) { args.addExecPath("--build_info_file", artifact); } } if (!includeBuildData) { args.add("--exclude_build_data"); } if (launcher != null) { args.add("--java_launcher"); args.add(launcher.getExecPathString()); } args.addExecPaths("--classpath_resources", classpathResources); args.addExecPaths("--sources", runtimeClasspath); return args; }