Search in sources :

Example 6 with BuildFileProperty

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());
}
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)

Example 7 with BuildFileProperty

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);
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) SimpleDataContext(com.intellij.openapi.actionSystem.impl.SimpleDataContext) BuildFileProperty(com.intellij.lang.ant.config.impl.BuildFileProperty) AntBuildTarget(com.intellij.lang.ant.config.AntBuildTarget)

Example 8 with BuildFileProperty

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);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) BuildFileProperty(com.intellij.lang.ant.config.impl.BuildFileProperty)

Aggregations

BuildFileProperty (com.intellij.lang.ant.config.impl.BuildFileProperty)8 ArrayList (java.util.ArrayList)3 Property (com.intellij.compiler.ant.taskdefs.Property)1 AntBuildTarget (com.intellij.lang.ant.config.AntBuildTarget)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ArtifactPropertiesProvider (com.intellij.packaging.artifacts.ArtifactPropertiesProvider)1 File (java.io.File)1 JpsAntBuildFileOptions (org.jetbrains.jps.ant.model.JpsAntBuildFileOptions)1 JpsAntInstallation (org.jetbrains.jps.ant.model.JpsAntInstallation)1 JpsAntArtifactExtension (org.jetbrains.jps.ant.model.artifacts.JpsAntArtifactExtension)1 JpsArtifact (org.jetbrains.jps.model.artifact.JpsArtifact)1