diff --git a/CHANGES.md b/CHANGES.md index 1e9b0c7a89..f6201a1c8e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,8 @@ You might be looking for: ### Version 1.25.0-SNAPSHOT - TBD (javadoc [lib](https://diffplug.github.io/spotless/javadoc/spotless-lib/snapshot/) [lib-extra](https://diffplug.github.io/spotless/javadoc/spotless-lib-extra/snapshot/), [snapshot repo](https://oss.sonatype.org/content/repositories/snapshots/com/diffplug/spotless/)) +* Eclipse-based formatters used to leave temporary files around ([#447](https://github.com/diffplug/spotless/issues/447)). This is now fixed, but only for eclipse 4.12+, no back-port to older Eclipse formatter versions is planned. ([#451](https://github.com/diffplug/spotless/issues/451)) + ### Version 1.24.1 - August 12th 2018 (javadoc [lib](https://diffplug.github.io/spotless/javadoc/spotless-lib/1.24.1/) [lib-extra](https://diffplug.github.io/spotless/javadoc/spotless-lib-extra/1.24.1/), artifact [lib]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib), [lib-extra]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib-extra))) * Fixes class loading issue with Java 9+ ([#426](https://github.com/diffplug/spotless/pull/426)). diff --git a/_ext/BUILD_INSTRUCTIONS.md b/_ext/BUILD_INSTRUCTIONS.md new file mode 100644 index 0000000000..377daf9ade --- /dev/null +++ b/_ext/BUILD_INSTRUCTIONS.md @@ -0,0 +1,9 @@ + +The `_ext` builds are currently tested only with gradle `4.4.1`. They are known not to work for the current wrapper version. + +To install the correct version using [sdkman](https://sdkman.io/install): + +- `sdk install gradle 4.4.1` +- `sdk default gradle 4.4.1` + +Then you can do `gradle -b _ext/{DIR}/build.gradle publish`. `gradlew` will not work. diff --git a/_ext/eclipse-base/CHANGES.md b/_ext/eclipse-base/CHANGES.md index 815f29e320..eec844b2a0 100644 --- a/_ext/eclipse-base/CHANGES.md +++ b/_ext/eclipse-base/CHANGES.md @@ -1,5 +1,9 @@ # spotless-eclipse-base +### Version 3.2.1 - September 3rd 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-base))) + +* Fixed deletion of temporary workspace. ([#447](https://github.com/diffplug/spotless/issues/447)) + ### Version 3.2.0 - June 30th 2019 ([artifact]([jcenter](https://bintray.com/diffplug/opensource/spotless-eclipse-base))) * Added support of Eclipse 4.12 framework wiring. ([#413](https://github.com/diffplug/spotless/issues/413)) diff --git a/_ext/eclipse-base/README.md b/_ext/eclipse-base/README.md index 9f038db79a..6b8ac83728 100644 --- a/_ext/eclipse-base/README.md +++ b/_ext/eclipse-base/README.md @@ -53,13 +53,9 @@ is included in your formatter fat JAR, the directory structure should be: ``` - ## Build -``` -gradlew -b _ext/eclipse-base/build.gradle publish -``` - +To publish a new version, update the `_ext/eclipse-base/gradle.properties` appropriately and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS). ## License diff --git a/_ext/eclipse-base/gradle.properties b/_ext/eclipse-base/gradle.properties index 6737e08912..aebbc9672a 100644 --- a/_ext/eclipse-base/gradle.properties +++ b/_ext/eclipse-base/gradle.properties @@ -1,7 +1,7 @@ # 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.0 +ext_version=3.2.1 ext_artifactId=spotless-eclipse-base ext_description=Eclipse bundle controller and services for Spotless diff --git a/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/BundleController.java b/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/BundleController.java index 3956b2d30c..4f6094aaf3 100644 --- a/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/BundleController.java +++ b/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/osgi/BundleController.java @@ -20,6 +20,7 @@ import java.util.Map; import java.util.function.Function; +import org.eclipse.osgi.internal.location.LocationHelper; import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -48,9 +49,13 @@ public final class BundleController implements StaticBundleContext { @SuppressWarnings("deprecation") public BundleController() throws BundleException { + //OSGI locks are not required, since this framework does not allow changes after initialization. + System.setProperty(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NONE); + this.properties = new HashMap(); //Don't activate all plugin bundles. Activation is triggered by this controller where needed. properties.put(org.eclipse.core.internal.runtime.InternalPlatform.PROP_ACTIVATE_PLUGINS, Boolean.toString(false)); + /* * Used to set-up an internal member of the Eclipse runtime FindSupport, * which is used during resources look-up from different version of bundles. diff --git a/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/service/TemporaryLocation.java b/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/service/TemporaryLocation.java index 229d21b1bb..9b0ffd5088 100644 --- a/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/service/TemporaryLocation.java +++ b/_ext/eclipse-base/src/main/java/com/diffplug/spotless/extra/eclipse/base/service/TemporaryLocation.java @@ -15,6 +15,7 @@ */ package com.diffplug.spotless.extra.eclipse.base.service; +import java.io.File; import java.io.IOError; import java.io.IOException; import java.net.URISyntaxException; @@ -22,6 +23,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Comparator; import org.eclipse.osgi.service.datalocation.Location; @@ -42,14 +44,28 @@ private TemporaryLocation(Location parent, URL defaultValue) { private static URL createTemporaryDirectory() { try { - Path locationPath = Files.createTempDirectory(TEMP_PREFIX); - locationPath.toFile().deleteOnExit(); - return locationPath.toUri().toURL(); + Path location = Files.createTempDirectory(TEMP_PREFIX); + deleteDirectoryRecursivelyOnExit(location); + location.toFile().deleteOnExit(); + return location.toUri().toURL(); } catch (IOException e) { throw new IOError(e); } } + private static void deleteDirectoryRecursivelyOnExit(Path location) { + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + Files.walk(location) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } catch (IOException e) { + //At shutdown everything is just done on best-efforts basis + } + })); + } + @Override public boolean allowsDefault() { return false; diff --git a/_ext/eclipse-cdt/README.md b/_ext/eclipse-cdt/README.md index a2f93486ce..1719323872 100644 --- a/_ext/eclipse-cdt/README.md +++ b/_ext/eclipse-cdt/README.md @@ -2,10 +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 run this from the root directory: +To publish a new version, update the `_ext/eclipse-cdt/gradle.properties` appropriately and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS). -``` -gradlew -b _ext/eclipse-cdt/build.gradle publish -``` +## License Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1. diff --git a/_ext/eclipse-groovy/README.md b/_ext/eclipse-groovy/README.md index 8850ecd75c..58e6a01342 100644 --- a/_ext/eclipse-groovy/README.md +++ b/_ext/eclipse-groovy/README.md @@ -5,10 +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 run this from the root directory: +To publish a new version, update the `_ext/eclipse-groovy/gradle.properties` appropriately and and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS). -``` -gradlew -b _ext/eclipse-groovy/build.gradle publish -``` +## License Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1. diff --git a/_ext/eclipse-jdt/README.md b/_ext/eclipse-jdt/README.md index 0657924bb0..0544fdf90e 100644 --- a/_ext/eclipse-jdt/README.md +++ b/_ext/eclipse-jdt/README.md @@ -4,10 +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 run this from the root directory: +To publish a new version, update the `_ext/eclipse-jdt/gradle.properties` appropriately and and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS). -``` -gradlew -b _ext/eclipse-jdt/build.gradle publish -``` +## License Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1. diff --git a/_ext/eclipse-wtp/README.md b/_ext/eclipse-wtp/README.md index 8555163acf..98279651bd 100644 --- a/_ext/eclipse-wtp/README.md +++ b/_ext/eclipse-wtp/README.md @@ -2,10 +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 run this from the root directory: +To publish a new version, update the `_ext/eclipse-wtp/gradle.properties` appropriately and and see [BUILD_INSTRUCTIONS.md](../BUILD_INSTRUCTIONS). -``` -gradlew -b _ext/eclipse-wtp/build.gradle publish -``` +## License Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1. diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.12.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.12.0.lockfile index e9c215b58a..a894c93136 100644 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.12.0.lockfile +++ b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.12.0.lockfile @@ -1,6 +1,6 @@ # Spotless formatter based on CDT version 9.8.0 (see https://www.eclipse.org/cdt/) com.diffplug.spotless:spotless-eclipse-cdt:9.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.2.0 +com.diffplug.spotless:spotless-eclipse-base:3.2.1 com.google.code.findbugs:annotations:3.0.0 com.google.code.findbugs:jsr305:3.0.0 com.ibm.icu:icu4j:61.2 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.12.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.12.0.lockfile index 93c67d37a5..c9bfc9a57d 100644 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.12.0.lockfile +++ b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.12.0.lockfile @@ -1,7 +1,7 @@ # Spotless formatter based on JDT version 4.12.0 (see https://projects.eclipse.org/projects/eclipse.jdt) # Compare tag in M2 pom with https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/tag/?h=R4_12 to determine core version. com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.2.0 +com.diffplug.spotless:spotless-eclipse-base:3.2.1 com.google.code.findbugs:annotations:3.0.0 com.google.code.findbugs:jsr305:3.0.0 org.eclipse.jdt:org.eclipse.jdt.core:3.18.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_wtp_formatters/v4.12.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_wtp_formatters/v4.12.0.lockfile index f3f0f0043f..2500c600b3 100644 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_wtp_formatters/v4.12.0.lockfile +++ b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_wtp_formatters/v4.12.0.lockfile @@ -1,6 +1,6 @@ # Spotless formatter based on Eclipse-WTP version 3.14 (see https://www.eclipse.org/webtools/) com.diffplug.spotless:spotless-eclipse-wtp:3.14.0 -com.diffplug.spotless:spotless-eclipse-base:3.2.0 +com.diffplug.spotless:spotless-eclipse-base:3.2.1 com.google.code.findbugs:annotations:3.0.0 com.google.code.findbugs:jsr305:3.0.0 com.ibm.icu:icu4j:61.2 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/groovy_eclipse_formatter/v4.12.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/groovy_eclipse_formatter/v4.12.0.lockfile index aee84fe946..a60e5e8fb0 100644 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/groovy_eclipse_formatter/v4.12.0.lockfile +++ b/lib-extra/src/main/resources/com/diffplug/spotless/extra/groovy_eclipse_formatter/v4.12.0.lockfile @@ -1,6 +1,6 @@ # Spotless formatter based on Groovy-Eclipse version 3.4.0 (see https://github.com/groovy/groovy-eclipse/releases) com.diffplug.spotless:spotless-eclipse-groovy:3.4.0 -com.diffplug.spotless:spotless-eclipse-base:3.2.0 +com.diffplug.spotless:spotless-eclipse-base:3.2.1 com.google.code.findbugs:annotations:3.0.0 com.google.code.findbugs:jsr305:3.0.0 org.eclipse.platform:org.eclipse.core.commands:3.9.400 diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 6413635b64..286e16cfe6 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -2,6 +2,8 @@ ### Version 3.25.0-SNAPSHOT - TBD ([javadoc](https://diffplug.github.io/spotless/javadoc/snapshot/), [snapshot](https://oss.sonatype.org/content/repositories/snapshots/com/diffplug/spotless/spotless-plugin-gradle/)) +* Eclipse-based formatters used to leave temporary files around ([#447](https://github.com/diffplug/spotless/issues/447)). This is now fixed, but only for eclipse 4.12+, no back-port to older Eclipse formatter versions is planned. ([#451](https://github.com/diffplug/spotless/issues/451)) + ### Version 3.24.2 - August 19th 2019 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-plugin-gradle/3.24.1/), [jcenter](https://bintray.com/diffplug/opensource/spotless-plugin-gradle/3.24.1)) * Fixed `Warning deprecated usage found: Using the incremental task API without declaring any outputs has been deprecated.` that started appearing in Gradle 5.5 ([#434](https://github.com/diffplug/spotless/pull/434)). diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 29e9e99067..0d60573961 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -2,6 +2,8 @@ ### Version 1.25.0-SNAPSHOT - TBD ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-maven-plugin/snapshot/), [snapshot](https://oss.sonatype.org/content/repositories/snapshots/com/diffplug/spotless/spotless-maven-plugin/)) +* Eclipse-based formatters used to leave temporary files around ([#447](https://github.com/diffplug/spotless/issues/447)). This is now fixed, but only for eclipse 4.12+, no back-port to older Eclipse formatter versions is planned. ([#451](https://github.com/diffplug/spotless/issues/451)) + ### Version 1.24.1 - August 12th 2019 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-maven-plugin/1.24.1/), [jcenter](https://bintray.com/diffplug/opensource/spotless-maven-plugin/1.24.1)) * Fixes class loading issue with Java 9+ ([#426](https://github.com/diffplug/spotless/pull/426)).