Package gw.lang.init
Class ClasspathToGosuPathEntryUtil
- java.lang.Object
-
- gw.lang.init.ClasspathToGosuPathEntryUtil
-
public class ClasspathToGosuPathEntryUtil extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classClasspathToGosuPathEntryUtil.ClassPathToGosuPathConverterBlockprivate static classClasspathToGosuPathEntryUtil.ModuleFindFromSourceEntryBlockprivate static interfaceClasspathToGosuPathEntryUtil.SourceDirectoryBlock
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringGW_FORBID_GOSU_JARS
-
Constructor Summary
Constructors Constructor Description ClasspathToGosuPathEntryUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<GosuPathEntry>convertClasspathToGosuPathEntries(java.util.List<IDirectory> classpath)Converts a set of Files into a list of GosuPathEntries.private static IDirectoryexecuteOnSourceDirectory(IDirectory dir, ClasspathToGosuPathEntryUtil.SourceDirectoryBlock block)static IDirectoryfindModuleRootFromSourceEntry(IDirectory dir)private static booleanmoduleContainsSourceDir(IFile moduleFile, IDirectory dir)
-
-
-
Field Detail
-
GW_FORBID_GOSU_JARS
static final java.lang.String GW_FORBID_GOSU_JARS
- See Also:
- Constant Field Values
-
-
Method Detail
-
convertClasspathToGosuPathEntries
public static java.util.List<GosuPathEntry> convertClasspathToGosuPathEntries(java.util.List<IDirectory> classpath)
Converts a set of Files into a list of GosuPathEntries. The algorithm is as follows. For each File in the list, if that file is a directory or a jar file, see if there's a module.xml file in the root. If so, parse that file and add in a GosuPathEntry based on the module definition. If not, if the file is a directory, look for a module.xml file in the parent directory. If such a file exists, add in a GosuPathEntry based on that file. If no module.xml file has been found in either case, add a GosuPath entry for the directory or jar file using the directory or jar as the root and as the only source directory, and with an empty list of custom typeloaders. If the file is not a directory and not a jar file, ignore it entirely. In all cases, duplicate entries are ignored; if a GosuPathEntry is created previously for a File and the root directory for that previous path entry is equal to or an ancestor of the root directory of the new path entry, the new path entry is not added to the list.- Parameters:
classpath- the list of Files to turn into GosuPathEntries- Returns:
- an ordered list of GosuPathEntries created based on the algorithm described above
-
findModuleRootFromSourceEntry
public static IDirectory findModuleRootFromSourceEntry(IDirectory dir)
-
executeOnSourceDirectory
private static IDirectory executeOnSourceDirectory(IDirectory dir, ClasspathToGosuPathEntryUtil.SourceDirectoryBlock block)
-
moduleContainsSourceDir
private static boolean moduleContainsSourceDir(IFile moduleFile, IDirectory dir)
-
-