Search in sources :

Example 61 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testExtractFileFromNonExistentJar.

public void testExtractFileFromNonExistentJar() throws IOException {
    String jar = getAbsolutePath("junit.jar");
    JpsArtifact a = addArtifact(root().extractedDir(jar, "/junit/textui/"));
    buildArtifacts(a);
    assertEmptyOutput(a);
    buildAllAndAssertUpToDate();
    FileUtil.copy(new File(getJUnitJarPath()), new File(jar));
    buildArtifacts(a);
    assertOutput(a, fs().file("ResultPrinter.class").file("TestRunner.class"));
    buildAllAndAssertUpToDate();
    delete(jar);
    buildArtifacts(a);
    assertEmptyOutput(a);
    buildAllAndAssertUpToDate();
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact) File(java.io.File)

Example 62 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testRenameFile.

public void testRenameFile() throws Exception {
    final String file = createFile("a/a.txt");
    final JpsArtifact a = addArtifact(root().parentDirCopy(file));
    buildAll();
    assertOutput(a, fs().file("a.txt"));
    rename(file, "b.txt");
    buildAll();
    assertOutput(a, fs().file("b.txt"));
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 63 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testUpdateFileIfCaseOfLetterInNameChanged.

//IDEADEV-25840
public void testUpdateFileIfCaseOfLetterInNameChanged() throws Exception {
    final String file = createFile("a/a.txt");
    final JpsArtifact a = addArtifact("a", root().parentDirCopy(file));
    buildAll();
    assertOutput(a, fs().file("a.txt"));
    rename(file, "A.txt");
    buildAll();
    assertOutput(a, fs().file("A.txt"));
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 64 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method _testFilesCopiedToTwoDifferentPlacesInArtifact.

//todo[nik] fix
//ZD-51993
public void _testFilesCopiedToTwoDifferentPlacesInArtifact() {
    final String fileA = createFile("res/a.txt", "0");
    final String fileB = createFile("res/b.txt", "0");
    String dir = PathUtil.getParentPath(fileA);
    JpsArtifact a = addArtifact("a", root().dir("d").dirCopy(dir).end().archive("a.zip").dirCopy(dir));
    buildAll();
    change(fileA, "1");
    buildAll();
    assertOutput(a, fs().dir("d").file("a.txt", "1").file("b.txt", "0").end().archive("a.zip").file("a.txt", "1").file("b.txt", "0"));
    change(fileB, "1");
    buildAll();
    assertOutput(a, fs().dir("d").file("a.txt", "1").file("b.txt", "1").end().archive("a.zip").file("a.txt", "1").file("b.txt", "1"));
}
Also used : JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact)

Example 65 with JpsArtifact

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

the class IncrementalArtifactBuildingTest method testPackChangedFile.

public void testPackChangedFile() {
    String file1 = createFile("dir/a.txt", "aaa");
    createFile("dir/b.txt", "bbb");
    final JpsArtifact a = addArtifact(archive("a.jar").parentDirCopy(file1));
    buildAll();
    assertOutput(a, fs().archive("a.jar").file("a.txt", "aaa").file("b.txt", "bbb"));
    buildAllAndAssertUpToDate();
    change(file1, "xxx");
    buildAll();
    assertDeletedAndCopied("out/artifacts/a/a.jar", "dir/a.txt", "dir/b.txt");
    assertOutput(a, fs().archive("a.jar").file("a.txt", "xxx").file("b.txt", "bbb"));
    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