Skip to content
Permalink
Browse files
[FIXED JENKINS-21202] - Added a BatchCommandInstaller
Related to https://issues.jenkins-ci.org/browse/JENKINS-21202

Signed-off-by: Oleg Nenashev <nenashev@synopsys.com>
  • Loading branch information
oleg-nenashev committed Jan 2, 2014
1 parent 38afe16 commit a7643e2df00c72761e2583d2be150e1f4521f323
Showing with 63 additions and 0 deletions.
  1. +62 −0 core/src/main/java/hudson/tools/BatchCommandInstaller.java
  2. +1 −0 core/src/main/resources/hudson/tools/Messages.properties
@@ -0,0 +1,62 @@
/*
* The MIT License
*
* Copyright (c) 2013, Oleg Nenashev
*
* 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.tools;

import hudson.Extension;
import hudson.FilePath;
import org.kohsuke.stapler.DataBoundConstructor;

/**
* Installs tool via script execution of Batch script.
* Inspired by "Command installer" from the Jenkins core.
* @since 0.1
*/
public class BatchCommandInstaller extends AbstractCommandInstaller {

@DataBoundConstructor
public BatchCommandInstaller(String label, String command, String toolHome) {
super(label, command, toolHome);
}

@Override
public String getCommandFileExtension() {
return ".bat";
}

@Override
public String[] getCommandCall(FilePath script) {
String[] cmd = {"cmd", "/c", "call", script.getRemote()};
return cmd;
}

@Extension
public static class DescriptorImpl extends Descriptor<BatchCommandInstaller> {

@Override
public String getDisplayName() {
return Messages.BatchCommandInstaller_DescriptorImpl_displayName();
}
}
}
@@ -24,6 +24,7 @@ ToolLocationNodeProperty.displayName=Tool Locations
CommandInstaller.DescriptorImpl.displayName=Run Shell Command
CommandInstaller.no_command=Must provide a command to run.
CommandInstaller.no_toolHome=Must provide a tool home directory.
BatchCommandInstaller.DescriptorImpl.displayName=Run Batch Command
JDKInstaller.FailedToInstallJDK=Failed to install JDK. Exit code={0}
JDKInstaller.RequireOracleAccount=Installing JDK requires Oracle account. <a href="{0}" target="_new">Please enter your username/password</a>
JDKInstaller.UnableToInstallUntilLicenseAccepted=Unable to auto-install JDK until the license is accepted.

0 comments on commit a7643e2

Please sign in to comment.