Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodor Boev2018-05-04 13:26:42 +0000
committerAlexander Kurtakov2018-06-01 15:48:28 +0000
commit0c85a21c906722b458e3841d7ca29d7e613ea5b0 (patch)
treeaea7bbaba2574a111aec81c311cfe91ef2b23651
parentc98a1d4f43b728e0864fe0c166bc6aae9e420b46 (diff)
downloadrt.equinox.p2-0c85a21c906722b458e3841d7ca29d7e613ea5b0.tar.gz
rt.equinox.p2-0c85a21c906722b458e3841d7ca29d7e613ea5b0.tar.xz
rt.equinox.p2-0c85a21c906722b458e3841d7ca29d7e613ea5b0.zip
Bug 534372 - Cleaned up the p2 director log logic
Concentrated all output into the ILog facade: std streams and the log. Added a DefaultLog implementation of ILog instead of using if-s. All code related to the "stacktrace" flag is dead since it can't be set from the command line. Removed to simplify logic. Change-Id: Ia9a4009701eb3370d7b8a158ee4d9612286eea69 Signed-off-by: Todor Boev <rinsvind@gmail.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DefaultLog.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java189
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/ILog.java89
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java18
-rw-r--r--features/org.eclipse.equinox.p2.extras.feature/feature.xml2
-rw-r--r--features/org.eclipse.equinox.p2.extras.feature/pom.xml2
-rw-r--r--features/org.eclipse.equinox.p2.sdk/feature.xml2
-rw-r--r--features/org.eclipse.equinox.p2.sdk/pom.xml2
-rw-r--r--features/org.eclipse.equinox.p2.user.ui/feature.xml2
-rw-r--r--features/org.eclipse.equinox.p2.user.ui/pom.xml2
12 files changed, 230 insertions, 141 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
index f9d983c6d..140fafc36 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.director.app;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.director.app.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.p2.director.app/pom.xml b/bundles/org.eclipse.equinox.p2.director.app/pom.xml
index c7ec46e54..bc1a5ff76 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.director.app/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.director.app</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DefaultLog.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DefaultLog.java
new file mode 100644
index 000000000..651d56bc5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DefaultLog.java
@@ -0,0 +1,59 @@
+package org.eclipse.equinox.internal.p2.director.app;
+
+import java.io.Closeable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.osgi.framework.log.FrameworkLog;
+
+/**
+ * Default implementation used for command line director invocations
+ */
+public class DefaultLog implements ILog, Closeable {
+ private boolean failed = false;
+
+ /**
+ * Sends logs to the {@link LogHelper standard p2 log}
+ */
+ @Override
+ public void log(IStatus status) {
+ LogHelper.log(status);
+
+ if (!status.isOK()) {
+ failed = true;
+ }
+ }
+
+ /**
+ * Sends messages to {@link System#out}
+ */
+ @Override
+ public void printOut(String message) {
+ System.out.println(message);
+ }
+
+ /**
+ * Sends messages to {@link System#err}
+ */
+ @Override
+ public void printErr(String message) {
+ System.err.println(message);
+ }
+
+ /**
+ * If failures were detected print a final message with the location of the log file
+ */
+ @Override
+ public void close() {
+ if (!failed) {
+ return;
+ }
+
+ FrameworkLog fwLog = ServiceHelper.getService(Activator.getContext(), FrameworkLog.class);
+ if (fwLog == null) {
+ return;
+ }
+
+ printErr("Failures loggaed in file: " + fwLog.getFile()); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
index d58202541..a341ae3b7 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
@@ -13,6 +13,7 @@
* Pascal Rapicault - Support for bundled macosx 431116
* Red Hat, Inc. - support repositories passed via fragments (see bug 378329).Bug 460967
* SAP AG - list formatting (bug 423538)
+ * Todor Boev - Software AG
*******************************************************************************/
package org.eclipse.equinox.internal.p2.director.app;
@@ -22,10 +23,13 @@ import java.net.URISyntaxException;
import java.security.cert.Certificate;
import java.util.*;
import java.util.Map.Entry;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.equinox.internal.p2.core.helpers.*;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.core.helpers.StringHelper;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.engine.EngineActivator;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
@@ -45,7 +49,6 @@ import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
-import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
@@ -261,7 +264,6 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
private boolean verifyOnly = false;
private boolean roamingProfile = false;
private boolean purgeRegistry = false;
- private boolean stackTrace = false;
private boolean followReferences = false;
private boolean downloadOnly = false;
private String profileId;
@@ -276,7 +278,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
private IEngine engine;
private boolean noProfileId = false;
private IPlanner planner;
- private ILog log = null;
+ private ILog log = new DefaultLog();
private IProvisioningAgent targetAgent;
private boolean targetAgentIsSelfAndUp = false;
@@ -296,14 +298,14 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
private Properties loadProperties(File file) {
if (!file.exists()) {
// log a warning and return
- logStatus(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.File_does_not_exist, file.getAbsolutePath())));
+ log.log(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.File_does_not_exist, file.getAbsolutePath())));
return null;
}
Properties properties = new Properties();
try (InputStream input = new BufferedInputStream(new FileInputStream(file))) {
properties.load(input);
} catch (IOException e) {
- logFailure(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.Problem_loading_file, file.getAbsolutePath()), e));
+ log.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.Problem_loading_file, file.getAbsolutePath()), e));
return null;
}
return properties;
@@ -343,10 +345,10 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
// skip over the keyword
id = line.substring(0, index);
} catch (NumberFormatException e) {
- logStatus(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.Bad_format, line, iuProfileProperties), e));
+ log.log(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.Bad_format, line, iuProfileProperties), e));
continue;
} catch (IndexOutOfBoundsException e) {
- logStatus(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.Bad_format, line, iuProfileProperties), e));
+ log.log(new Status(IStatus.WARNING, Activator.ID, NLS.bind(Messages.Bad_format, line, iuProfileProperties), e));
continue;
}
@@ -368,7 +370,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
if (key == null || value == null) {
String message = NLS.bind(Messages.Unmatched_iu_profile_property_key_value, key + '/' + value);
- logStatus(new Status(IStatus.WARNING, Activator.ID, message));
+ log.log(new Status(IStatus.WARNING, Activator.ID, message));
continue;
}
@@ -380,7 +382,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
IQueryResult<IInstallableUnit> qr = getInstallableUnits(null, query, null);
if (qr.isEmpty()) {
String msg = NLS.bind(Messages.Cannot_set_iu_profile_property_iu_does_not_exist, id + '/' + version);
- logStatus(new Status(IStatus.WARNING, Activator.ID, msg));
+ log.log(new Status(IStatus.WARNING, Activator.ID, msg));
continue;
}
IInstallableUnit iu = qr.iterator().next();
@@ -508,7 +510,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
anyValid = true;
} catch (ProvisionException e) {
//one of the repositories did not load
- logStatus(e.getStatus());
+ log.log(e.getStatus());
}
}
if (!anyValid)
@@ -535,7 +537,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
anyValid = true;
} catch (ProvisionException e) {
//one of the repositories did not load
- logStatus(e.getStatus());
+ log.log(e.getStatus());
}
}
if (!anyValid)
@@ -681,30 +683,6 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
}
}
- private void logStatus(IStatus status) {
- if (log != null)
- log.log(status);
- else
- LogHelper.log(status);
- }
-
- private void printMessage(String message) {
- if (log != null)
- log.log(message);
- else
- System.out.println(message);
- }
-
- private void logFailure(IStatus status) {
- if (log == null) {
- FrameworkLog frameworkLog = ServiceHelper.getService(Activator.getContext(), FrameworkLog.class);
- if (frameworkLog != null)
- System.err.println("Application failed, log file location: " + frameworkLog.getFile()); //$NON-NLS-1$
- }
-
- logStatus(status);
- }
-
private void markRoots(IProfileChangeRequest request, Collection<IInstallableUnit> roots) {
for (IInstallableUnit root : roots) {
request.setInstallableUnitProfileProperty(root, IProfile.PROP_PROFILE_ROOT_IU, Boolean.TRUE.toString());
@@ -786,7 +764,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
break;
case IStatus.INFO :
case IStatus.WARNING :
- logStatus(operationStatus);
+ log.log(operationStatus);
break;
//. All other status codes correspond to IStatus.isOk() == false
default :
@@ -816,17 +794,6 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
return false;
}
- private void printRequest(ProfileChangeRequest request) {
- Collection<IInstallableUnit> toAdd = request.getAdditions();
- for (IInstallableUnit added : toAdd) {
- printMessage(NLS.bind(Messages.Installing, added.getId(), added.getVersion()));
- }
- Collection<IInstallableUnit> toRemove = request.getRemovals();
- for (IInstallableUnit removed : toRemove) {
- printMessage(NLS.bind(Messages.Uninstalling, removed.getId(), removed.getVersion()));
- }
- }
-
public void processArguments(String[] args) throws CoreException {
if (args == null) {
printHelpInfo = true;
@@ -1024,7 +991,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
}
else if (!printHelpInfo && !printIUList && !printRootIUList && !printTags && !purgeRegistry && rootsToInstall.isEmpty() && rootsToUninstall.isEmpty() && revertToPreviousState == NOTHING_TO_REVERT_TO) {
- printMessage(Messages.Help_Missing_argument);
+ log.printOut(Messages.Help_Missing_argument);
printHelpInfo = true;
}
@@ -1073,7 +1040,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
initializeServices();
if (!(printIUList || printRootIUList || printTags)) {
if (!canInstallInDestination()) {
- printMessage(NLS.bind(Messages.Cant_write_in_destination, destination.getAbsolutePath()));
+ log.printOut(NLS.bind(Messages.Cant_write_in_destination, destination.getAbsolutePath()));
return EXIT_ERROR;
}
}
@@ -1091,17 +1058,20 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
performPrintTags();
if (purgeRegistry)
purgeRegistry();
- printMessage(NLS.bind(Messages.Operation_complete, Long.valueOf(System.currentTimeMillis() - time)));
+ log.printOut(NLS.bind(Messages.Operation_complete, Long.valueOf(System.currentTimeMillis() - time)));
}
return IApplication.EXIT_OK;
} catch (CoreException e) {
- printMessage(Messages.Operation_failed);
- deeplyPrint(e.getStatus(), System.err, 0);
- logFailure(e.getStatus());
+ log.printOut(Messages.Operation_failed);
+ printError(e.getStatus(), 0);
+
+ log.log(e.getStatus());
+
//set empty exit data to suppress error dialog from launcher
setSystemProperty("eclipse.exitdata", ""); //$NON-NLS-1$ //$NON-NLS-2$
return EXIT_ERROR;
} finally {
+ log.close();
cleanupRepositories();
cleanupServices();
}
@@ -1177,11 +1147,6 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
}
}
- private static void appendLevelPrefix(PrintStream strm, int level) {
- for (int idx = 0; idx < level; ++idx)
- strm.print(' ');
- }
-
IQueryResult<IInstallableUnit> getInstallableUnits(URI location, IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
IQueryable<IInstallableUnit> queryable = null;
if (location == null) {
@@ -1198,49 +1163,6 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
return Collector.emptyCollector();
}
- private void deeplyPrint(CoreException ce, PrintStream strm, int level) {
- appendLevelPrefix(strm, level);
- if (stackTrace)
- ce.printStackTrace(strm);
- deeplyPrint(ce.getStatus(), strm, level);
- }
-
- private void deeplyPrint(IStatus status, PrintStream strm, int level) {
- appendLevelPrefix(strm, level);
- String msg = status.getMessage();
- strm.println(msg);
- Throwable cause = status.getException();
- if (cause != null) {
- strm.print("Caused by: "); //$NON-NLS-1$
- if (stackTrace || !(msg.equals(cause.getMessage()) || msg.equals(cause.toString())))
- deeplyPrint(cause, strm, level);
- }
-
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++)
- deeplyPrint(children[i], strm, level + 1);
- }
- }
-
- private void deeplyPrint(Throwable t, PrintStream strm, int level) {
- if (t instanceof CoreException)
- deeplyPrint((CoreException) t, strm, level);
- else {
- appendLevelPrefix(strm, level);
- if (stackTrace)
- t.printStackTrace(strm);
- else {
- strm.println(t.toString());
- Throwable cause = t.getCause();
- if (cause != null) {
- strm.print("Caused by: "); //$NON-NLS-1$
- deeplyPrint(cause, strm, level);
- }
- }
- }
- }
-
private void performHelpInfo() {
CommandLineOption[] allOptions = new CommandLineOption[] {OPTION_HELP, OPTION_LIST, OPTION_LIST_INSTALLED, OPTION_LIST_FORMAT, OPTION_INSTALL_IU, OPTION_UNINSTALL_IU, OPTION_REVERT, OPTION_DESTINATION, OPTION_DOWNLOAD_ONLY, OPTION_METADATAREPOS, OPTION_ARTIFACTREPOS, OPTION_REPOSITORIES, OPTION_VERIFY_ONLY, OPTION_TAG, OPTION_LIST_TAGS, OPTION_PROFILE, OPTION_FLAVOR, OPTION_SHARED, OPTION_BUNDLEPOOL, OPTION_PROFILE_PROPS, OPTION_IU_PROFILE_PROPS, OPTION_ROAMING, OPTION_P2_OS, OPTION_P2_WS, OPTION_P2_ARCH, OPTION_P2_NL, OPTION_PURGEHISTORY, OPTION_FOLLOW_REFERENCES};
for (int i = 0; i < allOptions.length; ++i) {
@@ -1319,16 +1241,19 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
IProvisioningPlan result = planner.getProvisioningPlan(request, context, new NullProgressMonitor());
IStatus status = PlanExecutionHelper.executePlan(result, engine, context, new NullProgressMonitor());
if (!status.isOK())
- throw new CoreException(new MultiStatus(org.eclipse.equinox.internal.p2.director.app.Activator.ID, IStatus.ERROR, new IStatus[] {status}, NLS.bind(Messages.Cant_change_roaming, profile.getProfileId()), null));
+ throw new CoreException(new MultiStatus(Activator.ID, IStatus.ERROR, new IStatus[] {status}, NLS.bind(Messages.Cant_change_roaming, profile.getProfileId()), null));
}
@Override
public void stop() {
IProvisioningEventBus eventBus = (IProvisioningEventBus) targetAgent.getService(IProvisioningEventBus.SERVICE_NAME);
- if (eventBus != null)
+ if (eventBus != null) {
eventBus.removeListener(this);
- if (log != null)
+ }
+
+ if (log != null) {
log.close();
+ }
}
public void setLog(ILog log) {
@@ -1355,6 +1280,60 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
}
}
+ private void printRequest(IProfileChangeRequest request) {
+ Collection<IInstallableUnit> toAdd = request.getAdditions();
+ for (IInstallableUnit added : toAdd) {
+ log.printOut(NLS.bind(Messages.Installing, added.getId(), added.getVersion()));
+ }
+
+ Collection<IInstallableUnit> toRemove = request.getRemovals();
+ for (IInstallableUnit removed : toRemove) {
+ log.printOut(NLS.bind(Messages.Uninstalling, removed.getId(), removed.getVersion()));
+ }
+ }
+
+ private void printError(IStatus status, int level) {
+ String prefix = emptyString(level);
+
+ String msg = status.getMessage();
+ log.printErr(prefix + msg);
+
+ Throwable cause = status.getException();
+ if (cause != null) {
+ // TODO This is very unreliable. It assumes that if the IStatus message is the same as the IStatus cause
+ // message the cause exception has no more data to offer. Better to just print it.
+ boolean isCauseMsg = msg.equals(cause.getMessage()) || msg.equals(cause.toString());
+ if (!isCauseMsg) {
+ log.printErr(prefix + "Caused by: "); //$NON-NLS-1$
+ printError(cause, level);
+ }
+ }
+
+ for (IStatus child : status.getChildren()) {
+ printError(child, level + 1);
+ }
+ }
+
+ private void printError(Throwable trace, int level) {
+ if (trace instanceof CoreException) {
+ printError(((CoreException) trace).getStatus(), level);
+ } else {
+ String prefix = emptyString(level);
+
+ log.printErr(prefix + trace.toString());
+
+ Throwable cause = trace.getCause();
+ if (cause != null) {
+ log.printErr(prefix + "Caused by: "); //$NON-NLS-1$
+ printError(cause, level);
+ }
+ }
+ }
+
+ private static String emptyString(int size) {
+ return IntStream.range(0, size).mapToObj(i -> "\t").collect(Collectors.joining()); //$NON-NLS-1$
+ }
+
private boolean canInstallInDestination() {
//When we are provisioning what we are running. We can always install.
if (targetAgentIsSelfAndUp)
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/ILog.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/ILog.java
index f707d3a3f..250d7b58c 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/ILog.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/ILog.java
@@ -1,24 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.director.app;
-
-import org.eclipse.core.runtime.IStatus;
-
-public interface ILog {
-
- // Log a status
- public void log(IStatus status);
-
- public void log(String message);
-
- // Notify that logging is completed & cleanup resources
- public void close();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.director.app;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * Manages all outputs of the director application: logs to a file as well as the standard streams
+ * <p>
+ * This indirection is needed in order to manage the outputs when the director is called from ant, where
+ * the standard streams are handled differently.
+ */
+public interface ILog {
+ /**
+ * Send status to the standard log
+ *
+ * @param status
+ */
+ void log(IStatus status);
+
+ /**
+ *
+ * @param message
+ * @deprecated Use {@link ILog#printOut()} or {@link ILog#printErr()}
+ */
+ @Deprecated
+ default void log(String message) {
+ printOut(message);
+ }
+
+ /**
+ * Notify that logging is completed & cleanup resources
+ */
+ void close();
+
+ /**
+ * Print status on stdout or stderr.
+ *
+ * By default calls {@link #log}
+ *
+ * @param status
+ */
+ default void printOut(String line) {
+ System.out.println(line);
+ }
+
+ /**
+ * Send line to stdout
+ *
+ * By default does nothing
+ *
+ * @param message line
+ */
+ default void printErr(String line) {
+ System.err.println(line);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
index 5cc75da62..8c80c88d9 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
@@ -10,15 +10,24 @@
*******************************************************************************/
package org.eclipse.equinox.p2.director.app.ant;
-import java.io.*;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
-import org.apache.tools.ant.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.internal.p2.director.app.*;
+import org.eclipse.equinox.internal.p2.director.app.DirectorApplication;
+import org.eclipse.equinox.internal.p2.director.app.ILog;
+import org.eclipse.equinox.internal.p2.director.app.Messages;
import org.eclipse.equinox.p2.metadata.VersionedId;
import org.eclipse.osgi.util.NLS;
@@ -247,6 +256,7 @@ public class DirectorTask extends Task implements ILog {
}
@Override
+ @SuppressWarnings("deprecation")
public void log(String msg) {
if (outputBuffer != null) {
outputBuffer.append(msg);
diff --git a/features/org.eclipse.equinox.p2.extras.feature/feature.xml b/features/org.eclipse.equinox.p2.extras.feature/feature.xml
index 494cb76e2..57af96b58 100644
--- a/features/org.eclipse.equinox.p2.extras.feature/feature.xml
+++ b/features/org.eclipse.equinox.p2.extras.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.p2.extras.feature"
label="%featureName"
- version="1.4.0.qualifier"
+ version="1.4.100.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.p2.extras.feature/pom.xml b/features/org.eclipse.equinox.p2.extras.feature/pom.xml
index e8cec5c05..7a181559b 100644
--- a/features/org.eclipse.equinox.p2.extras.feature/pom.xml
+++ b/features/org.eclipse.equinox.p2.extras.feature/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.extras.feature</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.4.100-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<build>
diff --git a/features/org.eclipse.equinox.p2.sdk/feature.xml b/features/org.eclipse.equinox.p2.sdk/feature.xml
index 3e1169535..bd4afc671 100644
--- a/features/org.eclipse.equinox.p2.sdk/feature.xml
+++ b/features/org.eclipse.equinox.p2.sdk/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.p2.sdk"
label="%featureName"
- version="3.11.0.qualifier"
+ version="3.11.100.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.p2.sdk/pom.xml b/features/org.eclipse.equinox.p2.sdk/pom.xml
index d01fb64ae..12d06887c 100644
--- a/features/org.eclipse.equinox.p2.sdk/pom.xml
+++ b/features/org.eclipse.equinox.p2.sdk/pom.xml
@@ -20,6 +20,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.sdk</artifactId>
- <version>3.11.0-SNAPSHOT</version>
+ <version>3.11.100-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/features/org.eclipse.equinox.p2.user.ui/feature.xml b/features/org.eclipse.equinox.p2.user.ui/feature.xml
index 15c2f27be..3b2f05d3a 100644
--- a/features/org.eclipse.equinox.p2.user.ui/feature.xml
+++ b/features/org.eclipse.equinox.p2.user.ui/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.equinox.p2.user.ui"
label="%featureName"
- version="2.4.0.qualifier"
+ version="2.4.100.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.p2.user.ui/pom.xml b/features/org.eclipse.equinox.p2.user.ui/pom.xml
index 2bad1b497..05c38994b 100644
--- a/features/org.eclipse.equinox.p2.user.ui/pom.xml
+++ b/features/org.eclipse.equinox.p2.user.ui/pom.xml
@@ -20,7 +20,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.user.ui</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.100-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<build>

Back to the top