Skip to content

Commit

Permalink
Remove the Eclipse CDT stuff from the build and tests on Java 11. We …
Browse files Browse the repository at this point in the history
…can remove this complexity if we remove support for Java 11 (see #2375)
  • Loading branch information
nedtwigg committed Jan 1, 2025
1 parent eb31e75 commit aab831c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
14 changes: 9 additions & 5 deletions lib-extra/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def NEEDS_P2_DEPS = [
'groovy',
'jdt'
]
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
NEEDS_P2_DEPS.remove('cdt')
}
for (needsP2 in NEEDS_P2_DEPS) {
sourceSets.register(needsP2) {
compileClasspath += sourceSets.main.output
Expand All @@ -74,11 +77,12 @@ tasks.withType(Test).configureEach {

apply plugin: 'dev.equo.p2deps'
p2deps {
// (alphabetic order please)
into 'cdtCompileOnly', {
p2repo 'https://download.eclipse.org/eclipse/updates/4.26/'
p2repo 'https://download.eclipse.org/tools/cdt/releases/11.0/'
install 'org.eclipse.cdt.core'
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
into 'cdtCompileOnly', {
p2repo 'https://download.eclipse.org/eclipse/updates/4.26/'
p2repo 'https://download.eclipse.org/tools/cdt/releases/11.0/'
install 'org.eclipse.cdt.core'
}
}
into 'groovyCompileOnly', {
p2repo 'https://download.eclipse.org/eclipse/updates/4.26/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class EclipseCdtFormatterStep {
private EclipseCdtFormatterStep() {}

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

public static String defaultVersion() {
return JVM_SUPPORT.getRecommendedFormatterVersion();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2024 DiffPlug
* Copyright 2016-2025 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,11 @@
*/
package com.diffplug.spotless.extra.cpp;

import static org.junit.jupiter.api.condition.JRE.JAVA_17;

import java.util.stream.Stream;

import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

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

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

private static Stream<String> formatWithVersion() {
return Stream.of("10.6", "10.7", EclipseCdtFormatterStep.defaultVersion());
return Stream.of("11.0", "11.6", EclipseCdtFormatterStep.defaultVersion());
}
}

0 comments on commit aab831c

Please sign in to comment.