Skip to content

Commit

Permalink
[FIXED JENKINS-18629] inline attribute instead of deprecated newInsta…
Browse files Browse the repository at this point in the history
…nce() call, this allows use Gradle in ConditionalBuildstep with DataBoundConstructor
  • Loading branch information
imod committed Nov 13, 2013
1 parent 2922ce1 commit f4319ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -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>
Expand Down
20 changes: 1 addition & 19 deletions src/main/java/hudson/plugins/gradle/Gradle.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}

}
4 changes: 2 additions & 2 deletions src/main/resources/hudson/plugins/gradle/Gradle/config.jelly
@@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit f4319ad

Please sign in to comment.