Search in sources :

Example 56 with JpsArtifact

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

the class RebuildArtifactOnConfigurationChangeTest method testAddRoot.

public void testAddRoot() {
    String dir1 = PathUtil.getParentPath(createFile("dir1/a.txt", "a"));
    String dir2 = PathUtil.getParentPath(createFile("dir2/b.txt", "b"));
    JpsArtifact a = addArtifact(root().dirCopy(dir1));
    buildAll();
    assertOutput(a, fs().file("a.txt", "a"));
    a.getRootElement().addChild(JpsPackagingElementFactory.getInstance().createDirectoryCopy(dir2));
    buildAll();
    assertOutput(a, fs().file("a.txt", "a").file("b.txt", "b"));
    assertDeletedAndCopied("out/artifacts/a/a.txt", "dir1/a.txt", "dir2/b.txt");
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 57 with JpsArtifact

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

the class RebuildArtifactOnConfigurationChangeTest method testChangeOutput.

public void testChangeOutput() {
    String file = createFile("dir/a.txt");
    JpsArtifact a = addArtifact(root().parentDirCopy(file));
    buildAll();
    String oldOutput = a.getOutputPath();
    assertNotNull(oldOutput);
    assertOutput(oldOutput, fs().file("a.txt"));
    String newOutput = PathUtil.getParentPath(oldOutput) + "/a2";
    a.setOutputPath(newOutput);
    buildAll();
    assertOutput(newOutput, fs().file("a.txt"));
    assertOutput(oldOutput, fs());
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 58 with JpsArtifact

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

the class CleanArtifactOutputOnRebuildTest method testCleanArtifactOutputIfItIsIncludedIntoAnotherArtifact.

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

Example 59 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testAddFileToArchive.

public void testAddFileToArchive() {
    String file = createFile("dir/a.txt");
    JpsArtifact a = addArtifact("a", archive("a.jar").parentDirCopy(file));
    buildAll();
    assertOutput(a, fs().archive("a.jar").file("a.txt"));
    createFile("dir/b.txt");
    buildAll();
    assertOutput(a, fs().archive("a.jar").file("a.txt").file("b.txt"));
    assertCopied("dir/a.txt", "dir/b.txt");
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 60 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testDeleteFileAndRebuildIncludedArtifact.

public void testDeleteFileAndRebuildIncludedArtifact() {
    String file1 = createFile("d/1.txt");
    createFile("d/2.txt");
    JpsArtifact included = addArtifact("i", root().parentDirCopy(file1));
    JpsArtifact a = addArtifact(root().artifact(included));
    buildAllModulesAndArtifacts();
    assertOutput(included, fs().file("1.txt").file("2.txt"));
    assertOutput(a, fs().file("1.txt").file("2.txt"));
    delete(file1);
    //to trigger rebuild only for 'i'
    delete(included.getOutputPath());
    //doBuild(CompileScopeTestBuilder.rebuild().artifact(included)).assertSuccessful();
    doBuild(CompileScopeTestBuilder.make().artifact(included)).assertSuccessful();
    assertOutput(included, fs().file("2.txt"));
    assertOutput(a, fs().file("1.txt").file("2.txt"));
    buildAllModulesAndArtifacts();
    assertOutput(a, fs().file("2.txt"));
}
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