Skip to content

Commit

Permalink
Fixes #614 - allow dv to be installed
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
robstryker committed Nov 19, 2020
1 parent 076d890 commit 929ae52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.jboss.tools.rsp.foundation.core.tasks.TaskModel;
import org.jboss.tools.rsp.launching.utils.NativeEnvironmentUtils;
import org.jboss.tools.rsp.launching.utils.OSUtils;
import org.jboss.tools.rsp.runtime.core.RuntimeCoreActivator;
import org.jboss.tools.rsp.runtime.core.model.DownloadRuntime;
import org.jboss.tools.rsp.runtime.core.model.IDownloadRuntimeWorkflowConstants;
import org.jboss.tools.rsp.runtime.core.model.IDownloadRuntimesModel;
Expand Down Expand Up @@ -73,9 +74,10 @@ public IStatus installRuntime(DownloadRuntime downloadRuntime, String unzipDirec
getDownloadUrl(downloadRuntime, taskModel), deleteOnExit, user, pass, new SubProgressMonitor(monitor, 80));

ILaunch launch = createExternalToolsLaunchConfiguration(f, unzipDirectory);
// if (launch == null) {
// return new Status(IStatus.ERROR, RuntimeCoreActivator.PLUGIN_ID, "Unable to launch external command java -jar " + f.getAbsolutePath());
// }
if (launch == null) {
return new Status(IStatus.ERROR, RuntimeCoreActivator.PLUGIN_ID, "Unable to launch external command java -jar " + f.getAbsolutePath());
}

IProcess[] processes = launch.getProcesses();
boolean finished = false;
while(!monitor.isCanceled() && !finished) {
Expand Down Expand Up @@ -116,15 +118,14 @@ private String getDownloadUrl(DownloadRuntime downloadRuntime, TaskModel taskMod

static final String JAVA_HOME_PROPERTY_KEY = "java.home";
private ILaunch createExternalToolsLaunchConfiguration(File downloadedFile,
String unzipDirectory) {
String unzipDirectory) throws CoreException {

IVMInstall install = createVMRegistry().getDefaultVMInstall();
IPath javaBin = getJavaBin(install);
IPath workingDir = new Path(downloadedFile.getAbsolutePath());
IPath workingDir = new Path(downloadedFile.getParentFile().getAbsolutePath());
JavaJarInstallationLauncher launcher = new JavaJarInstallationLauncher(javaBin, workingDir,
new Path(downloadedFile.getAbsolutePath()), new Path(unzipDirectory));
ILaunch l2 = launcher.createLaunch("run");
return l2;
return launcher.launch("run");
}

private IVMInstallRegistry createVMRegistry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ public IDownloadRuntimeRunner getDownloadRunner(DownloadRuntime dr) {
if( dlrt == null || !dlrt.equals(dr))
return null;

String installer = (dr.getInstallationMethod() == null ?
IRuntimeInstaller.EXTRACT_INSTALLER : dr.getInstallationMethod());
if( !IRuntimeInstaller.EXTRACT_INSTALLER.equals(installer))
return null; // we can't handle binary or installer-jar at this time

String prop = dr.getProperty(DownloadRuntime.PROPERTY_REQUIRES_CREDENTIALS);
if( prop != null && "true".equalsIgnoreCase(prop))
// // Requires credentials is handled by another executor
Expand Down

0 comments on commit 929ae52

Please sign in to comment.