use of build.pluto.buildjava.JarBuilder in project spoofax by metaborg.
the class PackageBuilder method jar.
public Origin jar(File jarFile, File baseDir, @Nullable Origin origin, @Nullable File depPath, Iterable<File> paths) throws IOException {
final Collection<JarBuilder.Entry> fileEntries = Lists.newLinkedList();
for (File path : paths) {
require(path, new DirectoryModifiedStamper());
final Collection<File> files = findFiles(path);
for (final File classFile : files) {
final String relative = relativize(classFile, baseDir);
// Ignore files that are not relative to the base directory.
if (relative != null) {
// Convert \ to / on Windows; ZIP/JAR files must use / for paths.
// HACK: this should be fixed in the JarBuilder.
final String forwardslashRelative = relative.replace('\\', '/');
fileEntries.add(new JarBuilder.Entry(forwardslashRelative, classFile));
}
}
}
final BuildRequest<?, ?, ?, ?> buildRequest = new BuildRequest<>(JarBuilder.factory, new JarBuilder.Input(jarFile, fileEntries, origin, depPath));
final Origin jarOrigin = Origin.from(buildRequest);
requireBuild(jarOrigin);
return jarOrigin;
}
Aggregations