use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class JpsDependenciesEnumeratorTest method testAnnotations.
public void testAnnotations() {
JpsLibrary library = addLibrary();
String libraryUrl = "temp:///library";
library.addRoot(libraryUrl, JpsAnnotationRootType.INSTANCE);
JpsModuleRootModificationUtil.addDependency(myModule, library);
assertEnumeratorRoots(dependencies(myModule).annotations(), libraryUrl);
String moduleUrl = "temp://module";
JpsJavaExtensionService.getInstance().getOrCreateModuleExtension(myModule).getAnnotationRoots().addUrl(moduleUrl);
assertEnumeratorRoots(dependencies(myModule).annotations(), moduleUrl, libraryUrl);
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class JpsJavaExtensionTest method testDependency.
public void testDependency() {
final JpsModel model = myModel.createModifiableModel(new TestJpsEventDispatcher());
final JpsModule module = model.getProject().addModule("m", JpsJavaModuleType.INSTANCE);
final JpsLibrary library = model.getProject().addLibrary("l", JpsJavaLibraryType.INSTANCE);
final JpsLibraryDependency dependency = module.getDependenciesList().addLibraryDependency(library);
getJavaService().getOrCreateDependencyExtension(dependency).setScope(JpsJavaDependencyScope.TEST);
getJavaService().getOrCreateDependencyExtension(dependency).setExported(true);
model.commit();
List<JpsDependencyElement> dependencies = assertOneElement(myProject.getModules()).getDependenciesList().getDependencies();
assertEquals(2, dependencies.size());
final JpsDependencyElement dep = dependencies.get(1);
final JpsJavaDependencyExtension extension = getJavaService().getDependencyExtension(dep);
assertNotNull(extension);
assertTrue(extension.isExported());
assertSame(JpsJavaDependencyScope.TEST, extension.getScope());
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class JpsModuleTest method testChangeElementInModifiableModel.
public void testChangeElementInModifiableModel() {
final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
final JpsModule dep = myProject.addModule("dep", JpsJavaModuleType.INSTANCE);
final JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE);
module.getDependenciesList().addLibraryDependency(library);
myDispatcher.clear();
final JpsModel modifiableModel = myModel.createModifiableModel(new TestJpsEventDispatcher());
final JpsModule m = modifiableModel.getProject().getModules().get(0);
assertEquals("m", m.getName());
m.getDependenciesList().getDependencies().get(1).remove();
m.getDependenciesList().addModuleDependency(dep);
modifiableModel.commit();
assertOneElement(myDispatcher.retrieveRemoved(JpsLibraryDependency.class));
assertSame(dep, assertOneElement(myDispatcher.retrieveAdded(JpsModuleDependency.class)).getModuleReference().resolve());
List<JpsDependencyElement> dependencies = module.getDependenciesList().getDependencies();
assertEquals(2, dependencies.size());
assertSame(dep, assertInstanceOf(dependencies.get(1), JpsModuleDependency.class).getModuleReference().resolve());
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class MarkDirtyTest method testRecompileDependentTests.
public void testRecompileDependentTests() {
JpsModule module = addModule();
addTestRoot(module, "testSrc");
JpsLibrary library = addLibrary("lib/a.jar");
JpsModuleRootModificationUtil.addDependency(module, library, JpsJavaDependencyScope.TEST, false);
doTestBuild(1).assertSuccessful();
}
use of org.jetbrains.jps.model.library.JpsLibrary in project intellij-community by JetBrains.
the class ArtifactBuilderTest method testCopyLibrary.
public void testCopyLibrary() {
final JpsLibrary library = addProjectLibrary("lib", getJUnitJarPath());
final JpsArtifact a = addArtifact(root().lib(library));
buildAll();
assertOutput(a, fs().file("junit.jar"));
}
Aggregations