Skip to content

Commit

Permalink
[JENKINS-22367] Split JDKInstaller to a plugin (#3301)
Browse files Browse the repository at this point in the history
* [JENKINS-22367] Preparation for split of JDKInstaller to a plugin

* Add split-plugins entry and pending update to war/pom.xml

* Update jdk-tool plugin description

* Fix Findbugs warnings

* Update to HttpComponents Client 4.5

* Preserve formatting in translations of Messages.properties

* Preserve ISO-8859-1 encoding for properties

* Break cycle between jdk-tool and apache-httpcomponents-client-4-api

* Update version numbers after merge

* Add warning for the download from java.sun.com JDK installer

* Fix issues introduced when cleaning up Findbugs errors in 9dbf833

* Use warning class for error message and adjust message text

* Revert "Update to HttpComponents Client 4.5"

This reverts commit 9dbf833.

* Findbugs

* Remove JenkinsRule from test that does not use it

* Update version numbers after merge

* Warn when unexpected exceptions are thrown and update new plugin urls

* Update to 2.109-SNAPSHOT

* Address review feedback

* Update to 2.111-SNAPSHOT

* Try to use the agent's default charset to copy the install log

* Update to 2.112-SNAPSHOT

* Remove local module and use snapshot of jdk-tool

* Update to jdk-tool:1.0
  • Loading branch information
dwnusbaum committed Mar 16, 2018
1 parent f7d3e15 commit f0819d2
Show file tree
Hide file tree
Showing 65 changed files with 29 additions and 2,251 deletions.
22 changes: 19 additions & 3 deletions core/src/main/java/hudson/model/JDK.java
Expand Up @@ -32,16 +32,20 @@
import hudson.slaves.NodeSpecific;
import hudson.tools.ToolInstallation;
import hudson.tools.ToolDescriptor;
import hudson.tools.ToolInstaller;
import hudson.tools.ToolProperty;
import hudson.tools.JDKInstaller;
import hudson.util.XStream2;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;

import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
Expand Down Expand Up @@ -183,8 +187,18 @@ public String getDisplayName() {
}

@Override
public List<JDKInstaller> getDefaultInstallers() {
return Collections.singletonList(new JDKInstaller(null,false));
public List<? extends ToolInstaller> getDefaultInstallers() {
try {
Class<? extends ToolInstaller> jdkInstallerClass = Jenkins.getInstance().getPluginManager()
.uberClassLoader.loadClass("hudson.tools.JDKInstaller").asSubclass(ToolInstaller.class);
Constructor<? extends ToolInstaller> constructor = jdkInstallerClass.getConstructor(String.class, boolean.class);
return Collections.singletonList(constructor.newInstance(null, false));
} catch (ClassNotFoundException e) {
return Collections.emptyList();
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unable to get default installer", e);
return Collections.emptyList();
}
}

/**
Expand All @@ -211,4 +225,6 @@ public static class ConverterImpl extends ToolConverter {
return ((JDK)obj).javaHome;
}
}

private static final Logger LOGGER = Logger.getLogger(JDK.class.getName());
}

0 comments on commit f0819d2

Please sign in to comment.