Skip to content

Commit

Permalink
Add --manifest_file option into BazelJavaBuilder
Browse files Browse the repository at this point in the history
Now Bazel JavaBuilder can specifiy a file as the manifest file, before
this it just creates the manifest file on the fly.

--
Change-Id: I515d63a008e2c9e9113c56d3646b8bc78b76b3a7
Reviewed-on: https://cr.bazel.build/8352
PiperOrigin-RevId: 145428635
MOS_MIGRATED_REVID=145428635
  • Loading branch information
meteorcloudy authored and laszlocsomor committed Jan 25, 2017
1 parent 1da72a7 commit 32f0333
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public final class JavaLibraryBuildRequest {
private final String classDir;
private final String tempDir;

private final String manifestFile;

private JacocoInstrumentationProcessor jacocoInstrumentationProcessor;

private final boolean compressJar;
Expand Down Expand Up @@ -156,6 +158,7 @@ public JavaLibraryBuildRequest(
this.extdir = optionsParser.getExtdir();
this.processorPath = optionsParser.getProcessorPath();
this.processorNames = optionsParser.getProcessorNames();
this.manifestFile = optionsParser.getManifestFile();
// Since the default behavior of this tool with no arguments is "rm -fr <classDir>", let's not
// default to ".", shall we?
if (optionsParser.getClassDir() != null) {
Expand Down Expand Up @@ -264,6 +267,10 @@ public String getTempDir() {
return tempDir;
}

public String getManifestFile() {
return manifestFile;
}

public JacocoInstrumentationProcessor getJacocoInstrumentationProcessor() {
return jacocoInstrumentationProcessor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public final class OptionsParser {
private String sourceGenDir;
private String generatedSourcesOutputJar;
private String manifestProtoPath;
private String manifestFile;
private final Set<String> sourceRoots = new HashSet<>();

private final List<String> sourceFiles = new ArrayList<>();
Expand Down Expand Up @@ -145,6 +146,9 @@ private void processCommandlineArgs(Deque<String> argQueue) throws InvalidComman
case "--output_manifest_proto":
manifestProtoPath = getArgument(argQueue, arg);
break;
case "--manifest_file":
manifestFile = getArgument(argQueue, arg);
break;
case "--source_roots":
collectFlagArguments(sourceRoots, argQueue, "-");
break;
Expand Down Expand Up @@ -372,6 +376,10 @@ public String getManifestProtoPath() {
return manifestProtoPath;
}

public String getManifestFile() {
return manifestFile;
}

public Set<String> getSourceRoots() {
return sourceRoots;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public void buildJar(JavaLibraryBuildRequest build) throws IOException {
JarCreator jar = new JarCreator(build.getOutputJar());
jar.setNormalize(true);
jar.setCompression(build.compressJar());
jar.setManifestFile(build.getManifestFile());

for (String resourceJar : build.getResourceJars()) {
for (Path root : getJarFileSystem(Paths.get(resourceJar)).getRootDirectories()) {
Expand Down

0 comments on commit 32f0333

Please sign in to comment.