Search in sources :

Example 86 with JpsModule

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

the class IncrementalArtifactBuildingTest method testMoveClassFromOneModuleToAnother.

public void testMoveClassFromOneModuleToAnother() {
    String file = createFile("src1/A.java", "class A{}");
    JpsModule m1 = addModule("m1", PathUtil.getParentPath(file));
    JpsModule m2 = addModule("m2", PathUtil.getParentPath(createFile("src2/B.java", "class B{}")));
    JpsArtifact a = addArtifact(root().module(m1).module(m2));
    buildAll();
    assertOutput(a, fs().file("A.class").file("B.class"));
    delete(file);
    createFile("src2/A.java", "class A{}");
    buildAll();
    assertOutput(a, fs().file("A.class").file("B.class"));
    assertDeletedAndCopied(new String[] { "out/artifacts/a/A.class", "out/production/m1/A.class" }, "out/production/m2/A.class");
    buildAllAndAssertUpToDate();
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 87 with JpsModule

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

the class ModuleExcludeIndexTest method testProjectOutput.

public void testProjectOutput() throws IOException {
    File out = new File(myRoot, "out");
    getJavaService().getOrCreateProjectExtension(myProject).setOutputUrl(JpsPathUtil.pathToUrl(out.getAbsolutePath()));
    JpsModule module1 = addModule();
    getJavaService().getOrCreateModuleExtension(module1).setInheritOutput(true);
    JpsModule module2 = addModule();
    addContentRoot(module2, out);
    getJavaService().getOrCreateModuleExtension(module2).setInheritOutput(true);
    assertNotExcluded(myRoot);
    assertExcluded(out);
    assertEmpty(getModuleExcludes(module1));
    assertSameElements(getModuleExcludes(module2), out);
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) File(java.io.File)

Example 88 with JpsModule

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

the class ModuleExcludeIndexTest method testContentRootUnderExcluded.

public void testContentRootUnderExcluded() {
    File contentRoot = new File(myRoot, "project");
    File excluded = new File(contentRoot, "exc");
    File unexcluded = new File(excluded, "src");
    JpsModule module = addModule();
    addContentRoot(module, contentRoot);
    addExcludedRoot(module, excluded);
    addContentRoot(module, unexcluded);
    assertNotExcluded(contentRoot);
    assertExcluded(excluded);
    assertNotExcluded(unexcluded);
    ModuleExcludeIndexImpl index = createIndex();
    assertFalse(index.isExcludedFromModule(contentRoot, module));
    assertTrue(index.isExcludedFromModule(excluded, module));
    assertFalse(index.isExcludedFromModule(unexcluded, module));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) File(java.io.File)

Example 89 with JpsModule

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

the class ModuleExcludeIndexTest method testSourceRootUnderExcluded.

public void testSourceRootUnderExcluded() {
    File project = new File(myRoot, "project");
    File exc = new File(project, "exc");
    File src = new File(exc, "src");
    JpsModule module = addModule();
    addContentRoot(module, project);
    addExcludedRoot(module, exc);
    addSourceRoot(module, src);
    assertNotExcluded(src);
    addExcludedRoot(module, src);
    assertExcluded(src);
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) File(java.io.File)

Example 90 with JpsModule

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

the class ModuleExcludeIndexTest method testInnerModuleUnderExcludedRoot.

public void testInnerModuleUnderExcludedRoot() {
    File outerRoot = new File(myRoot, "outer");
    File exc = new File(outerRoot, "exc");
    File innerRoot = new File(exc, "inner");
    JpsModule outer = addModule("outer");
    addContentRoot(outer, outerRoot);
    addExcludedRoot(outer, exc);
    JpsModule inner = addModule("inner");
    addContentRoot(inner, innerRoot);
    assertNotExcluded(outerRoot);
    assertNotExcluded(innerRoot);
    assertSameElements(getModuleExcludes(outer), exc, innerRoot);
    assertEmpty(getModuleExcludes(inner));
    ModuleExcludeIndexImpl index = createIndex();
    assertTrue(index.isExcludedFromModule(innerRoot, outer));
    assertFalse(index.isExcludedFromModule(innerRoot, inner));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) File(java.io.File)

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