Search in sources :

Example 91 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.

the class JpsDependenciesEnumeratorTest method testNotExportedLibrary.

public void testNotExportedLibrary() throws Exception {
    final JpsModule dep = addModule("dep");
    JpsModuleRootModificationUtil.addDependency(dep, createJDomLibrary(), JpsJavaDependencyScope.COMPILE, false);
    JpsModuleRootModificationUtil.addDependency(myModule, createAsmLibrary(), JpsJavaDependencyScope.COMPILE, false);
    JpsModuleRootModificationUtil.addDependency(myModule, dep, JpsJavaDependencyScope.COMPILE, false);
    assertClassRoots(dependencies(myModule).withoutSdk(), getAsmJar());
    assertClassRoots(dependencies(myModule).withoutSdk().recursively(), getAsmJar(), getJDomJar());
    assertClassRoots(dependencies(myModule).withoutSdk().recursivelyExportedOnly(), getAsmJar());
    assertClassRoots(dependencies(myModule).withoutSdk().exportedOnly().recursively());
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule)

Example 92 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule 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());
}
Also used : JpsLibraryDependency(org.jetbrains.jps.model.module.JpsLibraryDependency) JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsDependencyElement(org.jetbrains.jps.model.module.JpsDependencyElement) JpsLibrary(org.jetbrains.jps.model.library.JpsLibrary)

Example 93 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.

the class JpsGantProjectBuilder method buildModules.

public void buildModules(List<JpsModule> modules) {
    Set<String> names = new LinkedHashSet<>();
    info("Collecting dependencies for " + modules.size() + " modules");
    for (JpsModule module : modules) {
        Set<String> dependencies = getModuleDependencies(module, false);
        for (String dependency : dependencies) {
            if (names.add(dependency)) {
                info(" adding " + dependency + " required for " + module.getName());
            }
        }
    }
    runBuild(names, false, false);
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule)

Example 94 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.

the class JpsGantProjectBuilder method exportModuleOutputProperties.

public void exportModuleOutputProperties() {
    for (JpsModule module : myModel.getProject().getModules()) {
        for (boolean test : new boolean[] { true, false }) {
            String propertyName = "module." + module.getName() + ".output." + (test ? "test" : "main");
            String outputPath = getModuleOutput(module, test);
            myProject.setProperty(propertyName, outputPath);
        }
    }
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule)

Example 95 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.

the class CommonTest method testMoveClassToDependentModuleWithSameOutput.

public void testMoveClassToDependentModuleWithSameOutput() throws Exception {
    final JpsSdk<JpsDummyElement> sdk = getOrCreateJdk();
    final String commonOutput = getAbsolutePath("out");
    JpsModule moduleA = addModule("moduleA", new String[] { getAbsolutePath("moduleA/src") }, commonOutput, commonOutput, sdk);
    JpsModule moduleB = addModule("moduleB", new String[] { getAbsolutePath("moduleB/src") }, commonOutput, commonOutput, sdk);
    JpsModuleRootModificationUtil.addDependency(moduleB, moduleA);
    doTestBuild(1).assertSuccessful();
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsDummyElement(org.jetbrains.jps.model.JpsDummyElement)

Aggregations

JpsModule (org.jetbrains.jps.model.module.JpsModule)128 File (java.io.File)33 NotNull (org.jetbrains.annotations.NotNull)15 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)15 JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)14 JpsAndroidModuleExtensionImpl (org.jetbrains.jps.android.model.impl.JpsAndroidModuleExtensionImpl)13 JpsAndroidModuleProperties (org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties)13 THashSet (gnu.trove.THashSet)11 JpsLibrary (org.jetbrains.jps.model.library.JpsLibrary)11 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)10 JpsSimpleElement (org.jetbrains.jps.model.JpsSimpleElement)10 JpsArtifact (org.jetbrains.jps.model.artifact.JpsArtifact)10 ArrayList (java.util.ArrayList)9 HashMap (com.intellij.util.containers.HashMap)8 IOException (java.io.IOException)8 TObjectLongHashMap (gnu.trove.TObjectLongHashMap)7 JpsDependencyElement (org.jetbrains.jps.model.module.JpsDependencyElement)7 JpsDummyElement (org.jetbrains.jps.model.JpsDummyElement)6 Pair (com.intellij.openapi.util.Pair)5 Nullable (org.jetbrains.annotations.Nullable)5