incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1073371 [11/28] - in /incubator/easyant/core/trunk: ./ bin/ example/build-configurations/ example/build-configurations/src/main/java/org/apache/easyant/example/ example/build-configurations/src/test/java/org/apache/easyant/example/ example...
Date Tue, 22 Feb 2011 15:56:09 GMT
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java?rev=1073371&r1=1073370&r2=1073371&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java Tue Feb 22 15:55:55 2011
@@ -28,139 +28,139 @@ import org.apache.tools.ant.Project;
  */
 public class BuildConfigurationHelper {
 
-	/**
-	 * This methods verify if at least one build configuration given in
-	 * arguments is contained in buildConfContainer.
-	 * 
-	 * @param buildConfs
-	 *            a string that represent build configurations names (can
-	 *            contains multiple configuration if they are comma separated)
-	 * @param buildConfContainer
-	 *            a string that represent build configurations container (can
-	 *            contains multiple configuration if they are comma separated)
-	 * @return true if the string contains at least one matching build
-	 *         configurations otherwise return false. If buildConfs is null this
-	 *         methods return true.
-	 */
-	public static boolean contains(String buildConfs, String buildConfContainer) {
-		if (buildConfs == null) {
-			return true;
-		}
-		return (null != getFirstBuildConfigurationMatching(buildConfs,
-				buildConfContainer));
-	}
-
-	/**
-	 * This methods return the first build configuration matching with the
-	 * criteria given in buildConfs argument.
-	 * 
-	 * @param buildConfs
-	 *            a string that represent build configurations names (can
-	 *            contains multiple configuration if they are comma separated)
-	 * @param buildConfContainer
-	 *            a string that represent build configurations container (can
-	 *            contains multiple configuration if they are comma separated)
-	 * @return a string that represent the first build configuration found.
-	 *         Return null if no build configuration matched.
-	 */
-	public static String getFirstBuildConfigurationMatching(String buildConfs,
-			String buildConfContainer) {
-		if (buildConfs == null || buildConfContainer == null) {
-			return null;
-		}
-		List<String> buildConfsToCheck = buildList(buildConfs);
-		List<String> availableBuildConfs = buildList(buildConfContainer);
-		for (String conf : buildConfsToCheck) {
-			if (availableBuildConfs.contains(conf)) {
-				return conf;
-			}
-		}
-
-		return null;
-	}
-
-	/**
-	 * This methods removes all the spaces in a list of confs separated by comma
-	 * 
-	 * @param confs
-	 *            a string that represent a list of conf separated by comma
-	 * @return a string that represent a list of conf separated by comma without
-	 *         spaces.
-	 */
-	public static String removeSpaces(String confs) {
-		return confs.replaceAll("\\s", "");
-	}
-
-	public static List<String> buildList(String conf) {
-		return Arrays.asList(removeSpaces(conf).split(","));
-
-	}
-
-	/**
-	 * Check if build configuration is active
-	 * 
-	 * @param requestedConfigurations
-	 *            build configuration to check
-	 * @param p
-	 *            the project (used to retrieve available and active build
-	 *            configuration)
-	 * @param message
-	 *            (prefix message used for log)
-	 * @return return true if buildconfiguration is active. This method also
-	 *         returns true if requestedConfigurations is null
-	 */
-	public static boolean isBuildConfigurationActive(
-			String requestedConfigurations, Project p, String message) {
-		if (requestedConfigurations == null) {
-			p.log(message + " not bound to any build configuration",Project.MSG_DEBUG);
-			return true;
-		}
-		List<String> buildConfigurationsList = buildList(requestedConfigurations);
-
-		// check consistency, here we consider that a build configuration must
-		// be explicitly declared
-		if (p.getProperty(EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS) == null) {
-			throw new BuildException(
-					"there is no available build configuration");
-		}
-
-		List<String> availableBuildConfigurations = Arrays.asList(p
-				.getProperty(EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS)
-				.split(","));
-
-		for (String conf : buildConfigurationsList) {
-			if (!availableBuildConfigurations.contains(conf)) {
-				throw new BuildException("unknown build configuration named "
-						+ conf);
-			}
-		}
-
-		// is there any activated build configuration matching with the build
-		// configurations defined?
-		if (p.getProperty(EasyAntMagicNames.MAIN_CONFS) != null) {
-			String buildConf = getFirstBuildConfigurationMatching(
-					requestedConfigurations, p
-							.getProperty(EasyAntMagicNames.MAIN_CONFS));
-			if (buildConf != null) {
-				p.log(message + " bound to build configuration " + buildConf,
-						Project.MSG_DEBUG);
-				return true;
-			} else {
-				// if no activated build configuration match with required build
-				// configuration, it means
-				// that related element should not be loaded
-				p
-						.log(
-								message
-										+ " not bound to any active build configuration. Requested build configuration was "
-										+ requestedConfigurations,
-								Project.MSG_DEBUG);
-				return false;
-			}
-		} else {
-			p.log("there is no activated build configuration",
-					Project.MSG_DEBUG);
-			return false;
-		}
-	}
+    /**
+     * This methods verify if at least one build configuration given in
+     * arguments is contained in buildConfContainer.
+     * 
+     * @param buildConfs
+     *            a string that represent build configurations names (can
+     *            contains multiple configuration if they are comma separated)
+     * @param buildConfContainer
+     *            a string that represent build configurations container (can
+     *            contains multiple configuration if they are comma separated)
+     * @return true if the string contains at least one matching build
+     *         configurations otherwise return false. If buildConfs is null this
+     *         methods return true.
+     */
+    public static boolean contains(String buildConfs, String buildConfContainer) {
+        if (buildConfs == null) {
+            return true;
+        }
+        return (null != getFirstBuildConfigurationMatching(buildConfs,
+                buildConfContainer));
+    }
+
+    /**
+     * This methods return the first build configuration matching with the
+     * criteria given in buildConfs argument.
+     * 
+     * @param buildConfs
+     *            a string that represent build configurations names (can
+     *            contains multiple configuration if they are comma separated)
+     * @param buildConfContainer
+     *            a string that represent build configurations container (can
+     *            contains multiple configuration if they are comma separated)
+     * @return a string that represent the first build configuration found.
+     *         Return null if no build configuration matched.
+     */
+    public static String getFirstBuildConfigurationMatching(String buildConfs,
+            String buildConfContainer) {
+        if (buildConfs == null || buildConfContainer == null) {
+            return null;
+        }
+        List<String> buildConfsToCheck = buildList(buildConfs);
+        List<String> availableBuildConfs = buildList(buildConfContainer);
+        for (String conf : buildConfsToCheck) {
+            if (availableBuildConfs.contains(conf)) {
+                return conf;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * This methods removes all the spaces in a list of confs separated by comma
+     * 
+     * @param confs
+     *            a string that represent a list of conf separated by comma
+     * @return a string that represent a list of conf separated by comma without
+     *         spaces.
+     */
+    public static String removeSpaces(String confs) {
+        return confs.replaceAll("\s", "");
+    }
+
+    public static List<String> buildList(String conf) {
+        return Arrays.asList(removeSpaces(conf).split(","));
+
+    }
+
+    /**
+     * Check if build configuration is active
+     * 
+     * @param requestedConfigurations
+     *            build configuration to check
+     * @param p
+     *            the project (used to retrieve available and active build
+     *            configuration)
+     * @param message
+     *            (prefix message used for log)
+     * @return return true if buildconfiguration is active. This method also
+     *         returns true if requestedConfigurations is null
+     */
+    public static boolean isBuildConfigurationActive(
+            String requestedConfigurations, Project p, String message) {
+        if (requestedConfigurations == null) {
+            p.log(message + " not bound to any build configuration",Project.MSG_DEBUG);
+            return true;
+        }
+        List<String> buildConfigurationsList = buildList(requestedConfigurations);
+
+        // check consistency, here we consider that a build configuration must
+        // be explicitly declared
+        if (p.getProperty(EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS) == null) {
+            throw new BuildException(
+                    "there is no available build configuration");
+        }
+
+        List<String> availableBuildConfigurations = Arrays.asList(p
+                .getProperty(EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS)
+                .split(","));
+
+        for (String conf : buildConfigurationsList) {
+            if (!availableBuildConfigurations.contains(conf)) {
+                throw new BuildException("unknown build configuration named "
+                        + conf);
+            }
+        }
+
+        // is there any activated build configuration matching with the build
+        // configurations defined?
+        if (p.getProperty(EasyAntMagicNames.MAIN_CONFS) != null) {
+            String buildConf = getFirstBuildConfigurationMatching(
+                    requestedConfigurations, p
+                            .getProperty(EasyAntMagicNames.MAIN_CONFS));
+            if (buildConf != null) {
+                p.log(message + " bound to build configuration " + buildConf,
+                        Project.MSG_DEBUG);
+                return true;
+            } else {
+                // if no activated build configuration match with required build
+                // configuration, it means
+                // that related element should not be loaded
+                p
+                        .log(
+                                message
+                                        + " not bound to any active build configuration. Requested build configuration was "
+                                        + requestedConfigurations,
+                                Project.MSG_DEBUG);
+                return false;
+            }
+        } else {
+            p.log("there is no activated build configuration",
+                    Project.MSG_DEBUG);
+            return false;
+        }
+    }
 }

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConfiguration.java?rev=1073371&r1=1073370&r2=1073371&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConfiguration.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConfiguration.java Tue Feb 22 15:55:55 2011
@@ -33,455 +33,455 @@ import org.apache.tools.ant.Project;
  */
 public class EasyAntConfiguration {
 
-	/** Stream to use for logging. */
-	private PrintStream out = System.out;
+    /** Stream to use for logging. */
+    private PrintStream out = System.out;
 
-	/** Stream that we are using for logging error messages. */
-	private PrintStream err = System.err;
+    /** Stream that we are using for logging error messages. */
+    private PrintStream err = System.err;
 
-	/** Our current message output status. Follows Project.MSG_XXX. */
-	private int msgOutputLevel = Project.MSG_INFO;
+    /** Our current message output status. Follows Project.MSG_XXX. */
+    private int msgOutputLevel = Project.MSG_INFO;
 
-	/** File that we are using for configuration. */
-	private File buildFile; /* null */
+    /** File that we are using for configuration. */
+    private File buildFile; /* null */
 
-	private File buildModule; /* null */
+    private File buildModule; /* null */
 
-	/** The build targets. */
-	private Vector<String> targets = new Vector<String>(1);
-	/** Set of properties that can be used by tasks. */
-	private Properties definedProps = new Properties();
+    /** The build targets. */
+    private Vector<String> targets = new Vector<String>(1);
+    /** Set of properties that can be used by tasks. */
+    private Properties definedProps = new Properties();
 
-	/** Names of classes to add as listeners to project. */
-	private Vector<String> listeners = new Vector<String>(1);
+    /** Names of classes to add as listeners to project. */
+    private Vector<String> listeners = new Vector<String>(1);
 
-	/** Indicates whether this build is to support interactive input */
-	private boolean allowInput = true;
+    /** Indicates whether this build is to support interactive input */
+    private boolean allowInput = true;
 
-	/** keep going mode */
-	private boolean keepGoingMode = false;
+    /** keep going mode */
+    private boolean keepGoingMode = false;
 
-	private boolean showMemoryDetails = false;
+    private boolean showMemoryDetails = false;
 
-	/**
-	 * The Ant logger class. There may be only one logger. It will have the
-	 * right to use the 'out' PrintStream. The class must implements the
-	 * BuildLogger interface.
-	 */
-	private String loggerClassname = null;
+    /**
+     * The Ant logger class. There may be only one logger. It will have the
+     * right to use the 'out' PrintStream. The class must implements the
+     * BuildLogger interface.
+     */
+    private String loggerClassname = null;
 
-	/**
-	 * The Ant InputHandler class. There may be only one input handler.
-	 */
-	private String inputHandlerClassname = null;
+    /**
+     * The Ant InputHandler class. There may be only one input handler.
+     */
+    private String inputHandlerClassname = null;
 
-	/**
-	 * Whether or not output to the log is to be unadorned.
-	 */
-	private boolean emacsMode = false;
+    /**
+     * Whether or not output to the log is to be unadorned.
+     */
+    private boolean emacsMode = false;
 
-	/**
-	 * optional thread priority
-	 */
-	private Integer threadPriority = null;
+    /**
+     * optional thread priority
+     */
+    private Integer threadPriority = null;
 
-	/**
-	 * proxy flag: default is false
-	 */
-	private boolean proxy = false;
+    /**
+     * proxy flag: default is false
+     */
+    private boolean proxy = false;
 
-	private Set<PluginDescriptor> systemPlugins = new HashSet<PluginDescriptor>();
+    private Set<PluginDescriptor> systemPlugins = new HashSet<PluginDescriptor>();
 
-	private Set<String> activeBuildConfigurations = new HashSet<String>();
+    private Set<String> activeBuildConfigurations = new HashSet<String>();
 
-	private ClassLoader coreLoader;
+    private ClassLoader coreLoader;
 
-	private boolean buildModuleLookupEnabled = false;
+    private boolean buildModuleLookupEnabled = false;
 
-	private String easyantIvySettingsFile;
-	private String easyantIvySettingsUrl;
+    private String easyantIvySettingsFile;
+    private String easyantIvySettingsUrl;
 
     private boolean offline;
 
-	/**
-	 * Get the ivysettings.xml file used by easyant
-	 * 
-	 * @return a string representing the ivysettings.xml used by easyant
-	 */
-	public String getEasyantIvySettingsFile() {
-		return easyantIvySettingsFile;
-	}
-
-	/**
-	 * Set the ivysettings.xml file used by easyant
-	 * 
-	 * @param easyantIvySettingsFile
-	 *            a string representing the ivysettings.xml used by easyant
-	 */
-	public void setEasyantIvySettingsFile(String easyantIvySettingsFile) {
-		this.easyantIvySettingsFile = easyantIvySettingsFile;
-	}
-
-	/**
-	 * Get the url of a ivysettings.xml used by easyant
-	 * 
-	 * @return a string representing the ivysettings.xml url used by easyant
-	 */
-	public String getEasyantIvySettingsUrl() {
-		return easyantIvySettingsUrl;
-	}
-
-	/**
-	 * Set the url of a ivysettings.xml used by easyant
-	 * 
-	 * @param easyantIvySettingsUrl
-	 *            a string representing the ivysettings.xml url used by easyant.
-	 */
-	public void setEasyantIvySettingsUrl(String easyantIvySettingsUrl) {
-		this.easyantIvySettingsUrl = easyantIvySettingsUrl;
-	}
-	
-	/**
-	 * Set the url of a ivysettings.xml used by easyant
-	 * 
-	 * @param easyantIvySettingsUrl
-	 *            a string representing the ivysettings.xml url used by easyant.
-	 */
-	public void setEasyantIvySettingsUrl(URL easyantIvySettingsUrl) {
-		this.easyantIvySettingsUrl = easyantIvySettingsUrl.toString();
-	}
-
-	/**
-	 * Get the output level Default is Project.MSG_INFO Follows Project.MSG_XXX.
-	 * 
-	 * @return a int representing the output level
-	 */
-	public int getMsgOutputLevel() {
-		return msgOutputLevel;
-	}
-
-	/**
-	 * Set the output level Default is Project.MSG_INFO Follows Project.MSG_XXX.
-	 * 
-	 * @param msgOutputLevel
-	 *            a int representing the output level
-	 */
-	public void setMsgOutputLevel(int msgOutputLevel) {
-		this.msgOutputLevel = msgOutputLevel;
-	}
-
-	/**
-	 * Get the buildFile that will be included
-	 * 
-	 * @return a file representing the buildFile included in this project
-	 */
-	public File getBuildFile() {
-		return buildFile;
-	}
-
-	/**
-	 * Set the buildFile that will be included
-	 * 
-	 * @param buildFile
-	 *            a file representing the buildFile included in this project
-	 */
-	public void setBuildFile(File buildFile) {
-		this.buildFile = buildFile;
-	}
-
-	/**
-	 * Get the buildModule that will be included
-	 * 
-	 * @return a file representing the buildModule included in this project
-	 */
-	public File getBuildModule() {
-		return buildModule;
-	}
-
-	/**
-	 * Set the buildModule that will be included
-	 * 
-	 * @param buildModule
-	 *            a file representing the buildModule included in this project
-	 */
-	public void setBuildModule(File buildModule) {
-		this.buildModule = buildModule;
-	}
-
-	/**
-	 * Get a Set of properties that can be used by tasks.
-	 * 
-	 * @return a Set of properties that can be used by tasks.
-	 */
-	public Properties getDefinedProps() {
-		return definedProps;
-	}
-
-	/**
-	 * Set of properties that can be used by tasks.
-	 * 
-	 * @param definedProps
-	 *            a Set of properties that can be used by tasks.
-	 */
-	public void setDefinedProps(Properties definedProps) {
-		this.definedProps = definedProps;
-	}
-
-	/**
-	 * Indicates whether this build is to support interactive input
-	 * 
-	 * @return true if input is allowed, false if we are in batchmode
-	 */
-	public boolean isAllowInput() {
-		return allowInput;
-	}
-
-	/**
-	 * Indicates whether this build is to support interactive input
-	 * 
-	 * @param allowInput
-	 */
-	public void setAllowInput(boolean allowInput) {
-		this.allowInput = allowInput;
-	}
-
-	public boolean isKeepGoingMode() {
-		return keepGoingMode;
-	}
-
-	public void setKeepGoingMode(boolean keepGoingMode) {
-		this.keepGoingMode = keepGoingMode;
-	}
-
-	/**
-	 * Should we print memory details?
-	 * 
-	 * @return true if we want to print memory details
-	 */
-	public boolean isShowMemoryDetails() {
-		return showMemoryDetails;
-	}
-
-	/**
-	 * Set to true if you want to print memory details Default is false.
-	 * 
-	 * @param showMemoryDetails
-	 */
-	public void setShowMemoryDetails(boolean showMemoryDetails) {
-		this.showMemoryDetails = showMemoryDetails;
-	}
-
-	/**
-	 * Get the default logger classname The Ant logger class. There may be only
-	 * one logger. It will have the right to use the 'out' PrintStream. The
-	 * class must implements the BuildLogger interface.
-	 * 
-	 * @return a string representing the logger classname
-	 */
-	public String getLoggerClassname() {
-		return loggerClassname;
-	}
-
-	/**
-	 * Set the default logger classname The Ant logger class. There may be only
-	 * one logger. It will have the right to use the 'out' PrintStream. The
-	 * class must implements the BuildLogger interface.
-	 * 
-	 * @param loggerClassname
-	 *            a string representing the logger classname
-	 */
-	public void setLoggerClassname(String loggerClassname) {
-		this.loggerClassname = loggerClassname;
-	}
-
-	/**
-	 * The Ant InputHandler class. There may be only one input handler.
-	 * 
-	 * @return a string representing the input handler classname
-	 */
-	public String getInputHandlerClassname() {
-		return inputHandlerClassname;
-	}
-
-	/**
-	 * set The Ant InputHandler class. There may be only one input handler.
-	 * 
-	 * @param inputHandlerClassname
-	 *            a string representing the input handler classname
-	 */
-	public void setInputHandlerClassname(String inputHandlerClassname) {
-		this.inputHandlerClassname = inputHandlerClassname;
-	}
-
-	/**
-	 * Whether or not output to the log is to be unadorned.
-	 * 
-	 * @return true if the output to the log is to be unadorned, otherwise false
-	 */
-	public boolean isEmacsMode() {
-		return emacsMode;
-	}
-
-	/**
-	 * Whether or not output to the log is to be unadorned.
-	 * 
-	 * @param emacsMode
-	 */
-	public void setEmacsMode(boolean emacsMode) {
-		this.emacsMode = emacsMode;
-	}
-
-	/**
-	 * Get the threadPriority
-	 * 
-	 * @return a integer representing the thread priority.
-	 */
-	public Integer getThreadPriority() {
-		return threadPriority;
-	}
-
-	public void setThreadPriority(Integer threadPriority) {
-		this.threadPriority = threadPriority;
-	}
-
-	public boolean isProxy() {
-		return proxy;
-	}
-
-	public void setProxy(boolean proxy) {
-		this.proxy = proxy;
-	}
-
-	public Vector<String> getTargets() {
-		return targets;
-	}
-
-	public void setTargets(Vector<String> targets) {
-		this.targets = targets;
-	}
-
-	/**
-	 * Names of classes to add as listeners to project.
-	 * 
-	 * @return a vector of listerners
-	 */
-	public Vector<String> getListeners() {
-		return listeners;
-	}
-
-	/**
-	 * Names of classes to add as listeners to project.
-	 * 
-	 * @param listeners
-	 */
-	public void setListeners(Vector<String> listeners) {
-		this.listeners = listeners;
-	}
-
-	/**
-	 * Stream to use for logging.
-	 * 
-	 * @return a stream used for logging
-	 */
-	public PrintStream getOut() {
-		return out;
-	}
-
-	/**
-	 * Stream to use for logging.
-	 * 
-	 * @param out stream to use for logging
-	 */
-	public void setOut(PrintStream out) {
-		this.out = out;
-	}
-
-	/**
-	 * Stream that we are using for logging error messages.
-	 * 
-	 * @return stream used for error logging
-	 */
-	public PrintStream getErr() {
-		return err;
-	}
-
-	/**
-	 * Stream that we are using for logging error messages.
-	 * 
-	 * @param err stream used for error logging 
-	 */
-	public void setErr(PrintStream err) {
-		this.err = err;
-	}
-
-	/**
-	 * Get a set of system plugins that will be included everytime
-	 * 
-	 * @return a set of system plugins that will be included everytime
-	 */
-	public Set<PluginDescriptor> getSystemPlugins() {
-		return systemPlugins;
-	}
-
-	/**
-	 * set of system plugins that will be included everytime
-	 * 
-	 * @param systemPlugins
-	 *            a set of system plugins that will be included everytime
-	 */
-	protected void setSystemPlugins(Set<PluginDescriptor> systemPlugins) {
-		this.systemPlugins = systemPlugins;
-	}
-
-	/**
-	 * Add a system plugin that will be included everytime
-	 * 
-	 * @param pluginDescriptor
-	 *            representing a plugin
-	 * @return true if the plugin has been added to the list of system plugins, otherwise false
-	 */
-	public boolean addSystemPlugin(PluginDescriptor pluginDescriptor) {
-		if (pluginDescriptor == null) {
-			throw new IllegalArgumentException(
-					"pluginDescriptor cannot be null");
-		}
-		return this.systemPlugins.add(pluginDescriptor);
-	}
-
-	public ClassLoader getCoreLoader() {
-		return coreLoader;
-	}
-
-	public void setCoreLoader(ClassLoader coreLoader) {
-		this.coreLoader = coreLoader;
-	}
-
-	/**
-	 * Search parent directories for the build file.
-	 * 
-	 * @return true if easyantEngine should lookup for buildModule
-	 */
-	public boolean isBuildModuleLookupEnabled() {
-		return this.buildModuleLookupEnabled;
-	}
-
-	/**
-	 * Search parent directories for the build file.
-	 * 
-	 * @param buildModuleLookupEnabled
-	 *            true if easyantEngine should lookup for buildModule
-	 */
-	public void setBuildModuleLookupEnabled(boolean buildModuleLookupEnabled) {
-		this.buildModuleLookupEnabled = buildModuleLookupEnabled;
-	}
-
-	public Set<String> getActiveBuildConfigurations() {
-		return activeBuildConfigurations;
-	}
-
-	public void setActiveBuildConfigurations(Set<String> buildConfigurations) {
-		this.activeBuildConfigurations = buildConfigurations;
-	}
+    /**
+     * Get the ivysettings.xml file used by easyant
+     * 
+     * @return a string representing the ivysettings.xml used by easyant
+     */
+    public String getEasyantIvySettingsFile() {
+        return easyantIvySettingsFile;
+    }
+
+    /**
+     * Set the ivysettings.xml file used by easyant
+     * 
+     * @param easyantIvySettingsFile
+     *            a string representing the ivysettings.xml used by easyant
+     */
+    public void setEasyantIvySettingsFile(String easyantIvySettingsFile) {
+        this.easyantIvySettingsFile = easyantIvySettingsFile;
+    }
+
+    /**
+     * Get the url of a ivysettings.xml used by easyant
+     * 
+     * @return a string representing the ivysettings.xml url used by easyant
+     */
+    public String getEasyantIvySettingsUrl() {
+        return easyantIvySettingsUrl;
+    }
+
+    /**
+     * Set the url of a ivysettings.xml used by easyant
+     * 
+     * @param easyantIvySettingsUrl
+     *            a string representing the ivysettings.xml url used by easyant.
+     */
+    public void setEasyantIvySettingsUrl(String easyantIvySettingsUrl) {
+        this.easyantIvySettingsUrl = easyantIvySettingsUrl;
+    }
+    
+    /**
+     * Set the url of a ivysettings.xml used by easyant
+     * 
+     * @param easyantIvySettingsUrl
+     *            a string representing the ivysettings.xml url used by easyant.
+     */
+    public void setEasyantIvySettingsUrl(URL easyantIvySettingsUrl) {
+        this.easyantIvySettingsUrl = easyantIvySettingsUrl.toString();
+    }
+
+    /**
+     * Get the output level Default is Project.MSG_INFO Follows Project.MSG_XXX.
+     * 
+     * @return a int representing the output level
+     */
+    public int getMsgOutputLevel() {
+        return msgOutputLevel;
+    }
+
+    /**
+     * Set the output level Default is Project.MSG_INFO Follows Project.MSG_XXX.
+     * 
+     * @param msgOutputLevel
+     *            a int representing the output level
+     */
+    public void setMsgOutputLevel(int msgOutputLevel) {
+        this.msgOutputLevel = msgOutputLevel;
+    }
+
+    /**
+     * Get the buildFile that will be included
+     * 
+     * @return a file representing the buildFile included in this project
+     */
+    public File getBuildFile() {
+        return buildFile;
+    }
+
+    /**
+     * Set the buildFile that will be included
+     * 
+     * @param buildFile
+     *            a file representing the buildFile included in this project
+     */
+    public void setBuildFile(File buildFile) {
+        this.buildFile = buildFile;
+    }
+
+    /**
+     * Get the buildModule that will be included
+     * 
+     * @return a file representing the buildModule included in this project
+     */
+    public File getBuildModule() {
+        return buildModule;
+    }
+
+    /**
+     * Set the buildModule that will be included
+     * 
+     * @param buildModule
+     *            a file representing the buildModule included in this project
+     */
+    public void setBuildModule(File buildModule) {
+        this.buildModule = buildModule;
+    }
+
+    /**
+     * Get a Set of properties that can be used by tasks.
+     * 
+     * @return a Set of properties that can be used by tasks.
+     */
+    public Properties getDefinedProps() {
+        return definedProps;
+    }
+
+    /**
+     * Set of properties that can be used by tasks.
+     * 
+     * @param definedProps
+     *            a Set of properties that can be used by tasks.
+     */
+    public void setDefinedProps(Properties definedProps) {
+        this.definedProps = definedProps;
+    }
+
+    /**
+     * Indicates whether this build is to support interactive input
+     * 
+     * @return true if input is allowed, false if we are in batchmode
+     */
+    public boolean isAllowInput() {
+        return allowInput;
+    }
+
+    /**
+     * Indicates whether this build is to support interactive input
+     * 
+     * @param allowInput
+     */
+    public void setAllowInput(boolean allowInput) {
+        this.allowInput = allowInput;
+    }
+
+    public boolean isKeepGoingMode() {
+        return keepGoingMode;
+    }
+
+    public void setKeepGoingMode(boolean keepGoingMode) {
+        this.keepGoingMode = keepGoingMode;
+    }
+
+    /**
+     * Should we print memory details?
+     * 
+     * @return true if we want to print memory details
+     */
+    public boolean isShowMemoryDetails() {
+        return showMemoryDetails;
+    }
+
+    /**
+     * Set to true if you want to print memory details Default is false.
+     * 
+     * @param showMemoryDetails
+     */
+    public void setShowMemoryDetails(boolean showMemoryDetails) {
+        this.showMemoryDetails = showMemoryDetails;
+    }
+
+    /**
+     * Get the default logger classname The Ant logger class. There may be only
+     * one logger. It will have the right to use the 'out' PrintStream. The
+     * class must implements the BuildLogger interface.
+     * 
+     * @return a string representing the logger classname
+     */
+    public String getLoggerClassname() {
+        return loggerClassname;
+    }
+
+    /**
+     * Set the default logger classname The Ant logger class. There may be only
+     * one logger. It will have the right to use the 'out' PrintStream. The
+     * class must implements the BuildLogger interface.
+     * 
+     * @param loggerClassname
+     *            a string representing the logger classname
+     */
+    public void setLoggerClassname(String loggerClassname) {
+        this.loggerClassname = loggerClassname;
+    }
+
+    /**
+     * The Ant InputHandler class. There may be only one input handler.
+     * 
+     * @return a string representing the input handler classname
+     */
+    public String getInputHandlerClassname() {
+        return inputHandlerClassname;
+    }
+
+    /**
+     * set The Ant InputHandler class. There may be only one input handler.
+     * 
+     * @param inputHandlerClassname
+     *            a string representing the input handler classname
+     */
+    public void setInputHandlerClassname(String inputHandlerClassname) {
+        this.inputHandlerClassname = inputHandlerClassname;
+    }
+
+    /**
+     * Whether or not output to the log is to be unadorned.
+     * 
+     * @return true if the output to the log is to be unadorned, otherwise false
+     */
+    public boolean isEmacsMode() {
+        return emacsMode;
+    }
+
+    /**
+     * Whether or not output to the log is to be unadorned.
+     * 
+     * @param emacsMode
+     */
+    public void setEmacsMode(boolean emacsMode) {
+        this.emacsMode = emacsMode;
+    }
+
+    /**
+     * Get the threadPriority
+     * 
+     * @return a integer representing the thread priority.
+     */
+    public Integer getThreadPriority() {
+        return threadPriority;
+    }
+
+    public void setThreadPriority(Integer threadPriority) {
+        this.threadPriority = threadPriority;
+    }
+
+    public boolean isProxy() {
+        return proxy;
+    }
+
+    public void setProxy(boolean proxy) {
+        this.proxy = proxy;
+    }
+
+    public Vector<String> getTargets() {
+        return targets;
+    }
+
+    public void setTargets(Vector<String> targets) {
+        this.targets = targets;
+    }
+
+    /**
+     * Names of classes to add as listeners to project.
+     * 
+     * @return a vector of listerners
+     */
+    public Vector<String> getListeners() {
+        return listeners;
+    }
+
+    /**
+     * Names of classes to add as listeners to project.
+     * 
+     * @param listeners
+     */
+    public void setListeners(Vector<String> listeners) {
+        this.listeners = listeners;
+    }
+
+    /**
+     * Stream to use for logging.
+     * 
+     * @return a stream used for logging
+     */
+    public PrintStream getOut() {
+        return out;
+    }
+
+    /**
+     * Stream to use for logging.
+     * 
+     * @param out stream to use for logging
+     */
+    public void setOut(PrintStream out) {
+        this.out = out;
+    }
+
+    /**
+     * Stream that we are using for logging error messages.
+     * 
+     * @return stream used for error logging
+     */
+    public PrintStream getErr() {
+        return err;
+    }
+
+    /**
+     * Stream that we are using for logging error messages.
+     * 
+     * @param err stream used for error logging 
+     */
+    public void setErr(PrintStream err) {
+        this.err = err;
+    }
+
+    /**
+     * Get a set of system plugins that will be included everytime
+     * 
+     * @return a set of system plugins that will be included everytime
+     */
+    public Set<PluginDescriptor> getSystemPlugins() {
+        return systemPlugins;
+    }
+
+    /**
+     * set of system plugins that will be included everytime
+     * 
+     * @param systemPlugins
+     *            a set of system plugins that will be included everytime
+     */
+    protected void setSystemPlugins(Set<PluginDescriptor> systemPlugins) {
+        this.systemPlugins = systemPlugins;
+    }
+
+    /**
+     * Add a system plugin that will be included everytime
+     * 
+     * @param pluginDescriptor
+     *            representing a plugin
+     * @return true if the plugin has been added to the list of system plugins, otherwise false
+     */
+    public boolean addSystemPlugin(PluginDescriptor pluginDescriptor) {
+        if (pluginDescriptor == null) {
+            throw new IllegalArgumentException(
+                    "pluginDescriptor cannot be null");
+        }
+        return this.systemPlugins.add(pluginDescriptor);
+    }
+
+    public ClassLoader getCoreLoader() {
+        return coreLoader;
+    }
+
+    public void setCoreLoader(ClassLoader coreLoader) {
+        this.coreLoader = coreLoader;
+    }
+
+    /**
+     * Search parent directories for the build file.
+     * 
+     * @return true if easyantEngine should lookup for buildModule
+     */
+    public boolean isBuildModuleLookupEnabled() {
+        return this.buildModuleLookupEnabled;
+    }
+
+    /**
+     * Search parent directories for the build file.
+     * 
+     * @param buildModuleLookupEnabled
+     *            true if easyantEngine should lookup for buildModule
+     */
+    public void setBuildModuleLookupEnabled(boolean buildModuleLookupEnabled) {
+        this.buildModuleLookupEnabled = buildModuleLookupEnabled;
+    }
+
+    public Set<String> getActiveBuildConfigurations() {
+        return activeBuildConfigurations;
+    }
+
+    public void setActiveBuildConfigurations(Set<String> buildConfigurations) {
+        this.activeBuildConfigurations = buildConfigurations;
+    }
 
     public void setOffline(boolean offline) {
         this.offline = offline;

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConstants.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConstants.java?rev=1073371&r1=1073370&r2=1073371&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConstants.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntConstants.java Tue Feb 22 15:55:55 2011
@@ -19,66 +19,66 @@ package org.apache.easyant.core;
 
 
 public interface EasyAntConstants {
-	
-	/**
-	 * Name of the task name used for internal easyant jobs
-	 */
-	public static final String EASYANT_TASK_NAME = "easyant";
-	
-	/**
-	 * Name of the default build module
-	 */
-	public static final String DEFAULT_BUILD_MODULE = "module.ivy";
-	
-	/**
-	 * Name of the default build file
-	 */
-	public static final String DEFAULT_BUILD_FILE = "module.ant";
-	
-	/**
-	 * Name of the default override build file
-	 */
-	public static final String DEFAULT_OVERRIDE_BUILD_FILE = "override.module.ant";
-
-	/**
-	 * URI of easyant module descriptor namespace
-	 */
-	public static final String EASYANT_MD_NAMESPACE = "http://www.easyant.org";
-
-	/**
-	 * Name of the default target
-	 */
-	public static final String DEFAULT_TARGET = "doit";
-
-	/**
-	 * Name of the default easyant plugins organisation
-	 */
-	public static final String EASYANT_PLUGIN_ORGANISATION = "org.apache.easyant.plugins";
-	
-	/**
-	 * Name of the default easyant build types organisation
-	 */
-	public static final String EASYANT_BUILDTYPES_ORGANISATION = "org.apache.easyant.buildtypes";
-	
-	/**
-	 * Name of the default easyant skeletons organisation
-	 */
-	public static final String EASYANT_SKELETONS_ORGANISATION = "org.apache.easyant.skeletons";
-
-	/**
-	 * Default location of user's easyant ivysettings file
-	 */
-	public static final String DEFAULT_USER_EASYANT_IVYSETTINGS = "${user.home}/.easyant/easyant-ivysettings.xml";
-
-	/**
-	 * Default location of global easyant ivysettings file
-	 */
-	public static final String DEFAULT_GLOBAL_EASYANT_IVYSETTINGS = "file://${easyant.home}/easyant-ivysettings.xml";
-
-	/**
-	 * Default value for pre module targets
-	 */
-	public static final String DEFAULT_PRE_MODULE_TARGETS = "clean";
-	
+    
+    /**
+     * Name of the task name used for internal easyant jobs
+     */
+    public static final String EASYANT_TASK_NAME = "easyant";
+    
+    /**
+     * Name of the default build module
+     */
+    public static final String DEFAULT_BUILD_MODULE = "module.ivy";
+    
+    /**
+     * Name of the default build file
+     */
+    public static final String DEFAULT_BUILD_FILE = "module.ant";
+    
+    /**
+     * Name of the default override build file
+     */
+    public static final String DEFAULT_OVERRIDE_BUILD_FILE = "override.module.ant";
+
+    /**
+     * URI of easyant module descriptor namespace
+     */
+    public static final String EASYANT_MD_NAMESPACE = "http://www.easyant.org";
+
+    /**
+     * Name of the default target
+     */
+    public static final String DEFAULT_TARGET = "doit";
+
+    /**
+     * Name of the default easyant plugins organisation
+     */
+    public static final String EASYANT_PLUGIN_ORGANISATION = "org.apache.easyant.plugins";
+    
+    /**
+     * Name of the default easyant build types organisation
+     */
+    public static final String EASYANT_BUILDTYPES_ORGANISATION = "org.apache.easyant.buildtypes";
+    
+    /**
+     * Name of the default easyant skeletons organisation
+     */
+    public static final String EASYANT_SKELETONS_ORGANISATION = "org.apache.easyant.skeletons";
+
+    /**
+     * Default location of user's easyant ivysettings file
+     */
+    public static final String DEFAULT_USER_EASYANT_IVYSETTINGS = "${user.home}/.easyant/easyant-ivysettings.xml";
+
+    /**
+     * Default location of global easyant ivysettings file
+     */
+    public static final String DEFAULT_GLOBAL_EASYANT_IVYSETTINGS = "file://${easyant.home}/easyant-ivysettings.xml";
+
+    /**
+     * Default value for pre module targets
+     */
+    public static final String DEFAULT_PRE_MODULE_TARGETS = "clean";
+    
 
 }

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=1073371&r1=1073370&r2=1073371&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 Tue Feb 22 15:55:55 2011
@@ -61,684 +61,684 @@ import org.apache.tools.ant.util.ProxySe
  */
 public class EasyAntEngine {
 
-	private static final long MEGABYTE = 1024 * 1024;;
+    private static final long MEGABYTE = 1024 * 1024;;
 
-	private final EasyAntConfiguration configuration;
+    private final EasyAntConfiguration configuration;
 
-	private PluginService pluginService = null;
+    private PluginService pluginService = null;
 
-	/**
-	 * Default constructor will initialize the default configuration
-	 */
-	public EasyAntEngine() {
-		this(EasyantConfigurationFactory.getInstance()
-				.createDefaultConfiguration());
-	}
-
-	/**
-	 * Constructor if you want to use a custom configuration
-	 * 
-	 * @param configuration
-	 */
-	public EasyAntEngine(final EasyAntConfiguration configuration) {
-		this.configuration = configuration;
-	}
-
-	/**
-	 * Configure easyant ivy instance
-	 * 
-	 * @param project
-	 *            project instance
-	 * @return a configured {@link Ivy} instance
-	 */
-	protected Ivy configureEasyAntIvyInstance(Project project) {
-		IvyConfigure easyantIvyConfigure = new IvyConfigure();
-		easyantIvyConfigure
-				.setSettingsId(EasyAntMagicNames.EASYANT_IVY_INSTANCE);
-
-		project
-				.setNewProperty(
-						EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS,
-						this
-								.getClass()
-								.getResource(
-										"/org/apache/easyant/core/default-easyant-ivysettings.xml")
-								.toExternalForm());
-		project
-				.setNewProperty(
-						EasyAntMagicNames.EASYANT_EXTRA_IVYSETTINGS,
-						this
-								.getClass()
-								.getResource(
-										"/org/apache/easyant/core/extra-easyant-ivysettings.xml")
-								.toExternalForm());
-
-		project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_REPO_URL, this
-				.getClass().getResource(
-						"/org/apache/easyant/core/repository/modules")
-				.toExternalForm());
-		if (this.getClass().getResource(
-				"/org/apache/easyant/repository/extra-modules") != null) {
-			project.setNewProperty(EasyAntMagicNames.EASYANT_EXTRA_REPO_URL,
-					this.getClass().getResource(
-							"/org/apache/easyant/repository/extra-modules")
-							.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 {
-				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 {
-				easyantIvyConfigure.setUrl(url);
-			} catch (MalformedURLException malformedUrl) {
-				throw new BuildException(
-						"Unable to parse easyant ivysettings from the following url : "
-								+ url, malformedUrl);
-			}
-		}
-		easyantIvyConfigure.setProject(project);
-		easyantIvyConfigure.setTaskName("configure-easyant");
-		easyantIvyConfigure.execute();
-
-		IvyAntSettings ivyAntSettings = IvyInstanceHelper
-				.getEasyAntIvyAntSettings(project);
-		return ivyAntSettings.getConfiguredIvyInstance(easyantIvyConfigure);
-	}
-
-	/**
-	 * Get user easyant-ivysettings file
-	 * 
-	 * @param project
-	 * @return the configured user easyant-ivysettings.file
-	 */
-	private File getUserEasyAntIvySettings(Project project) {
-		// path can be specified through a property
-		String path = project
-				.getProperty(EasyAntMagicNames.USER_EASYANT_IVYSETTINGS);
-		// if no property is set check the default location
-		if (path == null) {
-			path = PropertyHelper.getPropertyHelper(project).replaceProperties(
-					EasyAntConstants.DEFAULT_USER_EASYANT_IVYSETTINGS);
-		}
-		project.log("user's easyant-ivysettings file : " + path,
-				Project.MSG_DEBUG);
-		return new File(path);
-	}
-
-	/**
-	 * Get global easyant-ivysettings file
-	 * 
-	 * @param project
-	 * @return the configured global easyant-ivysettings.file
-	 */
-	private String getGlobalEasyAntIvySettings(Project project) {
-		PropertyHelper helper = PropertyHelper.getPropertyHelper(project);
-		String path=null;
-		if (configuration.getEasyantIvySettingsFile() != null) {
-			File f = new File(helper.replaceProperties(configuration.getEasyantIvySettingsFile()));
-			try {
-				path = f.toURL().toExternalForm();
-			} catch (MalformedURLException e) {
-				throw new BuildException("Can't load easyant ivysettings file from "+ f.getAbsolutePath());
-			}
-		}
-		if (configuration.getEasyantIvySettingsUrl() != null) {
-			path = 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);
-		}
-		// if no property is set check the default location
-		if (path == null) {
-			path = helper.replaceProperties(
-					EasyAntConstants.DEFAULT_GLOBAL_EASYANT_IVYSETTINGS);
-		}
-		project.log("global easyant-ivysettings file : " + path,
-				Project.MSG_DEBUG);
-		return path;
-	}
-
-	protected void configurePluginService(Project project,
-			Ivy easyantIvyInstance) {
-		pluginService = new DefaultPluginServiceImpl(easyantIvyInstance);
-		project.addReference(EasyAntMagicNames.PLUGIN_SERVICE_INSTANCE,
-				pluginService);
-
-	}
-
-	/**
-	 * Adds the listeners specified in the command line arguments, along with
-	 * the default listener, to the specified project.
-	 * 
-	 * @param project
-	 *            The project to add listeners to. Must not be <code>null</code>
-	 *            .
-	 */
-	protected void addBuildListeners(Project project) {
-
-		// Add the default listener
-		project.addBuildListener(createLogger());
-
-		for (int i = 0; i < configuration.getListeners().size(); i++) {
-			String className = (String) configuration.getListeners().elementAt(
-					i);
-			BuildListener listener = (BuildListener) ClasspathUtils
-					.newInstance(className, EasyAntEngine.class
-							.getClassLoader(), BuildListener.class);
-			project.setProjectReference(listener);
-
-			project.addBuildListener(listener);
-		}
-	}
-
-	/**
-	 * Creates the InputHandler and adds it to the project.
-	 * 
-	 * @param project
-	 *            the project instance.
-	 * 
-	 * @exception BuildException
-	 *                if a specified InputHandler implementation could not be
-	 *                loaded.
-	 */
-	protected void addInputHandler(Project project) {
-		InputHandler handler = null;
-
-		if (configuration.getInputHandlerClassname() == null) {
-			handler = new DefaultInputHandler();
-		} else {
-			handler = (InputHandler) ClasspathUtils.newInstance(configuration
-					.getInputHandlerClassname(), Main.class.getClassLoader(),
-					InputHandler.class);
-			project.setProjectReference(handler);
-		}
-		project.setInputHandler(handler);
-	}
-
-	/**
-	 * Creates the default build logger for sending build events to the ant log.
-	 * 
-	 * @return the logger instance for this build.
-	 */
-	protected BuildLogger createLogger() {
-		BuildLogger logger = null;
-		if (configuration.getLoggerClassname() != null) {
-			try {
-				logger = (BuildLogger) ClasspathUtils.newInstance(configuration
-						.getLoggerClassname(), EasyAntEngine.class
-						.getClassLoader(), BuildLogger.class);
-			} catch (BuildException e) {
-				throw new RuntimeException("The specified logger class "
-						+ configuration.getLoggerClassname()
-						+ " could not be used because " + e.getMessage(), e);
-			}
-		} else {
-			logger = new DefaultEasyAntLogger();
-		}
-
-		logger.setMessageOutputLevel(configuration.getMsgOutputLevel());
-		logger.setOutputPrintStream(configuration.getOut());
-		logger.setErrorPrintStream(configuration.getErr());
-		logger.setEmacsMode(configuration.isEmacsMode());
-
-		return logger;
-	}
-
-	/**
-	 * Search parent directories for the build file.
-	 * <p>
-	 * Takes the given target as a suffix to append to each parent directory in
-	 * search of a build file. Once the root of the file-system has been reached
-	 * an exception is thrown.
-	 * 
-	 * @param start
-	 *            Leaf directory of search. Must not be <code>null</code>.
-	 * @param suffix
-	 *            Suffix filename to look for in parents. Must not be
-	 *            <code>null</code>.
-	 * 
-	 * @return A handle to the build file if one is found
-	 * 
-	 * @exception BuildException
-	 *                if no build file is found
-	 */
-	protected File findBuildModule(String start, String suffix)
-			throws BuildException {
-		if (configuration.getMsgOutputLevel() >= Project.MSG_INFO) {
-			System.out.println("Searching for " + suffix + " ...");
-		}
-
-		File parent = new File(new File(start).getAbsolutePath());
-		File file = new File(parent, suffix);
-
-		// check if the target file exists in the current directory
-		while (!file.exists()) {
-			// change to parent directory
-			parent = parent.getParentFile();
-
-			// if parent is null, then we are at the root of the fs,
-			// complain that we can't find the build file.
-			if (parent == null) {
-				throw new BuildException("Could not locate a build file!");
-			}
-
-			// refresh our file handle
-			file = new File(parent, suffix);
-		}
-
-		return file;
-	}
-
-	/**
-	 * configure a given project with current configuration
-	 * 
-	 * @param project
-	 *            a given project
-	 * @throws BuildException
-	 */
-	public void configureProject(Project project) throws BuildException {
-
-		addBuildListeners(project);
-		addInputHandler(project);
-
-		// set the thread priorities
-		if (configuration.getThreadPriority() != null) {
-			try {
-				project.log("Setting Ant's thread priority to "
-						+ configuration.getThreadPriority(),
-						Project.MSG_VERBOSE);
-				Thread.currentThread().setPriority(
-						configuration.getThreadPriority().intValue());
-			} catch (SecurityException swallowed) {
-				// we cannot set the priority here.
-				project
-						.log("A security manager refused to set the -nice value");
-			}
-		}
-
-		project.setKeepGoingMode(configuration.isKeepGoingMode());
-		if (configuration.isProxy()) {
-			// proxy setup if enabledcoreLoader
-			ProxySetup proxySetup = new ProxySetup(project);
-			proxySetup.enableProxies();
-		}
-
-		project.setName("EasyAnt");
-
-	}
-
-	/**
-	 * Initialize an easyant Project
-	 * 
-	 * @param project
-	 */
-	public void initProject(Project project) {
-		project.init();
-		// set user-define properties
-		Enumeration e = configuration.getDefinedProps().keys();
-		while (e.hasMoreElements()) {
-			String arg = (String) e.nextElement();
-			String value = (String) configuration.getDefinedProps().get(arg);
-			project.setUserProperty(arg, value);
+    /**
+     * Default constructor will initialize the default configuration
+     */
+    public EasyAntEngine() {
+        this(EasyantConfigurationFactory.getInstance()
+                .createDefaultConfiguration());
+    }
+
+    /**
+     * Constructor if you want to use a custom configuration
+     * 
+     * @param configuration
+     */
+    public EasyAntEngine(final EasyAntConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    /**
+     * Configure easyant ivy instance
+     * 
+     * @param project
+     *            project instance
+     * @return a configured {@link Ivy} instance
+     */
+    protected Ivy configureEasyAntIvyInstance(Project project) {
+        IvyConfigure easyantIvyConfigure = new IvyConfigure();
+        easyantIvyConfigure
+                .setSettingsId(EasyAntMagicNames.EASYANT_IVY_INSTANCE);
+
+        project
+                .setNewProperty(
+                        EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS,
+                        this
+                                .getClass()
+                                .getResource(
+                                        "/org/apache/easyant/core/default-easyant-ivysettings.xml")
+                                .toExternalForm());
+        project
+                .setNewProperty(
+                        EasyAntMagicNames.EASYANT_EXTRA_IVYSETTINGS,
+                        this
+                                .getClass()
+                                .getResource(
+                                        "/org/apache/easyant/core/extra-easyant-ivysettings.xml")
+                                .toExternalForm());
+
+        project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_REPO_URL, this
+                .getClass().getResource(
+                        "/org/apache/easyant/core/repository/modules")
+                .toExternalForm());
+        if (this.getClass().getResource(
+                "/org/apache/easyant/repository/extra-modules") != null) {
+            project.setNewProperty(EasyAntMagicNames.EASYANT_EXTRA_REPO_URL,
+                    this.getClass().getResource(
+                            "/org/apache/easyant/repository/extra-modules")
+                            .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 {
+                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 {
+                easyantIvyConfigure.setUrl(url);
+            } catch (MalformedURLException malformedUrl) {
+                throw new BuildException(
+                        "Unable to parse easyant ivysettings from the following url : "
+                                + url, malformedUrl);
+            }
+        }
+        easyantIvyConfigure.setProject(project);
+        easyantIvyConfigure.setTaskName("configure-easyant");
+        easyantIvyConfigure.execute();
+
+        IvyAntSettings ivyAntSettings = IvyInstanceHelper
+                .getEasyAntIvyAntSettings(project);
+        return ivyAntSettings.getConfiguredIvyInstance(easyantIvyConfigure);
+    }
+
+    /**
+     * Get user easyant-ivysettings file
+     * 
+     * @param project
+     * @return the configured user easyant-ivysettings.file
+     */
+    private File getUserEasyAntIvySettings(Project project) {
+        // path can be specified through a property
+        String path = project
+                .getProperty(EasyAntMagicNames.USER_EASYANT_IVYSETTINGS);
+        // if no property is set check the default location
+        if (path == null) {
+            path = PropertyHelper.getPropertyHelper(project).replaceProperties(
+                    EasyAntConstants.DEFAULT_USER_EASYANT_IVYSETTINGS);
+        }
+        project.log("user's easyant-ivysettings file : " + path,
+                Project.MSG_DEBUG);
+        return new File(path);
+    }
+
+    /**
+     * Get global easyant-ivysettings file
+     * 
+     * @param project
+     * @return the configured global easyant-ivysettings.file
+     */
+    private String getGlobalEasyAntIvySettings(Project project) {
+        PropertyHelper helper = PropertyHelper.getPropertyHelper(project);
+        String path=null;
+        if (configuration.getEasyantIvySettingsFile() != null) {
+            File f = new File(helper.replaceProperties(configuration.getEasyantIvySettingsFile()));
+            try {
+                path = f.toURL().toExternalForm();
+            } catch (MalformedURLException e) {
+                throw new BuildException("Can't load easyant ivysettings file from "+ f.getAbsolutePath());
+            }
+        }
+        if (configuration.getEasyantIvySettingsUrl() != null) {
+            path = 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);
+        }
+        // if no property is set check the default location
+        if (path == null) {
+            path = helper.replaceProperties(
+                    EasyAntConstants.DEFAULT_GLOBAL_EASYANT_IVYSETTINGS);
+        }
+        project.log("global easyant-ivysettings file : " + path,
+                Project.MSG_DEBUG);
+        return path;
+    }
+
+    protected void configurePluginService(Project project,
+            Ivy easyantIvyInstance) {
+        pluginService = new DefaultPluginServiceImpl(easyantIvyInstance);
+        project.addReference(EasyAntMagicNames.PLUGIN_SERVICE_INSTANCE,
+                pluginService);
+
+    }
+
+    /**
+     * Adds the listeners specified in the command line arguments, along with
+     * the default listener, to the specified project.
+     * 
+     * @param project
+     *            The project to add listeners to. Must not be <code>null</code>
+     *            .
+     */
+    protected void addBuildListeners(Project project) {
+
+        // Add the default listener
+        project.addBuildListener(createLogger());
+
+        for (int i = 0; i < configuration.getListeners().size(); i++) {
+            String className = (String) configuration.getListeners().elementAt(
+                    i);
+            BuildListener listener = (BuildListener) ClasspathUtils
+                    .newInstance(className, EasyAntEngine.class
+                            .getClassLoader(), BuildListener.class);
+            project.setProjectReference(listener);
+
+            project.addBuildListener(listener);
+        }
+    }
+
+    /**
+     * Creates the InputHandler and adds it to the project.
+     * 
+     * @param project
+     *            the project instance.
+     * 
+     * @exception BuildException
+     *                if a specified InputHandler implementation could not be
+     *                loaded.
+     */
+    protected void addInputHandler(Project project) {
+        InputHandler handler = null;
+
+        if (configuration.getInputHandlerClassname() == null) {
+            handler = new DefaultInputHandler();
+        } else {
+            handler = (InputHandler) ClasspathUtils.newInstance(configuration
+                    .getInputHandlerClassname(), Main.class.getClassLoader(),
+                    InputHandler.class);
+            project.setProjectReference(handler);
+        }
+        project.setInputHandler(handler);
+    }
+
+    /**
+     * Creates the default build logger for sending build events to the ant log.
+     * 
+     * @return the logger instance for this build.
+     */
+    protected BuildLogger createLogger() {
+        BuildLogger logger = null;
+        if (configuration.getLoggerClassname() != null) {
+            try {
+                logger = (BuildLogger) ClasspathUtils.newInstance(configuration
+                        .getLoggerClassname(), EasyAntEngine.class
+                        .getClassLoader(), BuildLogger.class);
+            } catch (BuildException e) {
+                throw new RuntimeException("The specified logger class "
+                        + configuration.getLoggerClassname()
+                        + " could not be used because " + e.getMessage(), e);
+            }
+        } else {
+            logger = new DefaultEasyAntLogger();
+        }
+
+        logger.setMessageOutputLevel(configuration.getMsgOutputLevel());
+        logger.setOutputPrintStream(configuration.getOut());
+        logger.setErrorPrintStream(configuration.getErr());
+        logger.setEmacsMode(configuration.isEmacsMode());
+
+        return logger;
+    }
+
+    /**
+     * Search parent directories for the build file.
+     * <p>
+     * Takes the given target as a suffix to append to each parent directory in
+     * search of a build file. Once the root of the file-system has been reached
+     * an exception is thrown.
+     * 
+     * @param start
+     *            Leaf directory of search. Must not be <code>null</code>.
+     * @param suffix
+     *            Suffix filename to look for in parents. Must not be
+     *            <code>null</code>.
+     * 
+     * @return A handle to the build file if one is found
+     * 
+     * @exception BuildException
+     *                if no build file is found
+     */
+    protected File findBuildModule(String start, String suffix)
+            throws BuildException {
+        if (configuration.getMsgOutputLevel() >= Project.MSG_INFO) {
+            System.out.println("Searching for " + suffix + " ...");
+        }
+
+        File parent = new File(new File(start).getAbsolutePath());
+        File file = new File(parent, suffix);
+
+        // check if the target file exists in the current directory
+        while (!file.exists()) {
+            // change to parent directory
+            parent = parent.getParentFile();
+
+            // if parent is null, then we are at the root of the fs,
+            // complain that we can't find the build file.
+            if (parent == null) {
+                throw new BuildException("Could not locate a build file!");
+            }
+
+            // refresh our file handle
+            file = new File(parent, suffix);
+        }
+
+        return file;
+    }
+
+    /**
+     * configure a given project with current configuration
+     * 
+     * @param project
+     *            a given project
+     * @throws BuildException
+     */
+    public void configureProject(Project project) throws BuildException {
+
+        addBuildListeners(project);
+        addInputHandler(project);
+
+        // set the thread priorities
+        if (configuration.getThreadPriority() != null) {
+            try {
+                project.log("Setting Ant's thread priority to "
+                        + configuration.getThreadPriority(),
+                        Project.MSG_VERBOSE);
+                Thread.currentThread().setPriority(
+                        configuration.getThreadPriority().intValue());
+            } catch (SecurityException swallowed) {
+                // we cannot set the priority here.
+                project
+                        .log("A security manager refused to set the -nice value");
+            }
+        }
+
+        project.setKeepGoingMode(configuration.isKeepGoingMode());
+        if (configuration.isProxy()) {
+            // proxy setup if enabledcoreLoader
+            ProxySetup proxySetup = new ProxySetup(project);
+            proxySetup.enableProxies();
+        }
+
+        project.setName("EasyAnt");
+
+    }
+
+    /**
+     * Initialize an easyant Project
+     * 
+     * @param project
+     */
+    public void initProject(Project project) {
+        project.init();
+        // set user-define properties
+        Enumeration e = configuration.getDefinedProps().keys();
+        while (e.hasMoreElements()) {
+            String arg = (String) e.nextElement();
+            String value = (String) configuration.getDefinedProps().get(arg);
+            project.setUserProperty(arg, value);
         }
 
         project.setUserProperty(EasyAntMagicNames.EASYANT_OFFLINE, Boolean.toString(configuration.isOffline()));
 
-		File buildModule = configuration.getBuildModule();
-		File buildFile = configuration.getBuildFile();
+        File buildModule = configuration.getBuildModule();
+        File buildFile = configuration.getBuildFile();
+
+        if (buildModule == null) {
+            buildModule = new File(EasyAntConstants.DEFAULT_BUILD_MODULE);
+        }
 
-		if (buildModule == null) {
-			buildModule = new File(EasyAntConstants.DEFAULT_BUILD_MODULE);
-		}
-
-		if (!buildModule.exists() && configuration.isBuildModuleLookupEnabled()) {
-			buildModule = findBuildModule(System.getProperty("user.dir"),
-					buildModule.toString());
-		}
-
-		// calculate buildFile location based on buildModule directory
-		if (buildModule.exists() && buildFile == null) {
-			buildFile = new File(buildModule.getParentFile(),
-					EasyAntConstants.DEFAULT_BUILD_FILE);
-		}
-
-		if (buildFile == null && configuration.isBuildModuleLookupEnabled()) {
-			buildFile = findBuildModule(System.getProperty("user.dir"),
-					EasyAntConstants.DEFAULT_BUILD_FILE);
-		}
-
-		// Normalize buildFile for re-import detection
-		if (buildModule != null) {
-			buildModule = FileUtils.getFileUtils().normalize(
-					buildModule.getAbsolutePath());
-			project.setNewProperty(EasyAntMagicNames.EASYANT_FILE, buildModule
-					.getAbsolutePath());
-
-		}
-
-		if (buildFile != null) {
-			buildFile = FileUtils.getFileUtils().normalize(
-					buildFile.getAbsolutePath());
-			project.setNewProperty(MagicNames.ANT_FILE, buildFile
-					.getAbsolutePath());
-
-		}
-
-		configuration.setBuildFile(buildFile);
-		configuration.setBuildModule(buildModule);
-
-		// Emulate an empty project
-		// import task check that projectHelper is at toplevel by checking the
-		// size of projectHelper.getImportTask()
-		ProjectHelper helper = ProjectHelper.getProjectHelper();
-		File mainscript = null;
-		try {
-			mainscript = File.createTempFile(
-					EasyAntConstants.EASYANT_TASK_NAME, null);
-			mainscript.deleteOnExit();
-		} catch (IOException e1) {
-			throw new BuildException("Can't create temp file", e1);
-		}
-
-		Location mainscriptLocation = new Location(mainscript.toString());
-		helper.getImportStack().addElement(mainscript);
-		project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
-
-		// Used to emulate top level target
-		Target topLevel = new Target();
-		topLevel.setName("");
-
-		// Validate Phase is used by several system plugin so we should
-		// initialize it
-		Phase validatePhase = new Phase();
-		validatePhase.setName("validate");
-		validatePhase
-				.setDescription("validate the project is correct and all necessary information is available");
-		project.addTarget("validate", validatePhase);
-
-		Ivy easyantIvyInstance = configureEasyAntIvyInstance(project);
-		configurePluginService(project, easyantIvyInstance);
-
-		// Profile
-		if (configuration.getActiveBuildConfigurations().size() != 0) {
-			String buildConfigurations = null;
-			for (String conf : configuration.getActiveBuildConfigurations()) {
-				if (buildConfigurations == null) {
-					buildConfigurations = conf;
-				} else {
-					buildConfigurations = buildConfigurations + "," + conf;
-				}
-
-			}
-			project.log("Active build configurations : " + buildConfigurations,
-					Project.MSG_INFO);
-			project.setProperty(EasyAntMagicNames.ACTIVE_BUILD_CONFIGURATIONS,
-					buildConfigurations);
-		}
-
-		// Load system plugins
-		if (configuration.getSystemPlugins().size() > 0) {
-			project.log("Loading System Plugins...");
-		}
-		for (PluginDescriptor systemPlugin : configuration.getSystemPlugins()) {
-			// import/include system plugin
-			Import importTask = new Import();
-			importTask.setMrid(systemPlugin.getMrid());
-			importTask.setOrganisation(systemPlugin.getOrganisation());
-			importTask.setModule(systemPlugin.getModule());
-			importTask.setRevision(systemPlugin.getRevision());
-			importTask.setAs(systemPlugin.getAs());
-			importTask.setMode(systemPlugin.getMode());
-			importTask.setMandatory(systemPlugin.isMandatory());
-			importTask.setProject(project);
-			importTask.setTaskName(EasyAntConstants.EASYANT_TASK_NAME);
-			importTask.setOwningTarget(topLevel);
-			importTask.setLocation(mainscriptLocation);
-			importTask.execute();
-		}
-
-		if (configuration.getBuildModule() != null
-				|| configuration.getBuildFile() != null) {
-			LoadModule lm = new LoadModule();
-			lm.setBuildModule(configuration.getBuildModule());
-			lm.setBuildFile(configuration.getBuildFile());
-			lm.setTaskName(EasyAntConstants.EASYANT_TASK_NAME);
-			lm.setProject(project);
-			lm.setOwningTarget(topLevel);
-			lm.setLocation(mainscriptLocation);
-			lm.execute();
-		}
-	}
-
-	/**
-	 * this method run the build process
-	 * 
-	 * @throws BuildException
-	 */
-	public void doBuild() throws BuildException {
-		final Project project = new Project();
-		project.fireBuildStarted();
-
-		Throwable error = null;
-
-		try {
-
-			PrintStream savedErr = System.err;
-			PrintStream savedOut = System.out;
-			InputStream savedIn = System.in;
-
-			// use a system manager that prevents from System.exit()
-			SecurityManager oldsm = null;
-			oldsm = System.getSecurityManager();
-
-			// SecurityManager can not be installed here for backwards
-			// compatibility reasons (PD). Needs to be loaded prior to
-			// ant class if we are going to implement it.
-			// System.setSecurityManager(new NoExitSecurityManager());
-			try {
-				if (configuration.isAllowInput()) {
-					project.setDefaultInputStream(System.in);
-				}
-				System.setIn(new DemuxInputStream(project));
-				System.setOut(new PrintStream(new DemuxOutputStream(project,
-						false)));
-				System.setErr(new PrintStream(new DemuxOutputStream(project,
-						true)));
-				configureProject(project);
-				initProject(project);
-
-				// make sure that we have a target to execute
-				if (configuration.getTargets().size() == 0) {
-					if (project.getDefaultTarget() != null) {
-						configuration.getTargets().addElement(
-								project.getDefaultTarget());
-					}
-				}
-
-				project.executeTargets(configuration.getTargets());
-			} finally {
-				// put back the original security manager
-				// The following will never eval to true. (PD)
-				if (oldsm != null) {
-					System.setSecurityManager(oldsm);
-				}
-
-				System.setOut(savedOut);
-				System.setErr(savedErr);
-				System.setIn(savedIn);
-			}
-		} catch (RuntimeException exc) {
-			error = exc;
-			throw exc;
-		} catch (Error e) {
-			error = e;
-			throw e;
-		} finally {
-			try {
-				project.fireBuildFinished(error);
-			} catch (Throwable t) {
-				// yes, I know it is bad style to catch Throwable,
-				// but if we don't, we lose valuable information
-				System.err.println("Caught an exception while logging the"
-						+ " end of the build.  Exception was:");
-				t.printStackTrace();
-				if (error != null) {
-					System.err.println("There has been an error prior to"
-							+ " that:");
-					error.printStackTrace();
-				}
-				throw new BuildException(t);
-			}
-		}
-		if (configuration.isShowMemoryDetails()
-				|| configuration.getMsgOutputLevel() >= Project.MSG_VERBOSE) {
-			printMemoryDetails(project);
-		}
-
-	}
-
-	/**
-	 * This is a static method used to run build process
-	 * 
-	 * @param eaConfig
-	 *            an easyant configuration
-	 * @throws BuildException
-	 */
-	public static void runBuild(EasyAntConfiguration eaConfig)
-			throws BuildException {
-		EasyAntEngine eaEngine = new EasyAntEngine(eaConfig);
-		eaEngine.doBuild();
-	}
-
-	/**
-	 * This is a static method used to configure and initialize an existing
-	 * project
-	 * 
-	 * @param project
-	 *            a given project
-	 * @param eaConfiguration
-	 *            an easyant configuration
-	 * @return configured project
-	 * @throws BuildException
-	 */
-	public static Project configureAndInitProject(Project project,
-			EasyAntConfiguration eaConfiguration) throws BuildException {
-		EasyAntEngine eaEngine = new EasyAntEngine(eaConfiguration);
-		eaEngine.configureProject(project);
-		eaEngine.initProject(project);
-		return project;
-	}
-
-	/**
-	 * Print memory details
-	 * 
-	 * @param project
-	 *            a given project
-	 */
-	public static void printMemoryDetails(Project project) {
-		project.log("---- Memory Details ----");
-		project.log("  Used Memory  = "
-				+ (Runtime.getRuntime().totalMemory() / MEGABYTE - Runtime
-						.getRuntime().freeMemory()
-						/ MEGABYTE) + "MB");
-		project.log("  Free Memory  = "
-				+ (Runtime.getRuntime().freeMemory() / MEGABYTE) + "MB");
-		project.log("  Total Memory = "
-				+ (Runtime.getRuntime().totalMemory() / MEGABYTE) + "MB");
-		project.log("-----------------------");
-	}
-
-	/**
-	 * Return the configured plugin service instance
-	 * 
-	 * @return the configured plugin service instance
-	 */
-	public PluginService getPluginService() {
-		// hack for IDE integration
-		if (pluginService == null) {
-			Project project = new Project();
-			project.setCoreLoader(configuration.getCoreLoader());
-			Enumeration<?> e = configuration.getDefinedProps().keys();
-			while (e.hasMoreElements()) {
-				String arg = (String) e.nextElement();
-				String value = (String) configuration.getDefinedProps()
-						.get(arg);
-				project.setUserProperty(arg, value);
-			}
-			project.setName("EasyAnt");
-			// not sure we need to invoke init here
-			project.init();
-			Ivy ivy = configureEasyAntIvyInstance(project);
-			configurePluginService(project, ivy);
-		}
-		return pluginService;
-	}
-
-	/**
-	 * Cache of the EasyAnt version information when it has been loaded.
-	 */
-	private static String easyantVersion = null;
-
-	/**
-	 * Returns the EasyAnt version information, if available. Once the
-	 * information has been loaded once, it's cached and returned from the cache
-	 * on future calls.
-	 * 
-	 * @return the Ant version information as a String (always non-
-	 *         <code>null</code>)
-	 * 
-	 * @exception BuildException
-	 *                if the version information is unavailable
-	 */
-	public static String getEasyAntVersion() {
-
-		if (easyantVersion == null) {
-			try {
-				Properties props = new Properties();
-				InputStream in = Main.class
-						.getResourceAsStream("/META-INF/version.properties");
-				props.load(in);
-				in.close();
-
-				StringBuffer msg = new StringBuffer();
-				msg.append("EasyAnt version ");
-				msg.append(props.getProperty("VERSION"));
-				msg.append(" compiled on ");
-				msg.append(props.getProperty("DATE"));
-				easyantVersion = msg.toString();
-			} catch (IOException ioe) {
-				throw new BuildException(
-						"Could not load the version information:"
-								+ ioe.getMessage());
-			} catch (NullPointerException npe) {
-				throw new BuildException(
-						"Could not load the version information.");
-			}
-		}
-		return easyantVersion;
-	}
+        if (!buildModule.exists() && configuration.isBuildModuleLookupEnabled()) {
+            buildModule = findBuildModule(System.getProperty("user.dir"),
+                    buildModule.toString());
+        }
+
+        // calculate buildFile location based on buildModule directory
+        if (buildModule.exists() && buildFile == null) {
+            buildFile = new File(buildModule.getParentFile(),
+                    EasyAntConstants.DEFAULT_BUILD_FILE);
+        }
+
+        if (buildFile == null && configuration.isBuildModuleLookupEnabled()) {
+            buildFile = findBuildModule(System.getProperty("user.dir"),
+                    EasyAntConstants.DEFAULT_BUILD_FILE);
+        }
+
+        // Normalize buildFile for re-import detection
+        if (buildModule != null) {
+            buildModule = FileUtils.getFileUtils().normalize(
+                    buildModule.getAbsolutePath());
+            project.setNewProperty(EasyAntMagicNames.EASYANT_FILE, buildModule
+                    .getAbsolutePath());
+
+        }
+
+        if (buildFile != null) {
+            buildFile = FileUtils.getFileUtils().normalize(
+                    buildFile.getAbsolutePath());
+            project.setNewProperty(MagicNames.ANT_FILE, buildFile
+                    .getAbsolutePath());
+
+        }
+
+        configuration.setBuildFile(buildFile);
+        configuration.setBuildModule(buildModule);
+
+        // Emulate an empty project
+        // import task check that projectHelper is at toplevel by checking the
+        // size of projectHelper.getImportTask()
+        ProjectHelper helper = ProjectHelper.getProjectHelper();
+        File mainscript = null;
+        try {
+            mainscript = File.createTempFile(
+                    EasyAntConstants.EASYANT_TASK_NAME, null);
+            mainscript.deleteOnExit();
+        } catch (IOException e1) {
+            throw new BuildException("Can't create temp file", e1);
+        }
+
+        Location mainscriptLocation = new Location(mainscript.toString());
+        helper.getImportStack().addElement(mainscript);
+        project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
+
+        // Used to emulate top level target
+        Target topLevel = new Target();
+        topLevel.setName("");
+
+        // Validate Phase is used by several system plugin so we should
+        // initialize it
+        Phase validatePhase = new Phase();
+        validatePhase.setName("validate");
+        validatePhase
+                .setDescription("validate the project is correct and all necessary information is available");
+        project.addTarget("validate", validatePhase);
+
+        Ivy easyantIvyInstance = configureEasyAntIvyInstance(project);
+        configurePluginService(project, easyantIvyInstance);
+
+        // Profile
+        if (configuration.getActiveBuildConfigurations().size() != 0) {
+            String buildConfigurations = null;
+            for (String conf : configuration.getActiveBuildConfigurations()) {
+                if (buildConfigurations == null) {
+                    buildConfigurations = conf;
+                } else {
+                    buildConfigurations = buildConfigurations + "," + conf;
+                }
+
+            }
+            project.log("Active build configurations : " + buildConfigurations,
+                    Project.MSG_INFO);
+            project.setProperty(EasyAntMagicNames.ACTIVE_BUILD_CONFIGURATIONS,
+                    buildConfigurations);
+        }
+
+        // Load system plugins
+        if (configuration.getSystemPlugins().size() > 0) {
+            project.log("Loading System Plugins...");
+        }
+        for (PluginDescriptor systemPlugin : configuration.getSystemPlugins()) {
+            // import/include system plugin
+            Import importTask = new Import();
+            importTask.setMrid(systemPlugin.getMrid());
+            importTask.setOrganisation(systemPlugin.getOrganisation());
+            importTask.setModule(systemPlugin.getModule());
+            importTask.setRevision(systemPlugin.getRevision());
+            importTask.setAs(systemPlugin.getAs());
+            importTask.setMode(systemPlugin.getMode());
+            importTask.setMandatory(systemPlugin.isMandatory());
+            importTask.setProject(project);
+            importTask.setTaskName(EasyAntConstants.EASYANT_TASK_NAME);
+            importTask.setOwningTarget(topLevel);
+            importTask.setLocation(mainscriptLocation);
+            importTask.execute();
+        }
+
+        if (configuration.getBuildModule() != null
+                || configuration.getBuildFile() != null) {
+            LoadModule lm = new LoadModule();
+            lm.setBuildModule(configuration.getBuildModule());
+            lm.setBuildFile(configuration.getBuildFile());
+            lm.setTaskName(EasyAntConstants.EASYANT_TASK_NAME);
+            lm.setProject(project);
+            lm.setOwningTarget(topLevel);
+            lm.setLocation(mainscriptLocation);
+            lm.execute();
+        }
+    }
+
+    /**
+     * this method run the build process
+     * 
+     * @throws BuildException
+     */
+    public void doBuild() throws BuildException {
+        final Project project = new Project();
+        project.fireBuildStarted();
+
+        Throwable error = null;
+
+        try {
+
+            PrintStream savedErr = System.err;
+            PrintStream savedOut = System.out;
+            InputStream savedIn = System.in;
+
+            // use a system manager that prevents from System.exit()
+            SecurityManager oldsm = null;
+            oldsm = System.getSecurityManager();
+
+            // SecurityManager can not be installed here for backwards
+            // compatibility reasons (PD). Needs to be loaded prior to
+            // ant class if we are going to implement it.
+            // System.setSecurityManager(new NoExitSecurityManager());
+            try {
+                if (configuration.isAllowInput()) {
+                    project.setDefaultInputStream(System.in);
+                }
+                System.setIn(new DemuxInputStream(project));
+                System.setOut(new PrintStream(new DemuxOutputStream(project,
+                        false)));
+                System.setErr(new PrintStream(new DemuxOutputStream(project,
+                        true)));
+                configureProject(project);
+                initProject(project);
+
+                // make sure that we have a target to execute
+                if (configuration.getTargets().size() == 0) {
+                    if (project.getDefaultTarget() != null) {
+                        configuration.getTargets().addElement(
+                                project.getDefaultTarget());
+                    }
+                }
+
+                project.executeTargets(configuration.getTargets());
+            } finally {
+                // put back the original security manager
+                // The following will never eval to true. (PD)
+                if (oldsm != null) {
+                    System.setSecurityManager(oldsm);
+                }
+
+                System.setOut(savedOut);
+                System.setErr(savedErr);
+                System.setIn(savedIn);
+            }
+        } catch (RuntimeException exc) {
+            error = exc;
+            throw exc;
+        } catch (Error e) {
+            error = e;
+            throw e;
+        } finally {
+            try {
+                project.fireBuildFinished(error);
+            } catch (Throwable t) {
+                // yes, I know it is bad style to catch Throwable,
+                // but if we don't, we lose valuable information
+                System.err.println("Caught an exception while logging the"
+                        + " end of the build.  Exception was:");
+                t.printStackTrace();
+                if (error != null) {
+                    System.err.println("There has been an error prior to"
+                            + " that:");
+                    error.printStackTrace();
+                }
+                throw new BuildException(t);
+            }
+        }
+        if (configuration.isShowMemoryDetails()
+                || configuration.getMsgOutputLevel() >= Project.MSG_VERBOSE) {
+            printMemoryDetails(project);
+        }
+
+    }
+
+    /**
+     * This is a static method used to run build process
+     * 
+     * @param eaConfig
+     *            an easyant configuration
+     * @throws BuildException
+     */
+    public static void runBuild(EasyAntConfiguration eaConfig)
+            throws BuildException {
+        EasyAntEngine eaEngine = new EasyAntEngine(eaConfig);
+        eaEngine.doBuild();
+    }
+
+    /**
+     * This is a static method used to configure and initialize an existing
+     * project
+     * 
+     * @param project
+     *            a given project
+     * @param eaConfiguration
+     *            an easyant configuration
+     * @return configured project
+     * @throws BuildException
+     */
+    public static Project configureAndInitProject(Project project,
+            EasyAntConfiguration eaConfiguration) throws BuildException {
+        EasyAntEngine eaEngine = new EasyAntEngine(eaConfiguration);
+        eaEngine.configureProject(project);
+        eaEngine.initProject(project);
+        return project;
+    }
+
+    /**
+     * Print memory details
+     * 
+     * @param project
+     *            a given project
+     */
+    public static void printMemoryDetails(Project project) {
+        project.log("---- Memory Details ----");
+        project.log("  Used Memory  = "
+                + (Runtime.getRuntime().totalMemory() / MEGABYTE - Runtime
+                        .getRuntime().freeMemory()
+                        / MEGABYTE) + "MB");
+        project.log("  Free Memory  = "
+                + (Runtime.getRuntime().freeMemory() / MEGABYTE) + "MB");
+        project.log("  Total Memory = "
+                + (Runtime.getRuntime().totalMemory() / MEGABYTE) + "MB");
+        project.log("-----------------------");
+    }
+
+    /**
+     * Return the configured plugin service instance
+     * 
+     * @return the configured plugin service instance
+     */
+    public PluginService getPluginService() {
+        // hack for IDE integration
+        if (pluginService == null) {
+            Project project = new Project();
+            project.setCoreLoader(configuration.getCoreLoader());
+            Enumeration<?> e = configuration.getDefinedProps().keys();
+            while (e.hasMoreElements()) {
+                String arg = (String) e.nextElement();
+                String value = (String) configuration.getDefinedProps()
+                        .get(arg);
+                project.setUserProperty(arg, value);
+            }
+            project.setName("EasyAnt");
+            // not sure we need to invoke init here
+            project.init();
+            Ivy ivy = configureEasyAntIvyInstance(project);
+            configurePluginService(project, ivy);
+        }
+        return pluginService;
+    }
+
+    /**
+     * Cache of the EasyAnt version information when it has been loaded.
+     */
+    private static String easyantVersion = null;
+
+    /**
+     * Returns the EasyAnt version information, if available. Once the
+     * information has been loaded once, it's cached and returned from the cache
+     * on future calls.
+     * 
+     * @return the Ant version information as a String (always non-
+     *         <code>null</code>)
+     * 
+     * @exception BuildException
+     *                if the version information is unavailable
+     */
+    public static String getEasyAntVersion() {
+
+        if (easyantVersion == null) {
+            try {
+                Properties props = new Properties();
+                InputStream in = Main.class
+                        .getResourceAsStream("/META-INF/version.properties");
+                props.load(in);
+                in.close();
+
+                StringBuffer msg = new StringBuffer();
+                msg.append("EasyAnt version ");
+                msg.append(props.getProperty("VERSION"));
+                msg.append(" compiled on ");
+                msg.append(props.getProperty("DATE"));
+                easyantVersion = msg.toString();
+            } catch (IOException ioe) {
+                throw new BuildException(
+                        "Could not load the version information:"
+                                + ioe.getMessage());
+            } catch (NullPointerException npe) {
+                throw new BuildException(
+                        "Could not load the version information.");
+            }
+        }
+        return easyantVersion;
+    }
 
 }



Mime
View raw message