use of com.intellij.lang.ant.config.impl.BuildFileProperty in project intellij-community by JetBrains.
the class AntArtifactBuildExtension method generateTasksForArtifact.
@Override
public void generateTasksForArtifact(Artifact artifact, boolean preprocessing, ArtifactAntGenerationContext context, CompositeGenerator generator) {
final ArtifactPropertiesProvider provider;
if (preprocessing) {
provider = AntArtifactPreProcessingPropertiesProvider.getInstance();
} else {
provider = AntArtifactPostprocessingPropertiesProvider.getInstance();
}
final AntArtifactProperties properties = (AntArtifactProperties) artifact.getProperties(provider);
if (properties != null && properties.isEnabled()) {
final String path = VfsUtil.urlToPath(properties.getFileUrl());
String fileName = PathUtil.getFileName(path);
String dirPath = PathUtil.getParentPath(path);
final String relativePath = GenerationUtils.toRelativePath(dirPath, BuildProperties.getProjectBaseDir(context.getProject()), BuildProperties.getProjectBaseDirProperty(), context.getGenerationOptions());
final Tag ant = new Tag("ant", Pair.create("antfile", fileName), Pair.create("target", properties.getTargetName()), Pair.create("dir", relativePath));
final String outputPath = BuildProperties.propertyRef(context.getArtifactOutputProperty(artifact));
ant.add(new Property(JpsAntArtifactExtensionImpl.ARTIFACT_OUTPUT_PATH_PROPERTY, outputPath));
for (BuildFileProperty property : properties.getUserProperties()) {
ant.add(new Property(property.getPropertyName(), property.getPropertyValue()));
}
generator.add(ant);
}
}
use of com.intellij.lang.ant.config.impl.BuildFileProperty in project intellij-community by JetBrains.
the class AntArtifactProperties method getAllProperties.
public List<BuildFileProperty> getAllProperties(@NotNull Artifact artifact) {
final List<BuildFileProperty> properties = new ArrayList<>();
properties.add(new BuildFileProperty(JpsAntArtifactExtensionImpl.ARTIFACT_OUTPUT_PATH_PROPERTY, artifact.getOutputPath()));
properties.addAll(myExtensionProperties.myUserProperties);
return properties;
}
use of com.intellij.lang.ant.config.impl.BuildFileProperty in project intellij-community by JetBrains.
the class AntArtifactPropertiesEditor method reset.
public void reset() {
myRunTargetCheckBox.setSelected(myProperties.isEnabled());
myTarget = myProperties.findTarget(AntConfiguration.getInstance(myContext.getProject()));
final List<BuildFileProperty> properties = new ArrayList<>();
for (BuildFileProperty property : myProperties.getAllProperties(myContext.getArtifact())) {
properties.add(new BuildFileProperty(property.getPropertyName(), property.getPropertyValue()));
}
myContainer = new SinglePropertyContainer<>(ANT_PROPERTIES, properties);
myBinding.loadValues(myContainer);
updatePanel();
}
use of com.intellij.lang.ant.config.impl.BuildFileProperty in project intellij-community by JetBrains.
the class JpsAntArtifactExtensionImpl method getAntProperties.
@Override
public List<BuildFileProperty> getAntProperties() {
final List<BuildFileProperty> properties = new ArrayList<>();
properties.add(new BuildFileProperty(ARTIFACT_OUTPUT_PATH_PROPERTY, getArtifact().getOutputPath()));
properties.addAll(myProperties.myUserProperties);
return properties;
}
use of com.intellij.lang.ant.config.impl.BuildFileProperty 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));
}
Aggregations