use of com.intellij.packaging.artifacts.ArtifactPropertiesProvider 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);
}
}
Aggregations