Search in sources :

Example 1 with JpsAntInstallation

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

the class JpsAntSerializationTest method testLoadAntInstallations.

public void testLoadAntInstallations() {
    loadGlobalSettings(OPTIONS_PATH);
    JpsAntInstallation installation = JpsAntExtensionService.findAntInstallation(myModel, "Apache Ant version 1.8.2");
    assertNotNull(installation);
    assertEquals(FileUtil.toSystemIndependentName(installation.getAntHome().getAbsolutePath()), FileUtil.toSystemIndependentName(new File(SystemProperties.getUserHome(), "applications/apache-ant-1.8.2").getAbsolutePath()));
    JpsAntInstallation installation2 = JpsAntExtensionService.findAntInstallation(myModel, "Patched Ant");
    assertNotNull(installation2);
    assertContainsElements(toFiles(installation2.getClasspath()), PathManagerEx.findFileUnderCommunityHome("lib/ant/lib/ant.jar"), PathManagerEx.findFileUnderCommunityHome("lib/trove4j.jar"), PathManagerEx.findFileUnderCommunityHome("lib/dev/easymock-3.4.jar"));
}
Also used : JpsAntInstallation(org.jetbrains.jps.ant.model.JpsAntInstallation) File(java.io.File)

Example 2 with JpsAntInstallation

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

the class JpsAntSerializationTest method testLoadAntConfiguration.

public void testLoadAntConfiguration() {
    loadProject(PROJECT_PATH);
    loadGlobalSettings(OPTIONS_PATH);
    String buildXmlUrl = getUrl("build.xml");
    JpsAntBuildFileOptions options = JpsAntExtensionService.getOptions(myProject, buildXmlUrl);
    assertEquals(128, options.getMaxHeapSize());
    assertEquals("-J-Dmy.ant.prop=123", options.getAntCommandLineParameters());
    assertContainsElements(toFiles(options.getAdditionalClasspath()), new File(getAbsolutePath("lib/jdom.jar")), new File(getAbsolutePath("ant-lib/a.jar")));
    BuildFileProperty property = assertOneElement(options.getProperties());
    assertEquals("my.property", property.getPropertyName());
    assertEquals("its value", property.getPropertyValue());
    String emptyFileUrl = getUrl("empty.xml");
    JpsAntBuildFileOptions options2 = JpsAntExtensionService.getOptions(myProject, emptyFileUrl);
    assertEquals(256, options2.getMaxHeapSize());
    assertEquals(10, options2.getMaxStackSize());
    assertEquals("1.6", options2.getCustomJdkName());
    JpsAntInstallation bundled = JpsAntExtensionService.getAntInstallationForBuildFile(myModel, buildXmlUrl);
    assertNotNull(bundled);
    assertEquals("Bundled Ant", bundled.getName());
    JpsAntInstallation installation = JpsAntExtensionService.getAntInstallationForBuildFile(myModel, emptyFileUrl);
    assertNotNull(installation);
    assertEquals("Apache Ant version 1.8.2", installation.getName());
}
Also used : BuildFileProperty(com.intellij.lang.ant.config.impl.BuildFileProperty) JpsAntInstallation(org.jetbrains.jps.ant.model.JpsAntInstallation) JpsAntBuildFileOptions(org.jetbrains.jps.ant.model.JpsAntBuildFileOptions) File(java.io.File)

Aggregations

File (java.io.File)2 JpsAntInstallation (org.jetbrains.jps.ant.model.JpsAntInstallation)2 BuildFileProperty (com.intellij.lang.ant.config.impl.BuildFileProperty)1 JpsAntBuildFileOptions (org.jetbrains.jps.ant.model.JpsAntBuildFileOptions)1