Skip to content

Commit

Permalink
Fix endless loop when used with Ant builder
Browse files Browse the repository at this point in the history
[FIXES JENKINS-46051]
  • Loading branch information
wolfs committed Sep 26, 2017
1 parent 13140a0 commit 319f42a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
Expand Up @@ -25,12 +25,12 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
<l:ajax>
<table class='pane' id='console-outline'>
<table class='pane' id='gradle-console-outline'>
<tr>
<td class='pane-header'>${%Executed Gradle Tasks}</td>
</tr>
<tr>
<td id='console-outline-body'>
<td id='gradle-console-outline-body'>
<ul></ul>
</td>
</tr>
Expand Down
24 changes: 13 additions & 11 deletions src/main/resources/hudson/plugins/gradle/GradleTaskNote/script.js
@@ -1,24 +1,26 @@
(function() {
(function () {
// created on demand
var outline = null;
var loading = false;

var queue = []; // gradle tasks are queued up until we load outline.

function loadOutline() {
if (outline != null) return false; // already loaded
if (outline != null) return false; // already loaded

if (!loading) {
loading = true;
var u = new Ajax.Updater(document.getElementById("side-panel"),
rootURL + "/descriptor/hudson.plugins.gradle.GradleTaskNote/outline",
{insertion: Insertion.Bottom, onComplete: function() {
if (!u.success()) return; // we can't us onSuccess because that kicks in before onComplete
outline = document.getElementById("console-outline-body")
.getElementsByTagName('ul')[0];
loading = false;
queue.each(handle);
}});
rootURL + "/descriptor/hudson.plugins.gradle.GradleTaskNote/outline",
{
insertion: Insertion.Bottom, onComplete: function () {
if (!u.success()) return; // we can't us onSuccess because that kicks in before onComplete
outline = document.getElementById("gradle-console-outline-body")
.getElementsByTagName('ul')[0];
loading = false;
queue.each(handle);
}
});
}
return true;
}
Expand All @@ -42,7 +44,7 @@

Behaviour.register({
// insert <a name="..."> for each Gradle task and put it into the outline
"b.gradle-task" : function(e) {
"b.gradle-task": function (e) {
handle(e);
}
});
Expand Down
@@ -1,8 +1,8 @@
#console-outline-body ul {
#gradle-console-outline-body ul {
padding-left:5%;
word-wrap:break-word;
}

#console-outline-body ul li a {
#gradle-console-outline-body ul li a {
word-break:break-all;
}

0 comments on commit 319f42a

Please sign in to comment.