Skip to content

Commit

Permalink
Issue 483 (#519)
Browse files Browse the repository at this point in the history
Gradle 4 `_ext` projects converted to sub-projects of root supporting Gradle 6. GOOMPH updated to version 3.21.0.
  • Loading branch information
fvgh authored Feb 3, 2020
1 parent e870e78 commit c007dba
Show file tree
Hide file tree
Showing 28 changed files with 177 additions and 243 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gradle-app.setting
!gradle-wrapper.jar

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

### Eclipse ###
*.pydevproject
Expand Down
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@ Here's a checklist for creating a new step for Spotless:
- [ ] Test class has test methods to verify behavior.
- [ ] Test class has a test method `equality()` which tests equality using `StepEqualityTester` (see existing methods for examples).

## How to enable the _ext projects

The `_ext` projects are disabled per default, since:

* some of the projects perform vasts downloads at configuration time

* the downloaded content may change on server side and break CI builds


The `_ext` can be activated via the root project property `com.diffplug.spotless.include_ext`.

Activate the the property via command line, like for example:

```
gradlew -Pcom.diffplug.spotless.include.ext=true build
```

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.

## How to add a new plugin for a build system

The gist of it is that you will have to:
Expand Down
9 changes: 0 additions & 9 deletions _ext/BUILD_INSTRUCTIONS.md

This file was deleted.

3 changes: 2 additions & 1 deletion _ext/eclipse-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ is included in your formatter fat JAR, the directory structure should be:

## Build

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

## License

Expand Down
4 changes: 2 additions & 2 deletions _ext/eclipse-base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply from: rootProject.file('../gradle/java-setup.gradle')
apply from: rootProject.file('../gradle/java-publish.gradle')
apply from: rootProject.file('_ext/gradle/java-setup.gradle')
apply from: rootProject.file('_ext/gradle/java-publish.gradle')

ext {
developers = [
Expand Down
15 changes: 3 additions & 12 deletions _ext/eclipse-base/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Mayor versions correspond to the supported Eclipse core version.
# Minor version is incremented for features or incompatible changes (including changes to supported dependency versions).
# Patch version is incremented for backward compatible patches of this library.
ext_version=3.2.1
ext_artifactId=spotless-eclipse-base
ext_description=Eclipse bundle controller and services for Spotless

ext_org=diffplug
ext_group=com.diffplug.spotless

# Build requirements
ext_VER_JAVA=1.8
version=3.2.1
artifactId=spotless-eclipse-base
description=Eclipse bundle controller and services for Spotless

# Compile dependencies
VER_ECLIPSE_CORE_RESOURCES=[3.13.400,4.0.0[

# Provided dependencies
VER_SLF4J=[1.6,2.0[
3 changes: 2 additions & 1 deletion _ext/eclipse-cdt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

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.

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

## License

Expand Down
11 changes: 6 additions & 5 deletions _ext/eclipse-cdt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ ext {
]

p2Repository = "https://download.eclipse.org/tools/cdt/releases/${VER_ECLIPSE_CDT}"

p2Dependencies = [
'org.eclipse.cdt.core':'+', // CodeFormatter and related
]
]

}

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


dependencies {
Expand All @@ -25,7 +26,7 @@ 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}"

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

Expand Down
14 changes: 3 additions & 11 deletions _ext/eclipse-cdt/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
# 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.9.0
ext_artifactId=spotless-eclipse-cdt
ext_description=Eclipse's CDT C/C++ formatter bundled for Spotless
ext_org=diffplug
ext_group=com.diffplug.spotless

# Build requirements
ext_VER_JAVA=1.8
version=9.9.0
artifactId=spotless-eclipse-cdt
description=Eclipse's CDT C/C++ formatter bundled for Spotless

# Compile dependencies
VER_ECLIPSE_CDT=9.9
VER_SPOTLESS_ECLISPE_BASE=[3.2.0,4.0.0[
VER_ECLISPE_JFACE=[3.15.300,4.0.0[
VER_ECLISPE_PLATFORM=[3.6.700,4.0.0[
VER_IBM_ICU=[61,62[

# Provided dependencies
VER_SLF4J=[1.6,2.0[
3 changes: 2 additions & 1 deletion _ext/eclipse-groovy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ To fix this, we publish Groovy-Eclipse's formatter and all its dependencies, alo

## Build

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

## License

Expand Down
26 changes: 16 additions & 10 deletions _ext/eclipse-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ ext {
developers = [
fvgh: [ name: 'Frank Vennemeyer', email: '[email protected]' ],
]

p2Repository = "https://dist.springsource.org/release/GRECLIPSE/${VER_GRECLIPSE}/e${VER_ECLIPSE}"

p2Dependencies = [
p2Dependencies = [
'org.codehaus.groovy.eclipse.refactoring':'+', // GroovyFormatter and related

// The following lists does not reflect the complete transitive required packages, but
// the once used during code formatting
'org.codehaus.groovy':'+', // Groovy compiler patches supporting use within GrEclipse and Groovy itself
Expand All @@ -18,18 +18,24 @@ ext {

internalJars = [
//Jars included by org.codehaus.groovy
"**/groovy-${VER_GROOVY}-indy", // Use Groovy compiler compatible with GrEclipse instead of localGroovy
'**/groovy-eclipse', // Patches/Overrides some of the Groovy compiler classes
'**/eclipse-trace', // Provides logging capabilities for groovy-eclipse

//////////////////////////////////////////////////////////////////////////
// Use Groovy compiler compatible with GrEclipse instead of localGroovy
"**/groovy-${VER_GROOVY}-indy",
// Patches/Overrides some of the Groovy compiler classes
'**/groovy-eclipse',
// Provides logging capabilities for groovy-eclipse
'**/eclipse-trace',
//Jars included by org.eclipse.jdt.groovy.core
'**/nlcl' //Non locking class loader used by groovy compiler
//////////////////////////////////////////////////////////////////////////
//Non locking class loader used by groovy compiler
'**/nlcl'
]

}

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

dependencies {
compile "com.diffplug.spotless:spotless-eclipse-base:${VER_SPOTLESS_ECLISPE_BASE}"
Expand Down
15 changes: 3 additions & 12 deletions _ext/eclipse-groovy/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
# Versions correspond to the Groovy-Eclipse version used for the fat-JAR.
# See https://github.com/groovy/groovy-eclipse/releases for further information about Groovy-Eclipse versions.
# Patch version can be incremented independently for backward compatible patches of this library.
ext_version=3.5.0
ext_artifactId=spotless-eclipse-groovy
ext_description=Groovy Eclipse's formatter bundled for Spotless

ext_org=diffplug
ext_group=com.diffplug.spotless

# Build requirements
ext_VER_JAVA=1.8
version=3.5.0
artifactId=spotless-eclipse-groovy
description=Groovy Eclipse's formatter bundled for Spotless

# Compile
VER_ECLIPSE=4.13
VER_SPOTLESS_ECLISPE_BASE=[3.2.0,4.0.0[
VER_ECLISPE_JFACE=[3.15.300,4.0.0[
VER_GRECLIPSE=3.5.0
VER_GROOVY=3.0.0

# Provided dependencies
VER_SLF4J=[1.6,2.0[
3 changes: 2 additions & 1 deletion _ext/eclipse-jdt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Eclipse JDT and its dependencies require a large amount of byte code.
Hence they should not be directly be required by the Spotless, but only be requested in case
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.

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

## License

Expand Down
5 changes: 3 additions & 2 deletions _ext/eclipse-jdt/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply from: rootProject.file('../gradle/java-setup.gradle')
apply from: rootProject.file('../gradle/java-publish.gradle')
apply from: rootProject.file('_ext/gradle/update-lockfile.gradle')
apply from: rootProject.file('_ext/gradle/java-setup.gradle')
apply from: rootProject.file('_ext/gradle/java-publish.gradle')

ext {
developers = [
Expand Down
12 changes: 3 additions & 9 deletions _ext/eclipse-jdt/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Mayor/Minor versions correspond to the minimum Eclipse version supported/tested.
# Patch version is incremented for backward compatible patches of this library.
ext_version=4.12.0
ext_artifactId=spotless-eclipse-jdt
ext_description=Eclipse's JDT formatter bundled for Spotless

ext_org=diffplug
ext_group=com.diffplug.spotless

# Build requirements
ext_VER_JAVA=1.8
version=4.12.0
artifactId=spotless-eclipse-jdt
description=Eclipse's JDT formatter bundled for Spotless

# Compile
VER_ECLIPSE_JDT_CORE=[3.12.0,4.0.0[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ public void defaultFormat() throws Throwable {
* Spotless anyhow provides possibilities to change exception behavior.
* Furthermore it is assumed that Spotless runs on compile-able code.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void invalidFormat() throws Throwable {
format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
try {
String output = format(FORMATTED.replace("void hello() {", "void hello() "), config -> {});
assertTrue("Incomplete Java not formatted on best effort basis.", output.contains("void hello() " + LINE_DELIMITER));
} catch (IndexOutOfBoundsException e) {
/*
* Some JDT versions throw exception, but this changed again in later versions.
* Anyhow, exceptions are acceptable, since Spotless should fromat valid Java code.
*/
}
}

@Test
Expand Down
3 changes: 2 additions & 1 deletion _ext/eclipse-wtp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

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.

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

## License

Expand Down
Loading

0 comments on commit c007dba

Please sign in to comment.