public void readClasspath( JpsModule model, final String testPattern, Element classpathElement, JpsMacroExpander expander) throws IOException { LOG.debug("start loading classpath for " + model.getName()); final HashSet<String> libs = new HashSet<String>(); for (Object o : classpathElement.getChildren(EclipseXml.CLASSPATHENTRY_TAG)) { try { readClasspathEntry( model, new ArrayList<String>(), new ArrayList<String>(), new HashSet<String>(), testPattern, (Element) o, 0, null, expander.getExpandMacroMap(), libs); } catch (ConversionException e) { throw new IOException(e); } } boolean foundSdkDependency = false; JpsDependenciesList dependenciesList = model.getDependenciesList(); for (JpsDependencyElement element : dependenciesList.getDependencies()) { if (element instanceof JpsSdkDependency) { foundSdkDependency = true; break; } } if (!foundSdkDependency) { dependenciesList.addSdkDependency(JpsJavaSdkType.INSTANCE); } if (LOG.isDebugEnabled()) { String name = model.getName(); LOG.debug( "finished loading classpath for " + name + " (" + dependenciesList.getDependencies().size() + " items):"); for (JpsDependencyElement element : dependenciesList.getDependencies()) { LOG.debug(" [" + name + "]:" + element.toString()); } } }
@Override protected void addNamedLibrary( JpsModule rootModel, Collection<String> unknownLibraries, boolean exported, String name, boolean applicationLevel) { if (LOG.isDebugEnabled()) { LOG.debug( "loading " + rootModel.getName() + ": adding " + (applicationLevel ? "application" : "project") + " library '" + name + "'"); } JpsElementFactory factory = JpsElementFactory.getInstance(); JpsLibraryReference libraryReference; final String level = myLibLevels.get(name); libraryReference = level != null ? factory.createLibraryReference( name, JpsLibraryTableSerializer.createLibraryTableReference(level)) : factory.createLibraryReference(name, factory.createGlobalReference()); final JpsLibraryDependency dependency = rootModel.getDependenciesList().addLibraryDependency(libraryReference); setLibraryEntryExported(dependency, exported); }
@Override protected void setUpModuleJdk( JpsModule rootModel, Collection<String> unknownJdks, EclipseModuleManager eclipseModuleManager, String jdkName) { if (LOG.isDebugEnabled()) { LOG.debug("loading " + rootModel.getName() + ": set module jdk " + jdkName); } rootModel.getDependenciesList().addSdkDependency(JpsJavaSdkType.INSTANCE); }
@Override protected void addModuleLibrary( JpsModule rootModel, Element element, boolean exported, String libName, String url, String srcUrl, ExpandMacroToPathMap macroMap) { final JpsLibrary jpsLibrary = rootModel.addModuleLibrary(libName, JpsJavaLibraryType.INSTANCE); final JpsDependenciesList dependenciesList = rootModel.getDependenciesList(); final JpsLibraryDependency dependency = dependenciesList.addLibraryDependency(jpsLibrary); url = StringUtil.trimStart(url, "file://"); final String linked = expandLinkedResourcesPath(url, macroMap); if (linked != null) { url = pathToUrl(linked); } else { url = expandEclipsePath2Url(rootModel, url); } LOG.debug("loading " + rootModel.getName() + ": adding module library " + libName + ": " + url); jpsLibrary.addRoot(url, JpsOrderRootType.COMPILED); setLibraryEntryExported(dependency, exported); }