@CompileStatic class MainClassFinder extends java.lang.Object
| Modifiers | Name | Description |
|---|---|---|
static class |
MainClassFinder.MainMethodFinder |
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
ROOT_FOLDER_PATH |
| Type | Name and description |
|---|---|
static java.util.Map<java.lang.String, MainClassHolder> |
mainClasses |
| Constructor and description |
|---|
MainClassFinder() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static MainClassHolder |
findMainClass(java.io.File rootFolder, boolean supportCaching) |
|
protected static boolean |
isClassFile(java.io.File f) |
|
protected static boolean |
isMainClass(groovyjarjarasm.asm.ClassReader classReader) |
|
static java.lang.String |
searchMainClass(java.net.URI path, boolean supportCaching)Searches for the main class relative to the give path that is within the project tree |
|
static java.lang.String |
searchMainClass(java.net.URI path, java.util.Collection<java.io.File> classpath, java.io.File targetDirectory, boolean supportCaching)Searches for the main class relative to the given path, as searchMainClass(URI, boolean) does, first in the directories of the compile classpath that belong to the build being compiled. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Searches for the main class relative to the give path that is within the project tree
path - The path as a URIsupportCaching - Whether to cache the result for future calls Searches for the main class relative to the given path, as searchMainClass(URI, boolean) does, first in
the directories of the compile classpath that belong to the build being compiled. A compile classpath carries the
project's main classes directory wherever the build puts it, where the other places searched are guesses under
build/.
A classpath directory belongs to the build when it is next to the compile's own output: Gradle compiles into
<build>/classes/<language>/<sourceSet>, so the main classes are under the same <build>/classes,
wherever the build directory is (inside the project, at the root of the checkout, outside it). Without a target
directory laid out that way, a directory belongs to the build when its project, the nearest directory above it
with a build.gradle or grails-app, is the one path is in. Either way a directory of
another project, such as a plugin subproject's, is not searched.
path - The path as a URIclasspath - The classpath the path is compiled withtargetDirectory - The directory the path is compiled into, or nullsupportCaching - Whether to cache the result for future calls