From ad5c0ff2e94cab26179e969bf42d3e98f0341874 Mon Sep 17 00:00:00 2001 From: Max Rydahl Andersen Date: Wed, 5 Feb 2020 21:45:30 +0000 Subject: [PATCH] make ide-config shareable Why: * ide-config currently replicated at `ide-config`, `ip/arc/ide-config` and `ip/qute/ide-config` * quickstarts could benefit from reusing quarkus formatting This change addreses the need by: * move ide-config to independent-projects and make it a real project * update refs to `eclipse-format.xml` to use and resource lookup * update CONTRIBUTING.MD * enable code formatting and import sorting on tools/bootstrap --- CONTRIBUTING.md | 6 +- build-parent/pom.xml | 9 +- .../arc/ide-config/eclipse-format.xml | 279 ------------------ .../arc/ide-config/eclipse.importorder | 6 - independent-projects/arc/pom.xml | 9 +- independent-projects/bootstrap/pom.xml | 107 ++++++- independent-projects/ide-config/pom.xml | 17 ++ .../src/main/resources}/eclipse-format.xml | 0 .../src/main/resources}/eclipse.importorder | 0 .../qute/ide-config/eclipse-format.xml | 279 ------------------ .../qute/ide-config/eclipse.importorder | 6 - independent-projects/qute/pom.xml | 9 +- independent-projects/tools/pom.xml | 105 +++++++ pom.xml | 4 +- 14 files changed, 258 insertions(+), 578 deletions(-) delete mode 100644 independent-projects/arc/ide-config/eclipse-format.xml delete mode 100644 independent-projects/arc/ide-config/eclipse.importorder create mode 100644 independent-projects/ide-config/pom.xml rename {ide-config => independent-projects/ide-config/src/main/resources}/eclipse-format.xml (100%) rename {ide-config => independent-projects/ide-config/src/main/resources}/eclipse.importorder (100%) delete mode 100644 independent-projects/qute/ide-config/eclipse-format.xml delete mode 100644 independent-projects/qute/ide-config/eclipse.importorder diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86114fd86..15cf77651 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,7 +70,7 @@ On Linux, check [the post-installation guide](https://docs.docker.com/install/li ### IDE Config and Code Style Quarkus has a strictly enforced code style. Code formatting is done by the Eclipse code formatter, using the config files -found in the `ide-config` directory. By default when you run `./mvnw install` the code will be formatted automatically. +found in the `independent-projects/ide-config` directory. By default when you run `./mvnw install` the code will be formatted automatically. When submitting a pull request the CI build will fail if running the formatter results in any code changes, so it is recommended that you always run a full Maven build before submitting a pull request. @@ -79,7 +79,7 @@ If you want to run the formatting without doing a full build, you can run `./mvn #### Eclipse Setup Open the *Preferences* window, and then navigate to _Java_ -> _Code Style_ -> _Formatter_. Click _Import_ and then -select the `eclipse-format.xml` file in the `ide-config` directory. +select the `eclipse-format.xml` file in the `independent-projects/ide-config` directory. Next navigate to _Java_ -> _Code Style_ -> _Organize Imports_. Click _Import_ and select the `eclipse.importorder` file. @@ -90,7 +90,7 @@ Open the _Preferences_ window (or _Settings_ depending on your edition) , naviga Restart your IDE, open the *Preferences* (or *Settings*) window again and navigate to _Other Settings_ -> _Eclipse Code Formatter_. Select _Use the Eclipse Code Formatter_, then change the _Eclipse Java Formatter Config File_ to point to the -`eclipse-format.xml` file in the `ide-config` directory. Make sure the _Optimize Imports_ box is ticked, and +`eclipse-format.xml` file in the `independent-projects/ide-config` directory. Make sure the _Optimize Imports_ box is ticked, and select the `eclipse.importorder` file as the import order config file. diff --git a/build-parent/pom.xml b/build-parent/pom.xml index a25c0d315..f7a04a174 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -313,8 +313,15 @@ net.revelc.code.formatter formatter-maven-plugin 2.11.0 + + + quarkus-ide-config + io.quarkus + ${project.version} + + - ${maven.multiModuleProjectDirectory}/ide-config/eclipse-format.xml + eclipse-format.xml ${format.skip} diff --git a/independent-projects/arc/ide-config/eclipse-format.xml b/independent-projects/arc/ide-config/eclipse-format.xml deleted file mode 100644 index fa2bdf19c..000000000 --- a/independent-projects/arc/ide-config/eclipse-format.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/independent-projects/arc/ide-config/eclipse.importorder b/independent-projects/arc/ide-config/eclipse.importorder deleted file mode 100644 index 058fb14e6..000000000 --- a/independent-projects/arc/ide-config/eclipse.importorder +++ /dev/null @@ -1,6 +0,0 @@ -#Organize Import Order -#Wed Jan 23 12:03:29 AEDT 2019 -0=java -1=javax -2=org -3=com diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index d8d299180..3a17a1eee 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -252,8 +252,15 @@ net.revelc.code.formatter formatter-maven-plugin 2.11.0 + + + quarkus-ide-config + io.quarkus + ${project.version} + + - ${maven.multiModuleProjectDirectory}/ide-config/eclipse-format.xml + eclipse-format.xml ${format.skip} diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index b522d1786..ccd2dc670 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -323,7 +323,32 @@ - + + net.revelc.code.formatter + formatter-maven-plugin + 2.11.0 + + + quarkus-ide-config + io.quarkus + ${project.version} + + + + eclipse-format.xml + ${format.skip} + + + + net.revelc.code + impsort-maven-plugin + 1.3.2 + + true + ${format.skip} + + + @@ -406,5 +431,85 @@ + + format + + true + + !no-format + + + + + + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + format + + + + + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + + + + + + validate + + true + + no-format + + + + + + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + + + + check-imports + + check + + + + + + + diff --git a/independent-projects/ide-config/pom.xml b/independent-projects/ide-config/pom.xml new file mode 100644 index 000000000..6d2b00a14 --- /dev/null +++ b/independent-projects/ide-config/pom.xml @@ -0,0 +1,17 @@ + + + + org.jboss + jboss-parent + 31 + + 4.0.0 + + io.quarkus + quarkus-ide-config + Quarkus - IDE/Tools - Config + 999-SNAPSHOT + jar + diff --git a/ide-config/eclipse-format.xml b/independent-projects/ide-config/src/main/resources/eclipse-format.xml similarity index 100% rename from ide-config/eclipse-format.xml rename to independent-projects/ide-config/src/main/resources/eclipse-format.xml diff --git a/ide-config/eclipse.importorder b/independent-projects/ide-config/src/main/resources/eclipse.importorder similarity index 100% rename from ide-config/eclipse.importorder rename to independent-projects/ide-config/src/main/resources/eclipse.importorder diff --git a/independent-projects/qute/ide-config/eclipse-format.xml b/independent-projects/qute/ide-config/eclipse-format.xml deleted file mode 100644 index fa2bdf19c..000000000 --- a/independent-projects/qute/ide-config/eclipse-format.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/independent-projects/qute/ide-config/eclipse.importorder b/independent-projects/qute/ide-config/eclipse.importorder deleted file mode 100644 index 058fb14e6..000000000 --- a/independent-projects/qute/ide-config/eclipse.importorder +++ /dev/null @@ -1,6 +0,0 @@ -#Organize Import Order -#Wed Jan 23 12:03:29 AEDT 2019 -0=java -1=javax -2=org -3=com diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index 8acea8623..ec2793352 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -202,8 +202,15 @@ net.revelc.code.formatter formatter-maven-plugin 2.11.0 + + + quarkus-ide-config + io.quarkus + ${project.version} + + - ${maven.multiModuleProjectDirectory}/ide-config/eclipse-format.xml + eclipse-format.xml ${format.skip} diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index 288f50322..0ad47bc01 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -250,6 +250,31 @@ + + net.revelc.code.formatter + formatter-maven-plugin + 2.11.0 + + + quarkus-ide-config + io.quarkus + ${project.version} + + + + eclipse-format.xml + ${format.skip} + + + + net.revelc.code + impsort-maven-plugin + 1.3.2 + + true + ${format.skip} + + @@ -321,5 +346,85 @@ + + format + + true + + !no-format + + + + + + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + format + + + + + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + + + + + + validate + + true + + no-format + + + + + + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + + + + check-imports + + check + + + + + + + diff --git a/pom.xml b/pom.xml index b59cb190a..3958535f1 100644 --- a/pom.xml +++ b/pom.xml @@ -38,12 +38,14 @@ + + independent-projects/ide-config independent-projects/arc independent-projects/bootstrap independent-projects/tools independent-projects/qute - + bom/runtime bom/deployment