Author: maartenc
Date: Thu Jun 18 20:31:19 2009
New Revision: 786250
URL: http://svn.apache.org/viewvc?rev=786250&view=rev
Log:
FIX: The Ant output wasn't always prefixed by the name of the task
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConfigure.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=786250&r1=786249&r2=786250&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jun 18 20:31:19 2009
@@ -94,6 +94,7 @@
- IMPROVEMENT: Standalone runner should accept all the same parameters as ant
tasks (IVY-1090)
- IMPROVEMENT: Pre and post retrieve artifact events (IVY-1084)
+- FIX: The Ant output wasn't always prefixed by the name of the task
- FIX: Ivy buildnumber task does not find artifact in Sonatype Nexus repo
(IVY-1069)
- FIX: Publish with SSH (sftp or ssh) prevents enclosing java process to
terminate (IVY-1075)
- FIX: Ibiblio resolver throws IndexOutOfBoundsException when using snapshot
versions with usepoms='false' (IVY-1028)
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java?rev=786250&r1=786249&r2=786250&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyAntSettings.java Thu Jun
18 20:31:19 2009
@@ -35,6 +35,7 @@
import org.apache.ivy.util.url.URLHandlerRegistry;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.tools.ant.types.DataType;
@@ -107,12 +108,13 @@
* @param project TODO add text.
* @return An IvySetting instance.
*/
- public static IvyAntSettings getDefaultInstance(Project project) {
+ public static IvyAntSettings getDefaultInstance(Task task) {
+ Project project = task.getProject();
Object defaultInstanceObj = project.getReference("ivy.instance");
if (defaultInstanceObj != null
&& defaultInstanceObj.getClass().getClassLoader() !=
IvyAntSettings.class
.getClassLoader()) {
- project.log("ivy.instance reference an ivy:settings defined in an
other classloader. "
+ task.log("ivy.instance reference an ivy:settings defined in an
other classloader. "
+ "An new default one will be used in this project.",
Project.MSG_WARN);
defaultInstanceObj = null;
}
@@ -122,13 +124,13 @@
+ " an not an IvyAntSettings. Please don't use this
reference id ()");
}
if (defaultInstanceObj == null) {
- project.log("No ivy:settings found for the default reference
'ivy.instance'. "
- + "A default instance will be used", Project.MSG_INFO);
+ task.log("No ivy:settings found for the default reference
'ivy.instance'. "
+ + "A default instance will be used", Project.MSG_VERBOSE);
IvyAntSettings settings = new IvyAntSettings();
settings.setProject(project);
project.addReference("ivy.instance", settings);
- settings.createIvyEngine();
+ settings.createIvyEngine(task);
return settings;
} else {
return (IvyAntSettings) defaultInstanceObj;
@@ -230,35 +232,36 @@
* Return the configured Ivy instance.
* @return Returns the configured Ivy instance.
*/
- public Ivy getConfiguredIvyInstance() {
+ public Ivy getConfiguredIvyInstance(Task task) {
if (ivyEngine == null) {
- createIvyEngine();
+ createIvyEngine(task);
}
return ivyEngine;
}
- void createIvyEngine() {
+ void createIvyEngine(final Task task) {
+ Project project = task.getProject();
Property prop = new Property() {
public void execute() throws BuildException {
- addProperties(getDefaultProperties());
+ addProperties(getDefaultProperties(task));
}
};
- prop.setProject(getProject());
+ prop.setProject(project);
prop.init();
prop.execute();
- IvyAntVariableContainer ivyAntVariableContainer = new
IvyAntVariableContainer(getProject());
+ IvyAntVariableContainer ivyAntVariableContainer = new
IvyAntVariableContainer(project);
IvySettings settings = new IvySettings(ivyAntVariableContainer);
- settings.setBaseDir(getProject().getBaseDir());
+ settings.setBaseDir(project.getBaseDir());
if (file == null && url == null) {
- defineDefaultSettingFile(ivyAntVariableContainer);
+ defineDefaultSettingFile(ivyAntVariableContainer, task);
}
Ivy ivy = Ivy.newInstance(settings);
- ivy.getLoggerEngine().pushLogger(new AntMessageLogger(this));
+ ivy.getLoggerEngine().pushLogger(new AntMessageLogger(task));
Message.showInfo();
try {
configureURLHandler();
@@ -288,11 +291,11 @@
}
}
- protected Properties getDefaultProperties() {
+ protected Properties getDefaultProperties(Task task) {
URL url = IvySettings.getDefaultPropertiesURL();
// this is copy of loadURL code from ant Property task (not available
in 1.5.1)
Properties props = new Properties();
- verbose("Loading " + url);
+ task.log("Loading " + url, Project.MSG_VERBOSE);
try {
InputStream is = url.openStream();
try {
@@ -313,11 +316,11 @@
*
* @param variableContainer
*/
- private void defineDefaultSettingFile(IvyVariableContainer
variableContainer) {
+ private void defineDefaultSettingFile(IvyVariableContainer
variableContainer, Task task) {
String settingsFileName =
variableContainer.getVariable("ivy.conf.file");
if (settingsFileName != null
&&
!settingsFileName.equals(variableContainer.getVariable("ivy.settings.file"))) {
- info("DEPRECATED: 'ivy.conf.file' is deprecated, use
'ivy.settings.file' instead");
+ task.log("DEPRECATED: 'ivy.conf.file' is deprecated, use
'ivy.settings.file' instead", Project.MSG_INFO);
} else {
settingsFileName =
variableContainer.getVariable("ivy.settings.file");
}
@@ -329,32 +332,24 @@
};
for (int i = 0; i < settingsLocations.length; i++) {
file = settingsLocations[i];
- verbose("searching settings file: trying " + file);
+ task.log("searching settings file: trying " + file,
Project.MSG_VERBOSE);
if (file.exists()) {
break;
}
}
if (!file.exists()) {
if
(Boolean.valueOf(getProject().getProperty("ivy.14.compatible")).booleanValue())
{
- info("no settings file found, using Ivy 1.4 default...");
+ task.log("no settings file found, using Ivy 1.4 default...",
Project.MSG_VERBOSE);
file = null;
url = IvySettings.getDefault14SettingsURL();
} else {
- info("no settings file found, using default...");
+ task.log("no settings file found, using default...",
Project.MSG_VERBOSE);
file = null;
url = IvySettings.getDefaultSettingsURL();
}
}
}
- private void verbose(String msg) {
- log(msg, Project.MSG_VERBOSE);
- }
-
- private void info(String msg) {
- log(msg, Project.MSG_INFO);
- }
-
private void configureURLHandler() {
// TODO : the credentialStore should also be scoped
CredentialsStore.INSTANCE.addCredentials(getRealm(), getHost(),
getUsername(), getPasswd());
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConfigure.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConfigure.java?rev=786250&r1=786249&r2=786250&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConfigure.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyConfigure.java Thu Jun 18
20:31:19 2009
@@ -147,7 +147,7 @@
settings.setProject(getProject());
getProject().addReference(settingsId, settings);
- settings.createIvyEngine();
+ settings.createIvyEngine(this);
}
private void verbose(String msg) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java?rev=786250&r1=786249&r2=786250&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java Thu Jun 18
20:31:19 2009
@@ -87,9 +87,9 @@
getLocation());
}
} else {
- antIvyEngine = IvyAntSettings.getDefaultInstance(getProject());
+ antIvyEngine = IvyAntSettings.getDefaultInstance(this);
}
- Ivy ivy = ((IvyAntSettings) antIvyEngine).getConfiguredIvyInstance();
+ Ivy ivy = ((IvyAntSettings)
antIvyEngine).getConfiguredIvyInstance(this);
AntMessageLogger.register(this, ivy);
return ivy;
}