Skip to content

Commit e0d1bb6

Browse files
authored
Merge pull request #378 from diffplug/eclipse-wtp-upgrade
Switch to Eclipse-WTP 3.10. Cleanup fix for #369. Add SLF4J support.
2 parents 21fca9f + 14252be commit e0d1bb6

File tree

11 files changed

+36
-24
lines changed

11 files changed

+36
-24
lines changed

_ext/eclipse-jdt/src/main/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImpl.java

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ public class EclipseJdtFormatterStepImpl {
3333

3434
public EclipseJdtFormatterStepImpl(Properties settings) throws Exception {
3535
SpotlessEclipseFramework.setup(
36+
config -> {
37+
config.applyDefault();
38+
config.useSlf4J(EclipseJdtFormatterStepImpl.class.getPackage().getName());
39+
},
3640
plugins -> {
3741
plugins.applyDefault();
3842
plugins.add(new JavaCore());

_ext/eclipse-wtp/CHANGES.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# spotless-eclipse-wtp
22

3-
### Version 3.9.8 - March 10th 2018 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-wtp)))
3+
### Version 3.10.0 - March 17th 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-wtp)))
4+
5+
* Switch to Eclipse WTP release 3.10.0 for Eclipse 4.8 ([#378](https://github.com/diffplug/spotless/pull/378)).
6+
* Include Eclipse logging allowing formatter warnings/errors to be logged via SLF4J ([#236](https://github.com/diffplug/spotless/issues/236)).
7+
8+
### Version 3.9.8 - March 10th 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-wtp)))
49

510
* XML formatter ignores external URIs per default. ([#369](https://github.com/diffplug/spotless/issues/369)). Add `resolveExternalURI=true` property to switch to previous behavior.
611

7-
### Version 3.9.7 - February 25th 2018 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-wtp)))
12+
### Version 3.9.7 - February 25th 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-wtp)))
813

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

11-
### Version 3.9.6 - February 10th 2018 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-wtp)))
16+
### Version 3.9.6 - February 11th 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-wtp)))
1217

1318
* Fixed formatting of JSON arrays ([#344](https://github.com/diffplug/spotless/issues/344)).
1419

_ext/eclipse-wtp/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ dependencies {
7272
compile "org.eclipse.platform:org.eclipse.core.filesystem:${VER_ECLISPE_EFS}"
7373
// Required by org.eclipse.wst.xsd.core
7474
compile "org.eclipse.xsd:org.eclipse.xsd:${VER_ECLISPE_XSD}"
75+
76+
testCompile("org.slf4j:slf4j-simple:${VER_SLF4J}")
7577
}
7678

7779
jar {

_ext/eclipse-wtp/gradle.properties

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Versions correspond to the Eclipse-WTP version used for the fat-JAR.
22
# See https://www.eclipse.org/webtools/ for further information about Eclipse-WTP versions.
33
# Patch version can be incremented independently for backward compatible patches of this library.
4-
ext_version=3.9.8
4+
ext_version=3.10.0
55
ext_artifactId=spotless-eclipse-wtp
66
ext_description=Eclipse's WTP formatters bundled for Spotless
77

@@ -12,11 +12,14 @@ ext_group=com.diffplug.spotless
1212
ext_VER_JAVA=1.8
1313

1414
# Compile
15-
VER_ECLIPSE_WTP=oxygen
16-
VER_SPOTLESS_ECLISPE_BASE=[3.0.0,4.0.0[
15+
VER_ECLIPSE_WTP=photon
16+
VER_SPOTLESS_ECLISPE_BASE=[3.1.0,4.0.0[
1717
VER_IBM_ICU=[61,62[
1818
VER_ECLISPE_EMF=[2.12.0,3.0.0[
1919
VER_ECLISPE_PLATFORM=[3.6.0,4.0.0[
2020
VER_ECLISPE_JFACE=[3.12.0,4.0.0[
2121
VER_ECLISPE_EFS=[1.6.0,2.0.0[
22-
VER_ECLISPE_XSD=[2.12.0,3.0.0[
22+
VER_ECLISPE_XSD=[2.12.0,3.0.0[
23+
24+
# Provided dependencies
25+
VER_SLF4J=[1.6,2.0[

_ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/EclipseHtmlFormatterStepImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.diffplug.spotless.extra.eclipse.wtp.html.JsRegionProcessor;
4848
import com.diffplug.spotless.extra.eclipse.wtp.html.StructuredDocumentProcessor;
4949
import com.diffplug.spotless.extra.eclipse.wtp.sse.CleanupStep;
50+
import com.diffplug.spotless.extra.eclipse.wtp.sse.PreventExternalURIResolverExtension;
5051
import com.diffplug.spotless.extra.eclipse.wtp.sse.SpotlessPreferences;
5152

5253
/** Formatter step which calls out to the Eclipse HTML cleanup and formatter. */

_ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/EclipseJsFormatterStepImpl.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ public class EclipseJsFormatterStepImpl {
8484
public EclipseJsFormatterStepImpl(Properties properties) throws Exception {
8585
SpotlessEclipseFramework.setup(
8686
JS_CORE_CONFIG,
87-
config -> config.applyDefault(),
87+
config -> {
88+
config.applyDefault();
89+
config.useSlf4J(this.getClass().getPackage().getName());
90+
},
8891
plugins -> {
8992
plugins.applyDefault();
9093
// The JS core uses EFS for determination of temporary storage location

_ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/EclipseXmlFormatterStepImpl.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.osgi.framework.BundleException;
4848

4949
import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseFramework;
50+
import com.diffplug.spotless.extra.eclipse.wtp.sse.PreventExternalURIResolverExtension;
5051
import com.diffplug.spotless.extra.eclipse.wtp.sse.SpotlessPreferences;
5152

5253
/** Formatter step which calls out to the Eclipse XML formatter. */
@@ -58,7 +59,8 @@ public class EclipseXmlFormatterStepImpl {
5859
private final INodeAdapterFactory xmlAdapterFactory;
5960

6061
public EclipseXmlFormatterStepImpl(Properties properties) throws Exception {
61-
setupFramework(SpotlessPreferences.doResolveExternalURI(properties));
62+
boolean resolveExternalURI = Boolean.parseBoolean(properties.getProperty(SpotlessPreferences.RESOLVE_EXTERNAL_URI, "false"));
63+
setupFramework(resolveExternalURI);
6264
preferences = PREFERENCE_FACTORY.create(properties);
6365
formatter = new DefaultXMLPartitionFormatter();
6466
//The adapter factory maintains the common CMDocumentCache
@@ -67,6 +69,10 @@ public EclipseXmlFormatterStepImpl(Properties properties) throws Exception {
6769

6870
private static void setupFramework(boolean resolveExternalURI) throws BundleException {
6971
if (SpotlessEclipseFramework.setup(
72+
config -> {
73+
config.applyDefault();
74+
config.useSlf4J(EclipseXmlFormatterStepImpl.class.getPackage().getName());
75+
},
7076
plugins -> {
7177
plugins.applyDefault();
7278
//The WST XML formatter

_ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/sse/CleanupStep.java

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ protected CleanupStep(T processor, Consumer<SpotlessEclipseCoreConfig> core, Con
9292
config.add(IContentTypeManager.class, new ContentTypeManager(processor));
9393
//The preference lookup via the ContentTypeManager, requires a preference service
9494
config.add(IPreferencesService.class, PreferencesService.getDefault());
95+
config.useSlf4J(this.getClass().getPackage().getName());
9596
},
9697
plugins -> {
9798
plugins.applyDefault();

_ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/PreventExternalURIResolverExtension.java _ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/sse/PreventExternalURIResolverExtension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.diffplug.spotless.extra.eclipse.wtp;
16+
package com.diffplug.spotless.extra.eclipse.wtp.sse;
1717

1818
import org.eclipse.core.resources.IFile;
1919
import org.eclipse.emf.common.util.URI;

_ext/eclipse-wtp/src/main/java/com/diffplug/spotless/extra/eclipse/wtp/sse/SpotlessPreferences.java

-13
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,6 @@ public static Properties configurePluginPreferences(Plugin plugin, Properties ne
6565
return oldValues;
6666
}
6767

68-
public static boolean doResolveExternalURI(Properties properties) {
69-
Object obj = properties.get(RESOLVE_EXTERNAL_URI);
70-
if (null != obj) {
71-
if (obj instanceof Boolean) {
72-
return (Boolean) obj;
73-
}
74-
if (obj instanceof String) {
75-
return ((String) obj).equalsIgnoreCase("true");
76-
}
77-
}
78-
return false;
79-
}
80-
8168
public static void configureCatalog(final Properties config) {
8269
Optional<File> catalog = getCatalogConfig(config);
8370
Catalog defaultCatalog = getDefaultCatalog();

_ext/eclipse-wtp/src/main/resources/plugin.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!-- "low priority' might be missleading. In fact the result of this extension overrules all other -->
88
<!-- physical resolvers with higher priority. -->
99
<extension point="org.eclipse.wst.common.uriresolver.resolverExtensions">
10-
<resolverExtension stage="physical" priority="low" class="com.diffplug.spotless.extra.eclipse.wtp.PreventExternalURIResolverExtension">
10+
<resolverExtension stage="physical" priority="low" class="com.diffplug.spotless.extra.eclipse.wtp.sse.PreventExternalURIResolverExtension">
1111
</resolverExtension>
1212
</extension>
1313
</plugin>

0 commit comments

Comments
 (0)