use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class ArtifactBuilderOverwriteTest method testOverwriteArchives.
public void testOverwriteArchives() {
final String aFile = createFile("aaa.txt", "a");
final String bFile = createFile("bbb.txt", "b");
final JpsArtifact a = addArtifact(root().archive("x.jar").fileCopy(aFile).end().archive("x.jar").fileCopy(bFile));
buildAll();
assertOutput(a, fs().archive("x.jar").file("aaa.txt", "a"));
buildAllAndAssertUpToDate();
change(aFile, "a2");
buildAll();
assertDeletedAndCopied("out/artifacts/a/x.jar", "aaa.txt");
assertOutput(a, fs().archive("x.jar").file("aaa.txt", "a2"));
buildAllAndAssertUpToDate();
change(bFile, "b2");
buildAllAndAssertUpToDate();
delete(bFile);
buildAllAndAssertUpToDate();
}
use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class ArtifactBuilderOverwriteTest method testDeleteOverwritingFiles.
public void testDeleteOverwritingFiles() {
final String firstFile = createFile("d1/xxx.txt", "1");
final String secondFile = createFile("d2/xxx.txt", "2");
final JpsArtifact a = addArtifact("a", root().dir("ddd").dirCopy(PathUtil.getParentPath(firstFile)).parentDirCopy(secondFile).fileCopy(createFile("y.txt")));
buildAll();
assertOutput(a, fs().dir("ddd").file("xxx.txt", "1").file("y.txt"));
delete(firstFile);
buildAll();
assertDeletedAndCopied("out/artifacts/a/ddd/xxx.txt", "d2/xxx.txt");
assertOutput(a, fs().dir("ddd").file("xxx.txt", "2").file("y.txt"));
buildAllAndAssertUpToDate();
delete(secondFile);
buildAll();
assertDeleted("out/artifacts/a/ddd/xxx.txt");
assertOutput(a, fs().dir("ddd").file("y.txt"));
}
use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class ArtifactBuilderOverwriteTest method testUpdateManifest.
public void testUpdateManifest() {
final String manifestText1 = "Manifest-Version: 1.0\r\nMain-Class: A\r\n\r\n";
final String manifest = createFile("d/MANIFEST.MF", manifestText1);
final JpsArtifact a = addArtifact("a", root().archive("a.jar").dir("META-INF").parentDirCopy(manifest).fileCopy(createFile("a.txt")));
buildAll();
assertOutput(a, fs().archive("a.jar").dir("META-INF").file("MANIFEST.MF", manifestText1).file("a.txt"));
final String manifestText2 = "Manifest-Version: 1.0\r\nMain-Class: B\r\n\r\n";
change(manifest, manifestText2);
buildAll();
assertDeletedAndCopied("out/artifacts/a/a.jar", "d/MANIFEST.MF", "a.txt");
assertOutput(a, fs().archive("a.jar").dir("META-INF").file("MANIFEST.MF", manifestText2).file("a.txt"));
buildAllAndAssertUpToDate();
delete(manifest);
buildAll();
assertDeletedAndCopied("out/artifacts/a/a.jar", "a.txt");
assertOutput(a, fs().archive("a.jar").dir("META-INF").file("a.txt"));
}
use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class IncrementalArtifactBuildingTest method testRemoveDeletedFile.
public void testRemoveDeletedFile() {
String file1 = createFile("dir/a.txt");
createFile("dir/b.txt");
final JpsArtifact a = addArtifact("a", root().parentDirCopy(file1));
buildAll();
assertOutput(a, fs().file("a.txt").file("b.txt"));
delete(file1);
buildAll();
assertDeleted("out/artifacts/a/a.txt");
assertOutput(a, fs().file("b.txt"));
buildAllAndAssertUpToDate();
}
use of org.jetbrains.jps.model.artifact.JpsArtifact 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();
}
Aggregations