use of org.jetbrains.jps.model.library.sdk.JpsSdk in project intellij-community by JetBrains.
the class JpsPluginProjectSerializationTest method testLoadProject.
public void testLoadProject() {
loadProject("plugins/devkit/jps-plugin/testData/pluginProject/pluginProject.ipr");
JpsModule module = assertOneElement(myProject.getModules());
assertEquals(JpsPluginModuleType.INSTANCE, module.getModuleType());
JpsTypedModule<JpsSimpleElement<JpsPluginModuleProperties>> pluginModule = module.asTyped(JpsPluginModuleType.INSTANCE);
assertNotNull(pluginModule);
String url = pluginModule.getProperties().getData().getPluginXmlUrl();
assertEquals(getUrl("META-INF/plugin.xml"), url);
JpsTypedLibrary<JpsSdk<JpsDummyElement>> javaSdk = myModel.getGlobal().addSdk("1.6", null, null, JpsJavaSdkType.INSTANCE);
JpsSimpleElement<JpsIdeaSdkProperties> properties = JpsElementFactory.getInstance().createSimpleElement(new JpsIdeaSdkProperties(null, "1.6"));
JpsTypedLibrary<JpsSdk<JpsSimpleElement<JpsIdeaSdkProperties>>> pluginSdk = myModel.getGlobal().addSdk("IDEA plugin SDK", null, null, JpsIdeaSdkType.INSTANCE, properties);
assertSame(pluginSdk.getProperties(), module.getSdk(JpsIdeaSdkType.INSTANCE));
assertSame(javaSdk.getProperties(), module.getSdk(JpsJavaSdkType.INSTANCE));
}
use of org.jetbrains.jps.model.library.sdk.JpsSdk in project intellij-community by JetBrains.
the class JpsSdkTableSerializer method saveSdks.
public static void saveSdks(JpsLibraryCollection libraryCollection, Element sdkListElement) {
for (JpsLibrary library : libraryCollection.getLibraries()) {
JpsElement properties = library.getProperties();
if (properties instanceof JpsSdk<?>) {
Element sdkTag = new Element(JDK_TAG);
saveSdk((JpsSdk<?>) properties, sdkTag);
sdkListElement.addContent(sdkTag);
}
}
}
use of org.jetbrains.jps.model.library.sdk.JpsSdk in project intellij-community by JetBrains.
the class JpsDependenciesEnumeratorTest method testDoNotAddJdkRootsFromModuleDependency.
public void testDoNotAddJdkRootsFromModuleDependency() {
JpsModule dep = addModule("dep");
JpsTypedLibrary<JpsSdk<JpsDummyElement>> jdk8 = addJdk("1.8");
JpsModuleRootModificationUtil.addDependency(myModule, dep);
JpsModuleRootModificationUtil.setModuleSdk(dep, jdk8.getProperties());
assertClassRoots(dependencies(myModule).recursively(), getRtJarJdk17());
assertClassRoots(dependencies(dep).recursively(), getRtJarJdk18());
}
use of org.jetbrains.jps.model.library.sdk.JpsSdk in project intellij-community by JetBrains.
the class JpsDependenciesEnumeratorTest method addJdk.
@NotNull
private JpsTypedLibrary<JpsSdk<JpsDummyElement>> addJdk(final String mockJdkVersion) {
final String mockJdkDir = "mockJDK-" + mockJdkVersion;
File home = PathManagerEx.findFileUnderCommunityHome("java/" + mockJdkDir);
JpsTypedLibrary<JpsSdk<JpsDummyElement>> jdk = myModel.getGlobal().addSdk(mockJdkVersion, home.getAbsolutePath(), mockJdkVersion, JpsJavaSdkType.INSTANCE);
jdk.addRoot(getRtJar(mockJdkDir), JpsOrderRootType.COMPILED);
return jdk;
}
use of org.jetbrains.jps.model.library.sdk.JpsSdk in project intellij-community by JetBrains.
the class JpsJavaExtensionServiceImpl method addJavaSdk.
@Override
public JpsTypedLibrary<JpsSdk<JpsDummyElement>> addJavaSdk(@NotNull JpsGlobal global, @NotNull String name, @NotNull String homePath) {
String version = JdkVersionDetector.getInstance().detectJdkVersion(homePath);
JpsTypedLibrary<JpsSdk<JpsDummyElement>> sdk = global.addSdk(name, homePath, version, JpsJavaSdkType.INSTANCE);
File homeDir = new File(FileUtil.toSystemDependentName(homePath));
List<File> roots = JavaSdkUtil.getJdkClassesRoots(homeDir, false);
for (File root : roots) {
sdk.addRoot(root, JpsOrderRootType.COMPILED);
}
return sdk;
}
Aggregations