use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class ArtifactBuilderTest method testManifestFileIsFirstEntry.
//IDEA-73893
public void testManifestFileIsFirstEntry() throws IOException {
final String firstFile = createFile("src/A.txt");
final String manifestFile = createFile("src/MANIFEST.MF");
final String lastFile = createFile("src/Z.txt");
final JpsArtifact a = addArtifact(archive("a.jar").dir("META-INF").fileCopy(firstFile).fileCopy(manifestFile).fileCopy(lastFile));
buildArtifacts(a);
final String jarPath = a.getOutputPath() + "/a.jar";
JarFile jarFile = new JarFile(new File(jarPath));
try {
final Enumeration<JarEntry> entries = jarFile.entries();
assertTrue(entries.hasMoreElements());
final JarEntry firstEntry = entries.nextElement();
assertEquals(JarFile.MANIFEST_NAME, firstEntry.getName());
} finally {
jarFile.close();
}
}
use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class CleanArtifactOutputOnRebuildTest method testDoNotCleanIfContainsSourceFolder.
public void testDoNotCleanIfContainsSourceFolder() {
JpsArtifact a = addArtifact(root().fileCopy(createFile("a.txt")));
addModule("m", a.getOutputPath() + "/src");
buildArtifacts(a);
createFileInArtifactOutput(a, "b.txt");
rebuildAllModulesAndArtifacts();
assertOutput(a, fs().file("a.txt").file("b.txt"));
}
use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class CleanArtifactOutputOnRebuildTest method testCleanModuleOutputIfItIsIncludedInArtifact.
public void testCleanModuleOutputIfItIsIncludedInArtifact() {
String file = createFile("src/A.java", "class A{}");
JpsModule m = addModule("m", PathUtil.getParentPath(file));
JpsArtifact a = addArtifact(root().module(m));
buildArtifacts(a);
createFileInModuleOutput(m, "b.txt");
assertOutput(m, fs().file("A.class").file("b.txt"));
rebuildAllModulesAndArtifacts();
assertOutput(m, fs().file("A.class"));
}
use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class ArtifactBuilderTest method testDeleteOnlyOutputFileOnRebuildForArchiveArtifact.
public void testDeleteOnlyOutputFileOnRebuildForArchiveArtifact() throws IOException {
String file = createFile("a.txt");
JpsArtifact a = addArtifact(archive("a.jar").fileCopy(file));
buildAll();
createFileInArtifactOutput(a, "b.txt");
buildAllAndAssertUpToDate();
assertOutput(a, fs().archive("a.jar").file("a.txt").end().file("b.txt"));
rebuildAllModulesAndArtifacts();
assertOutput(a, fs().archive("a.jar").file("a.txt").end().file("b.txt"));
}
use of org.jetbrains.jps.model.artifact.JpsArtifact in project intellij-community by JetBrains.
the class ArtifactBuilderTest method testExtractDirectoryFromExcludedJar.
public void testExtractDirectoryFromExcludedJar() throws IOException {
String jarPath = createFile("dir/lib/j.jar");
FileUtil.copy(new File(getJUnitJarPath()), new File(jarPath));
JpsModule module = addModule("m");
String libDir = PathUtil.getParentPath(jarPath);
module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(PathUtil.getParentPath(libDir)));
module.getExcludeRootsList().addUrl(JpsPathUtil.pathToUrl(libDir));
final JpsArtifact a = addArtifact("a", root().extractedDir(jarPath, "/junit/textui/"));
buildAll();
assertOutput(a, fs().file("ResultPrinter.class").file("TestRunner.class"));
}
Aggregations