Skip to content

Commit

Permalink
[FIXED JENKINS-9309]
Browse files Browse the repository at this point in the history
  • Loading branch information
Karsten Brandt authored and Karsten Brandt committed Jun 3, 2012
1 parent 2a42be3 commit ba86876
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
26 changes: 23 additions & 3 deletions src/main/java/hudson/plugins/sloccount/SloccountProjectAction.java
Expand Up @@ -71,13 +71,33 @@ public void doIndex(final StaplerRequest request, final StaplerResponse response
}

public final boolean hasValidResults() {

AbstractBuild<?, ?> build = getLastFinishedBuild();

if (build != null) {

SloccountBuildAction resultAction = build.getAction(SloccountBuildAction.class);
if (resultAction != null) {
return resultAction.getPreviousResult() != null;
}
int nbr_results = 0;

do{

SloccountResult result = resultAction.getResult();

if(result != null){

nbr_results++;

if(nbr_results > 1){

return true;
}
}

resultAction = resultAction.getPreviousAction();

}while(resultAction != null);
}

return false;
}

Expand Down
14 changes: 10 additions & 4 deletions src/main/java/hudson/plugins/sloccount/SloccountPublisher.java
Expand Up @@ -46,8 +46,11 @@ protected boolean canContinue(final Result result) {

@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener){


SloccountResult result = null;

if(this.canContinue(build.getResult())){

FilePath workspace = build.getWorkspace();
PrintStream logger = listener.getLogger();
SloccountParser parser = new SloccountParser(this.getRealEncoding(), this.getRealPattern(), logger);
Expand All @@ -65,10 +68,13 @@ public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListene
return false;
}

SloccountResult result = new SloccountResult(report, build);
SloccountBuildAction buildAction = new SloccountBuildAction(build, result);
build.addAction(buildAction);
result = new SloccountResult(report, build);
}

SloccountBuildAction buildAction = new SloccountBuildAction(build, result);

build.addAction(buildAction);

return true;
}

Expand Down

0 comments on commit ba86876

Please sign in to comment.