diff --git a/project.ant/src/org/netbeans/spi/project/support/ant/AntProjectHelper.java b/project.ant/src/org/netbeans/spi/project/support/ant/AntProjectHelper.java --- a/project.ant/src/org/netbeans/spi/project/support/ant/AntProjectHelper.java +++ b/project.ant/src/org/netbeans/spi/project/support/ant/AntProjectHelper.java @@ -1020,7 +1020,27 @@ * @return an artifact */ public AntArtifact createSimpleAntArtifact(String type, String locationProperty, PropertyEvaluator eval, String targetName, String cleanTargetName) { - return new SimpleAntArtifact(this, type, locationProperty, eval, targetName, cleanTargetName); + return createSimpleAntArtifact(type, locationProperty, eval, targetName, cleanTargetName, null); + } + + /** + * Create a basic implementation of {@link AntArtifact} which assumes everything of interest + * is in a fixed location under a standard Ant-based project. + * @param type the type of artifact, e.g. JavaProjectConstants.ARTIFACT_TYPE_JAR + * @param locationProperty an Ant property name giving the project-relative + * location of the artifact, e.g. dist.jar + * @param eval a way to evaluate the location property (e.g. {@link #getStandardPropertyEvaluator}) + * @param targetName the name of an Ant target which will build the artifact, + * e.g. jar + * @param cleanTargetName the name of an Ant target which will delete the artifact + * (and maybe other build products), e.g. clean + * @param buildScriptProperty an Ant property name giving the project-relative + * location and name of the build.xml or null if default one (build.xml) should be used + * @return an artifact + */ + public AntArtifact createSimpleAntArtifact(String type, String locationProperty, PropertyEvaluator eval, + String targetName, String cleanTargetName, String buildScriptProperty) { + return new SimpleAntArtifact(this, type, locationProperty, eval, targetName, cleanTargetName, buildScriptProperty); } /** diff --git a/project.ant/src/org/netbeans/spi/project/support/ant/SimpleAntArtifact.java b/project.ant/src/org/netbeans/spi/project/support/ant/SimpleAntArtifact.java --- a/project.ant/src/org/netbeans/spi/project/support/ant/SimpleAntArtifact.java +++ b/project.ant/src/org/netbeans/spi/project/support/ant/SimpleAntArtifact.java @@ -63,17 +63,20 @@ private final PropertyEvaluator eval; private final String targetName; private final String cleanTargetName; + private final String buildScriptProperty; /** * @see AntProjectHelper#createSimpleAntArtifact */ - public SimpleAntArtifact(AntProjectHelper helper, String type, String locationProperty, PropertyEvaluator eval, String targetName, String cleanTargetName) { + public SimpleAntArtifact(AntProjectHelper helper, String type, String locationProperty, + PropertyEvaluator eval, String targetName, String cleanTargetName, String buildScriptProperty) { this.h = helper; this.type = type; this.locationProperty = locationProperty; this.eval = eval; this.targetName = targetName; this.cleanTargetName = cleanTargetName; + this.buildScriptProperty = buildScriptProperty; } private URI getArtifactLocation0() { @@ -104,7 +107,11 @@ } public File getScriptLocation() { - return h.resolveFile(GeneratedFilesHelper.BUILD_XML_PATH); + String path = GeneratedFilesHelper.BUILD_XML_PATH; + if (buildScriptProperty != null) { + path = eval.getProperty(buildScriptProperty); + } + return h.resolveFile(path); } public String getTargetName() {