Skip to content
Permalink
Browse files

[FIXED JENKINS-18629] inline attribute instead of deprecated newInsta…

…nce() call, this allows use Gradle in ConditionalBuildstep with DataBoundConstructor
  • Loading branch information
imod committed Nov 13, 2013
1 parent 2922ce1 commit f4319ad6130bfbd6b1312577b1f10a2d944e10cf
@@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.427</version>
<version>1.480</version>
</parent>

<artifactId>gradle</artifactId>
@@ -6,10 +6,8 @@
import hudson.tasks.Builder;
import hudson.tools.ToolInstallation;
import hudson.util.ArgumentListBuilder;
import net.sf.json.JSONObject;
import org.jenkinsci.lib.dryrun.DryRun;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import java.io.IOException;
import java.util.HashMap;
@@ -107,7 +105,7 @@ public GradleInstallation getGradle() {
return null;
}

@Override
// @Override
public boolean performDryRun(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
return performTask(true, build, launcher, listener);
}
@@ -331,21 +329,5 @@ public void setInstallations(GradleInstallation... installations) {
this.installations = installations;
save();
}

@Override
public Gradle newInstance(StaplerRequest request, JSONObject formData) throws FormException {

// "flatten" formData for useWrapper radioBlocks
JSONObject useWrapper = formData.getJSONObject("useWrapper");
boolean wrapper = useWrapper.getBoolean("value");
useWrapper.remove("value");
for (String key : (Set<String>) useWrapper.keySet()) {
formData.put(key, useWrapper.get(key));
}
formData.put("useWrapper", wrapper);

return (Gradle) request.bindJSON(clazz, formData);
}
}

}
@@ -1,7 +1,7 @@
<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">

<f:radioBlock name="useWrapper" checked="${!instance.useWrapper}" value="false" title="${%Invoke Gradle}">
<f:radioBlock inline="true" name="useWrapper" checked="${!instance.useWrapper}" value="false" title="${%Invoke Gradle}">
<f:entry title="${%Gradle Version}" field="gradleName">
<select class="setting-input" name="gradleName">
<option>(Default)</option>
@@ -11,7 +11,7 @@
</select>
</f:entry>
</f:radioBlock>
<f:radioBlock name="useWrapper" checked="${instance.useWrapper}" value="true" title="${%Use Gradle Wrapper}">
<f:radioBlock inline="true" name="useWrapper" checked="${instance.useWrapper}" value="true" title="${%Use Gradle Wrapper}">
<f:entry title="${%Make gradlew executable}" field="makeExecutable">
<f:checkbox />
</f:entry>

0 comments on commit f4319ad

Please sign in to comment.
You can’t perform that action at this time.