Serve bower_components from buck-out with --polygerrit-dev
Rather than depending on the bower_components directory built by `bower install`, use the Buck build and serve components directly from polygerrit_components.bower_components.zip. Add a filter in front of PolyGerrit index paths to recompile bower_components. The end result is developers can run: buck build polygerrit && \ java -jar buck-out/.../polygerrit.war --polygerrit-dev ... to start up a PolyGerrit dev server serving local content, without the need for Eclipse, and that doesn't need to be restarted even if bower_component deps change. Change-Id: I8658a2b03ff8ecb6824092e02411ba3b67d37569
This commit is contained in:
@@ -334,14 +334,44 @@ public final class GerritLauncher {
|
||||
zip = zip.toRealPath();
|
||||
FileSystem zipFs = zipFileSystems.get(zip);
|
||||
if (zipFs == null) {
|
||||
zipFs = FileSystems.newFileSystem(
|
||||
URI.create("jar:" + zip.toUri()),
|
||||
Collections.<String, String> emptyMap());
|
||||
zipFs = newZipFileSystem(zip);
|
||||
zipFileSystems.put(zip, zipFs);
|
||||
}
|
||||
return zipFs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload the zip {@link FileSystem} for a path.
|
||||
* <p>
|
||||
* <strong>Warning</strong>: This calls {@link FileSystem#close()} on any
|
||||
* previously open instance of the filesystem at this path, which may cause
|
||||
* {@code IOException}s in any open path handles created with the old
|
||||
* filesystem. Use with caution.
|
||||
*
|
||||
* @param zip path to zip file.
|
||||
* @return reloaded filesystem instance.
|
||||
* @throws IOException if there was an error reading the zip file.
|
||||
*/
|
||||
public static synchronized FileSystem reloadZipFileSystem(Path zip)
|
||||
throws IOException {
|
||||
// FileSystems canonicalizes the path, so we should too.
|
||||
zip = zip.toRealPath();
|
||||
@SuppressWarnings("resource") // Caching resource for later use.
|
||||
FileSystem zipFs = zipFileSystems.get(zip);
|
||||
if (zipFs != null) {
|
||||
zipFs.close();
|
||||
}
|
||||
zipFs = newZipFileSystem(zip);
|
||||
zipFileSystems.put(zip, zipFs);
|
||||
return zipFs;
|
||||
}
|
||||
|
||||
private static FileSystem newZipFileSystem(Path zip) throws IOException {
|
||||
return FileSystems.newFileSystem(
|
||||
URI.create("jar:" + zip.toUri()),
|
||||
Collections.<String, String> emptyMap());
|
||||
}
|
||||
|
||||
private static File locateMyArchive() throws FileNotFoundException {
|
||||
final ClassLoader myCL = GerritLauncher.class.getClassLoader();
|
||||
final String myName =
|
||||
|
Reference in New Issue
Block a user