Skip to content

Commit b6b6e7d

Browse files
committed
[FIXUP] Remove unnecessary addition of 'run-with' junit bundles
1 parent cc9a4df commit b6b6e7d

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECore.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,7 @@ public synchronized IPluginModelBase findPluginInHost(String id, VersionRange ve
241241
private static final Comparator<IPluginModelBase> VERSION = Comparator.comparing(PDECore::getVersion);
242242

243243
private static Version getVersion(IPluginModelBase p) {
244-
// TODO: Check the following also works for plugins from host. If yes,
245-
// use it.
246-
Version version2 = p.getBundleDescription().getVersion();
247-
return Version.parseVersion(p.getPluginBase().getVersion());
244+
return p.getBundleDescription().getVersion();
248245
}
249246

250247
private synchronized Map<String, List<IPluginModelBase>> getHostPlugins() {

ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/JUnitLaunchRequirements.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616

1717
import java.util.ArrayList;
1818
import java.util.Collection;
19-
import java.util.LinkedHashMap;
2019
import java.util.LinkedHashSet;
2120
import java.util.List;
2221
import java.util.Map;
23-
import java.util.Map.Entry;
24-
import java.util.Optional;
2522
import java.util.Set;
2623

2724
import org.eclipse.core.runtime.CoreException;
@@ -43,30 +40,11 @@ public class JUnitLaunchRequirements {
4340
public static final String JUNIT4_JDT_RUNTIME_PLUGIN = "org.eclipse.jdt.junit4.runtime"; //$NON-NLS-1$
4441
public static final String JUNIT5_JDT_RUNTIME_PLUGIN = "org.eclipse.jdt.junit5.runtime"; //$NON-NLS-1$
4542

46-
private static final VersionRange JUNIT5_VERSIONS = new VersionRange("[1, 6)"); //$NON-NLS-1$
47-
48-
// we add launcher and jupiter.engine to support @RunWith(JUnitPlatform.class)
49-
private static final Map<String, List<String>> JUNIT5_RUN_WITH_BUNDLES = new LinkedHashMap<>();
50-
static { // consider JUnit bundle names from old Eclipse-Orbit times. Assume either only new or only old names are used.
51-
JUNIT5_RUN_WITH_BUNDLES.put("junit-platform-runner", List.of("junit-platform-launcher", "junit-jupiter-engine")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
52-
JUNIT5_RUN_WITH_BUNDLES.put("org.junit.platform.runner", List.of("org.junit.platform.launcher", "org.junit.jupiter.engine")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
53-
}
54-
5543
public static void addRequiredJunitRuntimePlugins(ILaunchConfiguration configuration, Map<String, List<IPluginModelBase>> allBundles, Map<IPluginModelBase, String> allModels) throws CoreException {
5644
Collection<String> runtimePlugins = getRequiredJunitRuntimeEclipsePlugins(configuration);
57-
5845
Set<BundleDescription> addedRuntimeBundles = addAbsentRequirements(runtimePlugins, allBundles, allModels);
5946
Set<BundleDescription> runtimeRequirements = DependencyManager.findRequirementsClosure(addedRuntimeBundles);
6047
addAbsentRequirements(runtimeRequirements, allBundles, allModels);
61-
62-
if (runtimePlugins.contains(JUNIT5_JDT_RUNTIME_PLUGIN)) {
63-
Optional<List<String>> runWithBundles = JUNIT5_RUN_WITH_BUNDLES.entrySet().stream().filter(e -> allBundles.containsKey(e.getKey())).findFirst().map(Entry::getValue);
64-
if (runWithBundles.isPresent()) {
65-
Set<BundleDescription> descriptions = findBundlesInTargetOrHost(runWithBundles.get(), JUNIT5_VERSIONS);
66-
Set<BundleDescription> junitRquirements = DependencyManager.findRequirementsClosure(descriptions);
67-
addAbsentRequirements(junitRquirements, allBundles, allModels);
68-
}
69-
}
7048
}
7149

7250
@SuppressWarnings("restriction")
@@ -123,17 +101,6 @@ private static void addAbsentRequirements(Set<BundleDescription> requirements, M
123101
}
124102
}
125103

126-
private static Set<BundleDescription> findBundlesInTargetOrHost(List<String> bundleIDs, VersionRange version) throws CoreException {
127-
Set<BundleDescription> descriptions = new LinkedHashSet<>();
128-
for (String id : bundleIDs) {
129-
IPluginModelBase model = findRequiredPluginInTargetOrHost(id, version);
130-
if (model != null) {
131-
descriptions.add(model.getBundleDescription());
132-
}
133-
}
134-
return descriptions;
135-
}
136-
137104
private static IPluginModelBase findRequiredPluginInTargetOrHost(String id, VersionRange version) throws CoreException {
138105
IPluginModelBase model = version != null ? PluginRegistry.findModel(id, version) : PluginRegistry.findModel(id);
139106
if (model == null || !model.getBundleDescription().isResolved()) {

0 commit comments

Comments
 (0)