Merge branch 'stable-2.14'

* stable-2.14:
  PluginLoader: Remove stale plugin files from /tmp on startup
  Format Java files with google-java-format
  Update blame-cache to 0.2-1
  Set version to 2.13.8
  Upgrade JGit to 4.5.2.201704071617-r

Change-Id: Ia27737010984ba58ff74c844aa252d9b7adffbad
This commit is contained in:
David Pursehouse
2017-04-11 16:11:58 +09:00
4 changed files with 34 additions and 4 deletions

View File

@@ -556,10 +556,10 @@ maven_jar(
maven_jar(
name = "blame_cache",
artifact = "com/google/gitiles:blame-cache:0.2",
artifact = "com/google/gitiles:blame-cache:0.2-1",
attach_source = False,
repository = GERRIT,
sha1 = "519fc548df920123bce986056d2f644663665ae4",
sha1 = "da7977e8b140b63f18054214c1d1b86ffa6896cb",
)
# Keep this version of Soy synchronized with the version used in Gitiles.

View File

@@ -70,7 +70,8 @@ public class ServerInfo extends JavaScriptObject {
public final native String replyTooltip() /*-{ return this.reply_tooltip; }-*/;
public final native boolean showAssigneeInChangesTable() /*-{ return this.show_assignee_in_changes_table || false; }-*/;
public final native boolean
showAssigneeInChangesTable() /*-{ return this.show_assignee_in_changes_table || false; }-*/;
public final native int updateDelay() /*-{ return this.update_delay || 0; }-*/;

View File

@@ -207,7 +207,8 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
boolean hasAssigneeInIndex =
indexes.getSearchIndex().getSchema().hasField(ChangeField.ASSIGNEE);
info.showAssigneeInChangesTable =
toBoolean(cfg.getBoolean("change", "showAssigneeInChangesTable", false) && hasAssigneeInIndex);
toBoolean(
cfg.getBoolean("change", "showAssigneeInChangesTable", false) && hasAssigneeInIndex);
info.largeChange = cfg.getInt("change", "largeChange", 500);
info.replyTooltip =
Optional.ofNullable(cfg.getString("change", null, "replyTooltip")).orElse("Reply and score")

View File

@@ -79,6 +79,7 @@ public class PluginLoader implements LifecycleListener {
private final Path pluginsDir;
private final Path dataDir;
private final Path tempDir;
private final PluginGuiceEnvironment env;
private final ServerInformationImpl srvInfoImpl;
private final PluginUser.Factory pluginUserFactory;
@@ -107,6 +108,7 @@ public class PluginLoader implements LifecycleListener {
UniversalServerPluginProvider pluginFactory) {
pluginsDir = sitePaths.plugins_dir;
dataDir = sitePaths.data_dir;
tempDir = sitePaths.tmp_dir;
env = pe;
srvInfoImpl = sii;
pluginUserFactory = puf;
@@ -325,8 +327,34 @@ public class PluginLoader implements LifecycleListener {
}
}
private void removeStalePluginFiles() {
DirectoryStream.Filter<Path> filter =
new DirectoryStream.Filter<Path>() {
@Override
public boolean accept(Path entry) throws IOException {
return entry.getFileName().toString().startsWith("plugin_");
}
};
try (DirectoryStream<Path> files = Files.newDirectoryStream(tempDir, filter)) {
for (Path file : files) {
log.info("Removing stale plugin file: " + file.toFile().getName());
try {
Files.delete(file);
} catch (IOException e) {
log.error(
String.format(
"Failed to remove stale plugin file %s: %s",
file.toFile().getName(), e.getMessage()));
}
}
} catch (IOException e) {
log.warn("Unable to discover stale plugin files: " + e.getMessage());
}
}
@Override
public synchronized void start() {
removeStalePluginFiles();
log.info("Loading plugins from " + pluginsDir.toAbsolutePath());
srvInfoImpl.state = ServerInformation.State.STARTUP;
rescan();