summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHolger Oehm2011-09-06 04:07:30 (EDT)
committer jsievers2011-09-23 05:21:04 (EDT)
commit8546b12bd83846e4da27bf044529b8690c9c114c (patch)
treefcfa5e4031720418017ddd9c1cba32786c385254
parent47ddd30ee48b9d39d0016724440aa5e2fd595d4e (diff)
downloadorg.eclipse.tycho-8546b12bd83846e4da27bf044529b8690c9c114c.zip
org.eclipse.tycho-8546b12bd83846e4da27bf044529b8690c9c114c.tar.gz
org.eclipse.tycho-8546b12bd83846e4da27bf044529b8690c9c114c.tar.bz2
355367 Debug output for locally built IUs in target platform
- If debug logging is enabled, also write a list of locally available IUs. This may help to debug problems with the resolver in case it is affected by locally built and installed content. Bug: 355367 Locally built artifacts override target plaftorm configuration
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/test/MavenLoggerStub.java6
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java17
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextLocalRepositoryTest.java8
3 files changed, 25 insertions, 6 deletions
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/test/MavenLoggerStub.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/test/MavenLoggerStub.java
index 135d236..1c686a1 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/test/MavenLoggerStub.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/test/MavenLoggerStub.java
@@ -20,6 +20,7 @@ public class MavenLoggerStub implements MavenLogger {
private final boolean failOnWarning;
private final List<String> warnings = new ArrayList<String>();
+ private final List<String> debugs = new ArrayList<String>();
public MavenLoggerStub() {
this(false);
@@ -43,10 +44,15 @@ public class MavenLoggerStub implements MavenLogger {
return warnings;
}
+ public final List<String> getDebugs() {
+ return debugs;
+ }
+
public void info(String message) {
}
public void debug(String message) {
+ debugs.add(message);
}
public boolean isExtendedDebugEnabled() {
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
index 7ef0e81..dcc8271 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
@@ -441,14 +441,19 @@ public class ResolutionContextImpl implements ResolutionContext {
return new QueryableArray(result.toArray(new IInstallableUnit[result.size()]));
}
- public void warnAboutLocalIus(Collection<IInstallableUnit> ius) {
- final Set<IInstallableUnit> locallyResolvedIUs = localMetadataRepository.query(QueryUtil.ALL_UNITS, null)
- .toSet();
- locallyResolvedIUs.retainAll(ius);
- if (!locallyResolvedIUs.isEmpty()) {
+ public void warnAboutLocalIus(Collection<IInstallableUnit> usedIus) {
+ final Set<IInstallableUnit> localIUs = localMetadataRepository.query(QueryUtil.ALL_UNITS, null).toSet();
+ if (logger.isDebugEnabled()) {
+ logger.debug("The following units are part of the target platform because they have been installed to the local repository:");
+ for (IInstallableUnit unit : localIUs) {
+ logger.debug(" " + unit.getId() + "/" + unit.getVersion());
+ }
+ }
+ localIUs.retainAll(usedIus);
+ if (!localIUs.isEmpty()) {
logger.warn("The following locally built units have been used to resolve project dependencies:");
}
- for (IInstallableUnit localIu : locallyResolvedIUs) {
+ for (IInstallableUnit localIu : localIUs) {
logger.warn(" " + localIu.getId() + "/" + localIu.getVersion());
}
}
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextLocalRepositoryTest.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextLocalRepositoryTest.java
index 3227c67..304ff09 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextLocalRepositoryTest.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextLocalRepositoryTest.java
@@ -76,12 +76,14 @@ public class ResolutionContextLocalRepositoryTest {
context.warnAboutLocalIus(Collections.singleton(localIu));
assertEquals(Arrays.asList("The following locally built units have been used to resolve project dependencies:",
" bundle/1.0.0"), logger.getWarnings());
+ assertDebugOutputIsPresent();
}
@Test
public void testDontWarnAboutOtherIu() {
context.warnAboutLocalIus(Collections.singleton(InstallableUnitUtil.createIU("bundle", "1.0.1")));
assertTrue(logger.getWarnings().isEmpty());
+ assertDebugOutputIsPresent();
}
@Test
@@ -89,5 +91,11 @@ public class ResolutionContextLocalRepositoryTest {
final Collection<IInstallableUnit> noIus = Collections.emptySet();
context.warnAboutLocalIus(noIus);
assertTrue(logger.getWarnings().isEmpty());
+ assertDebugOutputIsPresent();
+ }
+
+ private void assertDebugOutputIsPresent() {
+ assertEquals(Arrays.asList("The following installable units are available from the local repository:",
+ " bundle/1.0.0"), logger.getDebugs());
}
}