From be76d0938401be581c66fbb2f274e95660883904 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 22 Sep 2014 11:54:31 -0400 Subject: [PATCH] If during hudson-dev:run we have updated a bundled plugin, honor that pin at next start. --- core/src/main/java/hudson/init/InitStrategy.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/hudson/init/InitStrategy.java b/core/src/main/java/hudson/init/InitStrategy.java index 9012b4c65a..7b8497405d 100644 --- a/core/src/main/java/hudson/init/InitStrategy.java +++ b/core/src/main/java/hudson/init/InitStrategy.java @@ -10,6 +10,7 @@ import java.util.Collection; import java.util.List; import java.util.ArrayList; import java.util.Arrays; +import java.util.Iterator; import java.util.logging.Level; import java.util.logging.Logger; @@ -49,6 +50,15 @@ public class InitStrategy { // for example, while doing "mvn jpi:run" or "mvn hpi:run" on a plugin that's bundled with Jenkins, we want to the // *.jpl file to override the bundled jpi/hpi file. getBundledPluginsFromProperty(r); + Iterator it = r.iterator(); + while (it.hasNext()) { + File f = it.next(); + if (new File(pm.rootDir, f.getName().replace(".hpi", ".jpi") + ".pinned").isFile()) { + // Cf. PluginManager.copyBundledPlugin, which is not called in this case. + LOGGER.log(Level.INFO, "ignoring {0} since this plugin is pinned", f); + it.remove(); + } + } // similarly, we prefer *.jpi over *.hpi listPluginFiles(pm, ".jpl", r); // linked plugin. for debugging.