public class ExternalUtility extends Object
| Constructor and Description |
|---|
ExternalUtility() |
| Modifier and Type | Method and Description |
|---|---|
static String |
dumpConstructors(Class classInQuestion) |
static String |
dumpMethods(Class classInQuestion) |
static ClassLoader |
getGradleClassloader(ClassLoader parentClassLoader,
File gradleHomeDirectory,
boolean showDebugInfo)
Call this to get a classloader that has loaded gradle.
|
static File |
getGradleJar(File gradleHomeDirectory)
This locates the gradle jar.
|
static Object |
invokeStaticMethod(Class classToInvoke,
String methodName,
Class[] argumentsClasses,
Object... argumentValues)
This wraps up invoking a static method into a single call.
|
static Class |
loadGradleClass(String classToLoad,
ClassLoader parentClassLoader,
File gradleHomeDirectory,
boolean showDebugInfo)
This attempts to load the a class from the specified gradle home directory.
|
public static ClassLoader getGradleClassloader(ClassLoader parentClassLoader, File gradleHomeDirectory, boolean showDebugInfo) throws Exception
parentClassLoader - Your classloader. Probably the classloader of whatever class is calling this.gradleHomeDirectory - the root directory of a gradle installationshowDebugInfo - true to show some additional information that may be helpful diagnosing problems is this failsExceptionpublic static File getGradleJar(File gradleHomeDirectory)
gradleHomeDirectory - the root directory of a gradle installation. We're expecting this to have a child directory named 'lib'.public static Class loadGradleClass(String classToLoad, ClassLoader parentClassLoader, File gradleHomeDirectory, boolean showDebugInfo) throws Exception
classToLoad - the full path to the class to loadparentClassLoader - Your classloader. Probably the classloader of whatever class is calling this.gradleHomeDirectory - the root directory of a gradle installationshowDebugInfo - true to show some additional information that may be helpful diagnosing problems is this failsExceptionpublic static Object invokeStaticMethod(Class classToInvoke, String methodName, Class[] argumentsClasses, Object... argumentValues) throws Exception
classToInvoke - the class that has the methodmethodName - the name of the method to invokeargumentsClasses - the classes of the arguments (we can't determine this from the argumentValues because they can be of class A, but implement class B and B is be the argument type of the
method in questionargumentValues - the values of the arguments.ExceptionCopyright © 2013. All rights reserved