Search in sources :

Example 31 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testCopyChangedFile.

public void testCopyChangedFile() {
    String file1 = createFile("dir/a.txt", "aaa");
    createFile("dir/b.txt", "bbb");
    final JpsArtifact a = addArtifact(root().parentDirCopy(file1));
    buildAll();
    assertOutput(a, fs().file("a.txt", "aaa").file("b.txt", "bbb"));
    buildAllAndAssertUpToDate();
    change(file1, "xxx");
    buildAll();
    assertDeletedAndCopied("out/artifacts/a/a.txt", "dir/a.txt");
    assertOutput(a, fs().file("a.txt", "xxx").file("b.txt", "bbb"));
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 32 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testNonExistentDirectoryRoot.

public void testNonExistentDirectoryRoot() throws IOException {
    String dir = getAbsolutePath("d");
    JpsArtifact a = addArtifact(root().dirCopy(dir));
    buildArtifacts(a);
    assertEmptyOutput(a);
    buildAllAndAssertUpToDate();
    FileUtil.createIfDoesntExist(new File(dir, "a.txt"));
    buildArtifacts(a);
    assertOutput(a, fs().file("a.txt"));
    buildAllAndAssertUpToDate();
    delete(dir);
    buildArtifacts(a);
    assertEmptyOutput(a);
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact) File(java.io.File)

Example 33 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testNonExistentFileRoot.

public void testNonExistentFileRoot() throws IOException {
    String file = getAbsolutePath("a.txt");
    JpsArtifact a = addArtifact(root().fileCopy(file));
    buildArtifacts(a);
    assertEmptyOutput(a);
    buildAllAndAssertUpToDate();
    FileUtil.createIfDoesntExist(new File(file));
    buildArtifacts(a);
    assertOutput(a, fs().file("a.txt"));
    buildAllAndAssertUpToDate();
    delete(file);
    buildArtifacts(a);
    assertEmptyOutput(a);
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact) File(java.io.File)

Example 34 with JpsArtifact

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

the class RebuildArtifactOnConfigurationChangeTest method testRemoveRoot.

public void testRemoveRoot() {
    String file1 = createFile("dir1/a.txt", "a");
    String file2 = createFile("dir2/b.txt", "b");
    JpsArtifact a = addArtifact(root().parentDirCopy(file1).parentDirCopy(file2));
    buildAll();
    assertOutput(a, fs().file("a.txt", "a").file("b.txt", "b"));
    a.getRootElement().removeChild(a.getRootElement().getChildren().get(0));
    buildAll();
    assertOutput(a, fs().file("b.txt", "b"));
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 35 with JpsArtifact

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

the class RebuildArtifactOnConfigurationChangeTest method testChangeConfiguration.

public void testChangeConfiguration() {
    String file = createFile("d/a.txt", "a");
    JpsArtifact a = addArtifact(root().parentDirCopy(file));
    buildAll();
    assertOutput(a, fs().file("a.txt", "a"));
    a.setRootElement(root().dir("dir").parentDirCopy(file).buildElement());
    buildAll();
    assertOutput(a, fs().dir("dir").file("a.txt", "a"));
    buildAllAndAssertUpToDate();
}
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