Search in sources :

Example 26 with JpsArtifact

use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.

the class CleanArtifactOutputOnRebuildTest method testDoNotCleanIfContainsArtifactRoot.

public void testDoNotCleanIfContainsArtifactRoot() {
    JpsModule m = addModule("m");
    String resDir = PathUtil.getParentPath(createFile("res/a.txt"));
    m.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(resDir));
    JpsArtifact a = addArtifact(root().dirCopy(resDir));
    a.setOutputPath(resDir);
    buildArtifacts(a);
    assertOutput(a, fs().file("a.txt"));
    createFile("res/b.txt");
    rebuildAllModulesAndArtifacts();
    assertOutput(a, fs().file("a.txt").file("b.txt"));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 27 with JpsArtifact

use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.

the class CleanArtifactOutputOnRebuildTest method testDoNotCleanOnRebuildIfOptionIsSwitchedOff.

public void testDoNotCleanOnRebuildIfOptionIsSwitchedOff() {
    JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(myProject).setClearOutputDirectoryOnRebuild(false);
    JpsArtifact a = addArtifact(root().fileCopy(createFile("a.txt")));
    buildArtifacts(a);
    createFileInArtifactOutput(a, "b.txt");
    rebuildAllModulesAndArtifacts();
    assertOutput(a, fs().file("a.txt").file("b.txt"));
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 28 with JpsArtifact

use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.

the class CleanArtifactOutputOnRebuildTest method testCleanOutput.

public void testCleanOutput() {
    JpsArtifact a = addArtifact(root().fileCopy(createFile("a.txt")));
    buildArtifacts(a);
    createFileInArtifactOutput(a, "b.txt");
    assertOutput(a, fs().file("a.txt").file("b.txt"));
    rebuildAllModulesAndArtifacts();
    assertOutput(a, fs().file("a.txt").file("b.txt"));
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 29 with JpsArtifact

use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.

the class IncrementalArtifactBuildingTest method testOneFileInTwoArtifacts.

public void testOneFileInTwoArtifacts() {
    final String file = createFile("file.txt");
    final JpsArtifact a1 = addArtifact("a1", root().dir("dir").fileCopy(file));
    final JpsArtifact a2 = addArtifact("a2", root().dir("dir2").fileCopy(file));
    buildAll();
    buildArtifacts(a1);
    assertUpToDate();
    buildArtifacts(a2);
    assertUpToDate();
    buildAllAndAssertUpToDate();
    change(file);
    buildArtifacts(a1);
    assertDeletedAndCopied("out/artifacts/a1/dir/file.txt", "file.txt");
    buildArtifacts(a1);
    assertUpToDate();
    buildArtifacts(a2);
    assertDeletedAndCopied("out/artifacts/a2/dir2/file.txt", "file.txt");
    buildArtifacts(a2);
    assertUpToDate();
    buildArtifacts(a1);
    assertUpToDate();
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 30 with JpsArtifact

use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.

the class IncrementalArtifactBuildingTest method testTwoArtifactsWithSameOutput.

//IDEA-51910
public void testTwoArtifactsWithSameOutput() throws Exception {
    final String res1 = PathUtil.getParentPath(createFile("res1/a.txt", "1"));
    final String res2 = PathUtil.getParentPath(createFile("res2/a.txt", "2"));
    final JpsArtifact a1 = addArtifact("a1", root().dirCopy(res1));
    final JpsArtifact a2 = addArtifact("a2", root().dirCopy(res2));
    a2.setOutputPath(a1.getOutputPath());
    assertEquals(a1.getOutputPath(), a2.getOutputPath());
    buildArtifacts(a1);
    assertOutput(a1, fs().file("a.txt", "1"));
    assertOutput(a2, fs().file("a.txt", "1"));
    buildArtifacts(a1);
    assertUpToDate();
    buildArtifacts(a2);
    assertOutput(a2, fs().file("a.txt", "2"));
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Aggregations

JpsArtifact (org.jetbrains.jps.model.artifact.JpsArtifact)85 File (java.io.File)10 JpsModule (org.jetbrains.jps.model.module.JpsModule)10 JarFile (java.util.jar.JarFile)4 ZipFile (java.util.zip.ZipFile)4 IOException (java.io.IOException)3 NotNull (org.jetbrains.annotations.NotNull)3 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)3 JpsCompositePackagingElement (org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement)3 THashSet (gnu.trove.THashSet)2 JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)2 JpsElement (org.jetbrains.jps.model.JpsElement)2 JpsPackagingElement (org.jetbrains.jps.model.artifact.elements.JpsPackagingElement)2 JpsLibrary (org.jetbrains.jps.model.library.JpsLibrary)2 BuildFileProperty (com.intellij.lang.ant.config.impl.BuildFileProperty)1 SmartList (com.intellij.util.SmartList)1 HashMap (com.intellij.util.containers.HashMap)1 HashSet (com.intellij.util.containers.HashSet)1 MultiMap (com.intellij.util.containers.MultiMap)1 TIntObjectHashMap (gnu.trove.TIntObjectHashMap)1