コード例 #1
0
  private void findTestTypesImpl(
      IDirectory root, IDirectory entry, TestClassFindType findType, ArrayList<IType> types) {
    if (entry.exists()) {
      for (IFile iFile : entry.listFiles()) {
        possiblyAddTest(iFile, root, findType, types);
      }

      for (IDirectory subDir : entry.listDirs()) {
        findTestTypesImpl(root, subDir, findType, types);
      }
    }
  }
コード例 #2
0
  private void possiblyAddTest(
      IFile entry, IDirectory root, TestClassFindType findType, ArrayList<IType> types) {
    if (shouldConsiderFile(entry, findType)) {
      String relativeFileName = root.relativePath(entry);
      String typeName = relativeFileName.replaceFirst("\\..*$", "").replace("/", ".");
      if (shouldConsiderTypeName(typeName)) {
        try {
          IType type = TypeSystem.getByFullName(typeName);
          if (shouldConsiderType(type)) {
            types.add(type);
          }
        } catch (Exception e) {
          // Log rather than warn, because invalid resources can exist
          ILogger logger = CommonServices.getEntityAccess().getLogger();
          logger.warn("Could not load type " + typeName);

          // TODO - AHK
          //      if (isLoggingErrors()) {
          //        logError("Couldn't load ");
          //        logError(GosuExceptionUtil.getStackTraceAsString(e));
          //      }
        }
      }
    }
  }
コード例 #3
0
ファイル: Suite.java プロジェクト: gosu-lang/old-gosu-repo
  protected List<IDirectory> createDefaultGosuClassSearchPath() {
    List<IDirectory> gosuClassSearchPath = new ArrayList<IDirectory>();
    List<? extends IDirectory> sourceEntries = TypeSystem.getCurrentModule().getSourcePath();
    for (IDirectory dir : sourceEntries) {
      if (_modules.isEmpty()) {
        gosuClassSearchPath.add(dir);
      } else {
        // TODO - AHK - This seems rather unnecessary:  we should have a way to already know what
        // the module root is
        IDirectory moduleRoot = ClasspathToGosuPathEntryUtil.findModuleRootFromSourceEntry(dir);
        if (_modules.contains(moduleRoot.getName())) {
          gosuClassSearchPath.add(dir);
        }
      }
    }

    return gosuClassSearchPath;
  }