Skip to content

Commit aab831c

Browse files
committed
Remove the Eclipse CDT stuff from the build and tests on Java 11. We can remove this complexity if we remove support for Java 11 (see #2375)
1 parent eb31e75 commit aab831c

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

lib-extra/build.gradle

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def NEEDS_P2_DEPS = [
5050
'groovy',
5151
'jdt'
5252
]
53+
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
54+
NEEDS_P2_DEPS.remove('cdt')
55+
}
5356
for (needsP2 in NEEDS_P2_DEPS) {
5457
sourceSets.register(needsP2) {
5558
compileClasspath += sourceSets.main.output
@@ -74,11 +77,12 @@ tasks.withType(Test).configureEach {
7477

7578
apply plugin: 'dev.equo.p2deps'
7679
p2deps {
77-
// (alphabetic order please)
78-
into 'cdtCompileOnly', {
79-
p2repo 'https://download.eclipse.org/eclipse/updates/4.26/'
80-
p2repo 'https://download.eclipse.org/tools/cdt/releases/11.0/'
81-
install 'org.eclipse.cdt.core'
80+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
81+
into 'cdtCompileOnly', {
82+
p2repo 'https://download.eclipse.org/eclipse/updates/4.26/'
83+
p2repo 'https://download.eclipse.org/tools/cdt/releases/11.0/'
84+
install 'org.eclipse.cdt.core'
85+
}
8286
}
8387
into 'groovyCompileOnly', {
8488
p2repo 'https://download.eclipse.org/eclipse/updates/4.26/'

lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public final class EclipseCdtFormatterStep {
3838
private EclipseCdtFormatterStep() {}
3939

4040
private static final String NAME = "eclipse cdt formatter";
41-
private static final Jvm.Support<String> JVM_SUPPORT = Jvm.<String> support(NAME).add(11, "11.0").add(17, "11.6");
41+
private static final Jvm.Support<String> JVM_SUPPORT = Jvm.<String> support(NAME).add(17, "11.6");
4242

4343
public static String defaultVersion() {
4444
return JVM_SUPPORT.getRecommendedFormatterVersion();

lib-extra/src/test/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStepTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,8 +15,11 @@
1515
*/
1616
package com.diffplug.spotless.extra.cpp;
1717

18+
import static org.junit.jupiter.api.condition.JRE.JAVA_17;
19+
1820
import java.util.stream.Stream;
1921

22+
import org.junit.jupiter.api.condition.EnabledForJreRange;
2023
import org.junit.jupiter.params.ParameterizedTest;
2124
import org.junit.jupiter.params.provider.MethodSource;
2225

@@ -30,13 +33,14 @@ public EclipseCdtFormatterStepTest() {
3033

3134
@ParameterizedTest
3235
@MethodSource
36+
@EnabledForJreRange(min = JAVA_17)
3337
void formatWithVersion(String version) throws Exception {
3438
harnessFor(version).test("main.c",
3539
"#include <a.h>;\nint main(int argc, \nchar *argv[]) {}",
3640
"#include <a.h>;\nint main(int argc, char *argv[]) {\n}\n");
3741
}
3842

3943
private static Stream<String> formatWithVersion() {
40-
return Stream.of("10.6", "10.7", EclipseCdtFormatterStep.defaultVersion());
44+
return Stream.of("11.0", "11.6", EclipseCdtFormatterStep.defaultVersion());
4145
}
4246
}

0 commit comments

Comments
 (0)