aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-12-04 13:34:40 (EST)
committerJohn Ross2013-12-05 16:10:54 (EST)
commitfdf475ed59e302b4f1528c79e71cbf00adcfcb40 (patch)
treeb3f05e52f597582a767eddde922e601fa413aff6
parentb136d6277a21a1a3dc745511d27c4df940b3338d (diff)
downloadrt.equinox.framework-fdf475ed59e302b4f1528c79e71cbf00adcfcb40.zip
rt.equinox.framework-fdf475ed59e302b4f1528c79e71cbf00adcfcb40.tar.gz
rt.equinox.framework-fdf475ed59e302b4f1528c79e71cbf00adcfcb40.tar.bz2
[Bug 420067] Add support for org.eclipse.osgi/resolver/wiring resolver trace option.
Setting org.eclipse.osgi/resolver/wiring = true will print out the wiring information for all bundles that were resolved as part of the resolution.
-rw-r--r--bundles/org.eclipse.osgi/.options2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java26
2 files changed, 28 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/.options b/bundles/org.eclipse.osgi/.options
index 63d78da..490f343 100644
--- a/bundles/org.eclipse.osgi/.options
+++ b/bundles/org.eclipse.osgi/.options
@@ -49,6 +49,8 @@ org.eclipse.osgi/resolver/providers = false
org.eclipse.osgi/resolver/hooks = false
# Displays information about uses constraint violations.
org.eclipse.osgi/resolver/uses = false
+# Displays wiring information after the resolve process completes.
+org.eclipse.osgi/resolver/wiring = true
#### Profile settings
org.eclipse.osgi/profile/startup = false
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
index eecdd5c..731f0a0 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
@@ -43,11 +43,13 @@ final class ModuleResolver {
private static final String OPTION_PROVIDERS = OPTION_RESOLVER + "/providers"; //$NON-NLS-1$
private static final String OPTION_HOOKS = OPTION_RESOLVER + "/hooks"; //$NON-NLS-1$
private static final String OPTION_USES = OPTION_RESOLVER + "/uses"; //$NON-NLS-1$
+ private static final String OPTION_WIRING = OPTION_RESOLVER + "/wiring"; //$NON-NLS-1$
static boolean DEBUG_RESOLVER = false;
static boolean DEBUG_PROVIDERS = false;
static boolean DEBUG_HOOKS = false;
static boolean DEBUG_USES = false;
+ static boolean DEBUG_WIRING = false;
private void setDebugOptions() {
DebugOptions options = adaptor.getDebugOptions();
@@ -58,6 +60,7 @@ final class ModuleResolver {
DEBUG_PROVIDERS = options.getBooleanOption(OPTION_PROVIDERS, false);
DEBUG_HOOKS = options.getBooleanOption(OPTION_HOOKS, false);
DEBUG_USES = options.getBooleanOption(OPTION_USES, false);
+ DEBUG_WIRING = options.getBooleanOption(OPTION_WIRING, false);
}
private static final Collection<String> NON_PAYLOAD_CAPABILITIES = Arrays.asList(IdentityNamespace.IDENTITY_NAMESPACE);
@@ -878,6 +881,9 @@ final class ModuleResolver {
} finally {
computeUnresolvedProviderResolutionReportEntries(result);
computeUsesConstraintViolations(logger.getUsesConstraintViolations());
+ if (DEBUG_RESOLVER || DEBUG_WIRING) {
+ printWirings(result);
+ }
report = reportBuilder.build(result, re);
if (hook instanceof ResolutionReport.Listener)
((ResolutionReport.Listener) hook).handleResolutionReport(report);
@@ -889,6 +895,26 @@ final class ModuleResolver {
}
}
+ private void printWirings(Map<Resource, List<Wire>> wires) {
+ StringBuilder builder = new StringBuilder("RESOLVER: Wirings for resolved bundles:"); //$NON-NLS-1$
+ for (Map.Entry<Resource, List<Wire>> entry : wires.entrySet()) {
+ builder.append(SEPARATOR).append(TAB) //
+ .append("Resource") //$NON-NLS-1$
+ .append(SEPARATOR).append(TAB).append(TAB) //
+ .append(entry.getKey()) //
+ .append(SEPARATOR).append(TAB) //
+ .append("Wiring"); //$NON-NLS-1$
+ int i = 0;
+ for (Wire wire : entry.getValue()) {
+ builder.append(SEPARATOR).append(TAB).append(TAB) //
+ .append('[').append(++i).append("] ") //$NON-NLS-1$
+ .append(wire);
+ }
+
+ }
+ Debug.println(builder);
+ }
+
private void resolveSingleRevision(ModuleRevision single, boolean isMandatory, ResolveLogger logger, Map<Resource, List<Wire>> result) throws ResolutionException {
if (wirings.containsKey(single) || failedToResolve.contains(single)) {
return;