don't copy superfluous files from artifact output directory when it is included in another artifact (TW-15033)

This commit is contained in:
nik
2011-01-13 15:30:48 +03:00
parent 4dc5321732
commit c2312ba749
6 changed files with 62 additions and 3 deletions
@@ -75,11 +75,16 @@ class ArtifactLayoutElement extends ComplexLayoutElement {
}
def output = project.artifactBuilder.artifactOutputs[artifact]
if (output != null) {
project.binding.ant.fileset(dir: output)
LayoutElement root = artifact.rootElement
if (root instanceof ArchiveElement) {
project.binding.ant.fileset(file: "$output/$root.name")
}
else {
project.binding.ant.fileset(dir: output)
}
}
else {
project.error("Required artifact $artifactName is not build")
// super.build(project)
}
}
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactManager">
<artifact type="jar" name="a">
<output-path>$PROJECT_DIR$/data</output-path>
<root id="archive" name="a.jar">
<element id="file-copy" path="$PROJECT_DIR$/a.txt" />
</root>
</artifact>
<artifact name="data">
<output-path>$PROJECT_DIR$/out/artifacts/data</output-path>
<root id="root">
<element id="artifact" artifact-name="a" />
</root>
</artifact>
</component>
<component name="ProjectModuleManager">
<modules />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
@@ -0,0 +1,30 @@
package org.jetbrains.jps
/**
* @author nik
*/
class ArtifactIncludesArchiveArtifactTest extends JpsBuildTestCase {
public void test() throws Exception {
def name = "artifactIncludesArchiveArtifact"
def project = buildAll("testData/$name/${name}.ipr", [:], {Project project ->
project.targetFolder = null
})
try {
assertOutput(project, "testData/$name/out", {
dir("artifacts") {
dir("data") {
archive("a.jar") {
dir("META-INF") {
file("MANIFEST.MF")
}
file("a.txt")
}
}
}
})
}
finally {
project.clean()
}
}
}
@@ -28,9 +28,9 @@ abstract class JpsBuildTestCase extends TestCase {
def protected buildAll(String projectPath, Map<String, String> pathVariables, Closure initProject) {
Project project = loadProject(projectPath, pathVariables)
initProject(project)
def target = FileUtil.createTempDirectory("targetDir")
project.targetFolder = target.absolutePath
initProject(project)
project.clean()
project.makeAll()
project.buildArtifacts()