Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,21 @@ class InternalProjectConfiguratorTest extends WorkspaceSpecification {
setup:
ProjectConfiguratorContribution c1 = configurator('c1')
ProjectConfiguratorContribution c2 = configurator('c2')
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c1, c2])

when:
configurators = configurators.toSorted()
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c1, c2])

then:
assertOrder(configurators, 'c1', 'c2')

when:
configurators = configurators.reverse().toSorted()

then:
assertOrder(configurators, 'c2', 'c1')
}

def "Ordering respects 'runsBefore' dependency"() {
setup:
ProjectConfiguratorContribution c1 = configurator('c1')
ProjectConfiguratorContribution c2 = configurator('c2', ['c1'])
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c1, c2])

when:
configurators = configurators.toSorted()
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c1, c2])

then:
assertOrder(configurators, 'c2', 'c1')
Expand All @@ -89,10 +81,9 @@ class InternalProjectConfiguratorTest extends WorkspaceSpecification {
setup:
ProjectConfiguratorContribution c1 = configurator('c1', [], ['c2'])
ProjectConfiguratorContribution c2 = configurator('c2')
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c1, c2])

when:
configurators = configurators.toSorted()
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c1, c2])

then:
assertOrder(configurators, 'c2', 'c1')
Expand All @@ -103,10 +94,9 @@ class InternalProjectConfiguratorTest extends WorkspaceSpecification {
ProjectConfiguratorContribution c1 = configurator('c1', ['c2'])
ProjectConfiguratorContribution c2 = configurator('c2', ['c3'])
ProjectConfiguratorContribution c3 = configurator('c3', ['c1'])
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c3, c2, c1])

when:
configurators = configurators.toSorted()
List<InternalProjectConfigurator> configurators = InternalProjectConfigurator.from([c3, c2, c1])

then:
assertOrder(configurators, 'c2', 'c3', 'c1')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package org.eclipse.buildship.core.internal.extension;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -89,7 +90,11 @@ public static List<InternalProjectConfigurator> from(List<ProjectConfiguratorCon
filterDuplicateIds(configurators);
filterInvalidDependencies(configurators);
filterCylicDependencies(configurators);
return configurators.stream().map(c -> new InternalProjectConfigurator(c)).collect(Collectors.toList());

List<InternalProjectConfigurator> internalConfigurators = configurators.stream().map(c -> new InternalProjectConfigurator(c)).collect(Collectors.toList());
Collections.sort(internalConfigurators);

return internalConfigurators;
}

private static void filterInvalidConfigurators(List<ProjectConfiguratorContribution> configurators) {
Expand Down