mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-08 01:26:03 +00:00
Compute version number before loading Hudson, so that the HudsonIsLoading page
displays a version number git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4802 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
8335306844
commit
0651632745
1 file changed
+24
-20
@@ -100,31 +100,14 @@ public class WebAppMain implements ServletContextListener {
|
||||
|
||||
new Thread("hudson initialization thread") {
|
||||
public void run() {
|
||||
computeVersion(context);
|
||||
|
||||
try {
|
||||
context.setAttribute("app",new Hudson(home,context));
|
||||
} catch( IOException e ) {
|
||||
throw new Error(e);
|
||||
}
|
||||
|
||||
// set the version
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
InputStream is = getClass().getResourceAsStream("hudson-version.properties");
|
||||
if(is!=null)
|
||||
props.load(is);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); // if the version properties is missing, that's OK.
|
||||
}
|
||||
String ver = props.getProperty("version");
|
||||
if(ver==null) ver="?";
|
||||
Hudson.VERSION = ver;
|
||||
context.setAttribute("version",ver);
|
||||
|
||||
if(ver.equals("?"))
|
||||
Hudson.RESOURCE_PATH = "";
|
||||
else
|
||||
Hudson.RESOURCE_PATH = "/static/"+Util.getDigestOf(ver).substring(0,8);
|
||||
|
||||
Trigger.init(); // start running trigger
|
||||
|
||||
// trigger the loading of changelogs in the background,
|
||||
@@ -139,7 +122,28 @@ public class WebAppMain implements ServletContextListener {
|
||||
}.start();
|
||||
}
|
||||
|
||||
/**
|
||||
protected void computeVersion(ServletContext context) {
|
||||
// set the version
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
InputStream is = getClass().getResourceAsStream("hudson-version.properties");
|
||||
if(is!=null)
|
||||
props.load(is);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); // if the version properties is missing, that's OK.
|
||||
}
|
||||
String ver = props.getProperty("version");
|
||||
if(ver==null) ver="?";
|
||||
Hudson.VERSION = ver;
|
||||
context.setAttribute("version",ver);
|
||||
|
||||
if(ver.equals("?"))
|
||||
Hudson.RESOURCE_PATH = "";
|
||||
else
|
||||
Hudson.RESOURCE_PATH = "/static/"+Util.getDigestOf(ver).substring(0,8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs log handler to monitor all Hudson logs.
|
||||
*/
|
||||
private void installLogger() {
|
||||
|
||||
Reference in new issue
Block a user