Search in sources :

Example 1 with JpsAntArtifactExtension

use of org.jetbrains.jps.ant.model.artifacts.JpsAntArtifactExtension in project intellij-community by JetBrains.

the class JpsAntSerializationTest method testLoadArtifactProperties.

public void testLoadArtifactProperties() {
    loadProject(PROJECT_PATH);
    List<JpsArtifact> artifacts = JpsArtifactService.getInstance().getSortedArtifacts(myProject);
    assertEquals(2, artifacts.size());
    JpsArtifact dir = artifacts.get(0);
    assertEquals("dir", dir.getName());
    JpsAntArtifactExtension preprocessing = JpsAntExtensionService.getPreprocessingExtension(dir);
    assertNotNull(preprocessing);
    assertTrue(preprocessing.isEnabled());
    assertEquals(getUrl("build.xml"), preprocessing.getFileUrl());
    assertEquals("show-message", preprocessing.getTargetName());
    assertEquals(JpsAntArtifactExtensionImpl.ARTIFACT_OUTPUT_PATH_PROPERTY, assertOneElement(preprocessing.getAntProperties()).getPropertyName());
    JpsAntArtifactExtension postprocessing = JpsAntExtensionService.getPostprocessingExtension(dir);
    assertNotNull(postprocessing);
    assertEquals(getUrl("build.xml"), postprocessing.getFileUrl());
    assertEquals("create-file", postprocessing.getTargetName());
    List<BuildFileProperty> properties = postprocessing.getAntProperties();
    assertEquals(2, properties.size());
    assertEquals(JpsAntArtifactExtensionImpl.ARTIFACT_OUTPUT_PATH_PROPERTY, properties.get(0).getPropertyName());
    assertEquals(dir.getOutputPath(), properties.get(0).getPropertyValue());
    assertEquals("message.text", properties.get(1).getPropertyName());
    assertEquals("post", properties.get(1).getPropertyValue());
    JpsArtifact jar = artifacts.get(1);
    assertEquals("jar", jar.getName());
    assertNull(JpsAntExtensionService.getPostprocessingExtension(jar));
    assertNull(JpsAntExtensionService.getPreprocessingExtension(jar));
}
Also used : BuildFileProperty(com.intellij.lang.ant.config.impl.BuildFileProperty) JpsArtifact(org.jetbrains.jps.model.artifact.JpsArtifact) JpsAntArtifactExtension(org.jetbrains.jps.ant.model.artifacts.JpsAntArtifactExtension)

Aggregations

BuildFileProperty (com.intellij.lang.ant.config.impl.BuildFileProperty)1 JpsAntArtifactExtension (org.jetbrains.jps.ant.model.artifacts.JpsAntArtifactExtension)1 JpsArtifact (org.jetbrains.jps.model.artifact.JpsArtifact)1