Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate _ext project version bumps #1054

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 24 additions & 94 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ anchors:
run:
name: set git origin to https
command: git remote set-url --push origin https://github.com/diffplug/spotless

checkout_ifgitdiff: &checkout_ifgitdiff
run:
name: checkout ifgitdiff here
command: git checkout -B ifgitdiff HEAD
test_nomaven: &test_nomaven
steps:
- checkout
Expand Down Expand Up @@ -202,6 +205,16 @@ jobs:
- run:
name: gradlew :plugin-maven:changelogPush
command: ./gradlew :plugin-maven:changelogPush -Prelease=true --stacktrace
test_ext:
<< : *env_gradle
steps:
- checkout
- *restore_cache_wrapper
- *restore_cache_deps
- *set_git_origin_to_https
- run:
name: gradlew -Pcom.diffplug.spotless.include.ext=ifgitdiff ext_test
command: ./gradlew -Pcom.diffplug.spotless.include.ext=ifgitdiff ext_test
ext_changelog_print:
<< : *env_gradle
steps:
Expand All @@ -210,64 +223,26 @@ jobs:
- *restore_cache_deps
- *set_git_origin_to_https
- run:
name: gradlew -Pcom.diffplug.spotless.include.ext.nop2=true changelogPrint
command: ./gradlew -Pcom.diffplug.spotless.include.ext.nop2=true changelogPrint
ext_do_release_base:
<< : *env_gradle
steps:
- checkout
- *restore_cache_wrapper
- *restore_cache_deps
- *set_git_origin_to_https
- run:
name: gradlew :eclipse-base:changelogPush
command: ./gradlew -Pcom.diffplug.spotless.include.ext.nop2=true :eclipse-base:changelogPush -Prelease=true --stacktrace
ext_do_release_jdt:
name: gradlew -Pcom.diffplug.spotless.include.ext=ifgitdiff ext_changelogPrint
command: ./gradlew -Pcom.diffplug.spotless.include.ext=ifgitdiff ext_changelogPrint
ext_do_release:
<< : *env_gradle
steps:
- checkout
- *restore_cache_wrapper
- *restore_cache_deps
- *set_git_origin_to_https
- *checkout_ifgitdiff
- run:
name: gradlew :eclipse-jdt:changelogPush
command: ./gradlew -Pcom.diffplug.spotless.include.ext.nop2=true :eclipse-jdt:changelogPush -Prelease=true --stacktrace
ext_do_release_cdt:
<< : *env_gradle
steps:
- checkout
- *restore_cache_wrapper
- *restore_cache_deps
- *set_git_origin_to_https
- run:
name: gradlew :eclipse-cdt:changelogPush
command: ./gradlew -Pcom.diffplug.spotless.include.ext.cdt=true :eclipse-cdt:changelogPush -Prelease=true --stacktrace
ext_do_release_groovy:
<< : *env_gradle
steps:
- checkout
- *restore_cache_wrapper
- *restore_cache_deps
- *set_git_origin_to_https
- run:
name: gradlew :eclipse-groovy:changelogPush
command: ./gradlew -Pcom.diffplug.spotless.include.ext.groovy=true :eclipse-groovy:changelogPush -Prelease=true --stacktrace
ext_do_release_wtp:
<< : *env_gradle
steps:
- checkout
- *restore_cache_wrapper
- *restore_cache_deps
- *set_git_origin_to_https
- run:
name: gradlew :eclipse-wtp:changelogPush
command: ./gradlew -Pcom.diffplug.spotless.include.ext.wtp=true :eclipse-wtp:changelogPush -Prelease=true --stacktrace
name: gradlew -Pcom.diffplug.spotless.include.ext=ifgitdiff ext_changelogPush -Prelease=true
command: ./gradlew -Pcom.diffplug.spotless.include.ext=ifgitdiff ext_changelogPush -Prelease=true --stacktrace

workflows:
version: 2
assemble_and_test:
jobs:
- test_windows
- test_ext
- assemble_testClasses
- test_justmaven_11:
requires:
Expand Down Expand Up @@ -329,57 +304,12 @@ workflows:
filters:
branches:
only: main
- ext_release_base:
type: approval
requires:
- ext_changelog_print
- ext_do_release_base:
requires:
- ext_release_base
context:
- SonatypeDeploy
- ext_release_jdt:
type: approval
requires:
- ext_changelog_print
- ext_do_release_jdt:
requires:
- ext_release_jdt
context:
- SonatypeDeploy
- ext_release_cdt:
type: approval
requires:
- ext_changelog_print
- ext_do_release_cdt:
filters:
branches:
only: main
requires:
- ext_release_cdt
context:
- SonatypeDeploy
- ext_release_groovy:
- ext_release:
type: approval
requires:
- ext_changelog_print
- ext_do_release_groovy:
filters:
branches:
only: main
requires:
- ext_release_groovy
context:
- SonatypeDeploy
- ext_release_wtp:
type: approval
requires:
- ext_changelog_print
- ext_do_release_wtp:
filters:
branches:
only: main
- ext_do_release:
requires:
- ext_release_wtp
- ext_release
context:
- SonatypeDeploy
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ 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.

You can also do `gradlew -Pcom.diffplug.spotless.include.ext=ifgitdiff` in which case each `_ext` project which has changes in the worktree relative to `origin/main` will be configured.

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

The gist of it is that you will have to:
Expand Down
27 changes: 25 additions & 2 deletions _ext/eclipse-cdt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,32 @@

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 [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
`_ext` projects.
## Build

The `_ext` projects are disabled per default. [CONTRIBUTING.md](../../CONTRIBUTING.md)
describes how to enable them.

## License

Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1.

## Bump version

Most Eclipse updates do not require code or test modifications. But be aware that this project
needs to access internal methods of the CDT plugin. Hence, the build step may fail
after upgrading the Eclipse version.

1. Update the version information in [projects properties](gradle.properties), e.g.
* `VER_ECLIPSE`: Eclipse version (see [Eclipse project](https://projects.eclipse.org/projects/eclipse/governance))
* `VER_ECLIPSE_CDT`: CDT version (see [CDT downloads](https://www.eclipse.org/cdt/downloads.php))

2. Update the [change log](CHANGES.md).

3. This project creates a M2 artifact, containing classes from Eclipse P2 artifacts. Hence a new project version is published for each new Eclipse version. Build and publish the new version via [Circle CI](https://app.circleci.com/pipelines/github/diffplug spotless).

Once the new version is [available on maven central](https://search.maven.org/artifact/com.diffplug.spotless/spotless-eclipse-cdt), prepare the integration of the new version
into the next Spotless release.

1. Execute `gradlew :eclipse-cdt:generateLibExtraLockFile`.
2. Update the default version in the `EclipseCdtFormatterStep` class of `lib-extra`.
3. Check your changes by running `gradlew :lib-extra:build`.
3 changes: 2 additions & 1 deletion _ext/eclipse-cdt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ext {
'org.eclipse.cdt.core':'+', // CodeFormatter and related
]

stepLockFileComment = "Spotless formatter based on CDT version ${VER_ECLIPSE_CDT} (see https://www.eclipse.org/cdt/)"
}

apply from: rootProject.file('_ext/gradle/update-lockfile.gradle')
Expand Down Expand Up @@ -36,5 +37,5 @@ dependencies {
//////////
sourceSets {
// Use JAR file with all resources for Eclipse-CDT integration-tests
test.runtimeClasspath = jar.outputs.files + sourceSets.test.output + sourceSets.test.compileClasspath
test.runtimeClasspath = jar.outputs.files + sourceSets.test.output + sourceSets.test.compileClasspath + sourceSets.test.runtimeClasspath
}
25 changes: 25 additions & 0 deletions _ext/eclipse-cdt/gradle.lockfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.diffplug.spotless:spotless-eclipse-base:3.5.2=compileClasspath
com.github.spotbugs:spotbugs-annotations:4.5.0=compileClasspath
com.google.code.findbugs:jsr305:3.0.2=compileClasspath
com.ibm.icu:icu4j:67.1=compileClasspath
net.jcip:jcip-annotations:1.0=compileClasspath
org.eclipse.platform:org.eclipse.core.commands:3.10.100=compileClasspath
org.eclipse.platform:org.eclipse.core.contenttype:3.8.100=compileClasspath
org.eclipse.platform:org.eclipse.core.filebuffers:3.7.100=compileClasspath
org.eclipse.platform:org.eclipse.core.filesystem:1.9.200=compileClasspath
org.eclipse.platform:org.eclipse.core.jobs:3.12.0=compileClasspath
org.eclipse.platform:org.eclipse.core.resources:3.16.0=compileClasspath
org.eclipse.platform:org.eclipse.core.runtime:3.24.0=compileClasspath
org.eclipse.platform:org.eclipse.equinox.app:1.6.100=compileClasspath
org.eclipse.platform:org.eclipse.equinox.common:3.15.100=compileClasspath
org.eclipse.platform:org.eclipse.equinox.preferences:3.9.100=compileClasspath
org.eclipse.platform:org.eclipse.equinox.registry:3.11.100=compileClasspath
org.eclipse.platform:org.eclipse.jface.text:3.19.0=compileClasspath
org.eclipse.platform:org.eclipse.jface:3.24.0=compileClasspath
org.eclipse.platform:org.eclipse.osgi:3.17.100=compileClasspath
org.eclipse.platform:org.eclipse.text:3.12.0=compileClasspath
org.slf4j:slf4j-api:1.8.0-beta4=compileClasspath
empty=
1 change: 1 addition & 0 deletions _ext/eclipse-cdt/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description=Eclipse's CDT C/C++ formatter bundled for Spotless
VER_JAVA=11

# Compile dependencies
VER_ECLIPSE=4.22
VER_ECLIPSE_CDT=10.5
VER_SPOTLESS_ECLISPE_BASE=[3.5.0,4.0.0[
VER_ECLISPE_JFACE=[3.18.0,4.0.0[
Expand Down
27 changes: 25 additions & 2 deletions _ext/eclipse-groovy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,32 @@ 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 [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
`_ext` projects.
The `_ext` projects are disabled per default. [CONTRIBUTING.md](../../CONTRIBUTING.md)
describes how to enable them.

## License

Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1.

## Bump version

Most Eclipse updates do not require code or test modifications. But be aware that this project
needs to access internal methods of the Groovy-Eclipse plugin. Hence, the build step may fail
after upgrading the Eclipse version.

1. Update the version information in [projects properties](gradle.properties), e.g.
* `VER_ECLIPSE`: Eclipse version (see [Eclipse project](https://projects.eclipse.org/projects/eclipse/governance))
* `VER_GRECLIPSE`: Groovy-Eclipse version (see [Groovy-Eclipse project](https://github.com/groovy/groovy-eclipse/wiki#news))
* `VER_GROOVY`: The groovy JAR is part of the org.codehaus.groovy JAR. Either download the P2 repository from `dist.springsource.org`, or have a look at the [Groovy-Eclipse about page](https://github.com/groovy/groovy-eclipse/blob/master/base/org.codehaus.groovy40/about.html), which also lists the current version in the *Third Party Content* section.
* `VAR_GRECLIPSE_JDT_PATCH`: The P2 repository contains two JDT JARs, one original and a patched one for groovy. Both are only distinguished by their version. Assure that you use the patched version, which contains the Groovy-Eclipse extended version string (timestamp, year, ...). Either download the P2 repository from `dist.springsource.org`, or have a look at the [Groovy-Eclipse release notes](https://github.com/groovy/groovy-eclipse/wiki#news), which lists the Groovy-Eclipse extended version string for the org.codehaus.groovy update sites at the bottom of the page.

2. Update the [change log](CHANGES.md).

3. This project creates a M2 artifact, containing classes from Eclipse P2 artifacts. Hence a new project version is published for each new Eclipse version. Build and publish the new version via [Circle CI](https://app.circleci.com/pipelines/github/diffplug spotless).

Once the new version is [available on maven central](https://search.maven.org/artifact/com.diffplug.spotless/spotless-eclipse-groovy), prepare the integration of the new version
into the next Spotless release.

1. Execute `gradlew :eclipse-groovy:generateLibExtraLockFile`.
2. Update the default version in the `GrEclipseFormatterStep` class of `lib-extra`.
3. Check your changes by running `gradlew :lib-extra:build`.
3 changes: 2 additions & 1 deletion _ext/eclipse-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ext {
'**/nlcl'
]

stepLockFileComment = "Spotless formatter based on Groovy-Eclipse version ${VER_GRECLIPSE} (see https://github.com/groovy/groovy-eclipse/releases)"
}

apply from: rootProject.file('_ext/gradle/update-lockfile.gradle')
Expand All @@ -52,5 +53,5 @@ dependencies {
//////////
sourceSets {
// Use JAR file with all resources for Eclipse-Groovy integration-tests
test.runtimeClasspath = jar.outputs.files + sourceSets.test.output + sourceSets.test.compileClasspath
test.runtimeClasspath = jar.outputs.files + sourceSets.test.output + sourceSets.test.compileClasspath + sourceSets.test.runtimeClasspath
}
23 changes: 23 additions & 0 deletions _ext/eclipse-groovy/gradle.lockfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.diffplug.spotless:spotless-eclipse-base:3.5.2=compileClasspath
com.github.spotbugs:spotbugs-annotations:4.5.0=compileClasspath
com.google.code.findbugs:jsr305:3.0.2=compileClasspath
net.jcip:jcip-annotations:1.0=compileClasspath
org.eclipse.platform:org.eclipse.core.commands:3.10.100=compileClasspath
org.eclipse.platform:org.eclipse.core.contenttype:3.8.0=compileClasspath
org.eclipse.platform:org.eclipse.core.filesystem:1.9.100=compileClasspath
org.eclipse.platform:org.eclipse.core.jobs:3.12.0=compileClasspath
org.eclipse.platform:org.eclipse.core.resources:3.15.100=compileClasspath
org.eclipse.platform:org.eclipse.core.runtime:3.23.0=compileClasspath
org.eclipse.platform:org.eclipse.equinox.app:1.6.0=compileClasspath
org.eclipse.platform:org.eclipse.equinox.common:3.15.0=compileClasspath
org.eclipse.platform:org.eclipse.equinox.preferences:3.9.0=compileClasspath
org.eclipse.platform:org.eclipse.equinox.registry:3.11.0=compileClasspath
org.eclipse.platform:org.eclipse.jface.text:3.18.100=compileClasspath
org.eclipse.platform:org.eclipse.jface:3.23.0=compileClasspath
org.eclipse.platform:org.eclipse.osgi:3.17.0=compileClasspath
org.eclipse.platform:org.eclipse.text:3.12.0=compileClasspath
org.slf4j:slf4j-api:1.8.0-beta4=compileClasspath
empty=
1 change: 0 additions & 1 deletion _ext/eclipse-groovy/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ VER_SPOTLESS_ECLISPE_BASE=[3.4.2,4.0.0[
VER_ECLISPE_JFACE=[3.15.300,4.0.0[
VER_GRECLIPSE=4.3.0
VER_GROOVY=4.0.0
# Use org.eclipse.jdt.core patched for Groovy-Eclipse
VAR_GRECLIPSE_JDT_PATCH=3.27.0.v202109301420-e2109-RELEASE
19 changes: 17 additions & 2 deletions _ext/eclipse-jdt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,24 @@ 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 [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable
`_ext` projects.
## Build

The `_ext` projects are disabled per default. [CONTRIBUTING.md](../../CONTRIBUTING.md)
describes how to enable them.

## License

Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1.

## Bump version

Most Eclipse updates do not require code or test modifications. But be aware that this project
needs to access internal methods of the JDT plugin. Hence, the build step may fail
after upgrading the Eclipse version.

1. Update the version information in [projects properties](gradle.properties), e.g. only `VER_ECLIPSE` (see [Eclipse project](https://projects.eclipse.org/projects/eclipse/governance)).
2. Build with latest Eclipse artifacts and update the dependency locks (`gradlew --write-locks :eclipse-jdt:build`).
3. Prepare the integration of the new version into the next Spotless release:
* Execute `gradlew :eclipse-jdt:generateLibExtraLockFile`.
* Update the default version in the `EclipseJdtFormatterStep` class of `lib-extra`.
* Check your changes by running `gradlew :lib-extra:build`.
10 changes: 6 additions & 4 deletions _ext/eclipse-jdt/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apply from: rootProject.file('_ext/gradle/update-lockfile.gradle')
apply from: rootProject.file('_ext/gradle/java-setup.gradle')
apply from: rootProject.file('gradle/java-publish.gradle')

ext {
developers = [
fvgh: [ name: 'Frank Vennemeyer', email: '[email protected]' ],
nedtwigg: [ name: 'Ned Twigg', email: '[email protected]' ],
]

stepLockFileComment = "Spotless formatter based on JDT version ${VER_ECLIPSE} (see https://projects.eclipse.org/projects/eclipse.jdt)"
}

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

dependencies {
implementation "com.diffplug.spotless:spotless-eclipse-base:${VER_SPOTLESS_ECLISPE_BASE}"
implementation("org.eclipse.jdt:org.eclipse.jdt.core:${VER_ECLIPSE_JDT_CORE}") {
Expand Down
Loading