Author: jlboudart
Date: Tue Aug 20 08:33:42 2013
New Revision: 1515740
URL: http://svn.apache.org/r1515740
Log:
Cleaning code
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ivy/IvyInstanceHelper.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureBuildScopedRepository.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/RegisterArtifact.java
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SearchModule.java
ant/easyant/core/trunk/src/main/java/org/apache/ivy/ant/EasyAntPluginBridge.java
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/BuildConfigurationHelper.java
Tue Aug 20 08:33:42 2013
@@ -28,43 +28,41 @@ import org.apache.tools.ant.Project;
*/
public class BuildConfigurationHelper {
+ private BuildConfigurationHelper() {
+ }
+
/**
- * This methods verify if at least one build configuration given in
- * arguments is contained in buildConfContainer.
+ * 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)
+ * 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.
+ * 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));
+ return (null != getFirstBuildConfigurationMatching(buildConfs,
buildConfContainer));
}
/**
- * This methods return the first build configuration matching with the
- * criteria given in buildConfs argument.
+ * 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)
+ * 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.
+ * 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) {
+ public static String getFirstBuildConfigurationMatching(String buildConfs,
String buildConfContainer) {
if (buildConfs == null || buildConfContainer == null) {
return null;
}
@@ -84,8 +82,7 @@ public class BuildConfigurationHelper {
*
* @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.
+ * @return a string that represent a list of conf separated by comma
without spaces.
*/
public static String removeSpaces(String confs) {
return confs.replaceAll("\\s", "");
@@ -102,17 +99,15 @@ public class BuildConfigurationHelper {
* @param requestedConfigurations
* build configuration to check
* @param p
- * the project (used to retrieve available and active build
- * configuration)
+ * 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
+ * @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) {
+ 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);
+ p.log(message + " not bound to any build configuration",
Project.MSG_DEBUG);
return true;
}
List<String> buildConfigurationsList =
buildList(requestedConfigurations);
@@ -120,46 +115,36 @@ public class BuildConfigurationHelper {
// 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");
+ throw new BuildException("there is no available build
configuration");
}
- List<String> availableBuildConfigurations = Arrays.asList(p
- .getProperty(EasyAntMagicNames.AVAILABLE_BUILD_CONFIGURATIONS)
- .split(","));
+ 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);
+ 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));
+ String buildConf =
getFirstBuildConfigurationMatching(requestedConfigurations,
+ p.getProperty(EasyAntMagicNames.MAIN_CONFS));
if (buildConf != null) {
- p.log(message + " bound to build configuration " + buildConf,
- Project.MSG_DEBUG);
+ 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);
+ 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);
+ p.log("there is no activated build configuration",
Project.MSG_DEBUG);
return false;
}
}
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
Tue Aug 20 08:33:42 2013
@@ -100,8 +100,9 @@ public class EasyAntEngine {
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_DEFAULT_IVYSETTINGS,
+
this.getClass().getResource("/org/apache/easyant/core/default-easyant-ivysettings.xml")
+ .toExternalForm());
project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_JAR_URL,
guessEasyantCoreJarUrl().toExternalForm());
@@ -228,8 +229,8 @@ public class EasyAntEngine {
}
// if no property is set check the default location
if (path == null) {
- File defaultGlboalEasyAntIvySettings = new File(helper
-
.replaceProperties(EasyAntConstants.DEFAULT_GLOBAL_EASYANT_IVYSETTINGS));
+ File defaultGlboalEasyAntIvySettings = new File(
+
helper.replaceProperties(EasyAntConstants.DEFAULT_GLOBAL_EASYANT_IVYSETTINGS));
if (!defaultGlboalEasyAntIvySettings.exists()) {
return null;
}
@@ -259,8 +260,8 @@ public class EasyAntEngine {
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);
+ BuildListener listener = (BuildListener)
ClasspathUtils.newInstance(className,
+ EasyAntEngine.class.getClassLoader(), BuildListener.class);
project.setProjectReference(listener);
project.addBuildListener(listener);
@@ -282,8 +283,8 @@ public class EasyAntEngine {
if (configuration.getInputHandlerClassname() == null) {
handler = new DefaultInputHandler();
} else {
- handler = (InputHandler)
ClasspathUtils.newInstance(configuration.getInputHandlerClassname(), Main.class
- .getClassLoader(), InputHandler.class);
+ handler = (InputHandler)
ClasspathUtils.newInstance(configuration.getInputHandlerClassname(),
+ Main.class.getClassLoader(), InputHandler.class);
project.setProjectReference(handler);
}
project.setInputHandler(handler);
@@ -367,6 +368,8 @@ public class EasyAntEngine {
*/
public void configureProject(Project project) throws BuildException {
+ project.setCoreLoader(configuration.getCoreLoader());
+
addBuildListeners(project);
addInputHandler(project);
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
Tue Aug 20 08:33:42 2013
@@ -166,7 +166,7 @@ public class EasyAntMain implements AntM
int exitCode = 1;
try {
try {
- runBuild(line, coreLoader);
+ runBuild(line);
exitCode = 0;
} catch (ExitStatusException ese) {
exitCode = ese.getStatus();
@@ -244,7 +244,7 @@ public class EasyAntMain implements AntM
return;
}
if (easyAntConfiguration.getMsgOutputLevel() >= Project.MSG_VERBOSE ||
line.hasOption("version")) {
- printVersion(easyAntConfiguration.getMsgOutputLevel());
+ printVersion();
if (line.hasOption("version")) {
return;
}
@@ -293,7 +293,7 @@ public class EasyAntMain implements AntM
if (line.hasOption("buildconf")) {
easyAntConfiguration.getActiveBuildConfigurations().add(line.getOptionValue("buildconf"));
}
-
+
File easyantConfFile = null;
if (line.hasOption("configfile")) {
@@ -318,7 +318,7 @@ public class EasyAntMain implements AntM
throw new BuildException(e);
}
}
-
+
if (line.hasOption("listener")) {
easyAntConfiguration.getListeners().addElement(line.getOptionValue("listener"));
}
@@ -428,14 +428,10 @@ public class EasyAntMain implements AntM
* Executes the build. If the constructor for this instance failed (e.g.
returned after issuing a warning), this
* method returns immediately.
*
- * @param coreLoader
- * The classloader to use to find core classes. May be
<code>null</code>, in which case the system
- * classloader is used.
- *
* @exception BuildException
* if the build fails
*/
- private void runBuild(CommandLine line, ClassLoader coreLoader) throws
BuildException {
+ private void runBuild(CommandLine line) throws BuildException {
if (!readyToRun) {
return;
}
@@ -522,7 +518,7 @@ public class EasyAntMain implements AntM
spaces += spaces;
}
StringBuffer msg = new StringBuffer();
- msg.append(lSep + heading + lSep + lSep);
+ msg.append(lSep).append(heading).append(lSep).append(lSep);
for (int i = 0; i < names.size(); i++) {
msg.append(" ");
msg.append(names.get(i));
@@ -716,7 +712,7 @@ public class EasyAntMain implements AntM
* @exception BuildException
* if the version information is unavailable
*/
- private static void printVersion(int logLevel) throws BuildException {
+ private static void printVersion() throws BuildException {
System.out.println(EasyAntEngine.getEasyAntVersion());
System.out.println(getAntVersion());
}
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
Tue Aug 20 08:33:42 2013
@@ -39,6 +39,9 @@ import org.apache.tools.ant.Target;
*/
public class ProjectUtils {
+ private ProjectUtils() {
+ }
+
private static final long MEGABYTE = 1024 * 1024;
/**
@@ -119,10 +122,8 @@ public class ProjectUtils {
*/
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(" 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("-----------------------");
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ivy/IvyInstanceHelper.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ivy/IvyInstanceHelper.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ivy/IvyInstanceHelper.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ivy/IvyInstanceHelper.java
Tue Aug 20 08:33:42 2013
@@ -24,14 +24,18 @@ import org.apache.tools.ant.types.Refere
/**
* Helper providing methods to play with both project and easyant ivy instances
- *
+ *
*/
public class IvyInstanceHelper {
-
+ private IvyInstanceHelper() {
+ }
/**
- * Get the project ivy instance name. This methods takes in consideration
that project ivy instance name can be set through "project.ivy.instance"
property
- * @param project a project instance
+ * Get the project ivy instance name. This methods takes in consideration
that project ivy instance name can be set
+ * through "project.ivy.instance" property
+ *
+ * @param project
+ * a project instance
* @return the project ivy instance name
*/
public static String getProjectIvyInstanceName(Project project) {
@@ -43,61 +47,75 @@ public class IvyInstanceHelper {
}
/**
- * Build a project ivy reference.
- * @param project a project instance
+ * Build a project ivy reference.
+ *
+ * @param project
+ * a project instance
* @return a project ivy refrence
*/
public static Reference buildProjectIvyReference(Project project) {
- return buildIvyReference(project,getProjectIvyInstanceName(project));
+ return buildIvyReference(project, getProjectIvyInstanceName(project));
}
-
+
/**
* Build an easyant ivy reference
- * @param project a project instance
+ *
+ * @param project
+ * a project instance
* @return an easyant ivy reference
*/
public static Reference buildEasyAntIvyReference(Project project) {
- return
buildIvyReference(project,EasyAntMagicNames.EASYANT_IVY_INSTANCE);
+ return buildIvyReference(project,
EasyAntMagicNames.EASYANT_IVY_INSTANCE);
}
-
+
/**
- * Build an ivy instance reference based on a given instance name
- * @param project a project instance
- * @param instanceName an instance name
+ * Build an ivy instance reference based on a given instance name
+ *
+ * @param project
+ * a project instance
+ * @param instanceName
+ * an instance name
* @return an ivy instance reference
*/
- public static Reference buildIvyReference (Project project,String
instanceName) {
+ public static Reference buildIvyReference(Project project, String
instanceName) {
return new Reference(project, instanceName);
}
-
+
/**
* Get project {@link IvyAntSettings}
- * @param project a project instance
+ *
+ * @param project
+ * a project instance
* @return the project {@link IvyAntSettings}
*/
public static IvyAntSettings getProjectIvyAntSettings(Project project) {
return getIvyAntSettings(project, getProjectIvyInstanceName(project));
}
-
+
/**
* Get easyant {@link IvyAntSettings}
- * @param project a project instance
+ *
+ * @param project
+ * a project instance
* @return the easyant {@link IvyAntSettings}
*/
public static IvyAntSettings getEasyAntIvyAntSettings(Project project) {
return getIvyAntSettings(project,
EasyAntMagicNames.EASYANT_IVY_INSTANCE);
}
-
+
/**
* Get an {@link IvyAntSettings} based on instance name
- * @param project a project instance
- * @param instanceName an {@link IvyAntSettings} name
+ *
+ * @param project
+ * a project instance
+ * @param instanceName
+ * an {@link IvyAntSettings} name
* @return the requested {@link IvyAntSettings}
*/
public static IvyAntSettings getIvyAntSettings(Project project, String
instanceName) {
Object o = project.getReference(instanceName);
- if (o != null && o instanceof IvyAntSettings) {
- return (IvyAntSettings)o;
+ if (o instanceof IvyAntSettings) {
+ return (IvyAntSettings) o;
} else {
throw new IllegalStateException(instanceName + " is not a valid
ivy instance");
}
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/report/XMLEasyAntReportWriter.java
Tue Aug 20 08:33:42 2013
@@ -122,7 +122,7 @@ public class XMLEasyAntReportWriter {
+ XMLHelper.escape(mid.getName()) + "\">");
for (Iterator<?> it2 = report.getNodes(mid).iterator();
it2.hasNext();) {
IvyNode dep = (IvyNode) it2.next();
- ouputRevision(report, out, dependencies, dep, easyAntReport);
+ ouputRevision(report, out, dependencies, dep);
}
out.println("\t\t</module>");
}
@@ -133,8 +133,7 @@ public class XMLEasyAntReportWriter {
out.flush();
}
- private void ouputRevision(ConfigurationResolveReport report, PrintWriter
out, List<?> dependencies, IvyNode dep,
- EasyAntReport easyAntReport) {
+ private void ouputRevision(ConfigurationResolveReport report, PrintWriter
out, List<?> dependencies, IvyNode dep) {
Map<?, ?> extraAttributes;
ModuleDescriptor md = null;
if (dep.getModuleRevision() != null) {
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
Tue Aug 20 08:33:42 2013
@@ -323,7 +323,7 @@ public class DefaultPluginServiceImpl im
throw new IllegalStateException(
"rootModuleLocation not found, looks like
TaskCollectorFromImplicitTargetListener is not properly configured");
}
- return rootModuleLocation != null && location != null &&
location.getFileName().equals(rootModuleLocation);
+ return location != null &&
location.getFileName().equals(rootModuleLocation);
}
private void handleImport(Import importTask, EasyAntReport eaReport,
String conf) throws Exception {
@@ -690,8 +690,7 @@ public class DefaultPluginServiceImpl im
mrid = EasyAntConstants.EASYANT_PLUGIN_ORGANISATION + "#" +
mrid;
}
}
- ModuleRevisionId module = ModuleRevisionId.parse(mrid);
- return module;
+ return ModuleRevisionId.parse(mrid);
}
public EasyAntReport generateEasyAntReport(File moduleDescriptor) throws
Exception {
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureBuildScopedRepository.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureBuildScopedRepository.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureBuildScopedRepository.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/ConfigureBuildScopedRepository.java
Tue Aug 20 08:33:42 2013
@@ -47,16 +47,16 @@ public class ConfigureBuildScopedReposit
@Override
public void doExecute() throws BuildException {
- String target = getTarget();
+ String targetDirectory = getTarget();
// be sure that we have an absolute path
- File targetDir = new File(target);
- target = targetDir.getAbsolutePath();
+ File targetDir = new File(targetDirectory);
+ targetDirectory = targetDir.getAbsolutePath();
String buildScopeRepositoryName = getName();
- final String DEFAULT_BUILD_SCOPED_REPOSITORY_DIR = target +
"/repository/" + buildScopeRepositoryName;
- final String DEFAULT_CACHE_BUILD_SCOPED_REPO = target + "/cache/" +
buildScopeRepositoryName;
+ final String DEFAULT_BUILD_SCOPED_REPOSITORY_DIR = targetDirectory +
"/repository/" + buildScopeRepositoryName;
+ final String DEFAULT_CACHE_BUILD_SCOPED_REPO = targetDirectory +
"/cache/" + buildScopeRepositoryName;
getProject().log("Registering build scoped repository in " +
DEFAULT_BUILD_SCOPED_REPOSITORY_DIR,
Project.MSG_DEBUG);
final String CACHENAME = "build-scoped-cache-" +
buildScopeRepositoryName;
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/LoadModule.java
Tue Aug 20 08:33:42 2013
@@ -37,7 +37,6 @@ import org.apache.easyant.core.ivy.Inher
import org.apache.easyant.core.ivy.IvyInstanceHelper;
import org.apache.easyant.core.parser.DefaultEasyAntXmlModuleDescriptorParser;
import org.apache.easyant.core.parser.EasyAntModuleDescriptorParser;
-import org.apache.ivy.ant.IvyAntSettings;
import org.apache.ivy.ant.IvyConfigure;
import org.apache.ivy.ant.IvyDependency;
import org.apache.ivy.ant.IvyInfo;
@@ -156,7 +155,7 @@ public class LoadModule extends Abstract
configureProjectOfflineResolver();
if (shouldUseBuildRepository()) {
-
configureBuildRepository(IvyInstanceHelper.getProjectIvyAntSettings(getProject()));
+ configureBuildRepository();
}
if (getProject().getDefaultTarget() == null
@@ -513,7 +512,7 @@ public class LoadModule extends Abstract
* Change the given Ivy settings to use a local build-scoped repository
and cache by default. This allows submodules
* to access each others' artifacts before they have been published to a
shared repository.
*/
- private void configureBuildRepository(IvyAntSettings projectSettings)
throws BuildException {
+ private void configureBuildRepository() throws BuildException {
ConfigureBuildScopedRepository configureBuildScopedRepository = new
ConfigureBuildScopedRepository();
configureBuildScopedRepository.setName(EasyAntConstants.BUILD_SCOPE_REPOSITORY);
configureBuildScopedRepository.setSettingsRef(IvyInstanceHelper.buildProjectIvyReference(getProject()));
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/RegisterArtifact.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/RegisterArtifact.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/RegisterArtifact.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/RegisterArtifact.java
Tue Aug 20 08:33:42 2013
@@ -46,16 +46,16 @@ public class RegisterArtifact extends Iv
// this is a published artifact
String artName = getSettings().substitute(getName());
artName = artName == null ? md.getModuleRevisionId().getName() :
artName;
- String type = getSettings().substitute(getType());
- type = type == null ? "jar" : type;
- String ext = getSettings().substitute(getExt());
- ext = ext != null ? ext : type;
+ String artType = getSettings().substitute(getType());
+ artType = artType == null ? "jar" : artType;
+ String artExt = getSettings().substitute(getExt());
+ artExt = artExt != null ? artExt : artType;
Map<String, String> extraAttributes = new HashMap<String, String>();
if (getClassifier() != null) {
md.addExtraAttributeNamespace("m",
"http://ant.apache.org/ivy/maven");
extraAttributes.put("m:classifier", getClassifier());
}
- MDArtifact artifact = new MDArtifact(md, artName, type, ext, null,
extraAttributes);
+ MDArtifact artifact = new MDArtifact(md, artName, artType, artExt,
null, extraAttributes);
String[] configurations = getConfs().split(",");
for (int i = 0; i < configurations.length; i++) {
if ("*".equals(configurations[i])) {
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SearchModule.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SearchModule.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SearchModule.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SearchModule.java
Tue Aug 20 08:33:42 2013
@@ -35,172 +35,159 @@ import org.apache.tools.ant.input.Multip
public class SearchModule extends IvyTask {
- private String organisation;
+ private String organisation;
- private String module;
+ private String module;
- private String branch = PatternMatcher.ANY_EXPRESSION;
+ private String branch = PatternMatcher.ANY_EXPRESSION;
- private String revision;
+ private String revision;
- private String matcher = PatternMatcher.EXACT_OR_REGEXP;
-
- private String propertyPrefix;
- private String resolver;
-
- public void doExecute() throws BuildException {
- if (getOrganisation() == null) {
- throw new BuildException(
- "no organisation provided for
SearchModule task");
- }
- if (getModule() == null) {
- throw new BuildException(
- "no module name provided for
SearchModule task");
- }
- if (getRevision() == null) {
- throw new BuildException(
- "no revision provided for SearchModule
task");
- }
-
- if (getPropertyPrefix() == null) {
- throw new BuildException(
- "no property prefix provided provided
for SearchModule task");
- }
- Ivy ivy = getIvyInstance();
- IvySettings settings = ivy.getSettings();
-
- // search all modules revision matching the requested criteria
- DependencyResolver resolverToCheck;
- if (getResolver() != null) {
- resolverToCheck = settings.getResolver(getResolver());
- } else {
- resolverToCheck = settings.getDefaultResolver();
- }
- ModuleRevisionId mridToSearch = ModuleRevisionId.newInstance(
- getOrganisation(), getModule(), getBranch(),
getRevision());
- ModuleRevisionId[] mrids = ivy.getSearchEngine().listModules(
- resolverToCheck, mridToSearch,
settings.getMatcher(matcher));
-
- // diplay the list
- Vector<String> choices = new Vector<String>();
- for (int i = 0; i < mrids.length; i++) {
- ResolvedModuleRevision rmr = ivy.findModule(mrids[i]);
- if (rmr == null) {
- log("Can't retrieve " +
mrids[i].toString(),Project.MSG_WARN);
- } else {
-
- choices.add(String.valueOf(i));
- StringBuilder sb = new StringBuilder();
- sb.append(i).append(": ");
- sb.append(mrids[i].getName());
- sb.append(" v").append(mrids[i].getRevision());
- // hide organization if its the default one
- if
(!EasyAntConstants.EASYANT_SKELETONS_ORGANISATION
-
.equals(mrids[i].getOrganisation())) {
- sb.append(" by
").append(mrids[i].getOrganisation());
- }
- // Get the description
- if (rmr.getDescriptor().getDescription() != null
- &&
!rmr.getDescriptor().getDescription().equals("")) {
- sb.append(" (")
-
.append(rmr.getDescriptor().getDescription())
- .append(")");
- }
- log(sb.toString());
- }
- }
- if (choices.size() == 0) {
- throw new BuildException("No matching module were found
!");
- }
-
- // ask end user to select a module
- // TODO handle a default value
- Integer value = new Integer(getInput("Choose a number:", null,
choices));
- ModuleRevisionId moduleToRetrieve = mrids[value];
-
- // set final properties
- getProject().setProperty(getPropertyPrefix() + ".org",
- moduleToRetrieve.getOrganisation());
- getProject().setProperty(getPropertyPrefix() + ".module",
- moduleToRetrieve.getName());
- getProject().setProperty(getPropertyPrefix() + ".rev",
- moduleToRetrieve.getRevision());
-
- }
-
- protected String getInput(String message, String defaultvalue,
- Vector<String> choices) {
- InputRequest request = null;
- request = new MultipleChoiceInputRequest(message, choices);
- request.setDefaultValue(defaultvalue);
-
- InputHandler h = getProject().getInputHandler();
-
- h.handleInput(request);
-
- String value = request.getInput();
- if ((value == null || value.trim().length() == 0)
- && defaultvalue != null) {
- value = defaultvalue;
- }
- return value;
-
- }
-
- public String getMatcher() {
- return matcher;
- }
-
- public void setMatcher(String matcher) {
- this.matcher = matcher;
- }
-
- public String getModule() {
- return module;
- }
-
- public void setModule(String module) {
- this.module = module;
- }
-
- public String getOrganisation() {
- return organisation;
- }
-
- public void setOrganisation(String organisation) {
- this.organisation = organisation;
- }
-
- public String getRevision() {
- return revision;
- }
-
- public void setRevision(String revision) {
- this.revision = revision;
- }
-
- public String getBranch() {
- return branch;
- }
-
- public void setBranch(String branch) {
- this.branch = branch;
- }
-
- public String getPropertyPrefix() {
- return propertyPrefix;
- }
-
- public void setPropertyPrefix(String propertyPrefix) {
- this.propertyPrefix = propertyPrefix;
- }
-
- public String getResolver() {
- return resolver;
- }
-
- public void setResolver(String resolver) {
- this.resolver = resolver;
- }
+ private String matcher = PatternMatcher.EXACT_OR_REGEXP;
+
+ private String propertyPrefix;
+ private String resolver;
+
+ public void doExecute() throws BuildException {
+ if (getOrganisation() == null) {
+ throw new BuildException("no organisation provided for
SearchModule task");
+ }
+ if (getModule() == null) {
+ throw new BuildException("no module name provided for SearchModule
task");
+ }
+ if (getRevision() == null) {
+ throw new BuildException("no revision provided for SearchModule
task");
+ }
+
+ if (getPropertyPrefix() == null) {
+ throw new BuildException("no property prefix provided provided for
SearchModule task");
+ }
+ Ivy ivy = getIvyInstance();
+ IvySettings settings = ivy.getSettings();
+
+ // search all modules revision matching the requested criteria
+ DependencyResolver resolverToCheck;
+ if (getResolver() != null) {
+ resolverToCheck = settings.getResolver(getResolver());
+ } else {
+ resolverToCheck = settings.getDefaultResolver();
+ }
+ ModuleRevisionId mridToSearch =
ModuleRevisionId.newInstance(getOrganisation(), getModule(), getBranch(),
+ getRevision());
+ ModuleRevisionId[] mrids =
ivy.getSearchEngine().listModules(resolverToCheck, mridToSearch,
+ settings.getMatcher(matcher));
+
+ // diplay the list
+ Vector<String> choices = new Vector<String>();
+ for (int i = 0; i < mrids.length; i++) {
+ ResolvedModuleRevision rmr = ivy.findModule(mrids[i]);
+ if (rmr == null) {
+ log("Can't retrieve " + mrids[i].toString(), Project.MSG_WARN);
+ } else {
+
+ choices.add(String.valueOf(i));
+ StringBuilder sb = new StringBuilder();
+ sb.append(i).append(": ");
+ sb.append(mrids[i].getName());
+ sb.append(" v").append(mrids[i].getRevision());
+ // hide organization if its the default one
+ if
(!EasyAntConstants.EASYANT_SKELETONS_ORGANISATION.equals(mrids[i].getOrganisation()))
{
+ sb.append(" by ").append(mrids[i].getOrganisation());
+ }
+ // Get the description
+ if (rmr.getDescriptor().getDescription() != null &&
!rmr.getDescriptor().getDescription().equals("")) {
+ sb.append("
(").append(rmr.getDescriptor().getDescription()).append(")");
+ }
+ log(sb.toString());
+ }
+ }
+ if (choices.size() == 0) {
+ throw new BuildException("No matching module were found !");
+ }
+
+ // ask end user to select a module
+ // TODO handle a default value
+ Integer value = Integer.valueOf(getInput("Choose a number:", null,
choices));
+ ModuleRevisionId moduleToRetrieve = mrids[value];
+
+ // set final properties
+ getProject().setProperty(getPropertyPrefix() + ".org",
moduleToRetrieve.getOrganisation());
+ getProject().setProperty(getPropertyPrefix() + ".module",
moduleToRetrieve.getName());
+ getProject().setProperty(getPropertyPrefix() + ".rev",
moduleToRetrieve.getRevision());
+
+ }
+
+ protected String getInput(String message, String defaultvalue,
Vector<String> choices) {
+ InputRequest request = null;
+ request = new MultipleChoiceInputRequest(message, choices);
+ request.setDefaultValue(defaultvalue);
+
+ InputHandler h = getProject().getInputHandler();
+
+ h.handleInput(request);
+
+ String value = request.getInput();
+ if ((value == null || value.trim().length() == 0) && defaultvalue !=
null) {
+ value = defaultvalue;
+ }
+ return value;
+
+ }
+
+ public String getMatcher() {
+ return matcher;
+ }
+
+ public void setMatcher(String matcher) {
+ this.matcher = matcher;
+ }
+
+ public String getModule() {
+ return module;
+ }
+
+ public void setModule(String module) {
+ this.module = module;
+ }
+
+ public String getOrganisation() {
+ return organisation;
+ }
+
+ public void setOrganisation(String organisation) {
+ this.organisation = organisation;
+ }
+
+ public String getRevision() {
+ return revision;
+ }
+
+ public void setRevision(String revision) {
+ this.revision = revision;
+ }
+
+ public String getBranch() {
+ return branch;
+ }
+
+ public void setBranch(String branch) {
+ this.branch = branch;
+ }
+
+ public String getPropertyPrefix() {
+ return propertyPrefix;
+ }
+
+ public void setPropertyPrefix(String propertyPrefix) {
+ this.propertyPrefix = propertyPrefix;
+ }
+
+ public String getResolver() {
+ return resolver;
+ }
+
+ public void setResolver(String resolver) {
+ this.resolver = resolver;
+ }
}
Modified:
ant/easyant/core/trunk/src/main/java/org/apache/ivy/ant/EasyAntPluginBridge.java
URL:
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/ivy/ant/EasyAntPluginBridge.java?rev=1515740&r1=1515739&r2=1515740&view=diff
==============================================================================
---
ant/easyant/core/trunk/src/main/java/org/apache/ivy/ant/EasyAntPluginBridge.java
(original)
+++
ant/easyant/core/trunk/src/main/java/org/apache/ivy/ant/EasyAntPluginBridge.java
Tue Aug 20 08:33:42 2013
@@ -28,6 +28,9 @@ import org.apache.ivy.core.settings.IvyS
*/
public class EasyAntPluginBridge {
+ private EasyAntPluginBridge() {
+ }
+
public static DefaultModuleDescriptor
computeModuleDescriptor(DefaultModuleDescriptor md, IvySettings settings,
List<IvyDependency> dependencies, List<IvyConflict> conflicts,
List<IvyExclude> excludes) {
for (IvyDependency dependency : dependencies) {