diff --git a/src/main/java/hudson/tasks/Ant.java b/src/main/java/hudson/tasks/Ant.java index 63464c2..99a7c60 100644 --- a/src/main/java/hudson/tasks/Ant.java +++ b/src/main/java/hudson/tasks/Ant.java @@ -366,6 +366,7 @@ public AntInstallation(String name, String home, List> * @deprecated as of 1.308 * Use {@link #AntInstallation(String, String, List)} */ + @Deprecated public AntInstallation(String name, String home) { this(name,home,Collections.>emptyList()); } @@ -451,12 +452,12 @@ public String getDisplayName() { // for compatibility reasons, the persistence is done by Ant.DescriptorImpl @Override public AntInstallation[] getInstallations() { - return Jenkins.getInstance().getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); + return Jenkins.get().getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); } @Override public void setInstallations(AntInstallation... installations) { - Jenkins.getInstance().getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(installations); + Jenkins.get().getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(installations); } @Override @@ -469,7 +470,7 @@ public List getDefaultInstallers() { */ public FormValidation doCheckHome(@QueryParameter File value) { // this can be used to check the existence of a file on the server, so needs to be protected - if(!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) + if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) return FormValidation.ok(); if(value.getPath().equals("")) diff --git a/src/main/java/hudson/tasks/AntWrapper.java b/src/main/java/hudson/tasks/AntWrapper.java index 5c18a7f..379d84b 100644 --- a/src/main/java/hudson/tasks/AntWrapper.java +++ b/src/main/java/hudson/tasks/AntWrapper.java @@ -79,10 +79,10 @@ public void setJdk(String jdk) { @Override public void setUp(Context context, Run build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException { if (installation != null) { - toolEnv(context, installation, Jenkins.getActiveInstance().getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(), workspace, listener, initialEnvironment); + toolEnv(context, installation, Jenkins.get().getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(), workspace, listener, initialEnvironment); } if (jdk != null) { - toolEnv(context, jdk, Jenkins.getActiveInstance().getDescriptorByType(JDK.DescriptorImpl.class).getInstallations(), workspace, listener, initialEnvironment); + toolEnv(context, jdk, Jenkins.get().getDescriptorByType(JDK.DescriptorImpl.class).getInstallations(), workspace, listener, initialEnvironment); } } diff --git a/src/main/resources/hudson/tasks/Ant/config.groovy b/src/main/resources/hudson/tasks/Ant/config.groovy deleted file mode 100644 index 47deb5e..0000000 --- a/src/main/resources/hudson/tasks/Ant/config.groovy +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2011, CloudBees, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package hudson.tasks.Ant; -f=namespace(lib.FormTagLib) - -if (descriptor.installations.length != 0) { - f.entry(title:_("Ant Version")) { - select(class:"setting-input",name:"ant.antName") { - option(value:"(Default)", _("Default")) - descriptor.installations.each { install -> - f.option(selected:install.name==instance?.ant?.name, value:install.name){ - text(install.name) - } - } - } - } -} - -f.entry(title:_("Targets"),field:"targets") { - f.expandableTextbox() -} - -f.advanced { - f.entry(title:_("Build File"),field:"buildFile") { - f.expandableTextbox() - } - f.entry(title:_("Properties"),field:"properties") { - f.expandableTextbox() - } - f.entry(title:_("Java Options"),field:"antOpts") { - f.expandableTextbox() - } -} diff --git a/src/main/resources/hudson/tasks/Ant/config.jelly b/src/main/resources/hudson/tasks/Ant/config.jelly new file mode 100644 index 0000000..c8e2a5d --- /dev/null +++ b/src/main/resources/hudson/tasks/Ant/config.jelly @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/hudson/tasks/AntWrapper/config.groovy b/src/main/resources/hudson/tasks/AntWrapper/config.groovy deleted file mode 100644 index 71d9820..0000000 --- a/src/main/resources/hudson/tasks/AntWrapper/config.groovy +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2016, CloudBees, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package hudson.tasks.AntWrapper; -f=namespace(lib.FormTagLib) - -def installations = app.getDescriptorByType(hudson.tasks.Ant.DescriptorImpl).installations -if (installations.length != 0) { - f.entry(title: _('Ant Version')) { - select(class: 'setting-input', name: 'ant.installation') { - option(value: '', _('Default')) - installations.each { install -> - f.option(selected: install.name == instance?.installation, value: install.name){ - text(install.name) - } - } - } - } -} - -def jdks = app.getDescriptorByType(hudson.model.JDK.DescriptorImpl).installations -if (jdks.length != 0) { - f.entry(title: _('JDK')) { - select(class: 'setting-input', name: 'ant.jdk') { - option(value: '', _('Default')) - jdks.each { install -> - f.option(selected: install.name == instance?.jdk, value: install.name){ - text(install.name) - } - } - } - } -} diff --git a/src/main/resources/hudson/tasks/AntWrapper/config.jelly b/src/main/resources/hudson/tasks/AntWrapper/config.jelly new file mode 100644 index 0000000..8e03d4a --- /dev/null +++ b/src/main/resources/hudson/tasks/AntWrapper/config.jelly @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/test/java/hudson/tasks/AntTest.java b/src/test/java/hudson/tasks/AntTest.java index d87b672..dec4826 100644 --- a/src/test/java/hudson/tasks/AntTest.java +++ b/src/test/java/hudson/tasks/AntTest.java @@ -130,9 +130,7 @@ public void testConfigRoundtrip() throws Exception { */ @Test public void testGlobalConfigAjax() throws Exception { - HtmlPage p = Jenkins.getVersion().toString().startsWith("2") ? - r.createWebClient().goTo("configureTools") : - r.createWebClient().goTo("configure"); + HtmlPage p = r.createWebClient().goTo("configureTools"); HtmlForm f = p.getFormByName("config"); HtmlButton b = r.getButtonByCaption(f, "Add Ant"); b.click(); @@ -184,12 +182,8 @@ public void testSensitiveParameters() throws Exception { project.getBuildersList().add(new Ant("foo",null,null,null,null)); FreeStyleBuild build = project.scheduleBuild2(0).get(); - // Due to bug JENKINS-28790. Password should not be shown but it is. - if (SystemUtils.IS_OS_WINDOWS && Jenkins.getVersion().isOlderThan(new VersionNumber("1.653"))) { - r.assertLogContains("-Dpassword=12345", build); - } else { - r.assertLogNotContains("-Dpassword=12345", build); - } + + r.assertLogNotContains("-Dpassword=12345", build); } @Test