提交 43663a6a 编写于 作者: K kohsuke

added one more state so that progressive log output works correctly.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5746 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9ecc4a9a
......@@ -101,8 +101,22 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
protected volatile transient State state;
private static enum State {
/**
* Build is created/queued but we haven't started building it.
*/
NOT_STARTED,
/**
* Build is in progress.
*/
BUILDING,
/**
* Build is completed now, and the status is determined,
* but log files are still being updated.
*/
POST_PRODUCTION,
/**
* Build is completed now, and log file is closed.
*/
COMPLETED
}
......@@ -224,10 +238,18 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
/**
* Returns true if the build is not completed yet.
* This includes "not started yet" state.
*/
@Exported
public boolean isBuilding() {
return state!=State.COMPLETED;
return state.compareTo(State.POST_PRODUCTION) < 0;
}
/**
* Returns true if the log file is still being updated.
*/
public boolean isLogUpdated() {
return state.compareTo(State.COMPLETED) < 0;
}
/**
......@@ -649,12 +671,12 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
long end = System.currentTimeMillis();
duration = end-start;
// mark the state as completed.
// advance the state.
// the significance of doing this is that Hudson
// will now see this build as completed.
// things like triggering other builds requires this as pre-condition.
// see issue #980.
state = State.COMPLETED;
state = State.POST_PRODUCTION;
try {
job.cleanUp(listener);
......@@ -841,7 +863,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
* Handles incremental log output.
*/
public void doProgressiveLog( StaplerRequest req, StaplerResponse rsp) throws IOException {
new LargeText(getLogFile(),!isBuilding()).doProgressText(req,rsp);
new LargeText(getLogFile(),!isLogUpdated()).doProgressText(req,rsp);
}
public void doToggleLogKeep( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
......
......@@ -15,7 +15,7 @@
</l:rightspace>
<j:choose>
<!-- Do progressive console output -->
<j:when test="${it.building}">
<j:when test="${it.isLogUpdated()}">
<pre id="out"></pre>
<div id="spinner">
<img src="${imagesURL}/spinner.gif" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册