diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e692fe8735..f139032cf6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -51,18 +51,18 @@ jobs: - name: publish all if: "${{ github.event.inputs.to_publish == 'all' }}" run: | - ./gradlew :changelogPush -Prelease=true --stacktrace --warning-mode all - ./gradlew :plugin-gradle:changelogPush -Prelease=true -Pgradle.publish.key=${{ secrets.GRADLE_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }} --stacktrace --warning-mode all - ./gradlew :plugin-maven:changelogPush -Prelease=true --stacktrace --warning-mode all + ./gradlew :changelogPush -Prelease=true --stacktrace --warning-mode all --no-configuration-cache + ./gradlew :plugin-gradle:changelogPush -Prelease=true -Pgradle.publish.key=${{ secrets.GRADLE_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }} --stacktrace --warning-mode all --no-configuration-cache + ./gradlew :plugin-maven:changelogPush -Prelease=true --stacktrace --warning-mode all --no-configuration-cache - name: publish just plugin-gradle if: "${{ github.event.inputs.to_publish == 'plugin-gradle' }}" run: | - ./gradlew :plugin-gradle:changelogPush -Prelease=true -Pgradle.publish.key=${{ secrets.GRADLE_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }} --stacktrace --warning-mode all + ./gradlew :plugin-gradle:changelogPush -Prelease=true -Pgradle.publish.key=${{ secrets.GRADLE_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }} --stacktrace --warning-mode all --no-configuration-cache - name: publish just plugin-maven if: "${{ github.event.inputs.to_publish == 'plugin-maven' }}" run: | - ./gradlew :plugin-maven:changelogPush -Prelease=true --stacktrace --warning-mode all + ./gradlew :plugin-maven:changelogPush -Prelease=true --stacktrace --warning-mode all --no-configuration-cache - name: publish just lib if: "${{ github.event.inputs.to_publish == 'lib' }}" run: | - ./gradlew :changelogPush -Prelease=true --stacktrace --warning-mode all + ./gradlew :changelogPush -Prelease=true --stacktrace --warning-mode all --no-configuration-cache diff --git a/CHANGES.md b/CHANGES.md index 8540a44851..77c49efe2a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,8 +10,22 @@ This document is intended for Spotless developers. We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Added +* Support configuration of mirrors for P2 repositories in `EquoBasedStepBuilder` ([#1629](https://github.com/diffplug/spotless/issues/1629)). +### Changes +* **POTENTIALLY BREAKING** Converted `googleJavaFormat` to a compile-only dependency and drop support for versions < `1.8`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) +* Bump default `googleJavaFormat` version `1.15.0` -> `1.16.0`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) + +## [2.37.0] - 2023-03-13 +### Added +* You can now put the filename into a license header template with `$FILE`. ([#1605](https://github.com/diffplug/spotless/pull/1605) fixes [#1147](https://github.com/diffplug/spotless/issues/1147)) ### Changes * We are now opting in to Gradle's new stable configuration cache. ([#1591](https://github.com/diffplug/spotless/pull/1591)) +* Adopt [Equo Solstice OSGi and p2 shim](https://github.com/equodev/equo-ide/tree/main/solstice) to update all Eclipse-based plugins. ([#1524](https://github.com/diffplug/spotless/pull/1524)) + * Eclipse JDT now supports `4.9` through `4.26`. Also we now recommend dropping the last `.0`, e.g. `4.26` instead of `4.26.0`, you'll get warnings to help you switch. + * Eclipse Groovy now supports `4.18` through `4.26`. Also we now recommend dropping the last `.0`, e.g. `4.26` instead of `4.26.0`, you'll get warnings to help you switch. + * Eclipse CDT now supports `10.6` through `11.0`. + * Eclipse WTP is still WIP at [#1622](https://github.com/diffplug/spotless/pull/1622). ## [2.36.0] - 2023-02-27 ### Added diff --git a/_ext/eclipse-cdt/CHANGES.md b/_ext/eclipse-cdt/CHANGES.md deleted file mode 100644 index cda212bd3d..0000000000 --- a/_ext/eclipse-cdt/CHANGES.md +++ /dev/null @@ -1,63 +0,0 @@ -# spotless-eclipse-cdt - -We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `9.9.0`). - -## [Unreleased] -### Fixed -* Fix typo in gradle variable names ([#1425](https://github.com/diffplug/spotless/pull/1425)) - -## [10.5.0] - 2021-12-13 -### Added -* Switch to Eclipse CDT release 10.5 for Eclipse 2021-12. - -## [10.4.0] - 2021-09-23 -### Added -* Switch to Eclipse CDT release 10.4 for Eclipse 4.21. - -## [10.3.0] - 2021-06-27 -### Added -* Switch to Eclipse CDT release 10.3 for Eclipse 4.20. - -## [10.2.0] - 2021-06-07 -### Added -* Switch to Eclipse CDT release 10.2 for Eclipse 4.19. - -## [10.1.0] - 2020-12-26 -### Added -* Switch to Eclipse CDT release 10.1 for Eclipse 4.18. - -## [10.0.0] - 2020-10-17 -### Added -* Switch to Eclipse CDT release 10.0 for Eclipse 4.17. -* **BREAKING** Minimum required Java version changed from 8 to 11. - -## [9.11.0] - 2020-10-03 -### Added -* Switch to Eclipse CDT release 9.11.1 for Eclipse 4.16. - -## [9.10.0] - 2020-09-25 -### Added -* Switch to Eclipse CDT release 9.10 for Eclipse 4.14. - -## [9.9.0] - 2019-11-01 -* Switch to Eclipse CDT release 9.9 for Eclipse 4.13 ([#480](https://github.com/diffplug/spotless/issues/480)). - -## [9.8.1] - 2019-10-31 -* Really publish Eclipse CDT release 9.8 for Eclipse 4.12 ([#482](https://github.com/diffplug/spotless/pull/482)). - -## [9.8.0] - 2019-07-24 -* **Known bug** - we actually published Eclipse CDT 9.7 instead of 9.8 - fixed in 9.8.1 -* Switch to Eclipse CDT release 9.8 for Eclipse 4.12 ([#423](https://github.com/diffplug/spotless/pull/423)). - -## [9.7.0] - 2019-03-31 -* Switch to Eclipse CDT release 9.7 for Eclipse 4.11 ([#389](https://github.com/diffplug/spotless/pull/389)). -* Include Eclipse logging allowing formatter warnings/errors to be logged via SLF4J ([#236](https://github.com/diffplug/spotless/issues/236)). - -## [9.4.5] - 2019-02-25 -* Replaced `http` update-site with `https` ([#360](https://github.com/diffplug/spotless/issues/360)). - -## [9.4.4] - 2018-09-04 -* Added missing log service, which caused exceptions on AST warnings ([#286](https://github.com/diffplug/spotless/pull/286)). - -## [9.4.3] - 2018-08-08 -* Initial release! diff --git a/_ext/eclipse-cdt/LICENSE.txt b/_ext/eclipse-cdt/LICENSE.txt deleted file mode 100644 index 3d967aee74..0000000000 --- a/_ext/eclipse-cdt/LICENSE.txt +++ /dev/null @@ -1,70 +0,0 @@ -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: -i) changes to the Program, and -ii) additions to the Program; -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and -b) its license agreement: -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and -b) a copy of this Agreement must be included with each copy of the Program. -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/_ext/eclipse-cdt/README.md b/_ext/eclipse-cdt/README.md deleted file mode 100644 index 842fbad606..0000000000 --- a/_ext/eclipse-cdt/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# spotless-eclipse-cdt - -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. - -## License - -Spotless at large is under the Apache 2.0 license, but this jar is under the EPL v1. diff --git a/_ext/eclipse-cdt/build.gradle b/_ext/eclipse-cdt/build.gradle deleted file mode 100644 index 0982b7d555..0000000000 --- a/_ext/eclipse-cdt/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -ext { - developers = [ - fvgh: [ name: 'Frank Vennemeyer', email: 'frankgh@zoho.com' ], - ] - - p2Repository = "https://download.eclipse.org/tools/cdt/releases/${VER_ECLIPSE_CDT}" - - p2Dependencies = [ - 'org.eclipse.cdt.core':'+', // CodeFormatter and related - ] - -} - -apply from: rootProject.file('_ext/gradle/update-lockfile.gradle') -apply from: rootProject.file('_ext/gradle/p2-fat-jar-setup.gradle') -apply from: rootProject.file('gradle/java-publish.gradle') - - -dependencies { - implementation "com.diffplug.spotless:spotless-eclipse-base:${VER_SPOTLESS_ECLIPSE_BASE}" - // Provides text partitioners for formatters - implementation ("org.eclipse.platform:org.eclipse.jface.text:${VER_ECLIPSE_JFACE}") { - exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt' - } - // Required to by CCorePlugin calling CDTLogWriter - implementation "com.ibm.icu:icu4j:${VER_IBM_ICU}" - // Required to by CCorePlugin calling PositionTrackerManager - implementation "org.eclipse.platform:org.eclipse.core.filebuffers:${VER_ECLIPSE_EFS}" - - testImplementation("org.slf4j:slf4j-simple:${VER_SLF4J}") -} - - -////////// -// Test // -////////// -sourceSets { - // Use JAR file with all resources for Eclipse-CDT integration-tests - test.runtimeClasspath = jar.outputs.files + sourceSets.test.output + sourceSets.test.compileClasspath -} diff --git a/_ext/eclipse-cdt/gradle.properties b/_ext/eclipse-cdt/gradle.properties deleted file mode 100644 index 821ceea4d1..0000000000 --- a/_ext/eclipse-cdt/gradle.properties +++ /dev/null @@ -1,12 +0,0 @@ -artifactId=spotless-eclipse-cdt -description=Eclipse's CDT C/C++ formatter bundled for Spotless - -# Build requirements -VER_JAVA=11 - -# Compile dependencies -VER_ECLIPSE_CDT=10.5 -VER_SPOTLESS_ECLIPSE_BASE=[3.5.0,4.0.0[ -VER_ECLIPSE_JFACE=[3.18.0,4.0.0[ -VER_ECLIPSE_EFS=[3.7.0,4.0.0[ -VER_IBM_ICU=[67.1,68[ diff --git a/_ext/eclipse-cdt/src/main/java/com/diffplug/spotless/extra/eclipse/cdt/package-info.java b/_ext/eclipse-cdt/src/main/java/com/diffplug/spotless/extra/eclipse/cdt/package-info.java deleted file mode 100644 index 831ab2b427..0000000000 --- a/_ext/eclipse-cdt/src/main/java/com/diffplug/spotless/extra/eclipse/cdt/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2016 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** Eclipse CDT based Spotless formatter */ -@ParametersAreNonnullByDefault -package com.diffplug.spotless.extra.eclipse.cdt; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/_ext/eclipse-cdt/src/test/java/com/diffplug/spotless/extra/eclipse/cdt/EclipseCdtFormatterStepImplTest.java b/_ext/eclipse-cdt/src/test/java/com/diffplug/spotless/extra/eclipse/cdt/EclipseCdtFormatterStepImplTest.java deleted file mode 100644 index 05637a4e22..0000000000 --- a/_ext/eclipse-cdt/src/test/java/com/diffplug/spotless/extra/eclipse/cdt/EclipseCdtFormatterStepImplTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2016-2021 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.extra.eclipse.cdt; - -import static com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseFramework.LINE_DELIMITER; -import static org.junit.jupiter.api.Assertions.*; - -import java.util.Properties; -import java.util.function.Consumer; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; -import org.junit.jupiter.api.Test; - -/** Eclipse CDT wrapper integration tests */ -class EclipseCdtFormatterStepImplTest { - - private final static String CPP_UNFORMATTED = "#include \n" + - "using namespace std;\n" + - "int main()\n{\n" + - " cout <<\n\"Hello, World!\";\n" + - " return 0;\n" + - "}".replaceAll("\n", LINE_DELIMITER); - private final static String CPP_FORMATTED = "#include \n" + - "using namespace std;\n" + - "int main() {\n" + - "\tcout << \"Hello, World!\";\n" + - "\treturn 0;\n" + - "}\n".replaceAll("\n", LINE_DELIMITER); - - private final static String DOXYGEN_HTML = "/**\n *
void f() {int a =1;} 
\n */\n".replaceAll("\n", LINE_DELIMITER); - - private final static String ILLEGAL_CHAR = Character.toString((char) 254); - - private final static String FUNCT_PTR_UNFORMATTED = "void (*getFunc(void)) (int);"; - private final static String FUNCT_PTR_FORMATTED = "void (* getFunc(void)) (int);"; - - @Test - void defaultFormat() throws Throwable { - String output = format(CPP_UNFORMATTED, config -> {}); - assertEquals(CPP_FORMATTED, - output, "Unexpected formatting with default preferences."); - } - - @Test - void invalidFormat() throws Throwable { - String output = format(CPP_FORMATTED.replace("int main() {", "int main() "), config -> {}); - assertTrue(output.contains("int main()" + LINE_DELIMITER), "Incomplete CPP not formatted on best effort basis."); - } - - @Test - void invalidCharater() throws Throwable { - String output = format(CPP_FORMATTED.replace("int main() {", "int main()" + ILLEGAL_CHAR + " {"), config -> {}); - assertTrue(output.contains("int main()" + LINE_DELIMITER), "Invalid charater not formatted on best effort basis."); - } - - @Test - void invalidConfiguration() throws Throwable { - String output = format(CPP_FORMATTED, config -> { - config.setProperty(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE); - config.setProperty(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "noInteger"); - }); - assertEquals(CPP_FORMATTED.replace("\t", " "), - output, "Invalid indentation configuration not replaced by default value (4 spaces)"); - } - - @Test - void htmlCommentFormat() throws Throwable { - String output = format(DOXYGEN_HTML + CPP_FORMATTED, config -> {}); - assertEquals(DOXYGEN_HTML + CPP_FORMATTED, - output, "HTML comments not ignored by formatter."); - } - - @Test - void regionWarning() throws Throwable { - String output = format(FUNCT_PTR_UNFORMATTED, config -> {}); - assertEquals(FUNCT_PTR_FORMATTED, output, "Code not formatted at all due to regional error."); - } - - private static String format(final String input, final Consumer config) throws Exception { - Properties properties = new Properties(); - config.accept(properties); - EclipseCdtFormatterStepImpl formatter = new EclipseCdtFormatterStepImpl(properties); - return formatter.format(input); - } -} diff --git a/_ext/eclipse-groovy/CHANGES.md b/_ext/eclipse-groovy/CHANGES.md deleted file mode 100644 index b0f909ccb2..0000000000 --- a/_ext/eclipse-groovy/CHANGES.md +++ /dev/null @@ -1,66 +0,0 @@ -# spotless-eclipse-groovy - -We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.5.0`). - -## [Unreleased] -### Fixed -* Fix typo in gradle variable names ([#1425](https://github.com/diffplug/spotless/pull/1425)) - -## [4.3.0] - 2021-10-13 -### Added -* Switch to Groovy-Eclipse release 4.3.0 for Eclipse 4.21 using Groovy 4.0.0 Beta 1. - -## [4.2.0] - 2021-09-14 -### Added -* Switch to Groovy-Eclipse release 4.2.0 for Eclipse 4.20 using Groovy 4.0.0 Alpha 3. - -### Fixed -* Fixed IndexOutOfBoundsException in parallel execution of `eclipse-groovy` formatter ([#877](https://github.com/diffplug/spotless/issues/877)) - -## [4.1.0] - 2021-06-05 -### Added -* Switch to Groovy-Eclipse release 4.1.0 for Eclipse 4.19 using Groovy 4.0.0 Alpha 2. - -## [4.0.0] - 2021-04-10 -### Added -* Switch to Groovy-Eclipse release 4.0.0 for Eclipse 4.18 using Groovy 4.0.0 Alpha 2. -* **BREAKING** Keep spotless-eclipse-groovy major version in sync with Groovy-Eclipse version. - -## [3.9.0] - 2020-10-17 -### Added -* Fixed version number determined by change log. - -## [3.8.1] - 2020-10-17 -### Added -* Switch to Groovy-Eclipse release 3.9.0 for Eclipse 4.17 using Groovy-Indy 3.0.6. - -## [3.8.0] - 2020-10-04 -### Added -* Switch to Groovy-Eclipse release 3.8.0 for Eclipse 4.16 using Groovy-Indy 3.0.4. - -## [3.7.0] - 2020-10-03 -### Added -* Switch to Groovy-Eclipse release 3.7.0 for Eclipse 4.15 using Groovy-Indy 3.0.2. - -## [3.6.0] - 2020-09-26 -### Added -* Switch to Groovy-Eclipse release 3.6.0 for Eclipse 4.14. - -## [3.5.0] - 2019-09-01 -* Switch to Groovy-Eclipse release 3.5.0 for Eclipse 4.13 ([#480](https://github.com/diffplug/spotless/issues/480)). - -## [3.4.0] - 2019-07-24 -* Switch to Groovy-Eclipse release 3.4.0 for Eclipse 4.12 using Groovy-Indy 3.0.0 ([#423](https://github.com/diffplug/spotless/pull/423)). - -## [3.2.0] - 2019-03-16 -* Switch to Groovy-Eclipse release 3.2.0 for Eclipse 4.10 ([#375](https://github.com/diffplug/spotless/pull/375)). -* Include Eclipse logging allowing formatter warnings/errors to be logged via SLF4J ([#236](https://github.com/diffplug/spotless/issues/236)). - -## [3.0.1] - 2019-02-25 -* Replaced `http` update-site with `https` ([#360](https://github.com/diffplug/spotless/issues/360)). - -## [3.0.0] - 2018-09-04 -* Switch to Groovy-Eclipse release 3.0.0 and Groovy 2.6 ([#288](https://github.com/diffplug/spotless/issues/288)). - -## [2.9.2] - 2018-07-19 -* Initial release! diff --git a/_ext/eclipse-groovy/LICENSE.txt b/_ext/eclipse-groovy/LICENSE.txt deleted file mode 100644 index 3d967aee74..0000000000 --- a/_ext/eclipse-groovy/LICENSE.txt +++ /dev/null @@ -1,70 +0,0 @@ -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: -i) changes to the Program, and -ii) additions to the Program; -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and -b) its license agreement: -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and -b) a copy of this Agreement must be included with each copy of the Program. -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/_ext/eclipse-groovy/README.md b/_ext/eclipse-groovy/README.md deleted file mode 100644 index 687ed7a132..0000000000 --- a/_ext/eclipse-groovy/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# spotless-eclipse-groovy - -Groovy-Eclipse is not available in a form which can be easily consumed by maven or gradle. -To fix this, we publish Groovy-Eclipse's formatter and all its dependencies, along with a small amount of glue code, into the `com.diffplug.gradle.spotless:spotless-eclipse-groovy` artifact. - -## Build - -To publish a new version, update the `_ext/eclipse-groovy/gradle.properties` appropriately and see [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable -`_ext` projects. - -## 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/build.gradle b/_ext/eclipse-groovy/build.gradle deleted file mode 100644 index a45590fada..0000000000 --- a/_ext/eclipse-groovy/build.gradle +++ /dev/null @@ -1,56 +0,0 @@ -ext { - developers = [ - fvgh: [ name: 'Frank Vennemeyer', email: 'frankgh@zoho.com' ], - ] - - p2Repository = "https://dist.springsource.org/release/GRECLIPSE/${VER_GRECLIPSE}/e${VER_ECLIPSE}" - - 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 - 'org.codehaus.groovy.eclipse.core':'+', // Groovy core classes (provides central logging used by formatter) - 'org.eclipse.jdt.core':"${VAR_GRECLIPSE_JDT_PATCH}", // Patches org.eclipse.jdt.core classes supporting use within GrEclipse (provides AST generator) - 'org.eclipse.jdt.groovy.core':'+' // Extends org.eclipse.jdt.core for Groovy - ] - - internalJars = [ - //Jars included by org.codehaus.groovy - ////////////////////////////////////////////////////////////////////////// - // Use Groovy compiler compatible with GrEclipse instead of localGroovy - "**/groovy-${VER_GROOVY}", - "**/groovy-parser2", - // 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 - ////////////////////////////////////////////////////////////////////////// - //Non locking class loader used by groovy compiler - '**/nlcl' - ] - -} - -apply from: rootProject.file('_ext/gradle/update-lockfile.gradle') -apply from: rootProject.file('_ext/gradle/p2-fat-jar-setup.gradle') -apply from: rootProject.file('gradle/java-publish.gradle') - -dependencies { - implementation "com.diffplug.spotless:spotless-eclipse-base:${VER_SPOTLESS_ECLIPSE_BASE}" - // Provides text partitioners for formatters - implementation ("org.eclipse.platform:org.eclipse.jface.text:${VER_ECLIPSE_JFACE}") { - exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt' - } - testImplementation("org.slf4j:slf4j-simple:${VER_SLF4J}") -} - -////////// -// Test // -////////// -sourceSets { - // Use JAR file with all resources for Eclipse-Groovy integration-tests - test.runtimeClasspath = jar.outputs.files + sourceSets.test.output + sourceSets.test.compileClasspath -} diff --git a/_ext/eclipse-groovy/gradle.properties b/_ext/eclipse-groovy/gradle.properties deleted file mode 100644 index c1c6101caa..0000000000 --- a/_ext/eclipse-groovy/gradle.properties +++ /dev/null @@ -1,14 +0,0 @@ -artifactId=spotless-eclipse-groovy -description=Groovy Eclipse's formatter bundled for Spotless - -# Build requirements -VER_JAVA=11 - -# Compile -VER_ECLIPSE=4.21 -VER_SPOTLESS_ECLIPSE_BASE=[3.4.2,4.0.0[ -VER_ECLIPSE_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 diff --git a/_ext/eclipse-groovy/src/test/java/com/diffplug/spotless/extra/eclipse/groovy/GrEclipseFormatterStepImplTest.java b/_ext/eclipse-groovy/src/test/java/com/diffplug/spotless/extra/eclipse/groovy/GrEclipseFormatterStepImplTest.java deleted file mode 100644 index 011c68e148..0000000000 --- a/_ext/eclipse-groovy/src/test/java/com/diffplug/spotless/extra/eclipse/groovy/GrEclipseFormatterStepImplTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2016-2021 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.extra.eclipse.groovy; - -import static com.diffplug.spotless.extra.eclipse.groovy.GrEclipseFormatterStepImpl.IGNORE_FORMATTER_PROBLEMS; -import static org.codehaus.groovy.eclipse.refactoring.PreferenceConstants.*; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import java.util.Properties; -import java.util.function.Consumer; - -import org.eclipse.jdt.core.JavaCore; -import org.junit.jupiter.api.Test; - -/** Smoke test checking that transitive dependencies are complete. */ -class GrEclipseFormatterStepImplTest { - - private final static TestData TEST_DATA = TestData.getTestDataOnFileSystem(); - private final static String PARSER_EXCEPTION = "class Test { void method() {} "; - private final static String SCANNER_EXCEPTION = "{"; - private final static String BOUNDED_WILDCARDS_UNFORMATTED = "foo(Map e)\n{\ne.clear();\n}"; - private final static String BOUNDED_WILDCARDS_FORMATTED = "foo(Map e) {\n\te.clear();\n}"; - - @Test - void defaultFormat() throws Throwable { - String output = format(TEST_DATA.input("nominal.test"), config -> {}); - assertEquals(TEST_DATA.expected("nominal.test"), - output, "Unexpected default formatting."); - } - - @Test - void validConfiguration() throws Throwable { - String output = format(TEST_DATA.input("nominal.test"), config -> { - config.put(GROOVY_FORMATTER_REMOVE_UNNECESSARY_SEMICOLONS, "true"); - }); - assertEquals(TEST_DATA.expected("nominal.test").replace(";", ""), - output, "Unexpected formatting for custom configuration."); - } - - @Test - void invalidConfiguration() throws Throwable { - String output = format(TEST_DATA.input("nominal.test"), config -> { - config.put(GROOVY_FORMATTER_INDENTATION, JavaCore.SPACE); - config.put(GROOVY_FORMATTER_INDENTATION_SIZE, "noInteger"); - }); - assertEquals(TEST_DATA.expected("nominal.test").replace("\t", " "), - output, "Groovy formatter does not replace invalid preferences by their defaults."); - } - - /** Test the handling AntlrParserPlugin exceptions by GroovyLogManager.manager logging */ - @Test - void parserException() throws Throwable { - assertThrows(IllegalArgumentException.class, () -> format(PARSER_EXCEPTION, config -> {})); - } - - /** Test the handling GroovyDocumentScanner exceptions by GroovyCore logging */ - @Test - void scannerException() throws Throwable { - assertThrows(IllegalArgumentException.class, () -> format(SCANNER_EXCEPTION, config -> {})); - } - - /** - * Test the handling bounded wildcards templates - * No exception since Groovy-Eclipse 3.0.0. - * Formatting fixed with Groovy-Eclipse 3.14 (org.codehaus.groovy:groovy[3.+]). - */ - @Test - void boundedWildCards() throws Throwable { - String output = format(BOUNDED_WILDCARDS_UNFORMATTED, config -> {}); - assertEquals(BOUNDED_WILDCARDS_FORMATTED, - output, "Unexpected formatting after bounded wildcards."); - } - - @Test - void ignoreCompilerProblems() throws Throwable { - Consumer ignoreCompilerProblems = config -> { - config.setProperty(IGNORE_FORMATTER_PROBLEMS, "true"); - }; - format(PARSER_EXCEPTION, ignoreCompilerProblems); - format(SCANNER_EXCEPTION, ignoreCompilerProblems); - //Test is passed if it does not throw an exception. See issue 237. - } - - private static String format(final String input, final Consumer config) throws Exception { - Properties properties = new Properties(); - config.accept(properties); - GrEclipseFormatterStepImpl formatter = new GrEclipseFormatterStepImpl(properties); - return formatter.format(input); - } - -} diff --git a/_ext/eclipse-groovy/src/test/java/com/diffplug/spotless/extra/eclipse/groovy/TestData.java b/_ext/eclipse-groovy/src/test/java/com/diffplug/spotless/extra/eclipse/groovy/TestData.java deleted file mode 100644 index b0e4f525da..0000000000 --- a/_ext/eclipse-groovy/src/test/java/com/diffplug/spotless/extra/eclipse/groovy/TestData.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2016-2021 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.extra.eclipse.groovy; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -public class TestData { - public static TestData getTestDataOnFileSystem() { - final String userDir = System.getProperty("user.dir", "."); - Path dataPath = Paths.get(userDir, "src", "test", "resources"); - if (Files.isDirectory(dataPath)) { - return new TestData(dataPath); - } - return null; - } - - private final Path inputPath; - private final Path expectedPath; - - private TestData(Path dataPath) { - inputPath = dataPath.resolve("input").toAbsolutePath(); - expectedPath = dataPath.resolve("expected").toAbsolutePath(); - for (Path testDataDir : new Path[]{inputPath, expectedPath}) { - if (!Files.isDirectory(testDataDir)) { - throw new IllegalArgumentException(String.format("'%1$s' is not a directory.", testDataDir)); - } - } - } - - public String input(final String fileName) throws Exception { - return read(inputPath.resolve(fileName)); - } - - public String expected(final String fileName) { - Path path = expectedPath.resolve(fileName); - return read(path); - } - - private String read(final Path xmlPath) { - if (!Files.isRegularFile(xmlPath)) { - throw new IllegalArgumentException(String.format("'%1$s' is not a regular file.", xmlPath)); - } - try { - String checkedOutFileContent = new String(java.nio.file.Files.readAllBytes(xmlPath), "UTF8"); - return checkedOutFileContent.replace("\r", ""); //Align GIT end-of-line normalization - } catch (IOException e) { - throw new IllegalArgumentException(String.format("Failed to read '%1$s'.", xmlPath), e); - } - } - -} diff --git a/_ext/eclipse-groovy/src/test/resources/expected/nominal.test b/_ext/eclipse-groovy/src/test/resources/expected/nominal.test deleted file mode 100644 index a40d247bad..0000000000 --- a/_ext/eclipse-groovy/src/test/resources/expected/nominal.test +++ /dev/null @@ -1,13 +0,0 @@ -class TestClass { - def a; - - TestClass(String s) { - this.a = s - } - def methodNamedArgs(Map args) { - "named args: $args" - } -} - -def t = new TestClass() -def arr = [4, 'string1', 'string2'] diff --git a/_ext/eclipse-groovy/src/test/resources/input/nominal.test b/_ext/eclipse-groovy/src/test/resources/input/nominal.test deleted file mode 100644 index 85f742677f..0000000000 --- a/_ext/eclipse-groovy/src/test/resources/input/nominal.test +++ /dev/null @@ -1,15 +0,0 @@ -class TestClass { - def a; - -TestClass(String s) { -this.a = s -} - def methodNamedArgs(Map args) { - "named args: $args" - } -} - -def t = new TestClass() -def arr = [4, -'string1', -'string2'] diff --git a/_ext/eclipse-jdt/CHANGES.md b/_ext/eclipse-jdt/CHANGES.md deleted file mode 100644 index d698ce2c6c..0000000000 --- a/_ext/eclipse-jdt/CHANGES.md +++ /dev/null @@ -1,15 +0,0 @@ -# spotless-eclipse-jdt - -We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `4.8.0`). - -## [Unreleased] - -## [4.8.1] - 2021-10-04 -### Changed -* Bumped minimum supported Eclipse JDT core version to 3.27.0 -* `format` interface requires source file information to distinguish module-info from compilation unit. Old interface marked as deprecated. -### Fixed -* Fixed module-info formatting. Previous versions did not recognized content and skipped formatting. - -## [4.8.0] - 2018-07-19 -* Initial release! diff --git a/_ext/eclipse-jdt/LICENSE.txt b/_ext/eclipse-jdt/LICENSE.txt deleted file mode 100644 index 3d967aee74..0000000000 --- a/_ext/eclipse-jdt/LICENSE.txt +++ /dev/null @@ -1,70 +0,0 @@ -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: -i) changes to the Program, and -ii) additions to the Program; -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and -b) its license agreement: -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and -b) a copy of this Agreement must be included with each copy of the Program. -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/_ext/eclipse-jdt/README.md b/_ext/eclipse-jdt/README.md deleted file mode 100644 index 624e577e0d..0000000000 --- a/_ext/eclipse-jdt/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# spotless-eclipse-jdt - -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 see [CONTRIBUTING.md](../../CONTRIBUTING.md) how to enable -`_ext` projects. - -## 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/build.gradle b/_ext/eclipse-jdt/build.gradle deleted file mode 100644 index 283e52f86d..0000000000 --- a/_ext/eclipse-jdt/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -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: 'frankgh@zoho.com' ], - nedtwigg: [ name: 'Ned Twigg', email: 'ned.twigg@diffplug.com' ], - ] -} - -dependencies { - implementation "com.diffplug.spotless:spotless-eclipse-base:${VER_SPOTLESS_ECLIPSE_BASE}" - implementation("org.eclipse.jdt:org.eclipse.jdt.core:${VER_ECLIPSE_JDT_CORE}") { - exclude group: 'org.eclipse.platform', module: 'org.eclipse.ant.core' - exclude group: 'org.eclipse.platform', module: 'org.eclipse.core.expressions' - exclude group: 'org.eclipse.platform', module: 'org.eclipse.core.filesystem' - } -} \ No newline at end of file diff --git a/_ext/eclipse-jdt/gradle.properties b/_ext/eclipse-jdt/gradle.properties deleted file mode 100644 index 51d5f41014..0000000000 --- a/_ext/eclipse-jdt/gradle.properties +++ /dev/null @@ -1,9 +0,0 @@ -artifactId=spotless-eclipse-jdt -description=Eclipse's JDT formatter bundled for Spotless - -# Build requirements -VER_JAVA=11 - -# Compile -VER_ECLIPSE_JDT_CORE=[3.13.0,4.0.0[ -VER_SPOTLESS_ECLIPSE_BASE=[3.5.0,4.0.0[ diff --git a/_ext/eclipse-jdt/src/main/java/com/diffplug/spotless/extra/eclipse/java/package-info.java b/_ext/eclipse-jdt/src/main/java/com/diffplug/spotless/extra/eclipse/java/package-info.java deleted file mode 100644 index 190557cc74..0000000000 --- a/_ext/eclipse-jdt/src/main/java/com/diffplug/spotless/extra/eclipse/java/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2016 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** Eclipse JDT based Spotless formatter */ -@ParametersAreNonnullByDefault -package com.diffplug.spotless.extra.eclipse.java; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/_ext/eclipse-jdt/src/test/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImplTest.java b/_ext/eclipse-jdt/src/test/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImplTest.java deleted file mode 100644 index cef63072c9..0000000000 --- a/_ext/eclipse-jdt/src/test/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImplTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2016-2021 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.extra.eclipse.java; - -import static org.junit.jupiter.api.Assertions.*; - -import java.io.File; -import java.io.IOException; -import java.util.Properties; - -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import com.diffplug.spotless.FormatterProperties; -import com.diffplug.spotless.ResourceHarness; - -/** Eclipse JDT wrapper integration tests */ -class EclipseJdtFormatterStepImplTest extends ResourceHarness { - - private static String UNFORMATTED; - private static String FORMATTED; - - @BeforeAll - static void beforeAll() throws IOException { - UNFORMATTED = getTestResource("java/eclipse/JavaCodeUnformatted.test"); - FORMATTED = getTestResource("java/eclipse/JavaCodeFormatted.test"); - } - - private Properties config; - - @BeforeEach - void beforeEach() throws IOException { - File settingsFile = createTestFile("java/eclipse/formatter.xml"); - config = FormatterProperties.from(settingsFile).getProperties(); - } - - private final static String ILLEGAL_CHAR = Character.toString((char) 254); - - @Test - void nominal() throws Throwable { - assertEquals(FORMATTED, format(UNFORMATTED)); - } - - @Test - public void invalidSyntax() throws Throwable { - try { - String invalidSyntax = FORMATTED.replace("{", ""); - assertEquals(invalidSyntax, format(invalidSyntax)); - } catch (IndexOutOfBoundsException e) { - /* - * Some JDT versions throw exception, but this changed again in later versions. - * Anyhow, exceptions are acceptable, since Spotless should format valid Java code. - */ - } - } - - @Test - void invalidCharater() throws Throwable { - String invalidInput = UNFORMATTED + ILLEGAL_CHAR; - assertEquals(invalidInput, format(invalidInput)); - } - - @Test - void invalidConfiguration() throws Throwable { - config.setProperty(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE); - config.setProperty(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "noInteger"); - String defaultTabReplacement = " "; - assertEquals(FORMATTED.replace("\t", defaultTabReplacement), format(FORMATTED)); - } - - @Test - void htmlPreTag() throws Throwable { - config.clear(); - config.setProperty( - DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, - DefaultCodeFormatterConstants.TRUE); - String formatted = getTestResource("java/eclipse/HtmlPreTagFormatted.test"); - String unformatted = getTestResource("java/eclipse/HtmlPreTagUnformatted.test"); - assertEquals(formatted, format(unformatted), "Failed to create internal code formatter. See Spotless issue #191"); - } - - @Test - void moduleInfo() throws Throwable { - File settingsFile = createTestFile("java/eclipse/ModuleInfo.prefs"); - config = FormatterProperties.from(settingsFile).getProperties(); - String formatted = getTestResource("java/eclipse/ModuleInfoFormatted.test"); - String unformatted = getTestResource("java/eclipse/ModuleInfoUnformatted.test"); - assertEquals(formatted, format(unformatted, "whatever/module-info.java"), "Jvm9 module info not formatted."); - } - - private String format(final String input) throws Exception { - return format(input, ""); - } - - private String format(final String input, final String fileName) throws Exception { - EclipseJdtFormatterStepImpl formatter = new EclipseJdtFormatterStepImpl(config); - return formatter.format(input, new File(fileName)); - } - -} diff --git a/build.gradle b/build.gradle index 312f84727d..0ae84bd9c4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,8 @@ -plugins { - // https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md - id 'dev.equo.ide' version '0.16.0' -} +apply plugin: 'dev.equo.ide' equoIde { branding().title('Spotless').icon(file('_images/spotless_logo.png')) welcome().openUrl('https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md') - gradleBuildship() + gradleBuildship().autoImport('.') } repositories { diff --git a/gradle.properties b/gradle.properties index 8820a36e30..1a72150dd6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,7 +29,7 @@ VER_SLF4J=[1.6,2.0[ # Used in multiple places VER_DURIAN=1.2.0 -VER_JGIT=6.4.0.202211300538-r +VER_JGIT=6.5.0.202303070854-r VER_JUNIT=5.9.2 VER_ASSERTJ=3.24.2 -VER_MOCKITO=5.1.1 +VER_MOCKITO=5.2.0 diff --git a/gradle/java-publish.gradle b/gradle/java-publish.gradle index 2ebc2a66b5..495694a5be 100644 --- a/gradle/java-publish.gradle +++ b/gradle/java-publish.gradle @@ -77,12 +77,11 @@ javadoc { // // Thus, no javadoc warnings. options.addStringOption('Xdoclint:none', '-quiet') - options.addStringOption('source', '8') + options.addStringOption('source', '11') // setup the header options.header javadocInfo // setup links - options.linksOffline('https://docs.oracle.com/javase/8/docs/api/', "${dotdotGradle}/javadoc/java8") - options.linksOffline('https://docs.gradle.org/2.14/javadoc/', "${dotdotGradle}/javadoc/gradle") + options.linksOffline('https://docs.gradle.org/6.1.1/javadoc/', "${dotdotGradle}/javadoc/gradle") // links to javadoc from the other versions options.linksOffline("https://javadoc.io/static/com.diffplug.spotless/spotless-lib/${rootProject.spotlessChangelog.versionLast}", "${dotdotGradle}/javadoc/spotless-lib") diff --git a/gradle/javadoc/java8/package-list b/gradle/javadoc/java8/package-list deleted file mode 100644 index 496d90dbfa..0000000000 --- a/gradle/javadoc/java8/package-list +++ /dev/null @@ -1,216 +0,0 @@ -java.applet -java.awt -java.awt.color -java.awt.datatransfer -java.awt.dnd -java.awt.event -java.awt.font -java.awt.geom -java.awt.im -java.awt.im.spi -java.awt.image -java.awt.image.renderable -java.awt.print -java.beans -java.beans.beancontext -java.io -java.lang -java.lang.annotation -java.lang.instrument -java.lang.invoke -java.lang.management -java.lang.ref -java.lang.reflect -java.math -java.net -java.nio -java.nio.channels -java.nio.channels.spi -java.nio.charset -java.nio.charset.spi -java.nio.file -java.nio.file.attribute -java.nio.file.spi -java.rmi -java.rmi.activation -java.rmi.dgc -java.rmi.registry -java.rmi.server -java.security -java.security.acl -java.security.cert -java.security.interfaces -java.security.spec -java.sql -java.text -java.text.spi -java.time -java.time.chrono -java.time.format -java.time.temporal -java.time.zone -java.util -java.util.concurrent -java.util.concurrent.atomic -java.util.concurrent.locks -java.util.function -java.util.jar -java.util.prefs -java.util.regex -java.util.spi -java.util.stream -java.util.zip -javax.accessibility -javax.activation -javax.activity -javax.annotation -javax.annotation.processing -javax.crypto -javax.crypto.interfaces -javax.crypto.spec -javax.imageio -javax.imageio.event -javax.imageio.metadata -javax.imageio.plugins.bmp -javax.imageio.plugins.jpeg -javax.imageio.spi -javax.imageio.stream -javax.jws -javax.jws.soap -javax.lang.model -javax.lang.model.element -javax.lang.model.type -javax.lang.model.util -javax.management -javax.management.loading -javax.management.modelmbean -javax.management.monitor -javax.management.openmbean -javax.management.relation -javax.management.remote -javax.management.remote.rmi -javax.management.timer -javax.naming -javax.naming.directory -javax.naming.event -javax.naming.ldap -javax.naming.spi -javax.net -javax.net.ssl -javax.print -javax.print.attribute -javax.print.attribute.standard -javax.print.event -javax.rmi -javax.rmi.CORBA -javax.rmi.ssl -javax.script -javax.security.auth -javax.security.auth.callback -javax.security.auth.kerberos -javax.security.auth.login -javax.security.auth.spi -javax.security.auth.x500 -javax.security.cert -javax.security.sasl -javax.sound.midi -javax.sound.midi.spi -javax.sound.sampled -javax.sound.sampled.spi -javax.sql -javax.sql.rowset -javax.sql.rowset.serial -javax.sql.rowset.spi -javax.swing -javax.swing.border -javax.swing.colorchooser -javax.swing.event -javax.swing.filechooser -javax.swing.plaf -javax.swing.plaf.basic -javax.swing.plaf.metal -javax.swing.plaf.multi -javax.swing.plaf.nimbus -javax.swing.plaf.synth -javax.swing.table -javax.swing.text -javax.swing.text.html -javax.swing.text.html.parser -javax.swing.text.rtf -javax.swing.tree -javax.swing.undo -javax.tools -javax.transaction -javax.transaction.xa -javax.xml -javax.xml.bind -javax.xml.bind.annotation -javax.xml.bind.annotation.adapters -javax.xml.bind.attachment -javax.xml.bind.helpers -javax.xml.bind.util -javax.xml.crypto -javax.xml.crypto.dom -javax.xml.crypto.dsig -javax.xml.crypto.dsig.dom -javax.xml.crypto.dsig.keyinfo -javax.xml.crypto.dsig.spec -javax.xml.datatype -javax.xml.namespace -javax.xml.parsers -javax.xml.soap -javax.xml.stream -javax.xml.stream.events -javax.xml.stream.util -javax.xml.transform -javax.xml.transform.dom -javax.xml.transform.sax -javax.xml.transform.stax -javax.xml.transform.stream -javax.xml.validation -javax.xml.ws -javax.xml.ws.handler -javax.xml.ws.handler.soap -javax.xml.ws.http -javax.xml.ws.soap -javax.xml.ws.spi -javax.xml.ws.spi.http -javax.xml.ws.wsaddressing -javax.xml.xpath -org.ietf.jgss -org.omg.CORBA -org.omg.CORBA.DynAnyPackage -org.omg.CORBA.ORBPackage -org.omg.CORBA.TypeCodePackage -org.omg.CORBA.portable -org.omg.CORBA_2_3 -org.omg.CORBA_2_3.portable -org.omg.CosNaming -org.omg.CosNaming.NamingContextExtPackage -org.omg.CosNaming.NamingContextPackage -org.omg.Dynamic -org.omg.DynamicAny -org.omg.DynamicAny.DynAnyFactoryPackage -org.omg.DynamicAny.DynAnyPackage -org.omg.IOP -org.omg.IOP.CodecFactoryPackage -org.omg.IOP.CodecPackage -org.omg.Messaging -org.omg.PortableInterceptor -org.omg.PortableInterceptor.ORBInitInfoPackage -org.omg.PortableServer -org.omg.PortableServer.CurrentPackage -org.omg.PortableServer.POAManagerPackage -org.omg.PortableServer.POAPackage -org.omg.PortableServer.ServantLocatorPackage -org.omg.PortableServer.portable -org.omg.SendingContext -org.omg.stub.java.rmi -org.w3c.dom -org.w3c.dom.bootstrap -org.w3c.dom.events -org.w3c.dom.ls -org.w3c.dom.views -org.xml.sax -org.xml.sax.ext -org.xml.sax.helpers diff --git a/lib-extra/build.gradle b/lib-extra/build.gradle index 8381d14041..8ed36bede6 100644 --- a/lib-extra/build.gradle +++ b/lib-extra/build.gradle @@ -1,11 +1,13 @@ plugins { id 'java-library' + id 'dev.equo.p2deps' } ext.artifactId = project.artifactIdLibExtra version = rootProject.spotlessChangelog.versionNext apply from: rootProject.file('gradle/java-setup.gradle') apply from: rootProject.file('gradle/java-publish.gradle') +String VER_SOLSTICE = '1.0.3' dependencies { api project(':lib') // misc useful utilities @@ -14,6 +16,8 @@ dependencies { // needed by GitAttributesLineEndings implementation "org.eclipse.jgit:org.eclipse.jgit:${VER_JGIT}" implementation "com.googlecode.concurrent-trees:concurrent-trees:2.6.1" + // for eclipse + implementation "dev.equo.ide:solstice:${VER_SOLSTICE}" // testing testImplementation project(':testlib') @@ -21,9 +25,11 @@ dependencies { testImplementation "org.assertj:assertj-core:${VER_ASSERTJ}" testImplementation "com.diffplug.durian:durian-testlib:${VER_DURIAN}" } - -// we'll hold the core lib to a high standard -spotbugs { reportLevel = 'low' } // low|medium|high (low = sensitive to even minor mistakes) +spotless { + java { + replaceRegex 'enforceSolsticeVersion', '"dev.equo.ide:solstice:(.*)"', '"dev.equo.ide:solstice:' + VER_SOLSTICE + '"' + } +} apply from: rootProject.file('gradle/special-tests.gradle') tasks.withType(Test).configureEach { @@ -32,3 +38,55 @@ tasks.withType(Test).configureEach { jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED' } } + +def NEEDS_P2_DEPS = [ + 'jdt', + 'groovy', + 'cdt' +] +for (needsP2 in NEEDS_P2_DEPS) { + sourceSets.register(needsP2) { + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + java {} + } + dependencies { + add("${needsP2}CompileOnly", "dev.equo.ide:solstice:${VER_SOLSTICE}") + } +} +jar { + for (needsP2 in NEEDS_P2_DEPS) { + from sourceSets.getByName(needsP2).output.classesDirs + } +} +tasks.withType(Test).configureEach { + dependsOn jar + doFirst { + classpath += jar.outputs.files + } +} + +apply plugin: 'dev.equo.p2deps' +p2deps { + into 'jdtCompileOnly', { + p2repo 'https://download.eclipse.org/eclipse/updates/4.26/' + install 'org.eclipse.jdt.core' + } + into 'groovyCompileOnly', { + p2repo 'https://download.eclipse.org/eclipse/updates/4.26/' + p2repo 'https://groovy.jfrog.io/artifactory/plugins-release/org/codehaus/groovy/groovy-eclipse-integration/4.8.0/e4.26/' + install 'org.codehaus.groovy.eclipse.refactoring' + install 'org.codehaus.groovy.eclipse.core' + install 'org.eclipse.jdt.groovy.core' + install 'org.codehaus.groovy' + } + into 'cdtCompileOnly', { + p2repo 'https://download.eclipse.org/eclipse/updates/4.26/' + p2repo 'https://download.eclipse.org/tools/cdt/releases/10.7/' + install 'org.eclipse.cdt.core' + } +} + +// we'll hold the core lib to a high standard +spotbugs { reportLevel = 'low' } // low|medium|high (low = sensitive to even minor mistakes) + diff --git a/_ext/eclipse-cdt/src/main/java/com/diffplug/spotless/extra/eclipse/cdt/EclipseCdtFormatterStepImpl.java b/lib-extra/src/cdt/java/com/diffplug/spotless/extra/glue/cdt/EclipseCdtFormatterStepImpl.java similarity index 66% rename from _ext/eclipse-cdt/src/main/java/com/diffplug/spotless/extra/eclipse/cdt/EclipseCdtFormatterStepImpl.java rename to lib-extra/src/cdt/java/com/diffplug/spotless/extra/glue/cdt/EclipseCdtFormatterStepImpl.java index 4482f3e752..045860f535 100644 --- a/_ext/eclipse-cdt/src/main/java/com/diffplug/spotless/extra/eclipse/cdt/EclipseCdtFormatterStepImpl.java +++ b/lib-extra/src/cdt/java/com/diffplug/spotless/extra/glue/cdt/EclipseCdtFormatterStepImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.diffplug.spotless.extra.eclipse.cdt; +package com.diffplug.spotless.extra.glue.cdt; import java.util.Map; import java.util.Map.Entry; @@ -21,23 +21,16 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.formatter.CodeFormatter; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.text.edits.TextEdit; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseConfig; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseFramework; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipsePluginConfig; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseServiceConfig; - /** Formatter step which calls out to the Eclipse CDT formatter. */ public class EclipseCdtFormatterStepImpl { private final CodeFormatter codeFormatter; public EclipseCdtFormatterStepImpl(Properties settings) throws Exception { - SpotlessEclipseFramework.setup(new FrameworkConfig()); Stream> stream = settings.entrySet().stream(); Map settingsMap = stream.collect(Collectors.toMap( e -> String.valueOf(e.getKey()), @@ -45,24 +38,10 @@ public EclipseCdtFormatterStepImpl(Properties settings) throws Exception { codeFormatter = org.eclipse.cdt.core.ToolFactory.createDefaultCodeFormatter(settingsMap); } - private static class FrameworkConfig implements SpotlessEclipseConfig { - @Override - public void registerServices(SpotlessEclipseServiceConfig config) { - config.applyDefault(); - config.useSlf4J(EclipseCdtFormatterStepImpl.class.getPackage().getName()); - } - - @Override - public void activatePlugins(SpotlessEclipsePluginConfig config) { - config.applyDefault(); - config.add(new CCorePlugin()); - } - } - /** Formatting C/C++ string */ public String format(String raw) throws Exception { //The 'kind' can be set to CodeFormatter.K_UNKNOWN, since it is anyway ignored by the internal formatter - TextEdit edit = codeFormatter.format(CodeFormatter.K_UNKNOWN, raw, 0, raw.length(), 0, SpotlessEclipseFramework.LINE_DELIMITER); + TextEdit edit = codeFormatter.format(CodeFormatter.K_UNKNOWN, raw, 0, raw.length(), 0, "\n"); if (edit == null) { throw new IllegalArgumentException("Invalid C/C++ syntax for formatting."); } else { diff --git a/_ext/eclipse-groovy/src/main/java/com/diffplug/spotless/extra/eclipse/groovy/GrEclipseFormatterStepImpl.java b/lib-extra/src/groovy/java/com/diffplug/spotless/extra/glue/groovy/GrEclipseFormatterStepImpl.java similarity index 78% rename from _ext/eclipse-groovy/src/main/java/com/diffplug/spotless/extra/eclipse/groovy/GrEclipseFormatterStepImpl.java rename to lib-extra/src/groovy/java/com/diffplug/spotless/extra/glue/groovy/GrEclipseFormatterStepImpl.java index 1d2b71c69f..9549847d74 100644 --- a/_ext/eclipse-groovy/src/main/java/com/diffplug/spotless/extra/eclipse/groovy/GrEclipseFormatterStepImpl.java +++ b/lib-extra/src/groovy/java/com/diffplug/spotless/extra/glue/groovy/GrEclipseFormatterStepImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,14 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.diffplug.spotless.extra.eclipse.groovy; +package com.diffplug.spotless.extra.glue.groovy; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Properties; import org.codehaus.groovy.eclipse.GroovyLogManager; @@ -37,15 +39,36 @@ import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.TextSelection; +import org.eclipse.osgi.internal.location.EquinoxLocations; import org.eclipse.text.edits.TextEdit; +import org.osgi.framework.Constants; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseConfig; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseFramework; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipsePluginConfig; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseServiceConfig; +import dev.equo.solstice.NestedJars; +import dev.equo.solstice.ShimIdeBootstrapServices; +import dev.equo.solstice.Solstice; +import dev.equo.solstice.p2.CacheLocations; /** Spotless-Formatter step which calls out to the Groovy-Eclipse formatter. */ public class GrEclipseFormatterStepImpl { + static { + NestedJars.setToWarnOnly(); + NestedJars.onClassPath().confirmAllNestedJarsArePresentOnClasspath(CacheLocations.nestedJars()); + try { + var solstice = Solstice.findBundlesOnClasspath(); + solstice.warnAndModifyManifestsToFix(); + var props = Map.of("osgi.nl", "en_US", + Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT, + EquinoxLocations.PROP_INSTANCE_AREA, Files.createTempDirectory("spotless-groovy").toAbsolutePath().toString()); + solstice.openShim(props); + ShimIdeBootstrapServices.apply(props, solstice.getContext()); + solstice.start("org.apache.felix.scr"); + solstice.startAllWithLazy(false); + solstice.start("org.codehaus.groovy.eclipse.core"); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + /** * Groovy compiler problems can be ignored. *

@@ -58,25 +81,11 @@ public class GrEclipseFormatterStepImpl { private final boolean ignoreFormatterProblems; public GrEclipseFormatterStepImpl(final Properties properties) throws Exception { - SpotlessEclipseFramework.setup(new FrameworkConfig()); PreferenceStore preferences = createPreferences(properties); preferencesStore = new FormatterPreferencesOnStore(preferences); ignoreFormatterProblems = Boolean.parseBoolean(properties.getProperty(IGNORE_FORMATTER_PROBLEMS, "false")); } - private static class FrameworkConfig implements SpotlessEclipseConfig { - @Override - public void registerServices(SpotlessEclipseServiceConfig config) { - config.applyDefault(); - config.useSlf4J(GrEclipseFormatterStepImpl.class.getPackage().getName()); - } - - @Override - public void activatePlugins(SpotlessEclipsePluginConfig config) { - config.add(new GroovyCoreActivator()); - } - } - /** Formatting Groovy string */ public String format(String raw) throws Exception { IDocument doc = new Document(raw); @@ -94,8 +103,7 @@ public String format(String raw) throws Exception { /** * Eclipse Groovy formatter does not signal problems by its return value, but by logging errors. */ - private static class GroovyErrorListener implements ILogListener, IGroovyLogger { - + private static final class GroovyErrorListener implements ILogListener, IGroovyLogger { private final List errors; public GroovyErrorListener() { @@ -106,7 +114,7 @@ public GroovyErrorListener() { errors = Collections.synchronizedList(new ArrayList()); ILog groovyLogger = GroovyCoreActivator.getDefault().getLog(); groovyLogger.addLogListener(this); - synchronized(GroovyLogManager.manager) { + synchronized (GroovyLogManager.manager) { GroovyLogManager.manager.addLogger(this); } } @@ -119,7 +127,7 @@ public void logging(final IStatus status, final String plugin) { public boolean errorsDetected() { ILog groovyLogger = GroovyCoreActivator.getDefault().getLog(); groovyLogger.removeLogListener(this); - synchronized(GroovyLogManager.manager) { + synchronized (GroovyLogManager.manager) { GroovyLogManager.manager.removeLogger(this); } return 0 != errors.size(); @@ -156,7 +164,6 @@ public boolean isCategoryEnabled(TraceCategory cat) { public void log(TraceCategory arg0, String arg1) { errors.add(arg1); } - } private static PreferenceStore createPreferences(final Properties properties) throws IOException { @@ -167,5 +174,4 @@ private static PreferenceStore createPreferences(final Properties properties) th preferences.load(input); return preferences; } - } diff --git a/_ext/eclipse-jdt/src/main/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImpl.java b/lib-extra/src/jdt/java/com/diffplug/spotless/extra/glue/jdt/EclipseJdtFormatterStepImpl.java similarity index 59% rename from _ext/eclipse-jdt/src/main/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImpl.java rename to lib-extra/src/jdt/java/com/diffplug/spotless/extra/glue/jdt/EclipseJdtFormatterStepImpl.java index b3fb7acaf3..40c02d8f3a 100644 --- a/_ext/eclipse-jdt/src/main/java/com/diffplug/spotless/extra/eclipse/java/EclipseJdtFormatterStepImpl.java +++ b/lib-extra/src/jdt/java/com/diffplug/spotless/extra/glue/jdt/EclipseJdtFormatterStepImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.diffplug.spotless.extra.eclipse.java; +package com.diffplug.spotless.extra.glue.jdt; import java.io.File; import java.util.Properties; -import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.ToolFactory; import org.eclipse.jdt.core.formatter.CodeFormatter; import org.eclipse.jdt.internal.compiler.env.IModule; @@ -26,47 +25,22 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.text.edits.TextEdit; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseConfig; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseFramework; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipsePluginConfig; -import com.diffplug.spotless.extra.eclipse.base.SpotlessEclipseServiceConfig; - /** Formatter step which calls out to the Eclipse JDT formatter. */ public class EclipseJdtFormatterStepImpl { + /** Spotless demands for internal formatter chains Unix (LF) line endings. */ + public static final String LINE_DELIMITER = "\n"; private final CodeFormatter codeFormatter; - public EclipseJdtFormatterStepImpl(Properties settings) throws Exception { - SpotlessEclipseFramework.setup(new FrameworkConfig()); + public EclipseJdtFormatterStepImpl(Properties settings) { this.codeFormatter = ToolFactory.createCodeFormatter(settings, ToolFactory.M_FORMAT_EXISTING); } - private static class FrameworkConfig implements SpotlessEclipseConfig { - @Override - public void registerServices(SpotlessEclipseServiceConfig config) { - config.applyDefault(); - config.useSlf4J(EclipseJdtFormatterStepImpl.class.getPackage().getName()); - } - - @Override - public void activatePlugins(SpotlessEclipsePluginConfig config) { - config.applyDefault(); - config.add(new JavaCore()); - } - } - - /** @deprecated Use {@link #format(String, File)} instead. */ - @Deprecated - public String format(String raw) throws Exception { - return format(raw, new File("")); - } - /** Formatting Java string, distinguishing module-info and compilation unit by file name */ public String format(String raw, File file) throws Exception { int kind = (file.getName().equals(IModule.MODULE_INFO_JAVA) ? CodeFormatter.K_MODULE_INFO : CodeFormatter.K_COMPILATION_UNIT) | CodeFormatter.F_INCLUDE_COMMENTS; - - TextEdit edit = codeFormatter.format(kind, raw, 0, raw.length(), 0, SpotlessEclipseFramework.LINE_DELIMITER); + TextEdit edit = codeFormatter.format(kind, raw, 0, raw.length(), 0, LINE_DELIMITER); if (edit == null) { throw new IllegalArgumentException("Invalid java syntax for formatting."); } else { @@ -75,5 +49,4 @@ public String format(String raw, File file) throws Exception { return doc.get(); } } - } diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/EquoBasedStepBuilder.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/EquoBasedStepBuilder.java new file mode 100644 index 0000000000..cc12a938ad --- /dev/null +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/EquoBasedStepBuilder.java @@ -0,0 +1,160 @@ +/* + * Copyright 2016-2023 DiffPlug + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.diffplug.spotless.extra; + +import java.io.File; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import com.diffplug.spotless.FileSignature; +import com.diffplug.spotless.FormatterFunc; +import com.diffplug.spotless.FormatterProperties; +import com.diffplug.spotless.FormatterStep; +import com.diffplug.spotless.JarState; +import com.diffplug.spotless.Provisioner; +import com.diffplug.spotless.ThrowingEx; + +import dev.equo.solstice.NestedJars; +import dev.equo.solstice.p2.P2ClientCache; +import dev.equo.solstice.p2.P2Model; +import dev.equo.solstice.p2.P2QueryCache; + +/** + * Generic Eclipse based formatter step {@link State} builder. + */ +public abstract class EquoBasedStepBuilder { + private final String formatterName; + private final Provisioner mavenProvisioner; + private final ThrowingEx.Function stateToFormatter; + private String formatterVersion; + private Iterable settingsFiles = new ArrayList<>(); + private Map p2Mirrors = Map.of(); + + /** Initialize valid default configuration, taking latest version */ + public EquoBasedStepBuilder(String formatterName, Provisioner mavenProvisioner, ThrowingEx.Function stateToFormatter) { + this.formatterName = formatterName; + this.mavenProvisioner = mavenProvisioner; + this.stateToFormatter = stateToFormatter; + } + + public void setVersion(String version) { + formatterVersion = version; + } + + public void setPreferences(Iterable settingsFiles) { + this.settingsFiles = settingsFiles; + } + + public void setP2Mirrors(Map p2Mirrors) { + this.p2Mirrors = Map.copyOf(p2Mirrors); + } + + /** Returns the FormatterStep (whose state will be calculated lazily). */ + public FormatterStep build() { + return FormatterStep.createLazy(formatterName, this::get, stateToFormatter); + } + + protected abstract P2Model model(String version); + + protected void addPlatformRepo(P2Model model, String version) { + if (!version.startsWith("4.")) { + throw new IllegalArgumentException("Expected 4.x"); + } + int minorVersion = Integer.parseInt(version.substring("4.".length())); + + model.addP2Repo("https://download.eclipse.org/eclipse/updates/" + version + "/"); + model.getInstall().addAll(List.of( + "org.apache.felix.scr", + "org.eclipse.equinox.event")); + if (minorVersion >= 25) { + model.getInstall().addAll(List.of( + "org.osgi.service.cm", + "org.osgi.service.metatype")); + } + } + + /** Creates the state of the configuration. */ + EquoBasedStepBuilder.State get() throws Exception { + var query = createModelWithMirrors().query(P2ClientCache.PREFER_OFFLINE, P2QueryCache.ALLOW); + var classpath = new ArrayList(); + var mavenDeps = new ArrayList(); + mavenDeps.add("dev.equo.ide:solstice:1.0.3"); + mavenDeps.add("com.diffplug.durian:durian-swt.os:4.1.1"); + mavenDeps.addAll(query.getJarsOnMavenCentral()); + classpath.addAll(mavenProvisioner.provisionWithTransitives(false, mavenDeps)); + classpath.addAll(query.getJarsNotOnMavenCentral()); + for (var nested : NestedJars.inFiles(query.getJarsNotOnMavenCentral()).extractAllNestedJars()) { + classpath.add(nested.getValue()); + } + var jarState = JarState.preserveOrder(classpath); + return new State(formatterVersion, jarState, FileSignature.signAsList(settingsFiles)); + } + + private P2Model createModelWithMirrors() { + P2Model model = model(formatterVersion); + if (p2Mirrors.isEmpty()) { + return model; + } + + ArrayList p2Repos = new ArrayList<>(model.getP2repo()); + p2Repos.replaceAll(url -> { + for (Map.Entry mirror : p2Mirrors.entrySet()) { + String prefix = mirror.getKey(); + if (url.startsWith(prefix)) { + return mirror.getValue() + url.substring(prefix.length()); + } + } + + throw new IllegalStateException("no mirror configured for P2 repository: " + url); + }); + + model.getP2repo().clear(); + model.getP2repo().addAll(p2Repos); + return model; + } + + /** + * State of Eclipse configuration items, providing functionality to derived information + * based on the state. + */ + public static class State implements Serializable { + private static final long serialVersionUID = 584400372246020995L; + final String semanticVersion; + final JarState jarState; + final FileSignature settingsFiles; + + public State(String semanticVersion, JarState jarState, FileSignature settingsFiles) { + this.semanticVersion = semanticVersion; + this.jarState = jarState; + this.settingsFiles = settingsFiles; + } + + public JarState getJarState() { + return jarState; + } + + public String getSemanticVersion() { + return semanticVersion; + } + + public Properties getPreferences() { + return FormatterProperties.from(settingsFiles.files()).getProperties(); + } + } +} diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java index 4c2b06fc9a..1a83389eaa 100644 --- a/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,15 @@ */ package com.diffplug.spotless.extra.cpp; -import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; import java.util.Properties; import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.Jvm; import com.diffplug.spotless.Provisioner; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder.State; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; + +import dev.equo.solstice.p2.P2Model; /** * Formatter step which calls out to the Eclipse CDT formatter. @@ -36,25 +37,40 @@ public final class EclipseCdtFormatterStep { private EclipseCdtFormatterStep() {} private static final String NAME = "eclipse cdt formatter"; - private static final String FORMATTER_CLASS = "com.diffplug.spotless.extra.eclipse.cdt.EclipseCdtFormatterStepImpl"; - private static final String FORMATTER_METHOD = "format"; - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(8, "4.16.0").add(11, "4.21.0"); + private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "10.7").add(17, "11.0"); public static String defaultVersion() { return JVM_SUPPORT.getRecommendedFormatterVersion(); } /** Provides default configuration */ - public static EclipseBasedStepBuilder createBuilder(Provisioner provisioner) { - return new EclipseBasedStepBuilder(NAME, provisioner, EclipseCdtFormatterStep::apply); + public static EquoBasedStepBuilder createBuilder(Provisioner provisioner) { + return new EquoBasedStepBuilder(NAME, provisioner, EclipseCdtFormatterStep::apply) { + @Override + protected P2Model model(String version) { + var model = new P2Model(); + addPlatformRepo(model, "4.26"); + model.addP2Repo("https://download.eclipse.org/tools/cdt/releases/" + version + "/"); + model.getInstall().add("org.eclipse.cdt.core"); + return model; + } + }; } - private static FormatterFunc apply(State state) throws Exception { + private static FormatterFunc apply(EquoBasedStepBuilder.State state) throws Exception { JVM_SUPPORT.assertFormatterSupported(state.getSemanticVersion()); - Class formatterClazz = state.loadClass(FORMATTER_CLASS); - Object formatter = formatterClazz.getConstructor(Properties.class).newInstance(state.getPreferences()); - Method method = formatterClazz.getMethod(FORMATTER_METHOD, String.class); - return JVM_SUPPORT.suggestLaterVersionOnError(state.getSemanticVersion(), input -> (String) method.invoke(formatter, input)); + Class formatterClazz = state.getJarState().getClassLoader().loadClass("com.diffplug.spotless.extra.glue.cdt.EclipseCdtFormatterStepImpl"); + var formatter = formatterClazz.getConstructor(Properties.class).newInstance(state.getPreferences()); + var method = formatterClazz.getMethod("format", String.class); + return JVM_SUPPORT.suggestLaterVersionOnError(state.getSemanticVersion(), + input -> { + try { + return (String) method.invoke(formatter, input); + } catch (InvocationTargetException exceptionWrapper) { + Throwable throwable = exceptionWrapper.getTargetException(); + Exception exception = (throwable instanceof Exception) ? (Exception) throwable : null; + throw (null == exception) ? exceptionWrapper : exception; + } + }); } - } diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java index 013f5b5c2c..08c28889f9 100644 --- a/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,15 @@ package com.diffplug.spotless.extra.groovy; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; +import java.util.List; import java.util.Properties; import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.Jvm; import com.diffplug.spotless.Provisioner; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder.State; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; + +import dev.equo.solstice.p2.P2Model; /** Formatter step which calls out to the Groovy-Eclipse formatter. */ public final class GrEclipseFormatterStep { @@ -31,26 +32,60 @@ public final class GrEclipseFormatterStep { private GrEclipseFormatterStep() {} private static final String NAME = "eclipse groovy formatter"; - private static final String FORMATTER_CLASS = "com.diffplug.spotless.extra.eclipse.groovy.GrEclipseFormatterStepImpl"; - private static final String FORMATTER_CLASS_OLD = "com.diffplug.gradle.spotless.groovy.eclipse.GrEclipseFormatterStepImpl"; - private static final String MAVEN_GROUP_ARTIFACT = "com.diffplug.spotless:spotless-eclipse-groovy"; - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(8, "4.19.0").add(11, "4.21.0"); - private static final String FORMATTER_METHOD = "format"; + private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "4.26"); public static String defaultVersion() { return JVM_SUPPORT.getRecommendedFormatterVersion(); } - /** Provides default configuration */ - public static EclipseBasedStepBuilder createBuilder(Provisioner provisioner) { - return new EclipseBasedStepBuilder(NAME, provisioner, GrEclipseFormatterStep::apply); + public static EquoBasedStepBuilder createBuilder(Provisioner provisioner) { + return new EquoBasedStepBuilder(NAME, provisioner, GrEclipseFormatterStep::apply) { + @Override + protected P2Model model(String version) { + if (!version.startsWith("4.")) { + throw new IllegalArgumentException("Expected version 4.x"); + } + int eVersion = Integer.parseInt(version.substring("4.".length())); + if (eVersion < 8) { + throw new IllegalArgumentException("4.8 is the oldest version we support, this was " + version); + } + String greclipseVersion; + if (eVersion >= 18) { + greclipseVersion = "4." + (eVersion - 18) + ".0"; + } else { + greclipseVersion = "3." + (eVersion - 8) + ".0"; + } + var model = new P2Model(); + addPlatformRepo(model, version); + model.addP2Repo("https://groovy.jfrog.io/artifactory/plugins-release/org/codehaus/groovy/groovy-eclipse-integration/" + greclipseVersion + "/e" + version + "/"); + model.getInstall().addAll(List.of( + "org.codehaus.groovy.eclipse.refactoring", + "org.codehaus.groovy.eclipse.core", + "org.eclipse.jdt.groovy.core", + "org.codehaus.groovy")); + model.addFilterAndValidate("no-debug", filter -> { + filter.exclude("org.eclipse.jdt.debug"); + }); + return model; + } + + @Override + public void setVersion(String version) { + if (version.endsWith(".0")) { + String newVersion = version.substring(0, version.length() - 2); + System.err.println("Recommend replacing '" + version + "' with '" + newVersion + "' for eclipse JDT"); + version = newVersion; + } + super.setVersion(version); + } + }; } - private static FormatterFunc apply(EclipseBasedStepBuilder.State state) throws Exception { + private static FormatterFunc apply(EquoBasedStepBuilder.State state) throws Exception { JVM_SUPPORT.assertFormatterSupported(state.getSemanticVersion()); - Class formatterClazz = getClass(state); - Object formatter = formatterClazz.getConstructor(Properties.class).newInstance(state.getPreferences()); - Method method = formatterClazz.getMethod(FORMATTER_METHOD, String.class); + Class formatterClazz = state.getJarState().getClassLoader().loadClass("com.diffplug.spotless.extra.glue.groovy.GrEclipseFormatterStepImpl"); + var formatter = formatterClazz.getConstructor(Properties.class).newInstance(state.getPreferences()); + var method = formatterClazz.getMethod("format", String.class); return JVM_SUPPORT.suggestLaterVersionOnError(state.getSemanticVersion(), input -> { try { @@ -62,12 +97,4 @@ private static FormatterFunc apply(EclipseBasedStepBuilder.State state) throws E } }); } - - private static Class getClass(State state) { - if (state.getMavenCoordinate(MAVEN_GROUP_ARTIFACT).isPresent()) { - return state.loadClass(FORMATTER_CLASS); - } - return state.loadClass(FORMATTER_CLASS_OLD); - } - } diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java index d0d42f2814..cd9314406f 100644 --- a/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package com.diffplug.spotless.extra.java; import java.io.File; -import java.lang.reflect.Method; import java.util.Properties; import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.Jvm; import com.diffplug.spotless.Provisioner; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder.State; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; + +import dev.equo.solstice.p2.P2Model; /** Formatter step which calls out to the Eclipse JDT formatter. */ public final class EclipseJdtFormatterStep { @@ -31,43 +31,40 @@ public final class EclipseJdtFormatterStep { private EclipseJdtFormatterStep() {} private static final String NAME = "eclipse jdt formatter"; - private static final String FORMATTER_CLASS_OLD = "com.diffplug.gradle.spotless.java.eclipse.EclipseFormatterStepImpl"; - private static final String FORMATTER_CLASS = "com.diffplug.spotless.extra.eclipse.java.EclipseJdtFormatterStepImpl"; - private static final String MAVEN_GROUP_ARTIFACT = "com.diffplug.spotless:spotless-eclipse-jdt"; - private static final String FORMATTER_METHOD = "format"; - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(8, "4.19.0").add(11, "4.21.0"); + private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "4.26"); public static String defaultVersion() { return JVM_SUPPORT.getRecommendedFormatterVersion(); } - /** Provides default configuration */ - public static EclipseBasedStepBuilder createBuilder(Provisioner provisioner) { - return new EclipseBasedStepBuilder(NAME, provisioner, EclipseJdtFormatterStep::apply); + public static EquoBasedStepBuilder createBuilder(Provisioner provisioner) { + return new EquoBasedStepBuilder(NAME, provisioner, EclipseJdtFormatterStep::apply) { + @Override + protected P2Model model(String version) { + var model = new P2Model(); + addPlatformRepo(model, version); + model.getInstall().add("org.eclipse.jdt.core"); + return model; + } + + @Override + public void setVersion(String version) { + if (version.endsWith(".0")) { + String newVersion = version.substring(0, version.length() - 2); + System.err.println("Recommend replacing '" + version + "' with '" + newVersion + "' for Eclipse JDT"); + version = newVersion; + } + super.setVersion(version); + } + }; } - private static FormatterFunc apply(State state) throws Exception { + private static FormatterFunc apply(EquoBasedStepBuilder.State state) throws Exception { JVM_SUPPORT.assertFormatterSupported(state.getSemanticVersion()); - Class formatterClazz = getClass(state); - Object formatter = formatterClazz.getConstructor(Properties.class).newInstance(state.getPreferences()); - FormatterFunc formatterFunc = getFormatterFunc(formatter, formatterClazz); + Class formatterClazz = state.getJarState().getClassLoader().loadClass("com.diffplug.spotless.extra.glue.jdt.EclipseJdtFormatterStepImpl"); + var formatter = formatterClazz.getConstructor(Properties.class).newInstance(state.getPreferences()); + var method = formatterClazz.getMethod("format", String.class, File.class); + FormatterFunc formatterFunc = (FormatterFunc.NeedsFile) (input, file) -> (String) method.invoke(formatter, input, file); return JVM_SUPPORT.suggestLaterVersionOnError(state.getSemanticVersion(), formatterFunc); } - - private static Class getClass(State state) { - if (state.getMavenCoordinate(MAVEN_GROUP_ARTIFACT).isPresent()) { - return state.loadClass(FORMATTER_CLASS); - } - return state.loadClass(FORMATTER_CLASS_OLD); - } - - private static FormatterFunc getFormatterFunc(Object formatter, Class formatterClazz) throws NoSuchMethodException, SecurityException { - try { - Method method = formatterClazz.getMethod(FORMATTER_METHOD, String.class, File.class); - return (FormatterFunc.NeedsFile) (input, file) -> (String) method.invoke(formatter, input, file); - } catch (NoSuchMethodException e) { - Method method = formatterClazz.getMethod(FORMATTER_METHOD, String.class); - return input -> (String) method.invoke(formatter, input); - } - } } diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.11.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.11.0.lockfile deleted file mode 100644 index 7cad5634fe..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.11.0.lockfile +++ /dev/null @@ -1,21 +0,0 @@ -# Spotless formatter based on CDT version 9.7.0 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:9.7.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.1 -com.google.code.findbugs:annotations:3.0.0 -com.google.code.findbugs:jsr305:3.0.0 -com.ibm.icu:icu4j:61.1 -org.eclipse.platform:org.eclipse.core.commands:3.9.300 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.300 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.500 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.300 -org.eclipse.platform:org.eclipse.core.jobs:3.10.300 -org.eclipse.platform:org.eclipse.core.resources:3.13.300 -org.eclipse.platform:org.eclipse.core.runtime:3.15.200 -org.eclipse.platform:org.eclipse.equinox.app:1.4.100 -org.eclipse.platform:org.eclipse.equinox.common:3.10.300 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.300 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.300 -org.eclipse.platform:org.eclipse.jface.text:3.15.100 -org.eclipse.platform:org.eclipse.jface:3.15.100 -org.eclipse.platform:org.eclipse.osgi:3.13.300 -org.eclipse.platform:org.eclipse.text:3.8.100 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 deleted file mode 100644 index 6fd639528a..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.12.0.lockfile +++ /dev/null @@ -1,21 +0,0 @@ -# Spotless formatter based on CDT version 9.8.0 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:9.8.1 -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 -org.eclipse.platform:org.eclipse.core.commands:3.9.400 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.300 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.600 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.400 -org.eclipse.platform:org.eclipse.core.jobs:3.10.400 -org.eclipse.platform:org.eclipse.core.resources:3.13.400 -org.eclipse.platform:org.eclipse.core.runtime:3.15.300 -org.eclipse.platform:org.eclipse.equinox.app:1.4.200 -org.eclipse.platform:org.eclipse.equinox.common:3.10.400 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.400 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.400 -org.eclipse.platform:org.eclipse.jface.text:3.15.200 -org.eclipse.platform:org.eclipse.jface:3.16.0 -org.eclipse.platform:org.eclipse.osgi:3.14.0 -org.eclipse.platform:org.eclipse.text:3.8.200 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.13.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.13.0.lockfile deleted file mode 100644 index 1d169ff087..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.13.0.lockfile +++ /dev/null @@ -1,21 +0,0 @@ -# Spotless formatter based on CDT version 9.9.0 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:9.9.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 -org.eclipse.platform:org.eclipse.core.commands:3.9.500 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.400 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.700 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.500 -org.eclipse.platform:org.eclipse.core.jobs:3.10.500 -org.eclipse.platform:org.eclipse.core.resources:3.13.500 -org.eclipse.platform:org.eclipse.core.runtime:3.16.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.300 -org.eclipse.platform:org.eclipse.equinox.common:3.10.500 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.500 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.500 -org.eclipse.platform:org.eclipse.jface.text:3.15.300 -org.eclipse.platform:org.eclipse.jface:3.17.0 -org.eclipse.platform:org.eclipse.osgi:3.15.0 -org.eclipse.platform:org.eclipse.text:3.9.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.14.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.14.0.lockfile deleted file mode 100644 index 43cb98774d..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.14.0.lockfile +++ /dev/null @@ -1,22 +0,0 @@ -# Spotless formatter based on CDT version 9.10.0 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:9.10.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -com.ibm.icu:icu4j:64.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.600 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.500 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.800 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.600 -org.eclipse.platform:org.eclipse.core.jobs:3.10.600 -org.eclipse.platform:org.eclipse.core.resources:3.13.600 -org.eclipse.platform:org.eclipse.core.runtime:3.17.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.300 -org.eclipse.platform:org.eclipse.equinox.common:3.10.600 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.600 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.600 -org.eclipse.platform:org.eclipse.jface.text:3.16.100 -org.eclipse.platform:org.eclipse.jface:3.18.0 -org.eclipse.platform:org.eclipse.osgi:3.15.100 -org.eclipse.platform:org.eclipse.text:3.10.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.16.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.16.0.lockfile deleted file mode 100644 index 3bf6b1ca01..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.16.0.lockfile +++ /dev/null @@ -1,22 +0,0 @@ -# Spotless formatter based on CDT version 9.11.1 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:9.11.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -com.google.j2objc:j2objc-annotations:1.3 -com.ibm.icu:icu4j:64.2 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.700 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.1000 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.700 -org.eclipse.platform:org.eclipse.core.jobs:3.10.800 -org.eclipse.platform:org.eclipse.core.resources:3.13.700 -org.eclipse.platform:org.eclipse.core.runtime:3.18.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.500 -org.eclipse.platform:org.eclipse.equinox.common:3.12.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.800 -org.eclipse.platform:org.eclipse.jface.text:3.16.300 -org.eclipse.platform:org.eclipse.jface:3.20.0 -org.eclipse.platform:org.eclipse.osgi:3.15.300 -org.eclipse.platform:org.eclipse.text:3.10.200 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.17.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.17.0.lockfile deleted file mode 100644 index 78a6db147f..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.17.0.lockfile +++ /dev/null @@ -1,22 +0,0 @@ -# Spotless formatter based on CDT version 10.0 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:10.0.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.1 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -com.ibm.icu:icu4j:64.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.800 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.1000 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.700 -org.eclipse.platform:org.eclipse.core.jobs:3.10.800 -org.eclipse.platform:org.eclipse.core.resources:3.13.800 -org.eclipse.platform:org.eclipse.core.runtime:3.19.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.0 -org.eclipse.platform:org.eclipse.equinox.common:3.13.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.9.0 -org.eclipse.platform:org.eclipse.jface.text:3.16.400 -org.eclipse.platform:org.eclipse.jface:3.21.0 -org.eclipse.platform:org.eclipse.osgi:3.16.0 -org.eclipse.platform:org.eclipse.text:3.10.300 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.18.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.18.0.lockfile deleted file mode 100644 index 7135a6826d..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.18.0.lockfile +++ /dev/null @@ -1,22 +0,0 @@ -# Spotless formatter based on CDT version 10.1 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:10.1.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -com.ibm.icu:icu4j:64.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.800 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.800 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.1100 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.700 -org.eclipse.platform:org.eclipse.core.jobs:3.10.1000 -org.eclipse.platform:org.eclipse.core.resources:3.13.900 -org.eclipse.platform:org.eclipse.core.runtime:3.20.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.0 -org.eclipse.platform:org.eclipse.equinox.common:3.14.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.0 -org.eclipse.platform:org.eclipse.jface.text:3.16.500 -org.eclipse.platform:org.eclipse.jface:3.22.0 -org.eclipse.platform:org.eclipse.osgi:3.16.100 -org.eclipse.platform:org.eclipse.text:3.10.400 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.19.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.19.0.lockfile deleted file mode 100644 index 7c508e64bd..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.19.0.lockfile +++ /dev/null @@ -1,22 +0,0 @@ -# Spotless formatter based on CDT version 10.2 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:10.2.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -com.ibm.icu:icu4j:67.1 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.800 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.900 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.1100 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.700 -org.eclipse.platform:org.eclipse.core.jobs:3.10.1100 -org.eclipse.platform:org.eclipse.core.resources:3.14.0 -org.eclipse.platform:org.eclipse.core.runtime:3.20.100 -org.eclipse.platform:org.eclipse.equinox.app:1.5.100 -org.eclipse.platform:org.eclipse.equinox.common:3.14.100 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.200 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.100 -org.eclipse.platform:org.eclipse.jface.text:3.17.0 -org.eclipse.platform:org.eclipse.jface:3.22.100 -org.eclipse.platform:org.eclipse.osgi:3.16.200 -org.eclipse.platform:org.eclipse.text:3.11.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.20.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.20.0.lockfile deleted file mode 100644 index 6cdb507d00..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.20.0.lockfile +++ /dev/null @@ -1,22 +0,0 @@ -# Spotless formatter based on CDT version 10.3 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:10.3.0 -com.diffplug.spotless:spotless-eclipse-base:3.5.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -com.ibm.icu:icu4j:67.1 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.10.0 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.1000 -org.eclipse.platform:org.eclipse.core.filebuffers:3.7.0 -org.eclipse.platform:org.eclipse.core.filesystem:1.9.0 -org.eclipse.platform:org.eclipse.core.jobs:3.11.0 -org.eclipse.platform:org.eclipse.core.resources:3.15.0 -org.eclipse.platform:org.eclipse.core.runtime:3.22.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.100 -org.eclipse.platform:org.eclipse.equinox.common:3.15.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.200 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.200 -org.eclipse.platform:org.eclipse.jface.text:3.18.0 -org.eclipse.platform:org.eclipse.jface:3.22.200 -org.eclipse.platform:org.eclipse.osgi:3.16.300 -org.eclipse.platform:org.eclipse.text:3.12.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.21.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.21.0.lockfile deleted file mode 100644 index 4acd5a98ca..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.21.0.lockfile +++ /dev/null @@ -1,22 +0,0 @@ -# Spotless formatter based on CDT version 10.4 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:10.4.0 -com.diffplug.spotless:spotless-eclipse-base:3.5.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -com.ibm.icu:icu4j:67.1 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.10.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.8.0 -org.eclipse.platform:org.eclipse.core.filebuffers:3.7.0 -org.eclipse.platform:org.eclipse.core.filesystem:1.9.100 -org.eclipse.platform:org.eclipse.core.jobs:3.12.0 -org.eclipse.platform:org.eclipse.core.resources:3.15.100 -org.eclipse.platform:org.eclipse.core.runtime:3.23.0 -org.eclipse.platform:org.eclipse.equinox.app:1.6.0 -org.eclipse.platform:org.eclipse.equinox.common:3.15.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.9.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.11.0 -org.eclipse.platform:org.eclipse.jface.text:3.18.100 -org.eclipse.platform:org.eclipse.jface:3.23.0 -org.eclipse.platform:org.eclipse.osgi:3.17.0 -org.eclipse.platform:org.eclipse.text:3.12.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.7.3a.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.7.3a.lockfile deleted file mode 100644 index 92a0d32cc7..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_cdt_formatter/v4.7.3a.lockfile +++ /dev/null @@ -1,21 +0,0 @@ -# Spotless formatter based on CDT version 9.4.3 (see https://www.eclipse.org/cdt/) -com.diffplug.spotless:spotless-eclipse-cdt:9.4.5 -com.diffplug.spotless:spotless-eclipse-base:3.1.1 -com.google.code.findbugs:annotations:3.0.0 -com.google.code.findbugs:jsr305:3.0.0 -com.ibm.icu:icu4j:61.1 -org.eclipse.platform:org.eclipse.core.commands:3.9.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.filebuffers:3.6.200 -org.eclipse.platform:org.eclipse.core.filesystem:1.7.100 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.jface.text:3.13.0 -org.eclipse.platform:org.eclipse.jface:3.14.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v2.3.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v2.3.0.lockfile deleted file mode 100644 index 878ddbe76a..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v2.3.0.lockfile +++ /dev/null @@ -1,5 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 2.3.0 (see https://github.com/groovy/groovy-eclipse/wiki) -# -# This version is deprecated since the new version system is based on the Eclipse versioning. -# Use the corresponding Eclipse version 4.6.3 instead. -com.diffplug.spotless:spotless-ext-greclipse:2.3.0 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.10.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.10.0.lockfile deleted file mode 100644 index 33f672b306..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.10.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 3.0.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:3.2.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.300 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.300 -org.eclipse.platform:org.eclipse.core.jobs:3.10.300 -org.eclipse.platform:org.eclipse.core.resources:3.13.300 -org.eclipse.platform:org.eclipse.core.runtime:3.15.200 -org.eclipse.platform:org.eclipse.equinox.app:1.4.100 -org.eclipse.platform:org.eclipse.equinox.common:3.10.300 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.300 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.300 -org.eclipse.platform:org.eclipse.jface.text:3.15.100 -org.eclipse.platform:org.eclipse.jface:3.15.100 -org.eclipse.platform:org.eclipse.osgi:3.13.300 -org.eclipse.platform:org.eclipse.text:3.8.100 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.12.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.12.0.lockfile deleted file mode 100644 index a60e5e8fb0..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.12.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# 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.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 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.300 -org.eclipse.platform:org.eclipse.core.jobs:3.10.400 -org.eclipse.platform:org.eclipse.core.resources:3.13.400 -org.eclipse.platform:org.eclipse.core.runtime:3.15.300 -org.eclipse.platform:org.eclipse.equinox.app:1.4.200 -org.eclipse.platform:org.eclipse.equinox.common:3.10.400 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.400 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.400 -org.eclipse.platform:org.eclipse.jface.text:3.15.200 -org.eclipse.platform:org.eclipse.jface:3.16.0 -org.eclipse.platform:org.eclipse.osgi:3.14.0 -org.eclipse.platform:org.eclipse.text:3.8.200 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.13.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.13.0.lockfile deleted file mode 100644 index aede5b0a76..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.13.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 3.5.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:3.5.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.500 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.400 -org.eclipse.platform:org.eclipse.core.jobs:3.10.500 -org.eclipse.platform:org.eclipse.core.resources:3.13.500 -org.eclipse.platform:org.eclipse.core.runtime:3.16.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.300 -org.eclipse.platform:org.eclipse.equinox.common:3.10.500 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.500 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.500 -org.eclipse.platform:org.eclipse.jface.text:3.15.300 -org.eclipse.platform:org.eclipse.jface:3.17.0 -org.eclipse.platform:org.eclipse.osgi:3.15.0 -org.eclipse.platform:org.eclipse.text:3.9.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.14.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.14.0.lockfile deleted file mode 100644 index bca432c337..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.14.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 3.6.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:3.6.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -org.eclipse.platform:org.eclipse.core.commands:3.9.600 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.500 -org.eclipse.platform:org.eclipse.core.jobs:3.10.600 -org.eclipse.platform:org.eclipse.core.resources:3.13.600 -org.eclipse.platform:org.eclipse.core.runtime:3.17.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.300 -org.eclipse.platform:org.eclipse.equinox.common:3.10.600 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.600 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.600 -org.eclipse.platform:org.eclipse.jface.text:3.16.100 -org.eclipse.platform:org.eclipse.jface:3.18.0 -org.eclipse.platform:org.eclipse.osgi:3.15.100 -org.eclipse.platform:org.eclipse.text:3.10.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.15.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.15.0.lockfile deleted file mode 100644 index fc91fae066..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.15.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 3.7.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:3.7.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.600 -org.eclipse.platform:org.eclipse.core.jobs:3.10.700 -org.eclipse.platform:org.eclipse.core.resources:3.13.700 -org.eclipse.platform:org.eclipse.core.runtime:3.17.100 -org.eclipse.platform:org.eclipse.equinox.app:1.4.400 -org.eclipse.platform:org.eclipse.equinox.common:3.11.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.700 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.700 -org.eclipse.platform:org.eclipse.jface.text:3.16.200 -org.eclipse.platform:org.eclipse.jface:3.19.0 -org.eclipse.platform:org.eclipse.osgi:3.15.200 -org.eclipse.platform:org.eclipse.text:3.10.100 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.16.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.16.0.lockfile deleted file mode 100644 index 2c5f4ccd03..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.16.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 3.8.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:3.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.700 -org.eclipse.platform:org.eclipse.core.jobs:3.10.800 -org.eclipse.platform:org.eclipse.core.resources:3.13.700 -org.eclipse.platform:org.eclipse.core.runtime:3.18.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.500 -org.eclipse.platform:org.eclipse.equinox.common:3.12.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.800 -org.eclipse.platform:org.eclipse.jface.text:3.16.300 -org.eclipse.platform:org.eclipse.jface:3.20.0 -org.eclipse.platform:org.eclipse.osgi:3.15.300 -org.eclipse.platform:org.eclipse.text:3.10.200 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.17.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.17.0.lockfile deleted file mode 100644 index 5242d0da8c..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.17.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 3.9.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:3.9.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.1 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.800 -org.eclipse.platform:org.eclipse.core.jobs:3.10.800 -org.eclipse.platform:org.eclipse.core.resources:3.13.800 -org.eclipse.platform:org.eclipse.core.runtime:3.19.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.0 -org.eclipse.platform:org.eclipse.equinox.common:3.13.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.9.0 -org.eclipse.platform:org.eclipse.jface.text:3.16.400 -org.eclipse.platform:org.eclipse.jface:3.21.0 -org.eclipse.platform:org.eclipse.osgi:3.16.0 -org.eclipse.platform:org.eclipse.text:3.10.300 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.18.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.18.0.lockfile deleted file mode 100644 index 6bfec53756..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.18.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 4.0.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:4.0.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.800 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.800 -org.eclipse.platform:org.eclipse.core.jobs:3.10.1000 -org.eclipse.platform:org.eclipse.core.resources:3.13.900 -org.eclipse.platform:org.eclipse.core.runtime:3.20.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.0 -org.eclipse.platform:org.eclipse.equinox.common:3.14.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.0 -org.eclipse.platform:org.eclipse.jface.text:3.16.500 -org.eclipse.platform:org.eclipse.jface:3.22.0 -org.eclipse.platform:org.eclipse.osgi:3.16.100 -org.eclipse.platform:org.eclipse.text:3.10.400 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.19.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.19.0.lockfile deleted file mode 100644 index 880d55ac8d..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.19.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 4.1.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:4.1.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.800 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.900 -org.eclipse.platform:org.eclipse.core.jobs:3.10.1100 -org.eclipse.platform:org.eclipse.core.resources:3.14.0 -org.eclipse.platform:org.eclipse.core.runtime:3.20.100 -org.eclipse.platform:org.eclipse.equinox.app:1.5.100 -org.eclipse.platform:org.eclipse.equinox.common:3.14.100 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.200 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.100 -org.eclipse.platform:org.eclipse.jface.text:3.17.0 -org.eclipse.platform:org.eclipse.jface:3.22.100 -org.eclipse.platform:org.eclipse.osgi:3.16.200 -org.eclipse.platform:org.eclipse.text:3.11.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.20.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.20.0.lockfile deleted file mode 100644 index 2836c05982..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.20.0.lockfile +++ /dev/null @@ -1,20 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 4.2.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:4.2.0 -com.diffplug.spotless:spotless-eclipse-base:3.5.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.10.0 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.1000 -org.eclipse.platform:org.eclipse.core.filesystem:1.9.0 -org.eclipse.platform:org.eclipse.core.jobs:3.11.0 -org.eclipse.platform:org.eclipse.core.resources:3.15.0 -org.eclipse.platform:org.eclipse.core.runtime:3.22.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.100 -org.eclipse.platform:org.eclipse.equinox.common:3.15.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.200 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.200 -org.eclipse.platform:org.eclipse.jface.text:3.18.0 -org.eclipse.platform:org.eclipse.jface:3.22.200 -org.eclipse.platform:org.eclipse.osgi:3.16.300 -org.eclipse.platform:org.eclipse.text:3.12.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.21.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.21.0.lockfile deleted file mode 100644 index 38376d1b32..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.21.0.lockfile +++ /dev/null @@ -1,20 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 4.3.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:4.3.0 -com.diffplug.spotless:spotless-eclipse-base:3.5.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.platform:org.eclipse.core.commands:3.10.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.8.0 -org.eclipse.platform:org.eclipse.core.filesystem:1.9.100 -org.eclipse.platform:org.eclipse.core.jobs:3.12.0 -org.eclipse.platform:org.eclipse.core.resources:3.15.100 -org.eclipse.platform:org.eclipse.core.runtime:3.23.0 -org.eclipse.platform:org.eclipse.equinox.app:1.6.0 -org.eclipse.platform:org.eclipse.equinox.common:3.15.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.9.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.11.0 -org.eclipse.platform:org.eclipse.jface.text:3.18.100 -org.eclipse.platform:org.eclipse.jface:3.23.0 -org.eclipse.platform:org.eclipse.osgi:3.17.0 -org.eclipse.platform:org.eclipse.text:3.12.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.6.3.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.6.3.lockfile deleted file mode 100644 index a6299ec57d..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.6.3.lockfile +++ /dev/null @@ -1,2 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 2.3.0 (see https://github.com/groovy/groovy-eclipse/wiki) -com.diffplug.spotless:spotless-ext-greclipse:2.3.0 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.8.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.8.0.lockfile deleted file mode 100644 index bb95c71104..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.8.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 2.9.2 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:2.9.2 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.jface.text:3.13.0 -org.eclipse.platform:org.eclipse.jface:3.14.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.8.1.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.8.1.lockfile deleted file mode 100644 index 9198eaccb9..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_groovy_formatter/v4.8.1.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on Groovy-Eclipse version 3.0.0 (see https://github.com/groovy/groovy-eclipse/releases) -com.diffplug.spotless:spotless-eclipse-groovy:3.0.1 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.jface.text:3.13.0 -org.eclipse.platform:org.eclipse.jface:3.14.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.10.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.10.0.lockfile deleted file mode 100644 index 42d81d7324..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.10.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on JDT version 4.10.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_10 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.16.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.11.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.11.0.lockfile deleted file mode 100644 index 3bbf59db23..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.11.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on JDT version 4.11.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_11 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.17.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 - 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 deleted file mode 100644 index c9bfc9a57d..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.12.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# 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.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 -org.eclipse.platform:org.eclipse.core.commands:3.9.400 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.300 -org.eclipse.platform:org.eclipse.core.jobs:3.10.400 -org.eclipse.platform:org.eclipse.core.resources:3.13.400 -org.eclipse.platform:org.eclipse.core.runtime:3.15.300 -org.eclipse.platform:org.eclipse.equinox.app:1.4.200 -org.eclipse.platform:org.eclipse.equinox.common:3.10.400 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.400 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.400 -org.eclipse.platform:org.eclipse.osgi:3.14.0 -org.eclipse.platform:org.eclipse.text:3.8.200 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.13.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.13.0.lockfile deleted file mode 100644 index 4ee0adb3cf..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.13.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on JDT version 4.13.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_13 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.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.19.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.500 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.400 -org.eclipse.platform:org.eclipse.core.jobs:3.10.500 -org.eclipse.platform:org.eclipse.core.resources:3.13.500 -org.eclipse.platform:org.eclipse.core.runtime:3.16.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.300 -org.eclipse.platform:org.eclipse.equinox.common:3.10.500 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.500 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.500 -org.eclipse.platform:org.eclipse.osgi:3.15.0 -org.eclipse.platform:org.eclipse.text:3.9.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.14.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.14.0.lockfile deleted file mode 100644 index b42352633a..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.14.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on JDT version 4.14.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/log/?h=R4_14 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.20.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.600 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.500 -org.eclipse.platform:org.eclipse.core.jobs:3.10.600 -org.eclipse.platform:org.eclipse.core.resources:3.13.600 -org.eclipse.platform:org.eclipse.core.runtime:3.17.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.300 -org.eclipse.platform:org.eclipse.equinox.common:3.10.600 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.600 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.600 -org.eclipse.platform:org.eclipse.osgi:3.15.100 -org.eclipse.platform:org.eclipse.text:3.10.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.15.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.15.0.lockfile deleted file mode 100644 index ee21631962..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.15.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on JDT version 4.15.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/log/?h=R4_15 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.21.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.600 -org.eclipse.platform:org.eclipse.core.jobs:3.10.700 -org.eclipse.platform:org.eclipse.core.resources:3.13.600 -org.eclipse.platform:org.eclipse.core.runtime:3.17.100 -org.eclipse.platform:org.eclipse.equinox.app:1.4.400 -org.eclipse.platform:org.eclipse.equinox.common:3.11.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.700 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.700 -org.eclipse.platform:org.eclipse.osgi:3.15.200 -org.eclipse.platform:org.eclipse.text:3.10.100 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.16.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.16.0.lockfile deleted file mode 100644 index 7ff27b440a..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.16.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on JDT version 4.16.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/log/?h=R4_16 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.3.0 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.22.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.700 -org.eclipse.platform:org.eclipse.core.jobs:3.10.800 -org.eclipse.platform:org.eclipse.core.resources:3.13.700 -org.eclipse.platform:org.eclipse.core.runtime:3.18.0 -org.eclipse.platform:org.eclipse.equinox.app:1.4.500 -org.eclipse.platform:org.eclipse.equinox.common:3.12.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.800 -org.eclipse.platform:org.eclipse.osgi:3.15.300 -org.eclipse.platform:org.eclipse.text:3.10.200 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.17.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.17.0.lockfile deleted file mode 100644 index 47cb5f10dd..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.17.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on JDT version 4.17.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/log/?h=R4_17 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.1 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.23.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.700 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.800 -org.eclipse.platform:org.eclipse.core.jobs:3.10.800 -org.eclipse.platform:org.eclipse.core.resources:3.13.800 -org.eclipse.platform:org.eclipse.core.runtime:3.19.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.0 -org.eclipse.platform:org.eclipse.equinox.common:3.13.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.9.0 -org.eclipse.platform:org.eclipse.osgi:3.16.0 -org.eclipse.platform:org.eclipse.text:3.10.300 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.18.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.18.0.lockfile deleted file mode 100644 index c5b2799c11..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.18.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on JDT version 4.18.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/log/?h=R4_18 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.24.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.800 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.800 -org.eclipse.platform:org.eclipse.core.jobs:3.10.1000 -org.eclipse.platform:org.eclipse.core.resources:3.13.900 -org.eclipse.platform:org.eclipse.core.runtime:3.20.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.0 -org.eclipse.platform:org.eclipse.equinox.common:3.14.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.0 -org.eclipse.platform:org.eclipse.osgi:3.16.100 -org.eclipse.platform:org.eclipse.text:3.10.400 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.19.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.19.0.lockfile deleted file mode 100644 index fcc96b8520..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.19.0.lockfile +++ /dev/null @@ -1,19 +0,0 @@ -# Spotless formatter based on JDT version 4.19.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/log/?h=R4_19 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.4.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.25.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.800 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.900 -org.eclipse.platform:org.eclipse.core.jobs:3.10.1100 -org.eclipse.platform:org.eclipse.core.resources:3.14.0 -org.eclipse.platform:org.eclipse.core.runtime:3.20.100 -org.eclipse.platform:org.eclipse.equinox.app:1.5.100 -org.eclipse.platform:org.eclipse.equinox.common:3.14.100 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.200 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.100 -org.eclipse.platform:org.eclipse.osgi:3.16.200 -org.eclipse.platform:org.eclipse.text:3.11.0 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.20.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.20.0.lockfile deleted file mode 100644 index b06a9bc617..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.20.0.lockfile +++ /dev/null @@ -1,20 +0,0 @@ -# Spotless formatter based on JDT version 4.20.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/log/?h=R4_20 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.1 -com.diffplug.spotless:spotless-eclipse-base:3.5.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.26.0 -org.eclipse.platform:org.eclipse.core.commands:3.10.0 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.1000 -org.eclipse.platform:org.eclipse.core.filesystem:1.9.0 -org.eclipse.platform:org.eclipse.core.jobs:3.11.0 -org.eclipse.platform:org.eclipse.core.resources:3.15.0 -org.eclipse.platform:org.eclipse.core.runtime:3.22.0 -org.eclipse.platform:org.eclipse.equinox.app:1.5.100 -org.eclipse.platform:org.eclipse.equinox.common:3.15.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.8.200 -org.eclipse.platform:org.eclipse.equinox.registry:3.10.200 -org.eclipse.platform:org.eclipse.osgi:3.16.300 -org.eclipse.platform:org.eclipse.text:3.12.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.21.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.21.0.lockfile deleted file mode 100644 index 84a90489c9..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.21.0.lockfile +++ /dev/null @@ -1,20 +0,0 @@ -# Spotless formatter based on JDT version 4.21.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/log/?h=R4_21 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.1 -com.diffplug.spotless:spotless-eclipse-base:3.5.2 -com.github.spotbugs:spotbugs-annotations:4.0.2 -com.google.code.findbugs:jsr305:3.0.2 -net.jcip:jcip-annotations:1.0 -org.eclipse.jdt:org.eclipse.jdt.core:3.27.0 -org.eclipse.platform:org.eclipse.core.commands:3.10.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.8.0 -org.eclipse.platform:org.eclipse.core.filesystem:1.9.100 -org.eclipse.platform:org.eclipse.core.jobs:3.12.0 -org.eclipse.platform:org.eclipse.core.resources:3.15.100 -org.eclipse.platform:org.eclipse.core.runtime:3.23.0 -org.eclipse.platform:org.eclipse.equinox.app:1.6.0 -org.eclipse.platform:org.eclipse.equinox.common:3.15.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.9.0 -org.eclipse.platform:org.eclipse.equinox.registry:3.11.0 -org.eclipse.platform:org.eclipse.osgi:3.17.0 -org.eclipse.platform:org.eclipse.text:3.12.0 diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.1.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.1.lockfile deleted file mode 100644 index fd408e7ecc..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.1.lockfile +++ /dev/null @@ -1,2 +0,0 @@ -# Spotless formatter based on JDT version 4.6.1 (see https://projects.eclipse.org/projects/eclipse.jdt) -com.diffplug.spotless:spotless-ext-eclipse-jdt:4.6.1 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.2.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.2.lockfile deleted file mode 100644 index a042b7e734..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.2.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on JDT version 4.6.2 (see https://projects.eclipse.org/projects/eclipse.jdt) -# Compare tag in M2 pom with https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/log/?h=R4_6_maintenance to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.12.2 -org.eclipse.platform:org.eclipse.core.commands:3.9.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.3.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.3.lockfile deleted file mode 100644 index 714ff708c8..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.6.3.lockfile +++ /dev/null @@ -1,2 +0,0 @@ -# Spotless formatter based on JDT version 4.6.3 (see https://projects.eclipse.org/projects/eclipse.jdt) -com.diffplug.spotless:spotless-ext-eclipse-jdt:4.6.3 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.0.lockfile deleted file mode 100644 index 9e3eefbcb1..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.0.lockfile +++ /dev/null @@ -1,2 +0,0 @@ -# Spotless formatter based on JDT version 4.7 (see https://projects.eclipse.org/projects/eclipse.jdt) -com.diffplug.spotless:spotless-ext-eclipse-jdt:4.7.0 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.1.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.1.lockfile deleted file mode 100644 index 650c67e13b..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.1.lockfile +++ /dev/null @@ -1,2 +0,0 @@ -# Spotless formatter based on JDT version 4.7.1 (see https://projects.eclipse.org/projects/eclipse.jdt) -com.diffplug.spotless:spotless-ext-eclipse-jdt:4.7.1 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.2.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.2.lockfile deleted file mode 100644 index 35abd036aa..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.2.lockfile +++ /dev/null @@ -1,2 +0,0 @@ -# Spotless formatter based on JDT version 4.7.2 (see https://projects.eclipse.org/projects/eclipse.jdt) -com.diffplug.spotless:spotless-ext-eclipse-jdt:4.7.2 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.3a.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.3a.lockfile deleted file mode 100644 index a5e7aaa57b..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.7.3a.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on JDT version 4.7.3a (see https://projects.eclipse.org/projects/eclipse.jdt) -# Compare tag in M2 pom with https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/log/?h=R4_7_maintenance to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.13.101 -org.eclipse.platform:org.eclipse.core.commands:3.9.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.8.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.8.0.lockfile deleted file mode 100644 index a9204f5a45..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.8.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on JDT version 4.8.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_8 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.14.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 \ No newline at end of file diff --git a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.9.0.lockfile b/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.9.0.lockfile deleted file mode 100644 index 5a19c69254..0000000000 --- a/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_jdt_formatter/v4.9.0.lockfile +++ /dev/null @@ -1,18 +0,0 @@ -# Spotless formatter based on JDT version 4.9.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_9 to determine core version. -com.diffplug.spotless:spotless-eclipse-jdt:4.8.0 -com.diffplug.spotless:spotless-eclipse-base:3.1.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.15.0 -org.eclipse.platform:org.eclipse.core.commands:3.9.100 -org.eclipse.platform:org.eclipse.core.contenttype:3.7.0 -org.eclipse.platform:org.eclipse.core.jobs:3.10.0 -org.eclipse.platform:org.eclipse.core.resources:3.13.0 -org.eclipse.platform:org.eclipse.core.runtime:3.14.0 -org.eclipse.platform:org.eclipse.equinox.app:1.3.500 -org.eclipse.platform:org.eclipse.equinox.common:3.10.0 -org.eclipse.platform:org.eclipse.equinox.preferences:3.7.100 -org.eclipse.platform:org.eclipse.equinox.registry:3.8.0 -org.eclipse.platform:org.eclipse.osgi:3.13.0 -org.eclipse.platform:org.eclipse.text:3.6.300 \ No newline at end of file diff --git a/lib-extra/src/test/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStepTest.java b/lib-extra/src/test/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStepTest.java index f39673cdc8..9ed9f2f227 100644 --- a/lib-extra/src/test/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStepTest.java +++ b/lib-extra/src/test/java/com/diffplug/spotless/extra/cpp/EclipseCdtFormatterStepTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import com.diffplug.spotless.Jvm; import com.diffplug.spotless.TestProvisioner; -import com.diffplug.spotless.extra.eclipse.EclipseResourceHarness; +import com.diffplug.spotless.extra.eclipse.EquoResourceHarness; -class EclipseCdtFormatterStepTest extends EclipseResourceHarness { - private final static Jvm.Support JVM_SUPPORT = Jvm. support("Oldest Version").add(8, "4.11.0"); +class EclipseCdtFormatterStepTest extends EquoResourceHarness { private final static String INPUT = "#include ;\nint main(int argc, \nchar *argv[]) {}"; private final static String EXPECTED = "#include ;\nint main(int argc, char *argv[]) {\n}\n"; @@ -40,6 +38,6 @@ void formatWithVersion(String version) throws Exception { } private static Stream formatWithVersion() { - return Stream.of(JVM_SUPPORT.getRecommendedFormatterVersion(), EclipseCdtFormatterStep.defaultVersion()); + return Stream.of("10.6", "10.7", EclipseCdtFormatterStep.defaultVersion()); } } diff --git a/lib-extra/src/test/java/com/diffplug/spotless/extra/eclipse/EquoResourceHarness.java b/lib-extra/src/test/java/com/diffplug/spotless/extra/eclipse/EquoResourceHarness.java new file mode 100644 index 0000000000..8d5d955c02 --- /dev/null +++ b/lib-extra/src/test/java/com/diffplug/spotless/extra/eclipse/EquoResourceHarness.java @@ -0,0 +1,99 @@ +/* + * Copyright 2016-2023 DiffPlug + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.diffplug.spotless.extra.eclipse; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.util.Arrays; + +import com.diffplug.spotless.FormatterStep; +import com.diffplug.spotless.LineEnding; +import com.diffplug.spotless.ResourceHarness; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; + +/** + * Provides a common formatter test for all Spotless Eclipse Formatter steps + * provided by lib-extra. + *

+ * The external Spotless Eclipse Formatter Step implementations are responsible + * to test the functionality of the Spotless adaptations for the Eclipse formatter. + * This explicitly includes a check of various forms of valid and invalid input + * to cover all relevant execution paths during the code formatting and internal + * exception handling. + *

+ *

+ * The lib-extra users, like plugin-gradle and plugin-maven are responsible + * to test the correct provision of user settings to the generic + * Spotless Eclipse Formatter steps provided by lib-extra. + *

+ */ +public class EquoResourceHarness extends ResourceHarness { + private final EquoBasedStepBuilder stepBuilder; + private final String fileName; + private final String input; + private final String expected; + + /** + * Create harness to be used for several versions of the formatter step + * @param builder Eclipse Formatter step builder + * @param unformatted Simple unformatted input + * @param formatted Expected formatted output + */ + public EquoResourceHarness(EquoBasedStepBuilder builder, String unformatted, String formatted) { + this(builder, "someSourceFile", unformatted, formatted); + } + + /** + * Create harness to be used for several versions of the formatter step + * @param builder Eclipse Formatter step builder + * @param sourceFileName File name of the source file + * @param unformatted Simple unformatted input + * @param formatted Expected formatted output + */ + public EquoResourceHarness(EquoBasedStepBuilder builder, String sourceFileName, String unformatted, String formatted) { + stepBuilder = builder; + fileName = sourceFileName; + input = unformatted; + expected = formatted; + } + + /** + * Assert that formatting input results in expected output + * @param formatterVersion Formatter version + * @param settingsFiles Formatter settings + * @return Formatted string + */ + protected String assertFormatted(String formatterVersion, File... settingsFiles) throws Exception { + String output = format(formatterVersion, settingsFiles); + assertThat(output).isEqualTo(expected); + return output; + } + + /** + * Formatting input results and returns output + * @param formatterVersion Formatter version + * @param settingsFiles Formatter settings + * @return Formatted string + */ + protected String format(String formatterVersion, File... settingsFiles) throws Exception { + File inputFile = setFile(fileName).toContent(input); + stepBuilder.setVersion(formatterVersion); + stepBuilder.setPreferences(Arrays.asList(settingsFiles)); + FormatterStep step = stepBuilder.build(); + return LineEnding.toUnix(step.format(input, inputFile)); + } +} diff --git a/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepTest.java b/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepTest.java index f1823e5f52..2bd68d0281 100644 --- a/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepTest.java +++ b/lib-extra/src/test/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStepTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import com.diffplug.spotless.Jvm; import com.diffplug.spotless.TestProvisioner; -import com.diffplug.spotless.extra.eclipse.EclipseResourceHarness; +import com.diffplug.spotless.extra.eclipse.EquoResourceHarness; -class GrEclipseFormatterStepTest extends EclipseResourceHarness { - private final static Jvm.Support JVM_SUPPORT = Jvm. support("Oldest Version").add(8, "2.3.0").add(11, "4.17.0"); +public class GrEclipseFormatterStepTest extends EquoResourceHarness { private final static String INPUT = "class F{ def m(){} }"; private final static String EXPECTED = "class F{\n\tdef m(){}\n}"; @@ -40,6 +38,6 @@ void formatWithVersion(String version) throws Exception { } private static Stream formatWithVersion() { - return Stream.of(JVM_SUPPORT.getRecommendedFormatterVersion(), GrEclipseFormatterStep.defaultVersion()); + return Stream.of("4.18", GrEclipseFormatterStep.defaultVersion()); } } diff --git a/lib-extra/src/test/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStepTest.java b/lib-extra/src/test/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStepTest.java index 2ade78f742..91bc8740ab 100644 --- a/lib-extra/src/test/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStepTest.java +++ b/lib-extra/src/test/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStepTest.java @@ -23,18 +23,15 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import com.diffplug.spotless.Jvm; import com.diffplug.spotless.TestProvisioner; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; -import com.diffplug.spotless.extra.eclipse.EclipseResourceHarness; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; +import com.diffplug.spotless.extra.eclipse.EquoResourceHarness; -class EclipseJdtFormatterStepTest extends EclipseResourceHarness { - private final static String NON_SEMANTIC_ECLIPSE_VERSION = "4.7.3a"; - private final static Jvm.Support JVM_SUPPORT = Jvm. support("Oldest Version").add(8, "4.6.1").add(11, "4.20.0"); +class EclipseJdtFormatterStepTest extends EquoResourceHarness { private final static String INPUT = "package p; class C{}"; private final static String EXPECTED = "package p;\nclass C {\n}"; - private static EclipseBasedStepBuilder createBuilder() { + private static EquoBasedStepBuilder createBuilder() { return EclipseJdtFormatterStep.createBuilder(TestProvisioner.mavenCentral()); } @@ -49,21 +46,20 @@ void formatWithVersion(String version) throws Exception { } private static Stream formatWithVersion() { - return Stream.of(NON_SEMANTIC_ECLIPSE_VERSION, JVM_SUPPORT.getRecommendedFormatterVersion(), EclipseJdtFormatterStep.defaultVersion()); + return Stream.of("4.9", EclipseJdtFormatterStep.defaultVersion()); } /** New format interface requires source file information to distinguish module-info from compilation unit */ @Nested - - class NewFormatInterface extends EclipseResourceHarness { - public NewFormatInterface() throws Exception { + class NewFormatInterface extends EquoResourceHarness { + public NewFormatInterface() { super(createBuilder(), "module-info.java", getTestResource("java/eclipse/ModuleInfoUnformatted.test"), getTestResource("java/eclipse/ModuleInfoFormatted.test")); } @Test void formatModuleInfo() throws Exception { File settingsFile = createTestFile("java/eclipse/ModuleInfo.prefs"); - assertFormatted(JVM_SUPPORT.getRecommendedFormatterVersion(), settingsFile); + assertFormatted("4.11", settingsFile); } } } diff --git a/lib/build.gradle b/lib/build.gradle index 9a6e7913d5..5480320889 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -10,6 +10,7 @@ apply from: rootProject.file('gradle/java-publish.gradle') def NEEDS_GLUE = [ 'sortPom', 'palantirJavaFormat', + 'googleJavaFormat', 'ktfmt', 'ktlint', 'flexmark', @@ -70,6 +71,8 @@ dependencies { palantirJavaFormatCompileOnly 'com.palantir.javaformat:palantir-java-format:1.1.0' // this version needs to stay compilable against Java 8 for CI Job testNpm + googleJavaFormatCompileOnly 'com.google.googlejavaformat:google-java-format:1.8' // minimum required version due to api changes before then + // used jackson-based formatters jacksonCompileOnly 'com.fasterxml.jackson.core:jackson-databind:2.14.2' jacksonCompileOnly 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.2' @@ -119,19 +122,10 @@ spotbugs { reportLevel = 'low' } // low|medium|high (low = sensitive to even min apply from: rootProject.file('gradle/special-tests.gradle') tasks.withType(Test).configureEach { - def args = [] if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) { // https://docs.gradle.org/7.5/userguide/upgrading_version_7.html#removes_implicit_add_opens_for_test_workers - args += [ - "--add-opens=java.base/java.lang=ALL-UNNAMED", - "--add-opens=java.base/java.util=ALL-UNNAMED", - ] - } - if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_18)) { - // https://openjdk.org/jeps/411 - args += "-Djava.security.manager=allow" + jvmArgs "--add-opens=java.base/java.lang=ALL-UNNAMED" } - jvmArgs(args) } jar { diff --git a/lib/src/googleJavaFormat/java/com/diffplug/spotless/glue/java/GoogleJavaFormatFormatterFunc.java b/lib/src/googleJavaFormat/java/com/diffplug/spotless/glue/java/GoogleJavaFormatFormatterFunc.java new file mode 100644 index 0000000000..f45394979a --- /dev/null +++ b/lib/src/googleJavaFormat/java/com/diffplug/spotless/glue/java/GoogleJavaFormatFormatterFunc.java @@ -0,0 +1,70 @@ +/* + * Copyright 2023 DiffPlug + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.diffplug.spotless.glue.java; + +import java.util.Objects; + +import javax.annotation.Nonnull; + +import com.google.googlejavaformat.java.Formatter; +import com.google.googlejavaformat.java.FormatterException; +import com.google.googlejavaformat.java.ImportOrderer; +import com.google.googlejavaformat.java.JavaFormatterOptions; +import com.google.googlejavaformat.java.RemoveUnusedImports; +import com.google.googlejavaformat.java.StringWrapper; + +import com.diffplug.spotless.FormatterFunc; + +public class GoogleJavaFormatFormatterFunc implements FormatterFunc { + + @Nonnull + private final Formatter formatter; + + @Nonnull + private final String version; + + @Nonnull + private final JavaFormatterOptions.Style formatterStyle; + + private final boolean reflowStrings; + + public GoogleJavaFormatFormatterFunc(@Nonnull String version, @Nonnull String style, boolean reflowStrings) { + this.version = Objects.requireNonNull(version); + this.formatterStyle = JavaFormatterOptions.Style.valueOf(Objects.requireNonNull(style)); + this.reflowStrings = reflowStrings; + + this.formatter = new Formatter(JavaFormatterOptions.builder() + .style(formatterStyle) + .build()); + } + + @Override + @Nonnull + public String apply(@Nonnull String input) throws Exception { + String formatted = formatter.formatSource(input); + String removedUnused = RemoveUnusedImports.removeUnusedImports(formatted); + String sortedImports = ImportOrderer.reorderImports(removedUnused, formatterStyle); + return reflowLongStrings(sortedImports); + } + + private String reflowLongStrings(String input) throws FormatterException { + if (reflowStrings) { + return StringWrapper.wrap(input, formatter); + } else { + return input; + } + } +} diff --git a/lib/src/googleJavaFormat/java/com/diffplug/spotless/glue/java/GoogleJavaFormatRemoveUnusedImporterFormatterFunc.java b/lib/src/googleJavaFormat/java/com/diffplug/spotless/glue/java/GoogleJavaFormatRemoveUnusedImporterFormatterFunc.java new file mode 100644 index 0000000000..de21a18795 --- /dev/null +++ b/lib/src/googleJavaFormat/java/com/diffplug/spotless/glue/java/GoogleJavaFormatRemoveUnusedImporterFormatterFunc.java @@ -0,0 +1,40 @@ +/* + * Copyright 2023 DiffPlug + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.diffplug.spotless.glue.java; + +import java.util.Objects; + +import javax.annotation.Nonnull; + +import com.google.googlejavaformat.java.RemoveUnusedImports; + +import com.diffplug.spotless.FormatterFunc; + +public class GoogleJavaFormatRemoveUnusedImporterFormatterFunc implements FormatterFunc { + + @Nonnull + private final String version; + + public GoogleJavaFormatRemoveUnusedImporterFormatterFunc(@Nonnull String version) { + this.version = Objects.requireNonNull(version); + } + + @Override + @Nonnull + public String apply(@Nonnull String input) throws Exception { + return RemoveUnusedImports.removeUnusedImports(input); + } +} diff --git a/lib/src/main/java/com/diffplug/spotless/FeatureClassLoader.java b/lib/src/main/java/com/diffplug/spotless/FeatureClassLoader.java index 0703a91318..d07e7e4324 100644 --- a/lib/src/main/java/com/diffplug/spotless/FeatureClassLoader.java +++ b/lib/src/main/java/com/diffplug/spotless/FeatureClassLoader.java @@ -62,7 +62,7 @@ class FeatureClassLoader extends URLClassLoader { @Override protected Class findClass(String name) throws ClassNotFoundException { - if (name.startsWith("com.diffplug.spotless.glue.")) { + if (name.startsWith("com.diffplug.spotless.glue.") || name.startsWith("com.diffplug.spotless.extra.glue.")) { String path = name.replace('.', '/') + ".class"; URL url = findResource(path); if (url == null) { diff --git a/lib/src/main/java/com/diffplug/spotless/JarState.java b/lib/src/main/java/com/diffplug/spotless/JarState.java index abe595e608..afd7c1ddf2 100644 --- a/lib/src/main/java/com/diffplug/spotless/JarState.java +++ b/lib/src/main/java/com/diffplug/spotless/JarState.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,11 +39,12 @@ public final class JarState implements Serializable { private static final long serialVersionUID = 1L; + @Deprecated private final Set mavenCoordinates; private final FileSignature fileSignature; private JarState(Collection mavenCoordinates, FileSignature fileSignature) { - this.mavenCoordinates = new TreeSet(mavenCoordinates); + this.mavenCoordinates = new TreeSet<>(mavenCoordinates); this.fileSignature = fileSignature; } @@ -73,6 +74,12 @@ private static JarState provisionWithTransitives(boolean withTransitives, Collec return new JarState(mavenCoordinates, fileSignature); } + /** Wraps the given collection of a files as a JarState, maintaining the order in the Collection. */ + public static JarState preserveOrder(Collection jars) throws IOException { + FileSignature fileSignature = FileSignature.signAsList(jars); + return new JarState(Collections.emptySet(), fileSignature); + } + URL[] jarUrls() { return fileSignature.files().stream().map(File::toURI).map(ThrowingEx.wrap(URI::toURL)).toArray(URL[]::new); } @@ -102,6 +109,7 @@ public ClassLoader getClassLoader(Serializable key) { } /** Returns unmodifiable view on sorted Maven coordinates */ + @Deprecated public Set getMavenCoordinates() { return Collections.unmodifiableSet(mavenCoordinates); } diff --git a/lib/src/main/java/com/diffplug/spotless/Jvm.java b/lib/src/main/java/com/diffplug/spotless/Jvm.java index c9c71b72df..7c9ad5b47a 100644 --- a/lib/src/main/java/com/diffplug/spotless/Jvm.java +++ b/lib/src/main/java/com/diffplug/spotless/Jvm.java @@ -63,8 +63,9 @@ public static int version() { public static class Support { private final String fmtName; private final Comparator fmtVersionComparator; - private final NavigableMap jvm2fmtVersion; - private final NavigableMap fmt2jvmVersion; + private final NavigableMap jvm2fmtMaxVersion; + private final NavigableMap jvm2fmtMinVersion; + private final NavigableMap fmtMaxVersion2jvmVersion; private Support(String fromatterName) { this(fromatterName, new SemanticVersionComparator()); @@ -73,40 +74,60 @@ private Support(String fromatterName) { private Support(String formatterName, Comparator formatterVersionComparator) { fmtName = formatterName; fmtVersionComparator = formatterVersionComparator; - jvm2fmtVersion = new TreeMap(); - fmt2jvmVersion = new TreeMap(formatterVersionComparator); + jvm2fmtMaxVersion = new TreeMap<>(); + jvm2fmtMinVersion = new TreeMap<>(); + fmtMaxVersion2jvmVersion = new TreeMap<>(formatterVersionComparator); } /** - * Add supported formatter version + * Add maximum supported formatter version * @param minimumJvmVersion Minimum Java version required * @param maxFormatterVersion Maximum formatter version supported by the Java version * @return this */ public Support add(int minimumJvmVersion, V maxFormatterVersion) { Objects.requireNonNull(maxFormatterVersion); - if (null != jvm2fmtVersion.put(minimumJvmVersion, maxFormatterVersion)) { + if (null != jvm2fmtMaxVersion.put(minimumJvmVersion, maxFormatterVersion)) { throw new IllegalArgumentException(String.format("Added duplicate entry for JVM %d+.", minimumJvmVersion)); } - if (null != fmt2jvmVersion.put(maxFormatterVersion, minimumJvmVersion)) { + if (null != fmtMaxVersion2jvmVersion.put(maxFormatterVersion, minimumJvmVersion)) { throw new IllegalArgumentException(String.format("Added duplicate entry for formatter version %s.", maxFormatterVersion)); } + verifyVersionRangesDoNotIntersect(jvm2fmtMaxVersion, minimumJvmVersion, maxFormatterVersion); + return this; + } + + public Support addMin(int minimumJvmVersion, V minFormatterVersion) { + Objects.requireNonNull(minFormatterVersion); + if (null != jvm2fmtMinVersion.put(minimumJvmVersion, minFormatterVersion)) { + throw new IllegalArgumentException(String.format("Added duplicate entry for JVM %d+.", minimumJvmVersion)); + } + verifyVersionRangesDoNotIntersect(jvm2fmtMinVersion, minimumJvmVersion, minFormatterVersion); + return this; + } + + private void verifyVersionRangesDoNotIntersect(NavigableMap jvm2fmtVersion, int minimumJvmVersion, V formatterVersion) { Map.Entry lower = jvm2fmtVersion.lowerEntry(minimumJvmVersion); - if ((null != lower) && (fmtVersionComparator.compare(maxFormatterVersion, lower.getValue()) <= 0)) { - throw new IllegalArgumentException(String.format("%d/%s should be lower than %d/%s", minimumJvmVersion, maxFormatterVersion, lower.getKey(), lower.getValue())); + if ((null != lower) && (fmtVersionComparator.compare(formatterVersion, lower.getValue()) <= 0)) { + throw new IllegalArgumentException(String.format("%d/%s should be lower than %d/%s", minimumJvmVersion, formatterVersion, lower.getKey(), lower.getValue())); } Map.Entry higher = jvm2fmtVersion.higherEntry(minimumJvmVersion); - if ((null != higher) && (fmtVersionComparator.compare(maxFormatterVersion, higher.getValue()) >= 0)) { - throw new IllegalArgumentException(String.format("%d/%s should be higher than %d/%s", minimumJvmVersion, maxFormatterVersion, higher.getKey(), higher.getValue())); + if ((null != higher) && (fmtVersionComparator.compare(formatterVersion, higher.getValue()) >= 0)) { + throw new IllegalArgumentException(String.format("%d/%s should be higher than %d/%s", minimumJvmVersion, formatterVersion, higher.getKey(), higher.getValue())); } - return this; } /** @return Highest formatter version recommended for this JVM (null, if JVM not supported) */ @Nullable public V getRecommendedFormatterVersion() { - Integer configuredJvmVersionOrNull = jvm2fmtVersion.floorKey(Jvm.version()); - return (null == configuredJvmVersionOrNull) ? null : jvm2fmtVersion.get(configuredJvmVersionOrNull); + Integer configuredJvmVersionOrNull = jvm2fmtMaxVersion.floorKey(Jvm.version()); + return (null == configuredJvmVersionOrNull) ? null : jvm2fmtMaxVersion.get(configuredJvmVersionOrNull); + } + + @Nullable + public V getMinimumRequiredFormatterVersion() { + Integer configuredJvmVersionOrNull = jvm2fmtMinVersion.floorKey(Jvm.version()); + return (null == configuredJvmVersionOrNull) ? null : jvm2fmtMinVersion.get(configuredJvmVersionOrNull); } /** @@ -123,10 +144,17 @@ public void assertFormatterSupported(V formatterVersion) { } private String buildUnsupportedFormatterMessage(V fmtVersion) { + // check if the jvm version is to low for the formatter version int requiredJvmVersion = getRequiredJvmVersion(fmtVersion); if (Jvm.version() < requiredJvmVersion) { return buildUpgradeJvmMessage(fmtVersion) + "Upgrade your JVM or try " + toString(); } + // check if the formatter version is too low for the jvm version + V minimumFormatterVersion = getMinimumRequiredFormatterVersion(); + if ((null != minimumFormatterVersion) && (fmtVersionComparator.compare(fmtVersion, minimumFormatterVersion) < 0)) { + return String.format("You are running Spotless on JVM %d. This requires %s of at least %s (you are using %s).%n", Jvm.version(), fmtName, minimumFormatterVersion, fmtVersion); + } + // otherwise all is well return ""; } @@ -137,7 +165,7 @@ private String buildUpgradeJvmMessage(V fmtVersion) { if (null != recommendedFmtVersionOrNull) { builder.append(String.format(", which limits you to %s %s.%n", fmtName, recommendedFmtVersionOrNull)); } else { - Entry nextFmtVersionOrNull = fmt2jvmVersion.ceilingEntry(fmtVersion); + Entry nextFmtVersionOrNull = fmtMaxVersion2jvmVersion.ceilingEntry(fmtVersion); if (null != nextFmtVersionOrNull) { builder.append(String.format(". %s %s requires JVM %d+", fmtName, fmtVersion, nextFmtVersionOrNull.getValue())); } @@ -147,12 +175,12 @@ private String buildUpgradeJvmMessage(V fmtVersion) { } private int getRequiredJvmVersion(V fmtVersion) { - Entry entry = fmt2jvmVersion.ceilingEntry(fmtVersion); + Entry entry = fmtMaxVersion2jvmVersion.ceilingEntry(fmtVersion); if (null == entry) { - entry = fmt2jvmVersion.lastEntry(); + entry = fmtMaxVersion2jvmVersion.lastEntry(); } if (null != entry) { - V maxKnownFmtVersion = jvm2fmtVersion.get(entry.getValue()); + V maxKnownFmtVersion = jvm2fmtMaxVersion.get(entry.getValue()); if (fmtVersionComparator.compare(fmtVersion, maxKnownFmtVersion) <= 0) { return entry.getValue(); } @@ -170,15 +198,15 @@ public FormatterFunc suggestLaterVersionOnError(V formatterVersion, FormatterFun Objects.requireNonNull(formatterVersion); Objects.requireNonNull(originalFunc); final String hintUnsupportedProblem = buildUnsupportedFormatterMessage(formatterVersion); - final String proposeDiffererntFormatter = hintUnsupportedProblem.isEmpty() ? buildUpgradeFormatterMessage(formatterVersion) : hintUnsupportedProblem; - return proposeDiffererntFormatter.isEmpty() ? originalFunc : new FormatterFunc() { + final String proposeDifferentFormatter = hintUnsupportedProblem.isEmpty() ? buildUpgradeFormatterMessage(formatterVersion) : hintUnsupportedProblem; + return proposeDifferentFormatter.isEmpty() ? originalFunc : new FormatterFunc() { @Override public String apply(String unix, File file) throws Exception { try { return originalFunc.apply(unix, file); } catch (Exception e) { - throw new Exception(proposeDiffererntFormatter, e); + throw new Exception(proposeDifferentFormatter, e); } } @@ -187,7 +215,7 @@ public String apply(String input) throws Exception { try { return originalFunc.apply(input); } catch (Exception e) { - throw new Exception(proposeDiffererntFormatter, e); + throw new Exception(proposeDifferentFormatter, e); } } @@ -196,16 +224,25 @@ public String apply(String input) throws Exception { private String buildUpgradeFormatterMessage(V fmtVersion) { StringBuilder builder = new StringBuilder(); + // check if the formatter is not supported on this jvm + V minimumFormatterVersion = getMinimumRequiredFormatterVersion(); V recommendedFmtVersionOrNull = getRecommendedFormatterVersion(); - if (null != recommendedFmtVersionOrNull && (fmtVersionComparator.compare(fmtVersion, recommendedFmtVersionOrNull) < 0)) { + if ((null != minimumFormatterVersion) && (fmtVersionComparator.compare(fmtVersion, minimumFormatterVersion) < 0)) { + builder.append(String.format("You are running Spotless on JVM %d. This requires %s of at least %s.%n", Jvm.version(), fmtName, minimumFormatterVersion)); + builder.append(String.format("You are using %s %s.%n", fmtName, fmtVersion)); + if (null != recommendedFmtVersionOrNull) { + builder.append(String.format("%s %s is the recommended version, which may have fixed this problem.%n", fmtName, recommendedFmtVersionOrNull)); + } + // check if the formatter is outdated on this jvm + } else if (null != recommendedFmtVersionOrNull && (fmtVersionComparator.compare(fmtVersion, recommendedFmtVersionOrNull) < 0)) { builder.append(String.format("%s %s is currently being used, but outdated.%n", fmtName, fmtVersion)); builder.append(String.format("%s %s is the recommended version, which may have fixed this problem.%n", fmtName, recommendedFmtVersionOrNull)); builder.append(String.format("%s %s requires JVM %d+.", fmtName, recommendedFmtVersionOrNull, getRequiredJvmVersion(recommendedFmtVersionOrNull))); } else { - V higherFormatterVersionOrNull = fmt2jvmVersion.higherKey(fmtVersion); + V higherFormatterVersionOrNull = fmtMaxVersion2jvmVersion.higherKey(fmtVersion); if (null != higherFormatterVersionOrNull) { builder.append(buildUpgradeJvmMessage(fmtVersion)); - Integer higherJvmVersion = fmt2jvmVersion.get(higherFormatterVersionOrNull); + Integer higherJvmVersion = fmtMaxVersion2jvmVersion.get(higherFormatterVersionOrNull); builder.append(String.format("If you upgrade your JVM to %d+, then you can use %s %s, which may have fixed this problem.", higherJvmVersion, fmtName, higherFormatterVersionOrNull)); } } @@ -215,7 +252,7 @@ private String buildUpgradeFormatterMessage(V fmtVersion) { @Override public String toString() { return String.format("%s alternatives:%n", fmtName) + - jvm2fmtVersion.entrySet().stream().map( + jvm2fmtMaxVersion.entrySet().stream().map( e -> String.format("- Version %s requires JVM %d+", e.getValue(), e.getKey())).collect(Collectors.joining(System.lineSeparator())); } diff --git a/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java b/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java index b4c0cf2a6f..073af855d3 100644 --- a/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java +++ b/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java @@ -45,6 +45,7 @@ /** Prefixes a license header before the package statement. */ public final class LicenseHeaderStep { + public static final String DEFAULT_JAVA_HEADER_DELIMITER = "(package|import|public|class|module) "; private static final Logger LOGGER = LoggerFactory.getLogger(LicenseHeaderStep.class); public enum YearMode { @@ -142,7 +143,7 @@ public FormatterStep build() { throw new IllegalStateException(yearMode.toString()); } return new Runtime(headerLazy.get(), delimiter, yearSeparator, updateYear, skipLinesMatching); - }, step -> step::format); + }, step -> FormatterFunc.needsFile(step::format)); } if (contentPattern == null) { @@ -213,6 +214,9 @@ private static class Runtime implements Serializable { private final @Nullable String afterYear; private final boolean updateYearWithLatest; private final boolean licenseHeaderWithRange; + private final boolean hasFileToken; + + private static final Pattern FILENAME_PATTERN = Pattern.compile("\\$FILE"); /** The license that we'd like enforced. */ private Runtime(String licenseHeader, String delimiter, String yearSeparator, boolean updateYearWithLatest, @Nullable String skipLinesMatching) { @@ -226,6 +230,7 @@ private Runtime(String licenseHeader, String delimiter, String yearSeparator, bo } this.delimiterPattern = Pattern.compile('^' + delimiter, Pattern.UNIX_LINES | Pattern.MULTILINE); this.skipLinesMatching = skipLinesMatching == null ? null : Pattern.compile(skipLinesMatching); + this.hasFileToken = FILENAME_PATTERN.matcher(licenseHeader).find(); Optional yearToken = getYearToken(licenseHeader); if (yearToken.isPresent()) { @@ -266,9 +271,9 @@ private static Optional getYearToken(String licenseHeader) { } /** Formats the given string. */ - private String format(String raw) { + private String format(String raw, File file) { if (skipLinesMatching == null) { - return addOrUpdateLicenseHeader(raw); + return addOrUpdateLicenseHeader(raw, file); } else { String[] lines = raw.split("\n"); StringBuilder skippedLinesBuilder = new StringBuilder(); @@ -287,11 +292,17 @@ private String format(String raw) { remainingLinesBuilder.append(line).append('\n'); } } - return skippedLinesBuilder + addOrUpdateLicenseHeader(remainingLinesBuilder.toString()); + return skippedLinesBuilder + addOrUpdateLicenseHeader(remainingLinesBuilder.toString(), file); } } - private String addOrUpdateLicenseHeader(String raw) { + private String addOrUpdateLicenseHeader(String raw, File file) { + raw = replaceYear(raw); + raw = replaceFileName(raw, file); + return raw; + } + + private String replaceYear(String raw) { Matcher contentMatcher = delimiterPattern.matcher(raw); if (!contentMatcher.find()) { throw new IllegalArgumentException("Unable to find delimiter regex " + delimiterPattern); @@ -421,6 +432,19 @@ private String setLicenseHeaderYearsFromGitHistory(String raw, File file) throws return beforeYear + yearRange + afterYear + raw.substring(contentMatcher.start()); } + private String replaceFileName(String raw, File file) { + if (!hasFileToken) { + return raw; + } + Matcher contentMatcher = delimiterPattern.matcher(raw); + if (!contentMatcher.find()) { + throw new IllegalArgumentException("Unable to find delimiter regex " + delimiterPattern); + } + String header = raw.substring(0, contentMatcher.start()); + String content = raw.substring(contentMatcher.start()); + return FILENAME_PATTERN.matcher(header).replaceAll(file.getName()) + content; + } + private static String parseYear(String cmd, File file) throws IOException { String fullCmd = cmd + " -- " + file.getAbsolutePath(); ProcessBuilder builder = new ProcessBuilder().directory(file.getParentFile()); diff --git a/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java b/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java index 6390c619a9..d7ba26f384 100644 --- a/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java +++ b/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,14 @@ package com.diffplug.spotless.java; import java.io.Serializable; -import java.lang.reflect.Method; +import java.lang.reflect.Constructor; import java.util.Objects; import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.FormatterStep; import com.diffplug.spotless.JarState; import com.diffplug.spotless.Jvm; -import com.diffplug.spotless.LineEnding; import com.diffplug.spotless.Provisioner; -import com.diffplug.spotless.ThrowingEx.BiFunction; -import com.diffplug.spotless.ThrowingEx.Function; /** Wraps up google-java-format as a FormatterStep. */ public class GoogleJavaFormatStep { @@ -37,27 +34,6 @@ private GoogleJavaFormatStep() {} private static final boolean DEFAULT_REFLOW_LONG_STRINGS = false; static final String NAME = "google-java-format"; static final String MAVEN_COORDINATE = "com.google.googlejavaformat:google-java-format"; - static final String FORMATTER_CLASS = "com.google.googlejavaformat.java.Formatter"; - static final String FORMATTER_METHOD = "formatSource"; - - private static final String OPTIONS_CLASS = "com.google.googlejavaformat.java.JavaFormatterOptions"; - private static final String OPTIONS_BUILDER_METHOD = "builder"; - private static final String OPTIONS_BUILDER_CLASS = "com.google.googlejavaformat.java.JavaFormatterOptions$Builder"; - private static final String OPTIONS_BUILDER_STYLE_METHOD = "style"; - private static final String OPTIONS_BUILDER_BUILD_METHOD = "build"; - private static final String OPTIONS_Style = "com.google.googlejavaformat.java.JavaFormatterOptions$Style"; - - private static final String REMOVE_UNUSED_CLASS = "com.google.googlejavaformat.java.RemoveUnusedImports"; - private static final String REMOVE_UNUSED_METHOD = "removeUnusedImports"; - - private static final String REMOVE_UNUSED_IMPORT_JavadocOnlyImports = "com.google.googlejavaformat.java.RemoveUnusedImports$JavadocOnlyImports"; - private static final String REMOVE_UNUSED_IMPORT_JavadocOnlyImports_Keep = "KEEP"; - - private static final String IMPORT_ORDERER_CLASS = "com.google.googlejavaformat.java.ImportOrderer"; - private static final String IMPORT_ORDERER_METHOD = "reorderImports"; - - private static final String STRING_WRAPPER_CLASS = "com.google.googlejavaformat.java.StringWrapper"; - private static final String STRING_WRAPPER_METHOD = "wrap"; /** Creates a step which formats everything - code, import order, and unused imports. */ public static FormatterStep create(Provisioner provisioner) { @@ -93,7 +69,10 @@ public static FormatterStep create(String groupArtifact, String version, String State::createFormat); } - static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(8, "1.7").add(11, "1.15.0"); + static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME) + .addMin(11, "1.8") // we only support google-java-format >= 1.8 due to api changes + .addMin(16, "1.10.0") // java 16 requires at least 1.10.0 due to jdk api changes in JavaTokenizer + .add(11, "1.16.0"); // default version public static String defaultGroupArtifact() { return MAVEN_COORDINATE; @@ -144,120 +123,24 @@ static final class State implements Serializable { this.reflowLongStrings = reflowLongStrings; } - @SuppressWarnings({"unchecked", "rawtypes"}) FormatterFunc createFormat() throws Exception { - ClassLoader classLoader = jarState.getClassLoader(); - - // instantiate the formatter and get its format method - Class optionsClass = classLoader.loadClass(OPTIONS_CLASS); - Class optionsBuilderClass = classLoader.loadClass(OPTIONS_BUILDER_CLASS); - Method optionsBuilderMethod = optionsClass.getMethod(OPTIONS_BUILDER_METHOD); - Object optionsBuilder = optionsBuilderMethod.invoke(null); - - Class optionsStyleClass = classLoader.loadClass(OPTIONS_Style); - Object styleConstant = Enum.valueOf((Class) optionsStyleClass, style); - Method optionsBuilderStyleMethod = optionsBuilderClass.getMethod(OPTIONS_BUILDER_STYLE_METHOD, optionsStyleClass); - optionsBuilderStyleMethod.invoke(optionsBuilder, styleConstant); - - Method optionsBuilderBuildMethod = optionsBuilderClass.getMethod(OPTIONS_BUILDER_BUILD_METHOD); - Object options = optionsBuilderBuildMethod.invoke(optionsBuilder); - - Class formatterClazz = classLoader.loadClass(FORMATTER_CLASS); - Object formatter = formatterClazz.getConstructor(optionsClass).newInstance(options); - Method formatterMethod = formatterClazz.getMethod(FORMATTER_METHOD, String.class); + final ClassLoader classLoader = jarState.getClassLoader(); + Class formatterFunc = classLoader.loadClass("com.diffplug.spotless.glue.java.GoogleJavaFormatFormatterFunc"); + Constructor constructor = formatterFunc.getConstructor(String.class, String.class, boolean.class); + FormatterFunc googleJavaFormatFormatterFunc = (FormatterFunc) constructor.newInstance(version, style, reflowLongStrings); - Function removeUnused = constructRemoveUnusedFunction(classLoader); - - Class importOrdererClass = classLoader.loadClass(IMPORT_ORDERER_CLASS); - Method importOrdererMethod = importOrdererClass.getMethod(IMPORT_ORDERER_METHOD, String.class); - - BiFunction reflowLongStrings = this.reflowLongStrings ? constructReflowLongStringsFunction(classLoader, formatterClazz) : (s, f) -> s; - - return JVM_SUPPORT.suggestLaterVersionOnError(version, (input -> { - String formatted = (String) formatterMethod.invoke(formatter, input); - String removedUnused = removeUnused.apply(formatted); - String sortedImports = (String) importOrdererMethod.invoke(null, removedUnused); - String reflowedLongStrings = reflowLongStrings.apply(sortedImports, formatter); - return fixWindowsBug(reflowedLongStrings, version); - })); + return JVM_SUPPORT.suggestLaterVersionOnError(version, googleJavaFormatFormatterFunc); } FormatterFunc createRemoveUnusedImportsOnly() throws Exception { ClassLoader classLoader = jarState.getClassLoader(); - Function removeUnused = constructRemoveUnusedFunction(classLoader); - return JVM_SUPPORT.suggestLaterVersionOnError(version, (input -> fixWindowsBug(removeUnused.apply(input), version))); - } - - private static Function constructRemoveUnusedFunction(ClassLoader classLoader) - throws NoSuchMethodException, ClassNotFoundException { - Class removeUnusedClass = classLoader.loadClass(REMOVE_UNUSED_CLASS); - Class removeJavadocOnlyClass; - try { - // google-java-format 1.7 or lower - removeJavadocOnlyClass = classLoader.loadClass(REMOVE_UNUSED_IMPORT_JavadocOnlyImports); - } catch (ClassNotFoundException e) { - // google-java-format 1.8+ - removeJavadocOnlyClass = null; - } + Class formatterFunc = classLoader.loadClass("com.diffplug.spotless.glue.java.GoogleJavaFormatRemoveUnusedImporterFormatterFunc"); + Constructor constructor = formatterFunc.getConstructor(String.class); //version + FormatterFunc googleJavaFormatRemoveUnusedImporterFormatterFunc = (FormatterFunc) constructor.newInstance(version); - Function removeUnused; - if (removeJavadocOnlyClass != null) { - @SuppressWarnings({"unchecked", "rawtypes"}) - Object removeJavadocConstant = Enum.valueOf((Class) removeJavadocOnlyClass, REMOVE_UNUSED_IMPORT_JavadocOnlyImports_Keep); - Method removeUnusedMethod = removeUnusedClass.getMethod(REMOVE_UNUSED_METHOD, String.class, removeJavadocOnlyClass); - removeUnused = (x) -> (String) removeUnusedMethod.invoke(null, x, removeJavadocConstant); - } else { - Method removeUnusedMethod = removeUnusedClass.getMethod(REMOVE_UNUSED_METHOD, String.class); - removeUnused = (x) -> (String) removeUnusedMethod.invoke(null, x); - } - return removeUnused; + return JVM_SUPPORT.suggestLaterVersionOnError(version, googleJavaFormatRemoveUnusedImporterFormatterFunc); } - private static BiFunction constructReflowLongStringsFunction(ClassLoader classLoader, Class formatterClazz) throws NoSuchMethodException { - Class stringWrapperClass; - try { - stringWrapperClass = classLoader.loadClass(STRING_WRAPPER_CLASS); - } catch (ClassNotFoundException e) { - // google-java-format 1.7 or lower, which happen to be LATEST_VERSION_JRE_8, so rely on suggestJre11 for the error - return (s, f) -> { - throw e; - }; - } - Method stringWrapperMethod = stringWrapperClass.getMethod(STRING_WRAPPER_METHOD, String.class, formatterClazz); - return (s, f) -> (String) stringWrapperMethod.invoke(null, s, f); - } } - private static final boolean IS_WINDOWS = LineEnding.PLATFORM_NATIVE.str().equals("\r\n"); - - /** - * google-java-format-1.1's removeUnusedImports does *wacky* stuff on Windows. - * The beauty of normalizing all line endings to unix! - */ - static String fixWindowsBug(String input, String version) { - if (IS_WINDOWS && version.equals("1.1")) { - int firstImport = input.indexOf("\nimport "); - if (firstImport == 0) { - return input; - } else if (firstImport > 0) { - int numToTrim = 0; - char prevChar; - do { - ++numToTrim; - prevChar = input.charAt(firstImport - numToTrim); - } while (Character.isWhitespace(prevChar) && (firstImport - numToTrim) > 0); - if (firstImport - numToTrim == 0) { - // import was the very first line, and we'd like to maintain a one-line gap - ++numToTrim; - } else if (prevChar == ';' || prevChar == '/') { - // import came after either license or a package declaration - --numToTrim; - } - if (numToTrim > 0) { - return input.substring(0, firstImport - numToTrim + 2) + input.substring(firstImport + 1); - } - } - } - return input; - } } diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index c19a7de733..0a0cabcca0 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -3,6 +3,32 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`). ## [Unreleased] +### Added +* Support configuration of mirrors for P2 repositories ([#1629](https://github.com/diffplug/spotless/issues/1629)): + ``` + spotless { + java { + eclipse().withP2Mirrors(['https://download.eclipse.org/', 'https://some.internal.mirror/eclipse']) + } + } + ``` + Mirrors are selected by prefix match, for example `https://download.eclipse.org/eclipse/updates/4.26/` will be redirected to `https://some.internal.mirror/eclipse/eclipse/updates/4.26/`. + The same configuration exists for `greclipse` and `eclipseCdt`. +### Changes +* **POTENTIALLY BREAKING** Drop support for `googleJavaFormat` versions < `1.8`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) +* Bump default `googleJavaFormat` version `1.15.0` -> `1.16.0`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) + +## [6.17.0] - 2023-03-13 +### Added +* You can now put the filename into a license header template with `$FILE`. ([#1605](https://github.com/diffplug/spotless/pull/1605) fixes [#1147](https://github.com/diffplug/spotless/issues/1147)) +* `licenseHeader` default pattern for Java files is updated to `(package|import|public|class|module) `. ([#1614](https://github.com/diffplug/spotless/pull/1614)) +### Changes +* All Eclipse formatters are now based on [Equo Solstice OSGi and p2 shim](https://github.com/equodev/equo-ide/tree/main/solstice). ([#1524](https://github.com/diffplug/spotless/pull/1524)) + * Eclipse JDT bumped default to `4.26` from `4.21`, oldest supported is `4.9`. + * We now recommend dropping the last `.0`, e.g. `4.26` instead of `4.26.0`, you'll get warnings to help you switch. + * Eclipse Groovy bumped default to `4.26` from `4.21`, oldest supported is `4.18`. + * Eclipse CDT bumped default to `11.0` from `4.21`, oldest supported is `10.6`. + * Eclipse WTP is still WIP at [#1622](https://github.com/diffplug/spotless/pull/1622). ## [6.16.0] - 2023-02-27 ### Added diff --git a/plugin-gradle/README.md b/plugin-gradle/README.md index b66d423e6b..616aacdb1f 100644 --- a/plugin-gradle/README.md +++ b/plugin-gradle/README.md @@ -14,9 +14,9 @@ output = [ ].join('\n'); --> [![Gradle plugin](https://img.shields.io/badge/plugins.gradle.org-com.diffplug.spotless-blue.svg)](https://plugins.gradle.org/plugin/com.diffplug.spotless) -[![Changelog](https://img.shields.io/badge/changelog-6.16.0-blue.svg)](CHANGES.md) +[![Changelog](https://img.shields.io/badge/changelog-6.17.0-blue.svg)](CHANGES.md) [![Maven central](https://img.shields.io/badge/mavencentral-here-blue.svg)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.diffplug.spotless%22%20AND%20a%3A%22spotless-plugin-gradle%22) -[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/index.html) +[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/index.html) [![VS Code plugin](https://img.shields.io/badge/IDE-VS_Code-blueviolet.svg)](https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-spotless-gradle) [![IntelliJ plugin](https://img.shields.io/badge/IDE-IntelliJ-blueviolet.svg)](https://plugins.jetbrains.com/plugin/18321-spotless-gradle) @@ -123,10 +123,10 @@ spotless { ``` Spotless consists of a list of formats (in the example above, `misc` and `java`), and each format has: -- a `target` (the files to format), which you set with [`target`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#target-java.lang.Object...-) and [`targetExclude`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#targetExclude-java.lang.Object...-) -- a list of `FormatterStep`, which are just `String -> String` functions, such as [`replace`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#replace-java.lang.String-java.lang.CharSequence-java.lang.CharSequence-), [`replaceRegex`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#replaceRegex-java.lang.String-java.lang.String-java.lang.String-), [`trimTrailingWhitespace`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#replace-java.lang.String-java.lang.CharSequence-java.lang.CharSequence-), [`custom`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#custom-java.lang.String-groovy.lang.Closure-), [`prettier`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#prettier--), [`eclipseWtp`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#eclipseWtp-com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep-), [`licenseHeader`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#licenseHeader-java.lang.String-java.lang.String-) etc. +- a `target` (the files to format), which you set with [`target`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#target-java.lang.Object...-) and [`targetExclude`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#targetExclude-java.lang.Object...-) +- a list of `FormatterStep`, which are just `String -> String` functions, such as [`replace`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#replace-java.lang.String-java.lang.CharSequence-java.lang.CharSequence-), [`replaceRegex`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#replaceRegex-java.lang.String-java.lang.String-java.lang.String-), [`trimTrailingWhitespace`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#replace-java.lang.String-java.lang.CharSequence-java.lang.CharSequence-), [`custom`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#custom-java.lang.String-groovy.lang.Closure-), [`prettier`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#prettier--), [`eclipseWtp`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#eclipseWtp-com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep-), [`licenseHeader`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#licenseHeader-java.lang.String-java.lang.String-) etc. -All the generic steps live in [`FormatExtension`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html), and there are many language-specific steps which live in its language-specific subclasses, which are described below. +All the generic steps live in [`FormatExtension`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html), and there are many language-specific steps which live in its language-specific subclasses, which are described below. ### Requirements @@ -138,7 +138,7 @@ If you're stuck on an older version of Gradle, `id 'com.diffplug.gradle.spotless ## Java -`com.diffplug.gradle.spotless.JavaExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/JavaExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java) +`com.diffplug.gradle.spotless.JavaExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/JavaExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java) ```gradle spotless { @@ -187,8 +187,8 @@ spotless { spotless { java { googleJavaFormat() - // optional: you can specify a specific version and/or switch to AOSP style - // and/or reflow long strings (requires at least 1.8) + // optional: you can specify a specific version (>= 1.8) and/or switch to AOSP style + // and/or reflow long strings // and/or use custom group artifact (you probably don't need this) googleJavaFormat('1.8').aosp().reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format') ``` @@ -213,7 +213,7 @@ spotless { java { eclipse() // optional: you can specify a specific version and/or config file - eclipse('4.17').configFile('eclipse-prefs.xml') + eclipse('4.26').configFile('eclipse-prefs.xml') ``` @@ -282,8 +282,8 @@ spotless { ## Groovy -- `com.diffplug.gradle.spotless.GroovyExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/GroovyExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyExtension.java) -- `com.diffplug.gradle.spotless.GroovyGradleExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/GroovyGradleExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyGradleExtension.java) +- `com.diffplug.gradle.spotless.GroovyExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/GroovyExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyExtension.java) +- `com.diffplug.gradle.spotless.GroovyGradleExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/GroovyGradleExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyGradleExtension.java) Configuration for Groovy is similar to [Java](#java), in that it also supports `licenseHeader` and `importOrder`. @@ -325,17 +325,16 @@ spotless { groovy { // Use the default version and Groovy-Eclipse default configuration greclipse() - // optional: you can specify a specific version or config file(s) - // compatible versions: https://github.com/diffplug/spotless/tree/main/lib-extra/src/main/resources/com/diffplug/spotless/extra/groovy_eclipse_formatter - greclipse('2.3.0').configFile('spotless.eclipseformat.xml', 'org.codehaus.groovy.eclipse.ui.prefs') + // optional: you can specify a specific version or config file(s), version matches the Eclipse Platform + greclipse('4.26').configFile('spotless.eclipseformat.xml', 'org.codehaus.groovy.eclipse.ui.prefs') ``` Groovy-Eclipse formatting errors/warnings lead per default to a build failure. This behavior can be changed by adding the property/key value `ignoreFormatterProblems=true` to a configuration file. In this scenario, files causing problems, will not be modified by this formatter step. ## Kotlin -- `com.diffplug.gradle.spotless.KotlinExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/KotlinExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinExtension.java) -- `com.diffplug.gradle.spotless.KotlinGradleExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/KotlinGradleExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinGradleExtension.java) +- `com.diffplug.gradle.spotless.KotlinExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/KotlinExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinExtension.java) +- `com.diffplug.gradle.spotless.KotlinGradleExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/KotlinGradleExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinGradleExtension.java) ```gradle spotless { // if you are using build.gradle.kts, instead of 'spotless {' use: @@ -406,7 +405,7 @@ spotless { ## Scala -`com.diffplug.gradle.spotless.ScalaExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/ScalaExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/ScalaExtension.java) +`com.diffplug.gradle.spotless.ScalaExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/ScalaExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/ScalaExtension.java) ```gradle spotless { @@ -430,15 +429,15 @@ spotless { ```gradle spotless { scala { - // version and configFile, majorScalaVersion are all optional - scalafmt('3.5.9').configFile('scalafmt.conf').majorScalaVersion('2.13') + // version and configFile, scalaMajorVersion are all optional + scalafmt('3.5.9').configFile('scalafmt.conf').scalaMajorVersion('2.13') ``` ## C/C++ -`com.diffplug.gradle.spotless.CppExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/CppExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/CppExtension.java) +`com.diffplug.gradle.spotless.CppExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/CppExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/CppExtension.java) ```gradle spotless { @@ -470,7 +469,7 @@ spotles { ## Python -`com.diffplug.gradle.spotless.PythonExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/PythonExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/PythonExtension.java) +`com.diffplug.gradle.spotless.PythonExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/PythonExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/PythonExtension.java) ```gradle spotless { @@ -504,7 +503,7 @@ black().pathToExe('C:/myuser/.pyenv/versions/3.8.0/scripts/black.exe') ## FreshMark -`com.diffplug.gradle.spotless.FreshMarkExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FreshMarkExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FreshMarkExtension.java) +`com.diffplug.gradle.spotless.FreshMarkExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FreshMarkExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FreshMarkExtension.java) [homepage](https://github.com/diffplug/freshmark). [changelog](https://github.com/diffplug/freshmark/blob/master/CHANGES.md). FreshMark lets you generate markdown in the comments of your markdown. This helps to keep badges and links up-to-date (see the source for this file), and can also be helpful for generating complex tables (see the source for [the parent readme](../README.md)). @@ -525,7 +524,7 @@ spotless { ## Antlr4 -`com.diffplug.gradle.spotless.Antlr4Extension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/Antlr4Extension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/Antlr4Extension.java) +`com.diffplug.gradle.spotless.Antlr4Extension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/Antlr4Extension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/Antlr4Extension.java) ```gradle spotless { @@ -550,7 +549,7 @@ antlr4formatter('1.2.1') // version is optional ## SQL -`com.diffplug.gradle.spotless.SqlExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/SqlExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SqlExtension.java) +`com.diffplug.gradle.spotless.SqlExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/SqlExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SqlExtension.java) ```gradle spotless { @@ -590,7 +589,7 @@ sql.formatter.indent.size=4 ## Typescript -- `com.diffplug.gradle.spotless.TypescriptExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/TypescriptExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TypescriptExtension.java) +- `com.diffplug.gradle.spotless.TypescriptExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/TypescriptExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TypescriptExtension.java) ```gradle spotless { @@ -683,7 +682,7 @@ For details, see the [npm detection](#npm-detection), [`.npmrc` detection](#npmr ## Javascript -- `com.diffplug.gradle.spotless.JavascriptExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/JavascriptExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavascriptExtension.java) +- `com.diffplug.gradle.spotless.JavascriptExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/JavascriptExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavascriptExtension.java) ```gradle spotless { @@ -747,7 +746,7 @@ For details, see the [npm detection](#npm-detection), [`.npmrc` detection](#npmr ## JSON -- `com.diffplug.gradle.spotless.JsonExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/JsonExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JsonExtension.java) +- `com.diffplug.gradle.spotless.JsonExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/JsonExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JsonExtension.java) ```gradle spotless { @@ -822,7 +821,7 @@ spotless { ## YAML -- `com.diffplug.gradle.spotless.YamlExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/JsonExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/YamlExtension.java) +- `com.diffplug.gradle.spotless.YamlExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/JsonExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/YamlExtension.java) ```gradle spotless { @@ -993,7 +992,7 @@ spotless { format 'xml', { target 'src/**/*.xml' // must specify target eclipseWtp('xml') // must specify a type (table below) - eclipseWtp('xml', '4.13.0') // optional version + eclipseWtp('xml', '11.0') // optional version, others at https://download.eclipse.org/tools/cdt/releases/ // you can also specify an arbitrary number of config files eclipseWtp('xml').configFile('spotless.xml.prefs', 'spotless.common.properties' } @@ -1049,7 +1048,7 @@ Once a file's license header has a valid year, whether it is a year (`2020`) or * `2017` -> `2017-2020` * `2017-2019` -> `2017-2020` -See the [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.LicenseHeaderConfig.html) for a complete listing of options. +See the [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.LicenseHeaderConfig.html) for a complete listing of options. @@ -1122,9 +1121,9 @@ spotless { custom 'lowercase', { str -> str.toLowerCase() } ``` -However, custom rules will disable up-to-date checking and caching, unless you read [this javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#bumpThisNumberIfACustomStepChanges-int-) and follow its instructions carefully. +However, custom rules will disable up-to-date checking and caching, unless you read [this javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#bumpThisNumberIfACustomStepChanges-int-) and follow its instructions carefully. -Another option is to create proper `FormatterStep` in your `buildSrc`, and then call [`addStep`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#addStep-com.diffplug.spotless.FormatterStep-). The contributing guide describes [how to do this](https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md#how-to-add-a-new-formatterstep). If the step is generally-useful, we hope you'll open a PR to share it! +Another option is to create proper `FormatterStep` in your `buildSrc`, and then call [`addStep`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#addStep-com.diffplug.spotless.FormatterStep-). The contributing guide describes [how to do this](https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md#how-to-add-a-new-formatterstep). If the step is generally-useful, we hope you'll open a PR to share it! ```gradle @@ -1157,11 +1156,11 @@ spotless { format 'foo', com.acme.FooLanguageExtension, { ``` -If you'd like to create a one-off Spotless task outside of the `check`/`apply` framework, see [`FormatExtension.createIndependentApplyTask`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#createIndependentApplyTask-java.lang.String-). +If you'd like to create a one-off Spotless task outside of the `check`/`apply` framework, see [`FormatExtension.createIndependentApplyTask`](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#createIndependentApplyTask-java.lang.String-). ## Inception (languages within languages within...) -In very rare cases, you might want to format e.g. javascript which is written inside JSP templates, or maybe java within a markdown file, or something wacky like that. You can specify hunks within a file using either open/close tags or a regex with a single capturing group, and then specify rules within it, like so. See [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.16.0/com/diffplug/gradle/spotless/FormatExtension.html#withinBlocks-java.lang.String-java.lang.String-java.lang.String-org.gradle.api.Action-) for more details. +In very rare cases, you might want to format e.g. javascript which is written inside JSP templates, or maybe java within a markdown file, or something wacky like that. You can specify hunks within a file using either open/close tags or a regex with a single capturing group, and then specify rules within it, like so. See [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.17.0/com/diffplug/gradle/spotless/FormatExtension.html#withinBlocks-java.lang.String-java.lang.String-java.lang.String-org.gradle.api.Action-) for more details. ```gradle import com.diffplug.gradle.spotless.JavaExtension diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/CppExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/CppExtension.java index 64dabc9ca5..6a08946c48 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/CppExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/CppExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,14 @@ import static com.diffplug.gradle.spotless.PluginGradlePreconditions.requireElementsNonNull; +import java.util.Map; + import javax.inject.Inject; import org.gradle.api.Project; import com.diffplug.spotless.cpp.CppDefaults; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; import com.diffplug.spotless.extra.cpp.EclipseCdtFormatterStep; public class CppExtension extends FormatExtension implements HasBuiltinDelimiterForLicense { @@ -42,7 +44,7 @@ public EclipseConfig eclipseCdt(String version) { } public class EclipseConfig { - private final EclipseBasedStepBuilder builder; + private final EquoBasedStepBuilder builder; EclipseConfig(String version) { builder = EclipseCdtFormatterStep.createBuilder(provisioner()); @@ -56,6 +58,12 @@ public void configFile(Object... configFiles) { builder.setPreferences(project.files(configFiles).getFiles()); replaceStep(builder.build()); } + + public EclipseConfig withP2Mirrors(Map mirrors) { + builder.setP2Mirrors(mirrors); + replaceStep(builder.build()); + return this; + } } @Override diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyExtension.java index 5e528e1b79..d25433293d 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GroovyExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ import static com.diffplug.gradle.spotless.PluginGradlePreconditions.requireElementsNonNull; +import java.util.Map; import java.util.Objects; import javax.inject.Inject; @@ -30,7 +31,7 @@ import org.gradle.api.tasks.GroovySourceSet; import org.gradle.api.tasks.SourceSet; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; import com.diffplug.spotless.extra.groovy.GrEclipseFormatterStep; import com.diffplug.spotless.generic.LicenseHeaderStep; import com.diffplug.spotless.java.ImportOrderStep; @@ -83,7 +84,7 @@ public GrEclipseConfig greclipse(String version) { } public static class GrEclipseConfig { - private final EclipseBasedStepBuilder builder; + private final EquoBasedStepBuilder builder; private final FormatExtension extension; GrEclipseConfig(String version, FormatExtension extension) { @@ -99,6 +100,12 @@ public void configFile(Object... configFiles) { builder.setPreferences(project.files(configFiles).getFiles()); extension.replaceStep(builder.build()); } + + public GrEclipseConfig withP2Mirrors(Map mirrors) { + builder.setP2Mirrors(mirrors); + extension.replaceStep(builder.build()); + return this; + } } /** If the user hasn't specified the files yet, we'll assume he/she means all of the groovy files. */ diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java index f351dd6188..e67bb6d076 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Objects; import javax.inject.Inject; @@ -32,7 +33,7 @@ import org.gradle.api.tasks.SourceSet; import com.diffplug.spotless.FormatterStep; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; import com.diffplug.spotless.extra.java.EclipseJdtFormatterStep; import com.diffplug.spotless.generic.LicenseHeaderStep; import com.diffplug.spotless.java.CleanthatJavaStep; @@ -50,9 +51,7 @@ public JavaExtension(SpotlessExtension spotless) { super(spotless); } - // If this constant changes, don't forget to change the similarly-named one in - // testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java as well - static final String LICENSE_HEADER_DELIMITER = "package "; + static final String LICENSE_HEADER_DELIMITER = LicenseHeaderStep.DEFAULT_JAVA_HEADER_DELIMITER; @Override public LicenseHeaderConfig licenseHeader(String licenseHeader) { @@ -219,7 +218,7 @@ public EclipseConfig eclipse(String version) { } public class EclipseConfig { - private final EclipseBasedStepBuilder builder; + private final EquoBasedStepBuilder builder; EclipseConfig(String version) { builder = EclipseJdtFormatterStep.createBuilder(provisioner()); @@ -234,6 +233,12 @@ public void configFile(Object... configFiles) { replaceStep(builder.build()); } + public EclipseConfig withP2Mirrors(Map mirrors) { + builder.setP2Mirrors(mirrors); + replaceStep(builder.build()); + return this; + } + } /** Removes newlines between type annotations and types. */ diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessTaskImpl.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessTaskImpl.java index b37e9f283a..ab584fa7b6 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessTaskImpl.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessTaskImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import org.gradle.work.FileChange; import org.gradle.work.InputChanges; +import com.diffplug.common.annotations.VisibleForTesting; import com.diffplug.common.base.StringPrinter; import com.diffplug.spotless.Formatter; import com.diffplug.spotless.PaddedCell; @@ -92,28 +93,37 @@ public void performAction(InputChanges inputs) throws Exception { } } - private void processInputFile(@Nullable GitRatchet ratchet, Formatter formatter, File input) throws IOException { + @VisibleForTesting + void processInputFile(@Nullable GitRatchet ratchet, Formatter formatter, File input) throws IOException { File output = getOutputFile(input); - getLogger().debug("Applying format to " + input + " and writing to " + output); + getLogger().debug("Applying format to {} and writing to {}", input, output); PaddedCell.DirtyState dirtyState; if (ratchet != null && ratchet.isClean(getProjectDir().get().getAsFile(), getRootTreeSha(), input)) { dirtyState = PaddedCell.isClean(); } else { - dirtyState = PaddedCell.calculateDirtyState(formatter, input); + try { + dirtyState = PaddedCell.calculateDirtyState(formatter, input); + } catch (IOException e) { + throw new IOException("Issue processing file: " + input, e); + } catch (RuntimeException e) { + throw new IllegalArgumentException("Issue processing file: " + input, e); + } } if (dirtyState.isClean()) { // Remove previous output if it exists Files.deleteIfExists(output.toPath()); } else if (dirtyState.didNotConverge()) { - getLogger().warn("Skipping '" + input + "' because it does not converge. Run {@code spotlessDiagnose} to understand why"); + getLogger().warn("Skipping '{}' because it does not converge. Run {@code spotlessDiagnose} to understand why", input); } else { Path parentDir = output.toPath().getParent(); if (parentDir == null) { - throw new IllegalStateException("Every file has a parent folder."); + throw new IllegalStateException("Every file has a parent folder. But not: " + output); } Files.createDirectories(parentDir); // Need to copy the original file to the tmp location just to remember the file attributes Files.copy(input.toPath(), output.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); + + getLogger().info(String.format("Writing clean file: %s", output)); dirtyState.writeCanonicalTo(output); } } diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigAvoidanceTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigAvoidanceTest.java index d5422a3631..bd521bd864 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigAvoidanceTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigAvoidanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ void noConfigOnHelp() throws IOException { "apply plugin: 'java'", "spotless {", " java {", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}", "", diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheTest.java index 4006752af2..396a884cc5 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ConfigurationCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 DiffPlug + * Copyright 2020-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ public void helpConfigures() throws IOException { "apply plugin: 'java'", "spotless {", " java {", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}"); gradleRunner().withArguments("help").build(); @@ -55,7 +55,7 @@ public void helpConfiguresIfTasksAreCreated() throws IOException { "apply plugin: 'java'", "spotless {", " java {", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}", "tasks.named('spotlessJavaApply').get()"); @@ -72,7 +72,7 @@ public void jvmLocalCache() throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}"); diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FilePermissionsTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FilePermissionsTest.java index a5ce2d11cd..d342348a5b 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FilePermissionsTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FilePermissionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 DiffPlug + * Copyright 2020-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ void spotlessApplyShouldPreservePermissions() throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}"); setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test"); diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java index 1f5cb6af05..5c7fe54f59 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ void integration() throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.2')", + " googleJavaFormat('1.10.0')", " }", "}"); @@ -41,8 +41,8 @@ void integration() throws IOException { checkRunsThenUpToDate(); replace("build.gradle", - "googleJavaFormat('1.2')", - "googleJavaFormat('1.3')"); + "googleJavaFormat('1.10.0')", + "googleJavaFormat()"); checkRunsThenUpToDate(); } } diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/IndependentTaskTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/IndependentTaskTest.java index 459b871b94..4062aae51d 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/IndependentTaskTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/IndependentTaskTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ void independent() throws IOException { "", "def underTest = new JavaExtension(spotless)", "underTest.target file('test.java')", - "underTest.googleJavaFormat('1.2')", + "underTest.googleJavaFormat()", "", "def independent = underTest.createIndependentApplyTask('independent')"); setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test"); diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/JavaDefaultTargetTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/JavaDefaultTargetTest.java index 898008c27a..e6569b2647 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/JavaDefaultTargetTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/JavaDefaultTargetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ void integration() throws IOException { "", "spotless {", " java {", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}"); setFile("src/main/java/test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test"); diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java index 086a2ddb1d..98761b472a 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/MultiProjectTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ void createSubproject(String name) throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.2')", + " googleJavaFormat('1.16.0')", " }", "}"); setFile(name + "/test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test"); @@ -71,7 +71,7 @@ public void hasRootSpotless() throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.2')", + " googleJavaFormat('1.16.0')", " }", "}"); setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test"); @@ -88,7 +88,7 @@ public void predeclaredFails() throws IOException { "spotless { predeclareDeps() }"); createNSubprojects(); Assertions.assertThat(gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput()) - .contains("Add a step with [com.google.googlejavaformat:google-java-format:1.2] into the `spotlessPredeclare` block in the root project."); + .contains("Add a step with [com.google.googlejavaformat:google-java-format:1.16.0] into the `spotlessPredeclare` block in the root project."); } @Test @@ -100,7 +100,7 @@ public void predeclaredSucceeds() throws IOException { "repositories { mavenCentral() }", "spotless { predeclareDeps() }", "spotlessPredeclare {", - " java { googleJavaFormat('1.2') }", + " java { googleJavaFormat('1.16.0') }", "}"); createNSubprojects(); gradleRunner().withArguments("spotlessApply").build(); @@ -115,7 +115,7 @@ public void predeclaredFromBuildscriptSucceeds() throws IOException { "repositories { mavenCentral() }", "spotless { predeclareDepsFromBuildscript() }", "spotlessPredeclare {", - " java { googleJavaFormat('1.2') }", + " java { googleJavaFormat('1.16.0') }", "}"); createNSubprojects(); gradleRunner().withArguments("spotlessApply").build(); @@ -129,7 +129,7 @@ public void predeclaredOrdering() throws IOException { "}", "repositories { mavenCentral() }", "spotlessPredeclare {", - " java { googleJavaFormat('1.2') }", + " java { googleJavaFormat('1.16.0') }", "}", "spotless { predeclareDepsFromBuildscript() }"); createNSubprojects(); @@ -145,7 +145,7 @@ public void predeclaredUndeclared() throws IOException { "}", "repositories { mavenCentral() }", "spotlessPredeclare {", - " java { googleJavaFormat('1.2') }", + " java { googleJavaFormat('1.16.0') }", "}"); createNSubprojects(); Assertions.assertThat(gradleRunner().withArguments("spotlessApply").buildAndFail().getOutput()) diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskTest.java index 480de4f01b..76d0449060 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/RegisterDependenciesTaskTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ void duplicateConfigs() throws IOException { "spotless {", " java {", " target 'src/main/java/**/*.java'", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", " format 'javaDupe', com.diffplug.gradle.spotless.JavaExtension, {", " target 'src/boop/java/**/*.java'", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}"); diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpotlessTaskImplTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpotlessTaskImplTest.java new file mode 100644 index 0000000000..fc7fab9980 --- /dev/null +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpotlessTaskImplTest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 DiffPlug + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.diffplug.gradle.spotless; + +import java.io.File; +import java.nio.file.Paths; + +import org.assertj.core.api.Assertions; +import org.gradle.api.file.DirectoryProperty; +import org.gradle.api.logging.Logger; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import com.diffplug.spotless.Formatter; + +public class SpotlessTaskImplTest { + @Test + public void testThrowsMessageContainsFilename() throws Exception { + SpotlessTaskImpl task = Mockito.mock(SpotlessTaskImpl.class, Mockito.CALLS_REAL_METHODS); + Mockito.when(task.getLogger()).thenReturn(Mockito.mock(Logger.class)); + + File projectDir = Paths.get("unitTests", "projectDir").toFile(); + DirectoryProperty projectDirProperty = Mockito.mock(DirectoryProperty.class, Mockito.RETURNS_DEEP_STUBS); + Mockito.when(projectDirProperty.get().getAsFile()).thenReturn(projectDir); + + Mockito.when(task.getProjectDir()).thenReturn(projectDirProperty); + + File input = Paths.get("unitTests", "projectDir", "someInput").toFile(); + Formatter formatter = Mockito.mock(Formatter.class); + + Assertions.assertThatThrownBy(() -> task.processInputFile(null, formatter, input)).hasMessageContaining(input.toString()); + } +} diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/WithinBlockTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/WithinBlockTest.java index 01fb048b66..d1df8b5f96 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/WithinBlockTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/WithinBlockTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 DiffPlug + * Copyright 2020-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ void genericFormatTest() throws IOException { "spotless {", " format 'customJava', JavaExtension, {", " target '*.java'", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", "}"); setFile("test.java").toResource("java/googlejavaformat/JavaCodeUnformatted.test"); @@ -53,7 +53,7 @@ void withinBlocksTourDeForce() throws IOException { " custom 'lowercase', { str -> str.toLowerCase() }", " }", " withinBlocks 'java only', '\\n```java\\n', '\\n```\\n', JavaExtension, {", - " googleJavaFormat('1.2')", + " googleJavaFormat()", " }", " }", "}"); diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 36a51d6ef2..421b5e56e7 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,6 +3,23 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Changes +* **POTENTIALLY BREAKING** Drop support for `googleJavaFormat` versions < `1.8`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) +* Bump default `googleJavaFormat` version `1.15.0` -> `1.16.0`. ([#1630](https://github.com/diffplug/spotless/pull/1630)) + +## [2.35.0] - 2023-03-13 +### Added +* You can now put the filename into a license header template with `$FILE`. ([#1605](https://github.com/diffplug/spotless/pull/1605) fixes [#1147](https://github.com/diffplug/spotless/issues/1147)) +### Fixed +* `licenseHeader` default pattern for Java files is updated to `(package|import|public|class|module) `. ([#1614](https://github.com/diffplug/spotless/pull/1614)) +### Changes +* Enable incremental up-to-date checking by default. ([#1621](https://github.com/diffplug/spotless/pull/1621)) +* All Eclipse formatters are now based on [Equo Solstice OSGi and p2 shim](https://github.com/equodev/equo-ide/tree/main/solstice). ([#1524](https://github.com/diffplug/spotless/pull/1524)) + * Eclipse JDT bumped default to `4.26` from `4.21`, oldest supported is `4.9`. + * We now recommend dropping the last `.0`, e.g. `4.26` instead of `4.26.0`, you'll get warnings to help you switch. + * Eclipse Groovy bumped default to `4.26` from `4.21`, oldest supported is `4.18`. + * Eclipse CDT bumped default to `11.0` from `4.21`, oldest supported is `10.6`. + * Eclipse WTP is still WIP at [#1622](https://github.com/diffplug/spotless/pull/1622). ## [2.34.0] - 2023-02-27 ### Added diff --git a/plugin-maven/README.md b/plugin-maven/README.md index 426b00184e..5971721e24 100644 --- a/plugin-maven/README.md +++ b/plugin-maven/README.md @@ -8,8 +8,8 @@ output = [ ].join('\n'); --> [![Maven central](https://img.shields.io/badge/mavencentral-com.diffplug.spotless%3Aspotless--maven--plugin-blue.svg)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.diffplug.spotless%22%20AND%20a%3A%22spotless-maven-plugin%22) -[![Changelog](https://img.shields.io/badge/changelog-2.34.0-blue.svg)](CHANGES.md) -[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug.spotless/spotless-maven-plugin/2.34.0/index.html) +[![Changelog](https://img.shields.io/badge/changelog-2.35.0-blue.svg)](CHANGES.md) +[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug.spotless/spotless-maven-plugin/2.35.0/index.html) + 1.8 - true + true com.google.googlejavaformat:google-java-format @@ -237,7 +237,7 @@ any other maven phase (i.e. compile) then it can be configured as below; ```xml - 4.21.0 + 4.26 ${project.basedir}/eclipse-formatter.xml ``` @@ -331,7 +331,7 @@ These mechanisms already exist for the Gradle plugin. ```xml - 4.21.0 + 4.26 ${project.basedir}/greclipse.properties ``` @@ -481,7 +481,7 @@ Additionally, `editorConfigOverride` options will override what's supplied in `. ```xml - 4.21.0 + 11.0 ${project.basedir}/eclipse-cdt.xml ``` @@ -1262,7 +1262,7 @@ To define what lines to skip at the beginning of such files, fill the `skipLines ## Incremental up-to-date checking and formatting -**This feature is turned off by default.** +**This feature is enabled by default starting from version 2.35.0.** Execution of `spotless:check` and `spotless:apply` for large projects can take time. By default, Spotless Maven plugin needs to read and format each source file. diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java index f6aab0eabb..2c0d6e35e6 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java @@ -187,7 +187,7 @@ public abstract class AbstractSpotlessMojo extends AbstractMojo { private String setLicenseHeaderYearsFromGitHistory; @Parameter - private UpToDateChecking upToDateChecking; + private UpToDateChecking upToDateChecking = UpToDateChecking.enabled(); protected abstract void process(Iterable files, Formatter formatter, UpToDateChecker upToDateChecker) throws MojoExecutionException; @@ -373,9 +373,9 @@ private UpToDateChecker createUpToDateChecker(Iterable formatters) { } final UpToDateChecker checker; if (upToDateChecking != null && upToDateChecking.isEnabled()) { - getLog().info("Up-to-date checking enabled"); checker = UpToDateChecker.forProject(project, indexFile, formatters, getLog()); } else { + getLog().info("Up-to-date checking disabled"); checker = UpToDateChecker.noop(project, indexFile, getLog()); } return UpToDateChecker.wrapWithBuildContext(checker, buildContext); diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessApplyMojo.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessApplyMojo.java index 028cc3fb9c..5ebe2885c9 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessApplyMojo.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessApplyMojo.java @@ -54,7 +54,7 @@ protected void process(Iterable files, Formatter formatter, UpToDateChecke } else { counter.checkedButAlreadyClean(); } - } catch (IOException e) { + } catch (IOException | RuntimeException e) { throw new MojoExecutionException("Unable to format file " + file, e); } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessCheckMojo.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessCheckMojo.java index ad3230f583..03e55e224a 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessCheckMojo.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/SpotlessCheckMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,9 +38,12 @@ public class SpotlessCheckMojo extends AbstractSpotlessMojo { @Override protected void process(Iterable files, Formatter formatter, UpToDateChecker upToDateChecker) throws MojoExecutionException { + ImpactedFilesTracker counter = new ImpactedFilesTracker(); + List problemFiles = new ArrayList<>(); for (File file : files) { if (upToDateChecker.isUpToDate(file.toPath())) { + counter.skippedAsCleanCache(); if (getLog().isDebugEnabled()) { getLog().debug("Spotless will not check an up-to-date file: " + file); } @@ -51,14 +54,24 @@ protected void process(Iterable files, Formatter formatter, UpToDateChecke PaddedCell.DirtyState dirtyState = PaddedCell.calculateDirtyState(formatter, file); if (!dirtyState.isClean() && !dirtyState.didNotConverge()) { problemFiles.add(file); + counter.cleaned(); } else { + counter.checkedButAlreadyClean(); upToDateChecker.setUpToDate(file.toPath()); } - } catch (IOException e) { + } catch (IOException | RuntimeException e) { throw new MojoExecutionException("Unable to format file " + file, e); } } + // We print the number of considered files which is useful when ratchetFrom is setup + if (counter.getTotal() > 0) { + getLog().info(String.format("Spotless.%s is keeping %s files clean - %s needs changes to be clean, %s were already clean, %s were skipped because caching determined they were already clean", + formatter.getName(), counter.getTotal(), counter.getCleaned(), counter.getCheckedButAlreadyClean(), counter.getSkippedAsCleanCache())); + } else { + getLog().debug(String.format("Spotless.%s has no target files. Examine your ``: https://github.com/diffplug/spotless/tree/main/plugin-maven#quickstart", formatter.getName())); + } + if (!problemFiles.isEmpty()) { throw new MojoExecutionException(DiffMessageFormatter.builder() .runToFix("Run 'mvn spotless:apply' to fix these violations.") diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/cpp/EclipseCdt.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/cpp/EclipseCdt.java index 78484abfba..a92e7b2423 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/cpp/EclipseCdt.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/cpp/EclipseCdt.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import org.apache.maven.plugins.annotations.Parameter; import com.diffplug.spotless.FormatterStep; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; import com.diffplug.spotless.extra.cpp.EclipseCdtFormatterStep; import com.diffplug.spotless.maven.FormatterStepConfig; import com.diffplug.spotless.maven.FormatterStepFactory; @@ -36,7 +36,7 @@ public class EclipseCdt implements FormatterStepFactory { @Override public FormatterStep newFormatterStep(FormatterStepConfig stepConfig) { - EclipseBasedStepBuilder eclipseConfig = EclipseCdtFormatterStep.createBuilder(stepConfig.getProvisioner()); + EquoBasedStepBuilder eclipseConfig = EclipseCdtFormatterStep.createBuilder(stepConfig.getProvisioner()); eclipseConfig.setVersion(version == null ? EclipseCdtFormatterStep.defaultVersion() : version); if (null != file) { File settingsFile = stepConfig.getFileLocator().locateFile(file); diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/GrEclipse.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/GrEclipse.java index 81da109e04..8836993cce 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/GrEclipse.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/GrEclipse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 DiffPlug + * Copyright 2020-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import org.apache.maven.plugins.annotations.Parameter; import com.diffplug.spotless.FormatterStep; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; import com.diffplug.spotless.extra.groovy.GrEclipseFormatterStep; import com.diffplug.spotless.maven.FormatterStepConfig; import com.diffplug.spotless.maven.FormatterStepFactory; @@ -36,7 +36,7 @@ public class GrEclipse implements FormatterStepFactory { @Override public FormatterStep newFormatterStep(FormatterStepConfig stepConfig) { - EclipseBasedStepBuilder grEclipseConfig = GrEclipseFormatterStep.createBuilder(stepConfig.getProvisioner()); + EquoBasedStepBuilder grEclipseConfig = GrEclipseFormatterStep.createBuilder(stepConfig.getProvisioner()); grEclipseConfig.setVersion(version == null ? GrEclipseFormatterStep.defaultVersion() : version); if (null != file) { File settingsFile = stepConfig.getFileLocator().locateFile(file); diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/Groovy.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/Groovy.java index 8041b812f9..35b91f3677 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/Groovy.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/Groovy.java @@ -20,6 +20,7 @@ import org.apache.maven.project.MavenProject; import com.diffplug.common.collect.ImmutableSet; +import com.diffplug.spotless.generic.LicenseHeaderStep; import com.diffplug.spotless.maven.FormatterFactory; import com.diffplug.spotless.maven.generic.LicenseHeader; @@ -32,7 +33,7 @@ public class Groovy extends FormatterFactory { private static final Set DEFAULT_INCLUDES = ImmutableSet.of("src/main/groovy/**/*.groovy", "src/test/groovy/**/*.groovy"); - private static final String LICENSE_HEADER_DELIMITER = "package "; + private static final String LICENSE_HEADER_DELIMITER = LicenseHeaderStep.DEFAULT_JAVA_HEADER_DELIMITER; @Override public Set defaultIncludes(MavenProject project) { diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/PluginFingerprint.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/PluginFingerprint.java index 9efd6f2586..34a01e235a 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/PluginFingerprint.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/PluginFingerprint.java @@ -21,6 +21,7 @@ import java.util.Objects; import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginManagement; import org.apache.maven.project.MavenProject; import com.diffplug.spotless.Formatter; @@ -43,10 +44,7 @@ private PluginFingerprint(String value) { } static PluginFingerprint from(MavenProject project, Iterable formatters) { - Plugin spotlessPlugin = project.getPlugin(SPOTLESS_PLUGIN_KEY); - if (spotlessPlugin == null) { - throw new IllegalArgumentException("Spotless plugin absent from the project: " + project); - } + Plugin spotlessPlugin = findSpotlessPlugin(project); byte[] digest = digest(spotlessPlugin, formatters); String value = Base64.getEncoder().encodeToString(digest); return new PluginFingerprint(value); @@ -86,6 +84,24 @@ public String toString() { return "PluginFingerprint[" + value + "]"; } + private static Plugin findSpotlessPlugin(MavenProject project) { + // Try to find the plugin instance from XML element + Plugin plugin = project.getPlugin(SPOTLESS_PLUGIN_KEY); + if (plugin == null) { + // Try to find the plugin instance from XML element. Useful when + // the current module is a parent of a multimodule project + PluginManagement pluginManagement = project.getPluginManagement(); + if (pluginManagement != null) { + plugin = pluginManagement.getPluginsAsMap().get(SPOTLESS_PLUGIN_KEY); + } + } + + if (plugin == null) { + throw new IllegalArgumentException("Spotless plugin absent from the project: " + project); + } + return plugin; + } + private static byte[] digest(Plugin plugin, Iterable formatters) { try (ObjectDigestOutputStream out = ObjectDigestOutputStream.create()) { out.writeObject(plugin.getVersion()); diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java index d5eb6aa941..f044b847c9 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 DiffPlug + * Copyright 2021-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,4 +38,10 @@ public boolean isEnabled() { public Path getIndexFile() { return indexFile == null ? null : new File(indexFile).toPath(); } + + public static UpToDateChecking enabled() { + UpToDateChecking upToDateChecking = new UpToDateChecking(); + upToDateChecking.enabled = true; + return upToDateChecking; + } } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Eclipse.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Eclipse.java index 1e6508121e..e30a4faad9 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Eclipse.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Eclipse.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import org.apache.maven.plugins.annotations.Parameter; import com.diffplug.spotless.FormatterStep; -import com.diffplug.spotless.extra.EclipseBasedStepBuilder; +import com.diffplug.spotless.extra.EquoBasedStepBuilder; import com.diffplug.spotless.extra.java.EclipseJdtFormatterStep; import com.diffplug.spotless.maven.FormatterStepConfig; import com.diffplug.spotless.maven.FormatterStepFactory; @@ -36,7 +36,7 @@ public class Eclipse implements FormatterStepFactory { @Override public FormatterStep newFormatterStep(FormatterStepConfig stepConfig) { - EclipseBasedStepBuilder eclipseConfig = EclipseJdtFormatterStep.createBuilder(stepConfig.getProvisioner()); + EquoBasedStepBuilder eclipseConfig = EclipseJdtFormatterStep.createBuilder(stepConfig.getProvisioner()); eclipseConfig.setVersion(version == null ? EclipseJdtFormatterStep.defaultVersion() : version); if (null != file) { File settingsFile = stepConfig.getFileLocator().locateFile(file); diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Java.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Java.java index efdf0827db..b0692446b7 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Java.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/java/Java.java @@ -26,6 +26,7 @@ import org.apache.maven.model.Build; import org.apache.maven.project.MavenProject; +import com.diffplug.spotless.generic.LicenseHeaderStep; import com.diffplug.spotless.maven.FormatterFactory; import com.diffplug.spotless.maven.generic.LicenseHeader; @@ -37,7 +38,7 @@ */ public class Java extends FormatterFactory { - private static final String LICENSE_HEADER_DELIMITER = "package "; + private static final String LICENSE_HEADER_DELIMITER = LicenseHeaderStep.DEFAULT_JAVA_HEADER_DELIMITER; @Override public Set defaultIncludes(MavenProject project) { diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/scala/Scala.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/scala/Scala.java index 7a9e455f5f..116d89263c 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/scala/Scala.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/scala/Scala.java @@ -20,6 +20,7 @@ import org.apache.maven.project.MavenProject; import com.diffplug.common.collect.ImmutableSet; +import com.diffplug.spotless.generic.LicenseHeaderStep; import com.diffplug.spotless.maven.FormatterFactory; import com.diffplug.spotless.maven.generic.LicenseHeader; @@ -33,7 +34,7 @@ public class Scala extends FormatterFactory { private static final Set DEFAULT_INCLUDES = ImmutableSet.of("src/main/scala/**/*.scala", "src/test/scala/**/*.scala", "src/main/scala/**/*.sc", "src/test/scala/**/*.sc"); - private static final String LICENSE_HEADER_DELIMITER = "package "; + private static final String LICENSE_HEADER_DELIMITER = LicenseHeaderStep.DEFAULT_JAVA_HEADER_DELIMITER; @Override public Set defaultIncludes(MavenProject project) { diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenProvisionerTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenProvisionerTest.java index 3e769d7705..5af146c736 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenProvisionerTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenProvisionerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ class MavenProvisionerTest extends MavenIntegrationHarness { void testMultipleDependenciesExcludingTransitives() throws Exception { writePomWithJavaSteps( "", - " 4.8.0", + " 4.9", ""); setFile("formatter.xml").toResource("java/eclipse/formatter.xml"); assertResolveDependenciesWorks(); @@ -33,7 +33,7 @@ void testMultipleDependenciesExcludingTransitives() throws Exception { void testSingleDependencyIncludingTransitives() throws Exception { writePomWithJavaSteps( "", - " 1.2", + " 1.10.0", ""); assertResolveDependenciesWorks(); } diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java index 1c9521c402..a2d491cb2b 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java @@ -32,31 +32,31 @@ class MultiModuleProjectTest extends MavenIntegrationHarness { @Test void testConfigurationDependency() throws Exception { /* - create a multi-module project with the following stucture: + create a multi-module project with the following structure: /junit-tmp-dir ├── config - │   ├── pom.xml - │   └── src/main/resources/configs - │   ├── eclipse-formatter.xml - │   └── scalafmt.conf + │ ├── pom.xml + │ └── src/main/resources/configs + │ ├── eclipse-formatter.xml + │ └── scalafmt.conf ├── mvnw ├── mvnw.cmd ├── one - │   ├── pom.xml - │   └── src - │   ├── main/java/test1.java - │   └── test/java/test2.java + │ ├── pom.xml + │ └── src + │ ├── main/java/test1.java + │ └── test/java/test2.java ├── two - │   ├── pom.xml - │   └── src - │   ├── main/java/test1.java - │   └── test/java/test2.java + │ ├── pom.xml + │ └── src + │ ├── main/java/test1.java + │ └── test/java/test2.java ├── three - │   ├── pom.xml - │   └── src - │   ├── main/scala/test1.scala - │   └── test/scala/test2.scala + │ ├── pom.xml + │ └── src + │ ├── main/scala/test1.scala + │ └── test/scala/test2.scala ├── pom.xml ├── .mvn ├── mvnw @@ -70,7 +70,7 @@ void testConfigurationDependency() throws Exception { "", " ", " configs/eclipse-formatter.xml", - " 4.7.1", + " 4.9", " ", "", "", diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/SpecificFilesTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/SpecificFilesTest.java index 55cd586582..11cca5994a 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/SpecificFilesTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/SpecificFilesTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 DiffPlug + * Copyright 2016-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ private void integration(String patterns, boolean firstFormatted, boolean second " src/**/java/**/*.java", "", "", - " 1.2", + " 1.10.0", ""); setFile(testFile(1)).toResource(fixture(false)); diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/groovy/GrEclipseTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/groovy/GrEclipseTest.java index 8807f47cc9..34d95dc7d2 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/groovy/GrEclipseTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/groovy/GrEclipseTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 DiffPlug + * Copyright 2020-2023 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ private void writePomWithGrEclipse() throws IOException { writePomWithGroovySteps( "", " ${basedir}/greclipse.properties", - " 4.19.0", + " 4.25", ""); setFile("greclipse.properties").toResource("groovy/greclipse/format/greclipse.properties"); } diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/PluginFingerprintTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/PluginFingerprintTest.java index c344580d37..ae61dec331 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/PluginFingerprintTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/PluginFingerprintTest.java @@ -23,9 +23,12 @@ import java.io.ByteArrayInputStream; import java.nio.file.Paths; import java.util.Arrays; +import java.util.Collections; import java.util.List; import org.apache.maven.model.Model; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginManagement; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.ReaderFactory; @@ -106,7 +109,7 @@ void emptyFingerprint() { } @Test - void failsWhenProjectDoesNotContainSpotlessPlugin() { + void failsForProjectWithoutSpotlessPlugin() { MavenProject projectWithoutSpotless = new MavenProject(); assertThatThrownBy(() -> PluginFingerprint.from(projectWithoutSpotless, FORMATTERS)) @@ -114,6 +117,37 @@ void failsWhenProjectDoesNotContainSpotlessPlugin() { .hasMessageContaining("Spotless plugin absent from the project"); } + @Test + void buildsFingerprintForProjectWithSpotlessPluginInBuildPlugins() { + MavenProject project = new MavenProject(); + Plugin spotlessPlugin = new Plugin(); + spotlessPlugin.setGroupId("com.diffplug.spotless"); + spotlessPlugin.setArtifactId("spotless-maven-plugin"); + spotlessPlugin.setVersion("1.2.3"); + project.getBuild().addPlugin(spotlessPlugin); + + PluginFingerprint fingerprint = PluginFingerprint.from(project, Collections.emptyList()); + + assertThat(fingerprint).isNotNull(); + } + + @Test + void buildsFingerprintForProjectWithSpotlessPluginInPluginManagement() { + MavenProject project = new MavenProject(); + Plugin spotlessPlugin = new Plugin(); + spotlessPlugin.setGroupId("com.diffplug.spotless"); + spotlessPlugin.setArtifactId("spotless-maven-plugin"); + spotlessPlugin.setVersion("1.2.3"); + project.getBuild().addPlugin(spotlessPlugin); + PluginManagement pluginManagement = new PluginManagement(); + pluginManagement.addPlugin(spotlessPlugin); + project.getBuild().setPluginManagement(pluginManagement); + + PluginFingerprint fingerprint = PluginFingerprint.from(project, Collections.emptyList()); + + assertThat(fingerprint).isNotNull(); + } + private MavenProject mavenProject(String spotlessVersion) throws Exception { String xml = createPomXmlContent(spotlessVersion, new String[0], new String[0]); return new MavenProject(readPom(xml)); diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/UpToDateCheckingTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/UpToDateCheckingTest.java index 0a9fe8f2d4..cfc17594ca 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/UpToDateCheckingTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/incremental/UpToDateCheckingTest.java @@ -31,8 +31,10 @@ class UpToDateCheckingTest extends MavenIntegrationHarness { + private static final String DISABLED_MESSAGE = "Up-to-date checking disabled"; + @Test - void upToDateCheckingDisabledByDefault() throws Exception { + void upToDateCheckingEnabledByDefault() throws Exception { writePom( "", " ", @@ -41,75 +43,53 @@ void upToDateCheckingDisabledByDefault() throws Exception { List files = writeUnformattedFiles(1); String output = runSpotlessApply(); - assertThat(output).doesNotContain("Up-to-date checking enabled"); + assertThat(output).doesNotContain(DISABLED_MESSAGE); assertFormatted(files); } @Test - void enableUpToDateChecking() throws Exception { + void explicitlyEnableUpToDateChecking() throws Exception { writePomWithUpToDateCheckingEnabled(true); List files = writeUnformattedFiles(1); String output = runSpotlessApply(); - assertThat(output).contains("Up-to-date checking enabled"); + assertThat(output).doesNotContain(DISABLED_MESSAGE); assertFormatted(files); } @Test - void enableUpToDateCheckingWithPluginDependencies() throws Exception { - writePomWithPluginManagementAndDependency(); + void explicitlyDisableUpToDateChecking() throws Exception { + writePomWithUpToDateCheckingEnabled(false); List files = writeUnformattedFiles(1); String output = runSpotlessApply(); - assertThat(output).contains("Up-to-date checking enabled"); + assertThat(output).contains(DISABLED_MESSAGE); assertFormatted(files); } @Test - void enableUpToDateCheckingWithPluginDependenciesMaven3_6_3() throws Exception { + void enableUpToDateCheckingWithPluginDependencies() throws Exception { writePomWithPluginManagementAndDependency(); - setFile(".mvn/wrapper/maven-wrapper.properties").toContent("distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip\n"); - List files = writeUnformattedFiles(1); String output = runSpotlessApply(); - assertThat(output).contains("Up-to-date checking enabled"); + assertThat(output).doesNotContain(DISABLED_MESSAGE); assertFormatted(files); } - private void writePomWithPluginManagementAndDependency() throws IOException { - setFile("pom.xml").toContent(createPomXmlContent("/pom-test-management.xml.mustache", - null, - null, - new String[]{ - "", - " ", - "", - "", - " true", - ""}, - new String[]{ - "", - " ", - " javax.inject", - " javax.inject", - " 1", - " ", - ""}, - null)); - } - @Test - void disableUpToDateChecking() throws Exception { - writePomWithUpToDateCheckingEnabled(false); + void enableUpToDateCheckingWithPluginDependenciesMaven3_6_3() throws Exception { + writePomWithPluginManagementAndDependency(); + + setFile(".mvn/wrapper/maven-wrapper.properties").toContent("distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip\n"); List files = writeUnformattedFiles(1); String output = runSpotlessApply(); - assertThat(output).doesNotContain("Up-to-date checking enabled"); + assertThat(output).doesNotContain(DISABLED_MESSAGE); assertFormatted(files); } @@ -124,7 +104,7 @@ void enableUpToDateCheckingCustomIndexFile() throws Exception { List files = writeUnformattedFiles(1); String output = runSpotlessApply(); - assertThat(output).contains("Up-to-date checking enabled"); + assertThat(output).doesNotContain(DISABLED_MESSAGE); assertFormatted(files); assertThat(indexFile.getParent()).exists(); assertThat(indexFile).exists(); @@ -143,7 +123,7 @@ void disableUpToDateCheckingCustomIndexFile() throws Exception { List files = writeUnformattedFiles(1); String output = runSpotlessApply(); - assertThat(output).doesNotContain("Up-to-date checking enabled"); + assertThat(output).contains(DISABLED_MESSAGE); assertFormatted(files); assertThat(indexFile.getParent()).exists(); assertThat(indexFile).doesNotExist(); @@ -215,6 +195,25 @@ void spotlessCheckRecordsUnformattedFiles() throws Exception { assertSpotlessCheckSkipped(files, checkOutput3); } + private void writePomWithPluginManagementAndDependency() throws IOException { + setFile("pom.xml").toContent(createPomXmlContent("/pom-test-management.xml.mustache", + null, + null, + new String[]{ + "", + " ", + ""}, + new String[]{ + "", + " ", + " javax.inject", + " javax.inject", + " 1", + " ", + ""}, + null)); + } + private void writePomWithUpToDateCheckingEnabled(boolean enabled) throws IOException { writePom( "", diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java index 98a83d612c..407d089999 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/java/GoogleJavaFormatTest.java @@ -24,7 +24,7 @@ class GoogleJavaFormatTest extends MavenIntegrationHarness { void specificVersionDefaultStyle() throws Exception { writePomWithJavaSteps( "", - " 1.2", + " 1.10.0", ""); runTest("java/googlejavaformat/JavaCodeFormatted.test"); @@ -34,7 +34,7 @@ void specificVersionDefaultStyle() throws Exception { void specificVersionSpecificStyle() throws Exception { writePomWithJavaSteps( "", - " 1.2", + " 1.10.0", " ", ""); @@ -45,7 +45,7 @@ void specificVersionSpecificStyle() throws Exception { void specificVersionReflowLongStrings() throws Exception { writePomWithJavaSteps( "", - " 1.8", + " 1.10.0", " true", ""); diff --git a/settings.gradle b/settings.gradle index 1478f5af31..a9ed9373ef 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,13 +6,13 @@ pluginManagement { } plugins { - id 'com.diffplug.spotless' version '6.16.0' apply false + id 'com.diffplug.spotless' version '6.17.0' apply false // https://plugins.gradle.org/plugin/com.gradle.plugin-publish id 'com.gradle.plugin-publish' version '1.1.0' apply false // https://github.com/gradle-nexus/publish-plugin/releases - id 'io.github.gradle-nexus.publish-plugin' version '1.2.0' apply false + id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' apply false // https://github.com/spotbugs/spotbugs-gradle-plugin/releases - id 'com.github.spotbugs' version '5.0.13' apply false + id 'com.github.spotbugs' version '5.0.14' apply false // https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md id 'com.diffplug.spotless-changelog' version '3.0.1' apply false // https://github.com/diffplug/goomph/blob/main/CHANGES.md @@ -23,7 +23,9 @@ plugins { // https://github.com/davidburstrom/version-compatibility-gradle-plugin/tags id 'io.github.davidburstrom.version-compatibility' version '0.4.0' apply false // https://plugins.gradle.org/plugin/com.gradle.enterprise - id 'com.gradle.enterprise' version '3.12.3' + id 'com.gradle.enterprise' version '3.12.6' + // https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md + id 'dev.equo.ide' version '1.0.1' apply false } dependencyResolutionManagement { @@ -90,7 +92,6 @@ def getStartProperty(java.lang.String name) { userProperties.load(userPropertiesFile.newReader()) } return userProperties.get(name) - } if (System.getenv('SPOTLESS_EXCLUDE_MAVEN') != 'true' && getStartProperty('SPOTLESS_EXCLUDE_MAVEN') != 'true') { diff --git a/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormatted.test b/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormatted.test index 7f7483f1bc..7a83a0a12c 100644 --- a/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormatted.test +++ b/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormatted.test @@ -1,4 +1,3 @@ - import mylib.UsedA; import mylib.UsedB; diff --git a/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormattedAOSP.test b/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormattedAOSP.test index dd1493b8c8..25ccbc25f5 100644 --- a/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormattedAOSP.test +++ b/testlib/src/main/resources/java/googlejavaformat/JavaCodeFormattedAOSP.test @@ -1,4 +1,3 @@ - import mylib.UsedA; import mylib.UsedB; diff --git a/testlib/src/main/resources/license/HelloWorld_java.test b/testlib/src/main/resources/license/HelloWorld_java.test new file mode 100644 index 0000000000..d9be2ea939 --- /dev/null +++ b/testlib/src/main/resources/license/HelloWorld_java.test @@ -0,0 +1,5 @@ +public class HelloWorld { + public static void main(String[] args) { + System.out.print("Hello World"); + } +} diff --git a/testlib/src/main/resources/license/HelloWorld_withImport_java.test b/testlib/src/main/resources/license/HelloWorld_withImport_java.test new file mode 100644 index 0000000000..fcfb64117e --- /dev/null +++ b/testlib/src/main/resources/license/HelloWorld_withImport_java.test @@ -0,0 +1,7 @@ +import java.time.LocalDate; + +public class HelloWorld { + public static void main(String[] args) { + System.out.print("Hello World. Date: " + LocalDate.now()); + } +} diff --git a/testlib/src/main/resources/license/module-info.test b/testlib/src/main/resources/license/module-info.test new file mode 100644 index 0000000000..6678147b68 --- /dev/null +++ b/testlib/src/main/resources/license/module-info.test @@ -0,0 +1,5 @@ +module java.sql { + exports java.sql; + exports javax.sql; + exports javax.transaction.xa; +} diff --git a/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java b/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java index 2b1d0aff07..92c6794643 100644 --- a/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/generic/LicenseHeaderStepTest.java @@ -28,13 +28,16 @@ import com.diffplug.spotless.ResourceHarness; import com.diffplug.spotless.SerializableEqualityTester; import com.diffplug.spotless.StepHarness; +import com.diffplug.spotless.StepHarnessWithFile; import com.diffplug.spotless.generic.LicenseHeaderStep.YearMode; class LicenseHeaderStepTest extends ResourceHarness { private static final String FILE_NO_LICENSE = "license/FileWithoutLicenseHeader.test"; - private static final String package_ = "package "; + private static final String package_ = LicenseHeaderStep.DEFAULT_JAVA_HEADER_DELIMITER; private static final String HEADER_WITH_$YEAR = "This is a fake license, $YEAR. ACME corp."; private static final String HEADER_WITH_RANGE_TO_$YEAR = "This is a fake license with range, 2009-$YEAR. ACME corp."; + private static final String HEADER_WITH_$FILE = "This is a fake license, $FILE. ACME corp."; + private static final String HEADER_WITH_$YEAR_$FILE = "This is a fake license, $FILE, $YEAR. ACME corp."; @Test void parseExistingYear() throws Exception { @@ -163,6 +166,16 @@ private String hasHeaderWithRangeAndWithYearTo(String toYear) throws IOException return hasHeaderYear(HEADER_WITH_RANGE_TO_$YEAR, toYear); } + private String hasHeaderFileName(String license, String fileName) throws IOException { + return header(license).replace("$FILE", fileName) + getTestResource(FILE_NO_LICENSE); + } + + private String hasHeaderYearFileName(String license, String year, String fileName) throws IOException { + return header(license) + .replace("$YEAR", year) + .replace("$FILE", fileName) + getTestResource(FILE_NO_LICENSE); + } + private static String currentYear() { return String.valueOf(YearMonth.now().getYear()); } @@ -250,4 +263,52 @@ void should_preserve_year_for_license_with_address() throws Throwable { hasHeader(licenceWithAddress().replace("$YEAR", "2015").replace("FooBar Inc. All", "FooBar Inc. All")), hasHeader(licenceWithAddress().replace("$YEAR", "2015"))); } + + @Test + void should_apply_license_containing_filename_token() throws Exception { + FormatterStep step = LicenseHeaderStep.headerDelimiter(header(HEADER_WITH_$FILE), package_).build(); + StepHarnessWithFile.forStep(this, step) + .test(new File("Test.java"), getTestResource(FILE_NO_LICENSE), hasHeaderFileName(HEADER_WITH_$FILE, "Test.java")) + .testUnaffected(new File("Test.java"), hasHeaderFileName(HEADER_WITH_$FILE, "Test.java")); + } + + @Test + void should_update_license_containing_filename_token() throws Exception { + FormatterStep step = LicenseHeaderStep.headerDelimiter(header(HEADER_WITH_$FILE), package_).build(); + StepHarnessWithFile.forStep(this, step) + .test( + new File("After.java"), + hasHeaderFileName(HEADER_WITH_$FILE, "Before.java"), + hasHeaderFileName(HEADER_WITH_$FILE, "After.java")); + } + + @Test + void should_apply_license_containing_YEAR_filename_token() throws Exception { + FormatterStep step = LicenseHeaderStep.headerDelimiter(header(HEADER_WITH_$YEAR_$FILE), package_).build(); + StepHarnessWithFile.forStep(this, step) + .test( + new File("Test.java"), + getTestResource(FILE_NO_LICENSE), + hasHeaderYearFileName(HEADER_WITH_$YEAR_$FILE, currentYear(), "Test.java")) + .testUnaffected( + new File("Test.java"), + hasHeaderYearFileName(HEADER_WITH_$YEAR_$FILE, currentYear(), "Test.java")); + } + + void noPackage() throws Throwable { + String header = header(getTestResource("license/TestLicense")); + FormatterStep step = LicenseHeaderStep.headerDelimiter(header, package_).build(); + StepHarness.forStep(step) + .test(ResourceHarness.getTestResource("license/HelloWorld_java.test"), header + ResourceHarness.getTestResource("license/HelloWorld_java.test")) + .test(ResourceHarness.getTestResource("license/HelloWorld_withImport_java.test"), header + ResourceHarness.getTestResource("license/HelloWorld_withImport_java.test")); + } + + // The following demonstrate the use of 'module' keyword + @Test + void moduleInfo() throws Throwable { + String header = header(getTestResource("license/TestLicense")); + FormatterStep step = LicenseHeaderStep.headerDelimiter(header, package_).build(); + StepHarness.forStep(step) + .test(ResourceHarness.getTestResource("license/module-info.test"), header + ResourceHarness.getTestResource("license/module-info.test")); + } } diff --git a/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java b/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java index ff64b574e1..694e390727 100644 --- a/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/java/GoogleJavaFormatStepTest.java @@ -17,12 +17,11 @@ import static org.junit.jupiter.api.condition.JRE.JAVA_13; import static org.junit.jupiter.api.condition.JRE.JAVA_15; +import static org.junit.jupiter.api.condition.JRE.JAVA_16; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledForJreRange; -import com.diffplug.common.base.StringPrinter; import com.diffplug.spotless.FormatterStep; import com.diffplug.spotless.Jvm; import com.diffplug.spotless.ResourceHarness; @@ -53,7 +52,7 @@ void behavior18() throws Exception { @Test void behavior() throws Exception { - FormatterStep step = GoogleJavaFormatStep.create("1.2", TestProvisioner.mavenCentral()); + FormatterStep step = GoogleJavaFormatStep.create("1.10.0", TestProvisioner.mavenCentral()); StepHarness.forStep(step) .testResource("java/googlejavaformat/JavaCodeUnformatted.test", "java/googlejavaformat/JavaCodeFormatted.test") .testResource("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test", "java/googlejavaformat/JavaCodeWithLicenseFormatted.test") @@ -62,8 +61,25 @@ void behavior() throws Exception { } @Test - void behaviorWithAospStyle() throws Exception { + void versionBelowMinimumRequiredVersionIsNotAllowed() throws Exception { FormatterStep step = GoogleJavaFormatStep.create("1.2", "AOSP", TestProvisioner.mavenCentral()); + StepHarness.forStep(step) + .testResourceExceptionMsg("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test") + .contains("you are using 1.2"); + } + + @Test + @EnabledForJreRange(min = JAVA_16) + void versionBelowOneDotTenIsNotAllowed() throws Exception { + FormatterStep step = GoogleJavaFormatStep.create("1.9", "AOSP", TestProvisioner.mavenCentral()); + StepHarness.forStep(step) + .testResourceExceptionMsg("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test") + .contains("you are using 1.9"); + } + + @Test + void behaviorWithAospStyle() throws Exception { + FormatterStep step = GoogleJavaFormatStep.create("1.10.0", "AOSP", TestProvisioner.mavenCentral()); StepHarness.forStep(step) .testResource("java/googlejavaformat/JavaCodeUnformatted.test", "java/googlejavaformat/JavaCodeFormattedAOSP.test") .testResource("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test", "java/googlejavaformat/JavaCodeWithLicenseFormattedAOSP.test") @@ -85,7 +101,7 @@ void behaviorWithReflowLongStrings() throws Exception { @Test void behaviorWithCustomGroupArtifact() throws Exception { - FormatterStep step = GoogleJavaFormatStep.create(GoogleJavaFormatStep.defaultGroupArtifact(), "1.2", GoogleJavaFormatStep.defaultStyle(), TestProvisioner.mavenCentral(), false); + FormatterStep step = GoogleJavaFormatStep.create(GoogleJavaFormatStep.defaultGroupArtifact(), "1.10.0", GoogleJavaFormatStep.defaultStyle(), TestProvisioner.mavenCentral(), false); StepHarness.forStep(step) .testResource("java/googlejavaformat/JavaCodeUnformatted.test", "java/googlejavaformat/JavaCodeFormatted.test") .testResource("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test", "java/googlejavaformat/JavaCodeWithLicenseFormatted.test") @@ -96,7 +112,7 @@ void behaviorWithCustomGroupArtifact() throws Exception { @Test void equality() throws Exception { new SerializableEqualityTester() { - String version = "1.2"; + String version = "1.10.0"; String style = ""; boolean reflowLongStrings = false; @@ -105,7 +121,7 @@ protected void setupTest(API api) { // same version == same api.areDifferentThan(); // change the version, and it's different - version = "1.1"; + version = "1.11.0"; api.areDifferentThan(); // change the style, and it's different style = "AOSP"; @@ -147,42 +163,4 @@ protected FormatterStep create() { }.testEquals(); } - @Test - void fixWindowsBugForGfj1Point1() { - fixWindowsBugTestcase(""); - fixWindowsBugTestcase( - "", - "import somepackage;", - ""); - fixWindowsBugTestcase( - "import somepackage;", - "", - "public class SomeClass {}"); - fixWindowsBugTestcase( - "/** Some license */", - "import somepackage;", - "", - "public class SomeClass {}"); - fixWindowsBugTestcase( - "package thispackage;", - "", - "import somepackage;", - "", - "public class SomeClass {}"); - fixWindowsBugTestcase( - "/*", - " * A License.", - " */", - "", - "package thispackage;", - "", - "import somepackage;", - "", - "public class SomeClass {}"); - } - - private void fixWindowsBugTestcase(String... lines) { - String input = StringPrinter.buildStringFromLines(lines); - Assertions.assertEquals(input, GoogleJavaFormatStep.fixWindowsBug(input, "1.1")); - } }