Skip to content

Commit

Permalink
[FIXED JENKINS-21202] - Added a BatchCommandInstaller
Browse files Browse the repository at this point in the history
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 a7643e2
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions core/src/main/java/hudson/tools/BatchCommandInstaller.java
@@ -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();
}
}
}
1 change: 1 addition & 0 deletions core/src/main/resources/hudson/tools/Messages.properties
Expand Up @@ -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.
Expand Down

0 comments on commit a7643e2

Please sign in to comment.