use of com.google.devtools.build.buildjar.proto.JavaCompilation.CompilationUnit in project bazel by bazelbuild.
the class AnnotationProcessingModule method buildManifestProto.
private Manifest buildManifestProto() {
Manifest.Builder builder = Manifest.newBuilder();
List<String> keys = new ArrayList<>(units.keySet());
Collections.sort(keys);
for (String key : keys) {
CompilationUnit unit = units.get(key);
builder.addCompilationUnit(unit);
}
return builder.build();
}
use of com.google.devtools.build.buildjar.proto.JavaCompilation.CompilationUnit in project bazel by bazelbuild.
the class IdlClass method writeSourceJar.
private static void writeSourceJar(IdlClassOptions options, List<Path> idlSources, Manifest manifest) throws IOException {
Path tempDir = options.tempDir.resolve("sourcejar");
Path idlSourceBaseDir = options.idlSourceBaseDir;
for (Path path : idlSources) {
for (CompilationUnit unit : manifest.getCompilationUnitList()) {
if (Paths.get(unit.getPath()).equals(path)) {
String pkg = unit.getPkg();
Path source = idlSourceBaseDir != null ? idlSourceBaseDir.resolve(path) : path;
Path target = tempDir.resolve(pkg.replace('.', '/')).resolve(path.getFileName());
Files.createDirectories(target.getParent());
Files.copy(source, target);
break;
}
}
}
writeOutputJar(options.outputSourceJar, tempDir);
}
Aggregations