private Collection<File> getClasspathFiles( ModuleChunk chunk, JpsJavaClasspathKind kind, final boolean excludeMainModuleOutput, ClasspathPart classpathPart, final boolean exportedOnly) { final Set<File> files = new LinkedHashSet<File>(); for (JpsModule module : chunk.getModules()) { JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(module).includedIn(kind).recursively(); if (exportedOnly) { enumerator = enumerator.exportedOnly(); } if (classpathPart == ClasspathPart.BEFORE_JDK) { enumerator = enumerator.satisfying(new BeforeJavaSdkItemFilter(module)); } else if (classpathPart == ClasspathPart.AFTER_JDK) { enumerator = enumerator.satisfying(new AfterJavaSdkItemFilter(module)); } JpsJavaDependenciesRootsEnumerator rootsEnumerator = enumerator.classes(); if (excludeMainModuleOutput) { rootsEnumerator = rootsEnumerator.withoutSelfModuleOutput(); } files.addAll(rootsEnumerator.getRoots()); } if (classpathPart == ClasspathPart.BEFORE_JDK) { for (JpsModule module : chunk.getModules()) { JpsSdk<JpsDummyElement> sdk = module.getSdk(JpsJavaSdkType.INSTANCE); if (sdk != null) { files.addAll(sdk.getParent().getFiles(JpsOrderRootType.COMPILED)); } } } return files; }
public List<String> moduleRuntimeClasspath(JpsModule module, boolean forTests) { JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(module) .recursively() .includedIn(JpsJavaClasspathKind.runtime(forTests)); Collection<File> roots = enumerator.classes().getRoots(); List<String> result = new ArrayList<String>(); for (File root : roots) { result.add(root.getAbsolutePath()); } return result; }