Skip to content

Commit

Permalink
Merge pull request #389 from diffplug/eclipse-cdt-upgrade
Browse files Browse the repository at this point in the history
Upgrade to CTD 9.7. Include SLF4J log service.
  • Loading branch information
nedtwigg committed Mar 31, 2019
2 parents 2ec61ea + 13eb8ef commit 2e16d9c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 468 deletions.
18 changes: 18 additions & 0 deletions _ext/eclipse-cdt/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# spotless-eclipse-cdt

### Version 9.7.0 - March 31st 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-cdt)))

* Switch to Eclipse CTD release 9.7 for Eclipse 4.11 ([#389](https://github.com/diffplug/spotless/pull/389)).
* Include Eclipse logging allowing formatter warnings/errors to be logged via SLF4J ([#236](https://github.com/diffplug/spotless/issues/236)).

### Version 9.4.5 - February 25th 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-cdt)))

* Replaced `http` update-site with `https` ([#360](https://github.com/diffplug/spotless/issues/360)).

### Version 9.4.4 - September 04th 2018 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-cdt)))

* Added missing log service, which caused exceptions on AST warnings ([#286](https://github.com/diffplug/spotless/pull/286)).

### Version 9.4.3 - August 8th 2018 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-cdt)))

* Initial release!
4 changes: 3 additions & 1 deletion _ext/eclipse-cdt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ dependencies {
compile "com.ibm.icu:icu4j:${VER_IBM_ICU}"
// Required to by CCorePlugin calling PositionTrackerManager
compile "org.eclipse.platform:org.eclipse.core.filebuffers:${VER_ECLISPE_PLATFORM}"

testCompile("org.slf4j:slf4j-simple:${VER_SLF4J}")
}


//////////
// Test //
//////////
sourceSets {
// Use JAR file with all resources for Eclipse-XML integration-tests
// Use JAR file with all resources for Eclipse-CDT integration-tests
test.runtimeClasspath = jar.outputs.files + sourceSets.test.output + sourceSets.test.compileClasspath
}
10 changes: 7 additions & 3 deletions _ext/eclipse-cdt/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Versions correspond to the Eclipse-CDT version used for the fat-JAR.
# See https://www.eclipse.org/cdt/ for further information about Eclipse-CDT versions.
# Patch version can be incremented independently for backward compatible patches of this library.
ext_version=9.4.5
ext_version=9.7.0
ext_artifactId=spotless-eclipse-cdt
ext_description=Eclipse's CDT C/C++ formatter bundled for Spotless
ext_org=diffplug
Expand All @@ -11,8 +11,12 @@ ext_group=com.diffplug.spotless
ext_VER_JAVA=1.8

# Compile dependencies
VER_ECLIPSE_CDT=9.4
VER_SPOTLESS_ECLISPE_BASE=[3.0.0,4.0.0[
VER_ECLIPSE_CDT=9.7
VER_SPOTLESS_ECLISPE_BASE=[3.1.0,4.0.0[
VER_ECLISPE_JFACE=[3.12.0,4.0.0[
VER_ECLISPE_WORKBENCH=[3.11.0,4.0.0[
VER_ECLISPE_PLATFORM=[3.6.0,4.0.0[
VER_IBM_ICU=[61,62[

# Provided dependencies
VER_SLF4J=[1.6,2.0[
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.formatter.CodeFormatter;
import org.eclipse.core.internal.filebuffers.FileBuffersPlugin;
import org.eclipse.equinox.log.ExtendedLogReaderService;
import org.eclipse.equinox.log.ExtendedLogService;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.text.edits.TextEdit;
Expand All @@ -37,12 +35,10 @@ public class EclipseCdtFormatterStepImpl {
private final CodeFormatter codeFormatter;

public EclipseCdtFormatterStepImpl(Properties settings) throws Exception {
LogErrorService logService = new LogErrorService();
SpotlessEclipseFramework.setup(
config -> {
config.applyDefault();
config.add(ExtendedLogService.class, logService);
config.add(ExtendedLogReaderService.class, logService);
config.useSlf4J(EclipseCdtFormatterStepImpl.class.getPackage().getName());
},
plugins -> {
plugins.applyDefault();
Expand All @@ -68,5 +64,4 @@ public String format(String raw) throws Exception {
return doc.get();
}
}

}

0 comments on commit 2e16d9c

Please sign in to comment.