Package gw.lang.init

Class ClasspathToGosuPathEntryUtil

java.lang.Object
gw.lang.init.ClasspathToGosuPathEntryUtil

public class ClasspathToGosuPathEntryUtil extends Object
  • Field Details

  • Constructor Details

    • ClasspathToGosuPathEntryUtil

      public ClasspathToGosuPathEntryUtil()
  • Method Details

    • convertClasspathToGosuPathEntries

      public static List<GosuPathEntry> convertClasspathToGosuPathEntries(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)