use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class JpsWrappedJavaSdkReferenceImpl method resolve.
@Nullable
@Override
public JpsTypedLibrary<JpsSdk<JpsDummyElement>> resolve() {
JpsTypedLibrary<? extends JpsSdk<? extends JpsElement>> wrapper = myContainer.getChild(WRAPPER_ROLE).resolve();
if (wrapper == null)
return null;
JpsModel model = getModel();
if (model == null)
return null;
String sdkName = mySdkType.getJavaSdkName(wrapper.getProperties().getSdkProperties());
if (sdkName == null)
return null;
JpsLibrary library = model.getGlobal().getLibraryCollection().findLibrary(sdkName);
return library != null ? library.asTyped(JpsJavaSdkType.INSTANCE) : null;
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class JpsDependenciesEnumeratorTest method createJDomLibrary.
private JpsLibrary createJDomLibrary() {
JpsLibrary library = addLibrary("jdom");
library.addRoot(getJDomJar(), JpsOrderRootType.COMPILED);
library.addRoot(getJDomSources(), JpsOrderRootType.SOURCES);
return library;
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class JpsEclipseClasspathReader method addJUnitDefaultLib.
@Override
protected void addJUnitDefaultLib(JpsModule rootModel, String junitName, ExpandMacroToPathMap macroMap) {
final String ideaHome = macroMap.substitute("$APPLICATION_HOME_DIR$", SystemInfo.isFileSystemCaseSensitive);
final FilenameFilter junitFilter = (dir, name) -> name.startsWith("junit");
File[] junitJars = new File(ideaHome, "lib").listFiles(junitFilter);
if (junitJars == null || junitJars.length == 0) {
junitJars = new File(new File(ideaHome, "community"), "lib").listFiles(junitFilter);
}
if (junitJars != null && junitJars.length > 0) {
final boolean isJUnit4 = junitName.contains("4");
File junitJar = null;
for (File jar : junitJars) {
final boolean isCurrentJarV4 = jar.getName().contains("4");
if (isCurrentJarV4 && isJUnit4 || !isCurrentJarV4 && !isJUnit4) {
junitJar = jar;
break;
}
}
if (junitJar != null) {
final JpsLibrary jpsLibrary = rootModel.addModuleLibrary(junitName, JpsJavaLibraryType.INSTANCE);
jpsLibrary.addRoot(pathToUrl(junitJar.getPath()), JpsOrderRootType.COMPILED);
final JpsDependenciesList dependenciesList = rootModel.getDependenciesList();
dependenciesList.addLibraryDependency(jpsLibrary);
}
}
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class AppEngineEnhancerBuilderTest method addEnhancerLibrary.
private static void addEnhancerLibrary(JpsModule module) {
String path = PathManager.getJarPathForClass(Enhance.class);
JpsLibrary library = module.addModuleLibrary("appengine-enhancer", JpsJavaLibraryType.INSTANCE);
library.addRoot(new File(path), JpsOrderRootType.COMPILED);
module.getDependenciesList().addLibraryDependency(library);
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-elixir by KronicDeth.
the class BuilderTest method addElixirSdk.
private JpsSdk<SdkProperties> addElixirSdk(@NotNull JpsSdk erlangSdk) {
JpsTypedLibrary<JpsSdk<SdkProperties>> elixirTypedLibrary = myModel.getGlobal().addSdk("Elixir " + elixirVersion(), elixirSdkHome(), elixirVersion(), Elixir.INSTANCE);
HomePath.eachEbinPath(elixirSdkHome(), ebinPath -> elixirTypedLibrary.addRoot(JpsPathUtil.pathToUrl(ebinPath.toAbsolutePath().toString()), JpsOrderRootType.COMPILED));
JpsLibrary erlangSdkLibrary = erlangSdk.getParent();
elixirTypedLibrary.getProperties().getSdkProperties().setErlangSdkName(erlangSdkLibrary.getName());
for (JpsLibraryRoot erlangLibraryRoot : erlangSdkLibrary.getRoots(JpsOrderRootType.COMPILED)) {
elixirTypedLibrary.addRoot(erlangLibraryRoot.getUrl(), JpsOrderRootType.COMPILED);
}
return elixirTypedLibrary.getProperties();
}
Aggregations