You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/10/04 20:56:45 UTC
svn commit: r1394262 - in
/incubator/easyant/core/trunk/src/main/java/org/apache/easyant: core/
core/ant/ core/ant/listerners/ core/services/impl/ tasks/
Author: jlboudart
Date: Thu Oct 4 20:56:44 2012
New Revision: 1394262
URL: http://svn.apache.org/viewvc?rev=1394262&view=rev
Log:
Simplify code using project helper and configureEasyAntIvyInstance mechanism
Modified:
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/EasyAntProjectHelper.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/listerners/DefaultEasyAntLogger.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java?rev=1394262&r1=1394261&r2=1394262&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java Thu Oct 4 20:56:44 2012
@@ -102,34 +102,30 @@ public class EasyAntEngine {
project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_JAR_URL, guessEasyantCoreJarUrl().toExternalForm());
- File userSettings = getUserEasyAntIvySettings(project);
- String globalSettings = getGlobalEasyAntIvySettings(project);
- boolean isIgnoringUserIvysettings = Project.toBoolean(project
- .getProperty(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS));
-
- if (userSettings.exists() && !isIgnoringUserIvysettings) {
- project.log("loading user's easyant ivysettings file from " + userSettings.getAbsolutePath(),
- Project.MSG_DEBUG);
- easyantIvyConfigure.setFile(userSettings);
- } else if (globalSettings != null) {
- project.log("loading global easyant ivysettings file from " + globalSettings, Project.MSG_DEBUG);
- try {
+ try {
+ File userSettings = getUserEasyAntIvySettings(project);
+ URL globalSettings = getGlobalEasyAntIvySettings(project);
+ boolean isIgnoringUserIvysettings = Project.toBoolean(project
+ .getProperty(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS));
+
+ if (userSettings.exists() && !isIgnoringUserIvysettings) {
+ project.log("loading user's easyant ivysettings file from " + userSettings.getAbsolutePath(),
+ Project.MSG_DEBUG);
+ easyantIvyConfigure.setFile(userSettings);
+ } else if (globalSettings != null) {
+ project.log("loading global easyant ivysettings file from " + globalSettings.toExternalForm(),
+ Project.MSG_DEBUG);
easyantIvyConfigure.setUrl(globalSettings);
- } catch (MalformedURLException malformedUrl) {
- throw new BuildException("Unable to parse easyant ivysettings from the following url : "
- + globalSettings, malformedUrl);
- }
- } else {
- project.log("using easyant default ivy settings file", Project.MSG_VERBOSE);
- String url = project.getProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS);
- try {
+ } else {
+ project.log("using easyant default ivy settings file", Project.MSG_VERBOSE);
+ String url = project.getProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS);
easyantIvyConfigure.setUrl(url);
- } catch (MalformedURLException malformedUrl) {
- throw new BuildException("Unable to parse easyant ivysettings from the following url : " + url,
- malformedUrl);
}
+ } catch (MalformedURLException malformedUrl) {
+ throw new BuildException("Unable to parse easyant ivysettings from given url", malformedUrl);
}
+
executeTask(easyantIvyConfigure, "configure-easyant", project);
configureEasyAntOfflineRepository(project);
@@ -197,24 +193,21 @@ public class EasyAntEngine {
*
* @param project
* @return the configured global easyant-ivysettings.file
+ * @throws MalformedURLException
*/
- private String getGlobalEasyAntIvySettings(Project project) {
+ private URL getGlobalEasyAntIvySettings(Project project) throws MalformedURLException {
PropertyHelper helper = PropertyHelper.getPropertyHelper(project);
- String path = null;
+ URL path = null;
if (configuration.getEasyantIvySettingsFile() != null) {
File f = new File(helper.replaceProperties(configuration.getEasyantIvySettingsFile()));
- try {
- path = f.toURI().toURL().toExternalForm();
- } catch (MalformedURLException e) {
- throw new BuildException("Can't load easyant ivysettings file from " + f.getAbsolutePath(), e);
- }
+ path = f.toURI().toURL();
}
if (configuration.getEasyantIvySettingsUrl() != null) {
- path = helper.replaceProperties(configuration.getEasyantIvySettingsUrl());
+ path = new URL(helper.replaceProperties(configuration.getEasyantIvySettingsUrl()));
}
// path can be specified through a property
if (path == null && project.getProperty(EasyAntMagicNames.GLOBAL_EASYANT_IVYSETTINGS) != null) {
- path = project.getProperty(EasyAntMagicNames.GLOBAL_EASYANT_IVYSETTINGS);
+ path = new URL(project.getProperty(EasyAntMagicNames.GLOBAL_EASYANT_IVYSETTINGS));
}
// if no property is set check the default location
if (path == null) {
@@ -223,14 +216,9 @@ public class EasyAntEngine {
if (!defaultGlboalEasyAntIvySettings.exists()) {
return null;
}
- try {
- path = defaultGlboalEasyAntIvySettings.toURI().toURL().toExternalForm();
- } catch (MalformedURLException e) {
- throw new BuildException("Can't load easyant ivysettings file from "
- + defaultGlboalEasyAntIvySettings.getAbsolutePath(), e);
- }
+ path = defaultGlboalEasyAntIvySettings.toURI().toURL();
}
- project.log("global easyant-ivysettings file : " + path, Project.MSG_DEBUG);
+ project.log("global easyant-ivysettings file : " + path.toExternalForm(), Project.MSG_DEBUG);
return path;
}
@@ -405,9 +393,7 @@ public class EasyAntEngine {
project.setUserProperty(EasyAntMagicNames.EASYANT_OFFLINE, Boolean.toString(configuration.isOffline()));
- ProjectHelper helper = ProjectHelper.getProjectHelper();
- helper.getImportStack().addElement(ProjectUtils.emulateMainScript(project));
- project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
+ ProjectHelper helper = ProjectUtils.configureProjectHelper(project);
IvyAntSettings easyantIvySettings = configureEasyAntIvyInstance(project);
configurePluginService(project, easyantIvySettings);
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/EasyAntProjectHelper.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/EasyAntProjectHelper.java?rev=1394262&r1=1394261&r2=1394262&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/EasyAntProjectHelper.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/EasyAntProjectHelper.java Thu Oct 4 20:56:44 2012
@@ -33,8 +33,7 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
/**
- * This class is the custom project helper used by easyant introducing support
- * for phase concept
+ * This class is the custom project helper used by easyant introducing support for phase concept
*
*/
public class EasyAntProjectHelper extends ProjectHelper2 {
@@ -44,53 +43,42 @@ public class EasyAntProjectHelper extend
setProjectHandler(new EasyAntProjectHandler());
setTargetHandler(new EasyAntTargetHandler());
}
-
@Override
public boolean canParseBuildFile(Resource buildFile) {
return buildFile.getName().endsWith(".ant") || buildFile.getName().endsWith(".xml");
}
-
-
/**
* Handler for the top level "project" element.
*/
public static class EasyAntProjectHandler extends ProjectHandler {
/**
- * Handles the start of a top-level element within the project. An
- * appropriate handler is created and initialised with the details of
- * the element.
+ * Handles the start of a top-level element within the project. An appropriate handler is created and
+ * initialised with the details of the element.
*
* @param uri
* The namespace URI for this element.
* @param name
- * The name of the element being started. Will not be
- * <code>null</code>.
+ * The name of the element being started. Will not be <code>null</code>.
* @param qname
* The qualified name for this element.
* @param attrs
- * Attributes of the element being started. Will not be
- * <code>null</code>.
+ * Attributes of the element being started. Will not be <code>null</code>.
* @param context
* The context for this element.
* @return a target or an element handler.
*
* @exception org.xml.sax.SAXParseException
- * if the tag given is not <code>"taskdef"</code>,
- * <code>"typedef"</code>, <code>"property"</code>,
- * <code>"target"</code>, <code>"phase"</code> or a data
- * type definition
+ * if the tag given is not <code>"taskdef"</code>, <code>"typedef"</code>,
+ * <code>"property"</code>, <code>"target"</code>, <code>"phase"</code> or a data type definition
*/
- public AntHandler onStartChild(String uri, String name, String qname,
- Attributes attrs, AntXMLContext context)
+ public AntHandler onStartChild(String uri, String name, String qname, Attributes attrs, AntXMLContext context)
throws SAXParseException {
- return (name.equals("target") || name.equals("phase") || name
- .equals("extension-point"))
- && (uri.equals("") || uri.equals(ANT_CORE_URI)) ? getTargetHandler()
- : getElementHandler();
+ return (name.equals("target") || name.equals("phase") || name.equals("extension-point"))
+ && (uri.equals("") || uri.equals(ANT_CORE_URI)) ? getTargetHandler() : getElementHandler();
}
}
@@ -100,39 +88,33 @@ public class EasyAntProjectHelper extend
public static class EasyAntTargetHandler extends TargetHandler {
/**
- * Initialisation routine called after handler creation with the element
- * name and attributes. The attributes which this handler can deal with
- * are: <code>"name"</code>, <code>"depends"</code>, <code>"if"</code>,
- * <code>"unless"</code>, <code>"id"</code> and
- * <code>"description"</code>.
+ * Initialisation routine called after handler creation with the element name and attributes. The attributes
+ * which this handler can deal with are: <code>"name"</code>, <code>"depends"</code>, <code>"if"</code>,
+ * <code>"unless"</code>, <code>"id"</code> and <code>"description"</code>.
*
* @param uri
* The namespace URI for this element.
* @param tag
- * Name of the element which caused this handler to be
- * created. Should not be <code>null</code>. Ignored in this
- * implementation.
+ * Name of the element which caused this handler to be created. Should not be <code>null</code>.
+ * Ignored in this implementation.
* @param qname
* The qualified name for this element.
* @param attrs
- * Attributes of the element which caused this handler to be
- * created. Must not be <code>null</code>.
+ * Attributes of the element which caused this handler to be created. Must not be <code>null</code>.
* @param context
* The current context.
*
* @exception SAXParseException
- * if an unexpected attribute is encountered or if the
- * <code>"name"</code> attribute is missing.
+ * if an unexpected attribute is encountered or if the <code>"name"</code> attribute is missing.
*/
- public void onStartElement(String uri, String tag, String qname,
- Attributes attrs, AntXMLContext context)
+ public void onStartElement(String uri, String tag, String qname, Attributes attrs, AntXMLContext context)
throws SAXParseException {
String name = null;
String depends = "";
String extensionPoint = null;
String phase = null;
- OnMissingExtensionPoint extensionPointMissing = null;
+ OnMissingExtensionPoint extensionPointMissing = null;
Project project = context.getProject();
@@ -151,8 +133,7 @@ public class EasyAntProjectHelper extend
for (int i = 0; i < attrs.getLength(); i++) {
String attrUri = attrs.getURI(i);
- if (attrUri != null && !attrUri.equals("")
- && !attrUri.equals(uri)) {
+ if (attrUri != null && !attrUri.equals("") && !attrUri.equals(uri)) {
continue; // Ignore attributes from unknown uris
}
String key = attrs.getLocalName(i);
@@ -161,8 +142,7 @@ public class EasyAntProjectHelper extend
if (key.equals("name")) {
name = value;
if ("".equals(name)) {
- throw new BuildException("name attribute must "
- + "not be empty");
+ throw new BuildException("name attribute must " + "not be empty");
}
} else if (key.equals("depends")) {
depends = value;
@@ -187,31 +167,25 @@ public class EasyAntProjectHelper extend
} else if (key.equals("phase")) {
phase = value;
} else {
- throw new SAXParseException("Unexpected attribute \"" + key
- + "\"", context.getLocator());
+ throw new SAXParseException("Unexpected attribute \"" + key + "\"", context.getLocator());
}
}
if (name == null) {
- throw new SAXParseException(
- "target element appears without a name attribute",
- context.getLocator());
+ throw new SAXParseException("target element appears without a name attribute", context.getLocator());
}
boolean isPhase = target instanceof Phase;
String prefix = null;
- boolean isInIncludeMode = context.isIgnoringProjectTag()
- && isInIncludeMode();
+ boolean isInIncludeMode = context.isIgnoringProjectTag() && isInIncludeMode();
String sep = getCurrentPrefixSeparator();
if (isInIncludeMode && !isPhase) {
prefix = getTargetPrefix(context);
if (prefix == null) {
- throw new BuildException("can't include build file "
- + context.getBuildFile()
- + ", no as attribute has been given"
- + " and the project tag doesn't"
+ throw new BuildException("can't include build file " + context.getBuildFile()
+ + ", no as attribute has been given" + " and the project tag doesn't"
+ " specify a name attribute");
}
name = prefix + sep + name;
@@ -219,16 +193,13 @@ public class EasyAntProjectHelper extend
// Check if this target is in the current build file
if (context.getCurrentTargets().get(name) != null) {
- throw new BuildException("Duplicate target '" + name + "'",
- target.getLocation());
+ throw new BuildException("Duplicate target '" + name + "'", target.getLocation());
}
Hashtable projectTargets = project.getTargets();
boolean usedTarget = false;
// If the name has not already been defined define it
if (projectTargets.containsKey(name)) {
- project.log(
- "Already defined in main or a previous import, ignore "
- + name, Project.MSG_VERBOSE);
+ project.log("Already defined in main or a previous import, ignore " + name, Project.MSG_VERBOSE);
} else {
target.setName(name);
context.getCurrentTargets().put(name, target);
@@ -240,11 +211,9 @@ public class EasyAntProjectHelper extend
if (!isInIncludeMode) {
target.setDepends(depends);
} else {
- for (Iterator iter = Target.parseDepends(depends, name,
- "depends").iterator(); iter.hasNext();) {
+ for (Iterator iter = Target.parseDepends(depends, name, "depends").iterator(); iter.hasNext();) {
String curTarget = (String) iter.next();
- if (projectTargets.containsKey(curTarget)
- && (projectTargets.get(curTarget) instanceof Phase)) {
+ if (projectTargets.containsKey(curTarget) && (projectTargets.get(curTarget) instanceof Phase)) {
target.addDependency(curTarget);
} else {
@@ -253,8 +222,7 @@ public class EasyAntProjectHelper extend
}
}
}
- if (!isInIncludeMode && context.isIgnoringProjectTag()
- && (prefix = getTargetPrefix(context)) != null) {
+ if (!isInIncludeMode && context.isIgnoringProjectTag() && (prefix = getTargetPrefix(context)) != null) {
// In an imported file (and not completely
// ignoring the project tag or having a preconfigured prefix)
String newName = prefix + sep + name;
@@ -263,36 +231,32 @@ public class EasyAntProjectHelper extend
context.getCurrentTargets().put(newName, newTarget);
project.addOrReplaceTarget(newName, newTarget);
}
- if (extensionPointMissing != null && extensionPoint == null) {
- throw new BuildException("onMissingExtensionPoint attribute cannot " +
- "be specified unless extensionOf is specified",
- target.getLocation());
+ if (extensionPointMissing != null && extensionPoint == null) {
+ throw new BuildException("onMissingExtensionPoint attribute cannot "
+ + "be specified unless extensionOf is specified", target.getLocation());
}
if (extensionPoint != null) {
- ProjectHelper helper = (ProjectHelper) context.getProject()
- .getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
- for (Iterator iter = Target.parseDepends(extensionPoint, name,
- "extensionOf").iterator(); iter.hasNext();) {
+ ProjectHelper helper = ProjectUtils.getConfiguredProjectHelper(context.getProject());
+ for (Iterator<?> iter = Target.parseDepends(extensionPoint, name, "extensionOf").iterator(); iter
+ .hasNext();) {
String tgName = (String) iter.next();
if (isInIncludeMode()) {
tgName = prefix + sep + tgName;
}
if (extensionPointMissing == null) {
- extensionPointMissing = OnMissingExtensionPoint.FAIL;
+ extensionPointMissing = OnMissingExtensionPoint.FAIL;
}
// defer extensionpoint resolution until the full
// import stack has been processed
- helper.getExtensionStack().add(
- new String[] { tgName, name, extensionPointMissing.name()});
+ helper.getExtensionStack().add(new String[] { tgName, name, extensionPointMissing.name() });
}
}
if (phase != null) {
if (!projectTargets.containsKey(phase)) {
if (!Project.toBoolean(project.getProperty("audit.mode"))) {
- throw new BuildException("can't add target " + name
- + " to phase " + phase + " because the phase"
- + " is unknown.");
+ throw new BuildException("can't add target " + name + " to phase " + phase
+ + " because the phase" + " is unknown.");
} else {
Phase p = new Phase();
p.setName(phase);
@@ -303,8 +267,7 @@ public class EasyAntProjectHelper extend
Target t = (Target) projectTargets.get(phase);
if (t != null) {
if (!(t instanceof Phase)) {
- throw new BuildException("referenced target " + phase
- + " is not a phase");
+ throw new BuildException("referenced target " + phase + " is not a phase");
}
t.addDependency(name);
}
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java?rev=1394262&r1=1394261&r2=1394262&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java Thu Oct 4 20:56:44 2012
@@ -185,4 +185,16 @@ public class ProjectUtils {
}
}
}
+
+ @SuppressWarnings("unchecked")
+ public static ProjectHelper configureProjectHelper(Project project) {
+ ProjectHelper helper = ProjectHelper.getProjectHelper();
+ helper.getImportStack().addElement(ProjectUtils.emulateMainScript(project));
+ project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
+ return helper;
+ }
+
+ public static ProjectHelper getConfiguredProjectHelper(Project project) {
+ return (ProjectHelper) project.getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
+ }
}
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/listerners/DefaultEasyAntLogger.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/listerners/DefaultEasyAntLogger.java?rev=1394262&r1=1394261&r2=1394262&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/listerners/DefaultEasyAntLogger.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/listerners/DefaultEasyAntLogger.java Thu Oct 4 20:56:44 2012
@@ -17,6 +17,7 @@
*/
package org.apache.easyant.core.ant.listerners;
+import org.apache.easyant.core.ant.ProjectUtils;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.NoBannerLogger;
@@ -33,10 +34,9 @@ public class DefaultEasyAntLogger extend
private long startTime = System.currentTimeMillis();
- protected static void throwableMessage(StringBuffer m, Throwable error,
- boolean verbose) {
+ protected static void throwableMessage(StringBuffer m, Throwable error, boolean verbose) {
- while (error !=null) {
+ while (error != null) {
Throwable cause = error.getCause();
if (cause == null) {
break;
@@ -44,15 +44,13 @@ public class DefaultEasyAntLogger extend
String msg1 = error.toString();
String msg2 = cause.toString();
if (msg1.endsWith(msg2)) {
- String messageException = msg1.substring(0, msg1.length()
- - msg2.length());
+ String messageException = msg1.substring(0, msg1.length() - msg2.length());
if (error instanceof BuildException) {
BuildException be = (BuildException) error;
// wipe location information
if (be.getLocation() != null) {
- messageException = messageException.substring(be
- .getLocation().toString().length());
+ messageException = messageException.substring(be.getLocation().toString().length());
}
}
@@ -92,23 +90,17 @@ public class DefaultEasyAntLogger extend
if (be.getLocation().getFileName() != null) {
message.append(WHERE_MSG);
message.append(lSep).append(lSep);
- message.append("File : ").append(
- be.getLocation().getFileName()).append(lSep);
- message.append("Line : ").append(
- be.getLocation().getLineNumber());
- message.append(" column : ").append(
- be.getLocation().getColumnNumber()).append(lSep);
+ message.append("File : ").append(be.getLocation().getFileName()).append(lSep);
+ message.append("Line : ").append(be.getLocation().getLineNumber());
+ message.append(" column : ").append(be.getLocation().getColumnNumber()).append(lSep);
}
if (Project.MSG_DEBUG == msgOutputLevel) {
message.append(StringUtils.LINE_SEP);
message.append("Import stack :");
message.append(StringUtils.LINE_SEP);
- ProjectHelper helper = (ProjectHelper) event
- .getProject()
- .getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
+ ProjectHelper helper = ProjectUtils.getConfiguredProjectHelper(event.getProject());
for (int i = 0; i < helper.getImportStack().size(); i++) {
- message.append(helper.getImportStack().get(i)
- .toString());
+ message.append(helper.getImportStack().get(i).toString());
message.append(StringUtils.LINE_SEP);
}
@@ -119,8 +111,7 @@ public class DefaultEasyAntLogger extend
message.append(DIAGNOSTIC_MSG);
message.append(StringUtils.LINE_SEP);
message.append(StringUtils.LINE_SEP);
- throwableMessage(message, error,
- Project.MSG_VERBOSE <= msgOutputLevel);
+ throwableMessage(message, error, Project.MSG_VERBOSE <= msgOutputLevel);
message.append(StringUtils.LINE_SEP);
if (msgOutputLevel < Project.MSG_VERBOSE) {
message.append(StringUtils.LINE_SEP);
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java?rev=1394262&r1=1394261&r2=1394262&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java Thu Oct 4 20:56:44 2012
@@ -209,9 +209,7 @@ public class DefaultPluginServiceImpl im
}
}
project.init();
- ProjectHelper helper = ProjectHelper.getProjectHelper();
- helper.getImportStack().addElement(ProjectUtils.emulateMainScript(project));
- project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
+ ProjectUtils.configureProjectHelper(project);
return project;
}
@@ -422,8 +420,7 @@ public class DefaultPluginServiceImpl im
loadModule.setLocation(new Location(ProjectUtils.emulateMainScript(p).getAbsolutePath()));
loadModule.setProject(p);
loadModule.execute();
- ProjectHelper projectHelper = (ProjectHelper) p.getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
- ProjectUtils.injectTargetIntoExtensionPoint(p, projectHelper);
+ ProjectUtils.injectTargetIntoExtensionPoint(p, ProjectUtils.getConfiguredProjectHelper(p));
analyseProject(p, eaReport, "default");
return eaReport;
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java?rev=1394262&r1=1394261&r2=1394262&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java Thu Oct 4 20:56:44 2012
@@ -180,10 +180,7 @@ public class SubModule extends Task {
}
subModule.setNewProperty(EasyAntMagicNames.EASYANT_FILE, file.getAbsolutePath());
- ProjectHelper helper = ProjectHelper.getProjectHelper();
- File mainscript = ProjectUtils.emulateMainScript(getProject());
- helper.getImportStack().addElement(mainscript);
- subModule.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
+ ProjectHelper helper = ProjectUtils.configureProjectHelper(subModule);
LoadModule lm = new LoadModule();
lm.setBuildModule(file);
@@ -191,7 +188,7 @@ public class SubModule extends Task {
lm.setTaskName(EasyAntConstants.EASYANT_TASK_NAME);
lm.setProject(subModule);
lm.setOwningTarget(ProjectUtils.createTopLevelTarget());
- lm.setLocation(new Location(mainscript.getAbsolutePath()));
+ lm.setLocation(new Location(ProjectUtils.emulateMainScript(getProject()).getAbsolutePath()));
lm.setUseBuildRepository(useBuildRepository);
lm.execute();