Polygerrit: Decouple bower components rebuild from dev workflow
According to the polygerrit "development story", any changes related
to polymer components (aka bower_components) involves buck invocations:
buck run //tools/js:bower2buck -- -o /tmp/newbuck
That why it doesn't really make sense to try to optimize for this use
case and to refresh polymer components in running container. This only
makes polygerrit development unnecessary slow. We are getting the main
use case to refresh the polygerrit sources in running container for
granted due to mounting the PolyGerritUiServlet to the source path.
Remove bower components rebuild filter and store zip file system in
bower component own servlet instead of leaking it to GerritLauncher
instance. Eclipse project generation depends now also on polymer
components.
Test Plan:
* Run:
buck build polygerrit && \
java -jar buck-out/gen/polygerrit/polygerrit.war daemon \
--polygerrit-dev -d ../gerrit_testsite
* Change polygerrit sources, refresh the browser window and observe
that the changes are reflected and that there is no delay for
unnecessary `buck build //polygerrit-ui:polygerrit_components`
invocations, every time browser window is refreshed.
Change-Id: If86bbbe14b9ddf0fa5001b2bbb9a39629e9b383f
This commit is contained in:
committed by
Dave Borowitz
parent
29101927ba
commit
d383d114c4
@@ -341,33 +341,7 @@ public final class GerritLauncher {
|
||||
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 {
|
||||
public static FileSystem newZipFileSystem(Path zip) throws IOException {
|
||||
return FileSystems.newFileSystem(
|
||||
URI.create("jar:" + zip.toUri()),
|
||||
Collections.<String, String> emptyMap());
|
||||
|
||||
Reference in New Issue
Block a user