use of com.intellij.lang.ant.config.impl.BuildFileProperty 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());
}
use of com.intellij.lang.ant.config.impl.BuildFileProperty in project intellij-community by JetBrains.
the class AntArtifactProperties method runAntTarget.
private void runAntTarget(CompileContext compileContext, final Artifact artifact) {
if (myExtensionProperties.myEnabled) {
final Project project = compileContext.getProject();
final AntBuildTarget target = findTarget(AntConfiguration.getInstance(project));
if (target != null) {
final DataContext dataContext = SimpleDataContext.getProjectContext(project);
List<BuildFileProperty> properties = getAllProperties(artifact);
final boolean success = AntConfigurationImpl.executeTargetSynchronously(dataContext, target, properties);
if (!success) {
compileContext.addMessage(CompilerMessageCategory.ERROR, "Cannot build artifact '" + artifact.getName() + "': ant target '" + target.getDisplayName() + "' failed with error", null, -1, -1);
}
}
}
}
use of com.intellij.lang.ant.config.impl.BuildFileProperty in project intellij-community by JetBrains.
the class AntArtifactPropertiesEditor method apply.
public void apply() {
myProperties.setEnabled(myRunTargetCheckBox.isSelected());
if (myTarget != null) {
final VirtualFile file = myTarget.getModel().getBuildFile().getVirtualFile();
if (file != null) {
myProperties.setFileUrl(file.getUrl());
myProperties.setTargetName(myTarget.getName());
final List<BuildFileProperty> properties = getUserProperties();
myProperties.setUserProperties(properties);
return;
}
}
myProperties.setFileUrl(null);
myProperties.setTargetName(null);
}
Aggregations