From bb4fdd43c5aab16cd11f0a2f21c9fc503f77dffc Mon Sep 17 00:00:00 2001
From: MLewerenz <152180836+LewerenzM@users.noreply.github.com>
Date: Thu, 6 Jun 2024 13:19:20 +0200
Subject: [PATCH 01/11] added env param to ci-build.yml
---
.github/workflows/ci-build.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml
index 48345241..41d75b2a 100644
--- a/.github/workflows/ci-build.yml
+++ b/.github/workflows/ci-build.yml
@@ -1,4 +1,8 @@
name: CI Build
+
+env:
+ CIBUILD: true
+
on:
workflow_dispatch:
pull_request:
From f5d0832beaf467d3dfa430b4a04e1c8b22b36dad Mon Sep 17 00:00:00 2001
From: Marcus Lewerenz <152180836+LewerenzM@users.noreply.github.com>
Date: Tue, 11 Jun 2024 15:31:41 +0200
Subject: [PATCH 02/11] updated README
---
README.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/README.md b/README.md
index 93da61c5..4aa195e1 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,15 @@
# ids.server: Server part of ICAT Data Server (IDS)
+## Linting
+The [formatter-maven-plugin](https://code.revelc.net/formatter-maven-plugin/) is used here for linting. It uses the same configuration like the Eclipse code formatting feature.
+An automatically code formatting is triggered while local build. In CI builds the code is only validated.
+You also can execute the commands manually:
+* `mvn formatter:validate` for validation
+* `mvn formatter:format` to update the source code like it is defined in the formatters configuration.
+
+The rules for the formatter are defined in `eclipse-formatter-config.xml`.
+
+## Further Information
[](https://github.com/icatproject/ids.server/actions?query=workflow%3A%22CI+Build%22)
General installation instructions are at http://www.icatproject.org/installation/component
From 4d99d7b5882e7a599e9d940fc00924cea99736e2 Mon Sep 17 00:00:00 2001
From: Marcus Lewerenz <152180836+LewerenzM@users.noreply.github.com>
Date: Wed, 12 Jun 2024 11:11:24 +0200
Subject: [PATCH 03/11] using spotless for managing eclipse formatter and
import order management
---
README.md | 10 +-
eclipse-formatter.xml | 404 ++++++++++++++++++++++++++++++++++++++++++
pom.xml | 55 ++++++
3 files changed, 465 insertions(+), 4 deletions(-)
create mode 100644 eclipse-formatter.xml
diff --git a/README.md b/README.md
index 4aa195e1..62844851 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,15 @@
# ids.server: Server part of ICAT Data Server (IDS)
## Linting
-The [formatter-maven-plugin](https://code.revelc.net/formatter-maven-plugin/) is used here for linting. It uses the same configuration like the Eclipse code formatting feature.
+The [spotless-maven-plugin](https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-maven-plugin) is used here for linting. It uses the Eclipse code formatting feature. The guidelines are defined in `eclipse-formatter.xml` which was initially exported from eclipse (so you can do it again: define rules in eclipse an export the file to use it here).
+
An automatically code formatting is triggered while local build. In CI builds the code is only validated.
You also can execute the commands manually:
-* `mvn formatter:validate` for validation
-* `mvn formatter:format` to update the source code like it is defined in the formatters configuration.
+* `mvn spotless:check` for validation
+* `mvn spotless:apply` to update the source code like it is defined in the formatters configuration.
-The rules for the formatter are defined in `eclipse-formatter-config.xml`.
+### Import order
+The import order is also validated and applied by the spotless-maven-plugin. It is defined in its plugin configuration in the `pom.xml`. You can find it in `plugin.configuration.java.importOrder.order`
## Further Information
[](https://github.com/icatproject/ids.server/actions?query=workflow%3A%22CI+Build%22)
diff --git a/eclipse-formatter.xml b/eclipse-formatter.xml
new file mode 100644
index 00000000..8c3a01e3
--- /dev/null
+++ b/eclipse-formatter.xml
@@ -0,0 +1,404 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 4fb68fc6..6796de8a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,6 +12,7 @@
UTF-8
https://repo.icatproject.org/repo
github
+ apply
@@ -27,6 +28,11 @@
MireDot Releases
https://secure-nexus.miredot.com/content/repositories/miredot
+
+ com.diffplug.spotless
+ spotless-maven-plugin Repo
+ https://mvnrepository.com/artifact/com.diffplug.spotless/
+
@@ -128,6 +134,13 @@
test
+
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 2.43.0
+
+
@@ -414,10 +427,52 @@
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 2.43.0
+
+
+
+ src/main/java/**/*.java
+ src/test/java/**/*.java
+
+
+ ${project.basedir}/eclipse-formatter.xml
+
+
+ java|jakarta|org|org.icatproject|org.icatproject.ids
+
+
+
+
+
+
+ ${spotless.goal}
+
+
+
+
+
+
+
+ cibuild
+
+
+ env.CIBUILD
+
+
+
+
+ check
+
+
+
+
From 8dfc27aa38b53146fcb7fb53f52591153ef73eba Mon Sep 17 00:00:00 2001
From: Marcus Lewerenz <152180836+LewerenzM@users.noreply.github.com>
Date: Wed, 12 Jun 2024 11:59:16 +0200
Subject: [PATCH 04/11] spotless: moved import order to file
---
README.md | 2 +-
eclipse-importorder.txt | 7 +++++++
pom.xml | 5 +++--
3 files changed, 11 insertions(+), 3 deletions(-)
create mode 100644 eclipse-importorder.txt
diff --git a/README.md b/README.md
index 62844851..dd28dbd1 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ You also can execute the commands manually:
* `mvn spotless:apply` to update the source code like it is defined in the formatters configuration.
### Import order
-The import order is also validated and applied by the spotless-maven-plugin. It is defined in its plugin configuration in the `pom.xml`. You can find it in `plugin.configuration.java.importOrder.order`
+The import order is also validated and applied by the spotless-maven-plugin. It is defined in the file `eclipse-importorder.txt` and referenced in `pom.xml`. It is needed that it has a compatible format like the eclipse built-in import order configuration (better its exported file).
## Further Information
[](https://github.com/icatproject/ids.server/actions?query=workflow%3A%22CI+Build%22)
diff --git a/eclipse-importorder.txt b/eclipse-importorder.txt
new file mode 100644
index 00000000..a7cc5e1e
--- /dev/null
+++ b/eclipse-importorder.txt
@@ -0,0 +1,7 @@
+#Organize Import Order
+#Wed Jun 12 08:50:43 CEST 2024
+0=java
+1=jakarta
+2=org
+3=org.icatproject
+4=org.icatproject.ids
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6796de8a..68f2b7ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -441,15 +441,16 @@
${project.basedir}/eclipse-formatter.xml
- java|jakarta|org|org.icatproject|org.icatproject.ids
+ ${project.basedir}/eclipse-importorder.txt
- ${spotless.goal}
+ ${spotless.goal}
+ compile
From 6ee775e32151de54aa8f5ffca78938b7c1a02174 Mon Sep 17 00:00:00 2001
From: Rolf Krahl
Date: Thu, 8 Aug 2024 16:25:39 +0200
Subject: [PATCH 05/11] Move spotless config files into a dedicated
subdirectory
---
eclipse-formatter.xml => .spotless/eclipse-formatter.xml | 0
eclipse-importorder.txt => .spotless/eclipse-importorder.txt | 0
pom.xml | 4 ++--
3 files changed, 2 insertions(+), 2 deletions(-)
rename eclipse-formatter.xml => .spotless/eclipse-formatter.xml (100%)
rename eclipse-importorder.txt => .spotless/eclipse-importorder.txt (100%)
diff --git a/eclipse-formatter.xml b/.spotless/eclipse-formatter.xml
similarity index 100%
rename from eclipse-formatter.xml
rename to .spotless/eclipse-formatter.xml
diff --git a/eclipse-importorder.txt b/.spotless/eclipse-importorder.txt
similarity index 100%
rename from eclipse-importorder.txt
rename to .spotless/eclipse-importorder.txt
diff --git a/pom.xml b/pom.xml
index 68f2b7ac..07cd91b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -438,10 +438,10 @@
src/test/java/**/*.java
- ${project.basedir}/eclipse-formatter.xml
+ ${project.basedir}/.spotless/eclipse-formatter.xml
- ${project.basedir}/eclipse-importorder.txt
+ ${project.basedir}/.spotless/eclipse-importorder.txt
From 7b43255329faf0518c23b7cd919ba9e0d7883feb Mon Sep 17 00:00:00 2001
From: Rolf Krahl
Date: Thu, 8 Aug 2024 17:33:33 +0200
Subject: [PATCH 06/11] Change the default goal for spotless to check, but skip
the checks unless in CIBUILD environment
---
pom.xml | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 07cd91b1..1f4263ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,8 @@
UTF-8
https://repo.icatproject.org/repo
github
- apply
+ check
+ true
@@ -468,8 +469,9 @@
-
- check
+
+ false
From ced2f5a50c3c83ce2dea340e7037af6f7d42e1f4 Mon Sep 17 00:00:00 2001
From: Rolf Krahl
Date: Thu, 8 Aug 2024 17:39:13 +0200
Subject: [PATCH 07/11] Run spotless in gradually formatting (aka ratchet) mode
by default
---
pom.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pom.xml b/pom.xml
index 1f4263ed..a26d92a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,6 +14,7 @@
github
check
true
+ origin/master
@@ -433,6 +434,7 @@
spotless-maven-plugin
2.43.0
+ ${spotless.ratchetFrom}
src/main/java/**/*.java
From c437eae10ddb4275d05d08c26d1ae727fd313c7f Mon Sep 17 00:00:00 2001
From: Rolf Krahl
Date: Thu, 8 Aug 2024 17:55:35 +0200
Subject: [PATCH 08/11] Update README
---
README.md | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index dd28dbd1..e40eb44d 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,16 @@
# ids.server: Server part of ICAT Data Server (IDS)
## Linting
-The [spotless-maven-plugin](https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-maven-plugin) is used here for linting. It uses the Eclipse code formatting feature. The guidelines are defined in `eclipse-formatter.xml` which was initially exported from eclipse (so you can do it again: define rules in eclipse an export the file to use it here).
+The [spotless-maven-plugin](https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-maven-plugin) is used here for linting. It uses the Eclipse code formatting feature. The guidelines are defined in `.spotless/eclipse-formatter.xml` which was initially exported from eclipse (so you can do it again: define rules in eclipse an export the file to use it here).
-An automatically code formatting is triggered while local build. In CI builds the code is only validated.
+By default, code checks are disabled for local builds, but enforced in the CI build pipeline.
You also can execute the commands manually:
-* `mvn spotless:check` for validation
-* `mvn spotless:apply` to update the source code like it is defined in the formatters configuration.
+* `mvn spotless:check -Dspotless.check.skip=false` to validate the source files,
+* `mvn spotless:apply` to directly change the source files according to the linting.
+By default, the linter only checks files that have been changed with respect to the `master` branch. To check all the files, add a `-Dspotless.ratchetFrom=NONE` flag to the manual commands.
### Import order
-The import order is also validated and applied by the spotless-maven-plugin. It is defined in the file `eclipse-importorder.txt` and referenced in `pom.xml`. It is needed that it has a compatible format like the eclipse built-in import order configuration (better its exported file).
+The import order is also validated and applied by the spotless-maven-plugin. It is defined in the file `.spotless/eclipse-importorder.txt` and referenced in `pom.xml`. It is needed that it has a compatible format like the eclipse built-in import order configuration (better its exported file).
## Further Information
[](https://github.com/icatproject/ids.server/actions?query=workflow%3A%22CI+Build%22)
From 179cd56888e12d0c6aa746da61bf3eb01c46255a Mon Sep 17 00:00:00 2001
From: Rolf Krahl
Date: Thu, 8 Aug 2024 18:03:18 +0200
Subject: [PATCH 09/11] Lint the linter config files (missing final newline)
---
.spotless/eclipse-formatter.xml | 2 +-
.spotless/eclipse-importorder.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.spotless/eclipse-formatter.xml b/.spotless/eclipse-formatter.xml
index 8c3a01e3..d6f0e886 100644
--- a/.spotless/eclipse-formatter.xml
+++ b/.spotless/eclipse-formatter.xml
@@ -401,4 +401,4 @@
-
\ No newline at end of file
+
diff --git a/.spotless/eclipse-importorder.txt b/.spotless/eclipse-importorder.txt
index a7cc5e1e..14a1749c 100644
--- a/.spotless/eclipse-importorder.txt
+++ b/.spotless/eclipse-importorder.txt
@@ -4,4 +4,4 @@
1=jakarta
2=org
3=org.icatproject
-4=org.icatproject.ids
\ No newline at end of file
+4=org.icatproject.ids
From a0848e69a438f67dda080b2a879bac370bda1475 Mon Sep 17 00:00:00 2001
From: Rolf Krahl
Date: Thu, 15 Aug 2024 11:22:24 +0200
Subject: [PATCH 10/11] Partly revert ced2f5a: switch ratchet off by default,
but leave the property in place, so it can be enabled on the mvn command line
---
README.md | 1 -
pom.xml | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index e40eb44d..1e32c633 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,6 @@ By default, code checks are disabled for local builds, but enforced in the CI bu
You also can execute the commands manually:
* `mvn spotless:check -Dspotless.check.skip=false` to validate the source files,
* `mvn spotless:apply` to directly change the source files according to the linting.
-By default, the linter only checks files that have been changed with respect to the `master` branch. To check all the files, add a `-Dspotless.ratchetFrom=NONE` flag to the manual commands.
### Import order
The import order is also validated and applied by the spotless-maven-plugin. It is defined in the file `.spotless/eclipse-importorder.txt` and referenced in `pom.xml`. It is needed that it has a compatible format like the eclipse built-in import order configuration (better its exported file).
diff --git a/pom.xml b/pom.xml
index a26d92a6..a0eb4130 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
github
check
true
- origin/master
+ NONE
From 87948822e05c0910610b5238ef0dc71e0e6f3c2e Mon Sep 17 00:00:00 2001
From: Marcus Lewerenz <152180836+LewerenzM@users.noreply.github.com>
Date: Wed, 4 Sep 2024 09:55:24 +0200
Subject: [PATCH 11/11] formatter: switched off line length options
---
.spotless/eclipse-formatter.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.spotless/eclipse-formatter.xml b/.spotless/eclipse-formatter.xml
index d6f0e886..30a63498 100644
--- a/.spotless/eclipse-formatter.xml
+++ b/.spotless/eclipse-formatter.xml
@@ -247,7 +247,7 @@
-
+
@@ -397,7 +397,7 @@
-
+