Skip to content

Commit ac04df7

Browse files
authored
Merge pull request #578 from xdev-software/v5-leaflet-plugins
V5 - Leaflet plugins
2 parents a145180 + ae6046a commit ac04df7

File tree

152 files changed

+4332
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+4332
-73
lines changed

.github/workflows/check-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
- 'assets/**'
2121

2222
env:
23-
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
23+
DEMO_MAVEN_MODULE: flow-demo
2424

2525
jobs:
2626
build:

.github/workflows/release.yml

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
push:
55
branches: [ master ]
66

7-
env:
8-
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
9-
107
permissions:
118
contents: write
129
pull-requests: write
@@ -66,10 +63,9 @@ jobs:
6663
- name: Get version
6764
id: version
6865
run: |
69-
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
66+
version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
7067
echo "release=$version" >> $GITHUB_OUTPUT
7168
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
72-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
7369
7470
- name: Commit and Push
7571
run: |
@@ -94,12 +90,14 @@ jobs:
9490
Add the following lines to your pom:
9591
```XML
9692
<dependency>
97-
<groupId>software.xdev</groupId>
98-
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
93+
<groupId>software.xdev.vaadin.maps-leaflet</groupId>
94+
<artifactId>flow</artifactId>
9995
<version>${{ steps.version.outputs.release }}</version>
10096
</dependency>
10197
```
10298
99+
You can also use the [BOM](https://github.com/${{ github.repository }}/tree/develop/bom) for easier dependency management.
100+
103101
### Additional notes
104102
* [Spring-Boot] You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages)
105103
@@ -125,14 +123,19 @@ jobs:
125123
server-password: PACKAGES_CENTRAL_TOKEN
126124
gpg-passphrase: MAVEN_GPG_PASSPHRASE
127125
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
128-
129-
- name: Publish to GitHub Packages Central
130-
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
131-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
126+
127+
- name: Publish to GitHub Packages
128+
run: |
129+
modules=("bom")
130+
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
131+
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
132+
printf -v modules_joined '%s,' "${modules[@]}"
133+
modules_arg=$(echo "${modules_joined%,}")
134+
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
132135
env:
133136
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
134137
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
135-
138+
136139
- name: Set up JDK
137140
uses: actions/setup-java@v4
138141
with: # running setup-java again overwrites the settings.xml
@@ -144,12 +147,17 @@ jobs:
144147
gpg-passphrase: MAVEN_GPG_PASSPHRASE
145148

146149
- name: Publish to Central Portal
147-
run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests
150+
run: |
151+
modules=("bom")
152+
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
153+
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
154+
printf -v modules_joined '%s,' "${modules[@]}"
155+
modules_arg=$(echo "${modules_joined%,}")
156+
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish,publish-sonatype-central-portal -DskipTests
148157
env:
149158
MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
150159
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
151160
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
152-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
153161

154162
publish-pages:
155163
runs-on: ubuntu-latest
@@ -172,14 +180,22 @@ jobs:
172180
cache: 'maven'
173181

174182
- name: Build site
175-
run: ../mvnw -B compile site -DskipTests -T2C
176-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
183+
run: ./mvnw -B compile site -DskipTests -T2C
184+
185+
- name: Aggregate site
186+
run: |
187+
modules=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
188+
for m in "${modules[@]}"
189+
do
190+
echo "$m/target/site -> ./target/site/$m"
191+
cp -r $m/target/site ./target/site/$m
192+
done
177193
178194
- name: Deploy to Github pages
179195
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
180196
with:
181197
github_token: ${{ secrets.GITHUB_TOKEN }}
182-
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
198+
publish_dir: ./target/site
183199
force_orphan: true
184200

185201
after-release:

.github/workflows/test-deploy.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,18 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16-
- name: Set up JDK
17-
uses: actions/setup-java@v4
18-
with: # running setup-java overwrites the settings.xml
19-
distribution: 'temurin'
20-
java-version: '17'
21-
server-id: github-central
22-
server-password: PACKAGES_CENTRAL_TOKEN
23-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
24-
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
25-
26-
- name: Publish to GitHub Packages Central
27-
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
28-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
16+
- name: Publish to GitHub Packages
17+
run: |
18+
modules=("bom")
19+
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
20+
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
21+
printf -v modules_joined '%s,' "${modules[@]}"
22+
modules_arg=$(echo "${modules_joined%,}")
23+
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
2924
env:
3025
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
3126
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
32-
27+
3328
- name: Set up JDK
3429
uses: actions/setup-java@v4
3530
with: # running setup-java again overwrites the settings.xml
@@ -41,8 +36,13 @@ jobs:
4136
gpg-passphrase: MAVEN_GPG_PASSPHRASE
4237

4338
- name: Publish to Central Portal
44-
run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests
45-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
39+
run: |
40+
modules=("bom")
41+
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
42+
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
43+
printf -v modules_joined '%s,' "${modules[@]}"
44+
modules_arg=$(echo "${modules_joined%,}")
45+
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish,publish-sonatype-central-portal -DskipTests
4646
env:
4747
MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
4848
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}

.run/Run Demo.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
33
<option name="MAIN_CLASS_NAME" value="software.xdev.vaadin.Application" />
4-
<module name="vaadin-maps-leaflet-flow-demo" />
4+
<module name="flow-demo" />
55
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
66
<extension name="coverage">
77
<pattern>

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# 5.0.0
2+
3+
> [!WARNING]
4+
> Breaking change - Artifact relocation: <br/>
5+
> ``software.xdev:vaadin-maps-leaflet-flow`` was moved to ``software.xdev.vaadin.maps-leaflet:flow``
6+
7+
* Introduced support for Leaflet plugins #307
8+
* Plugins can be installed from ``software.xdev.vaadin.maps-leaflet.plugins:<artifactId>``
9+
* The following [plugins](./plugins/) are currently available:
10+
* geoman
11+
* leaflet-markercluster
12+
* maplibre-gl-leaflet
13+
* You can also use the [``bom``](./bom/) for easier dependency management
14+
115
# 4.6.4
216
* Updated dependencies
317

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ A Vaadin Flow Java API for [Leaflet](https://leafletjs.com/)
1212

1313
This API wraps the Leaflet API in a Vaadin friendly way.<br/>It uses a similar structure (classes, methods) as the [Leaflet JavaScript API](https://leafletjs.com/reference.html).
1414

15-
To get started it's recommended to have a look at the [demo](./vaadin-maps-leaflet-flow-demo), notably the [minimalistic example](./vaadin-maps-leaflet-flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/MinimalisticDemo.java).
15+
To get started it's recommended to have a look at the [demo](./flow-demo), notably the [minimalistic example](./flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/MinimalisticDemo.java).
1616

1717
> [!NOTE]
1818
> **The API only supports sending instructions to the client**<br/>
1919
> Due to data integrity retrieving client-side data (that can be modified by users) is not supported.
2020
>
21-
> Event listeners can still be registered but this needs to be done manually. An example is available [in the demo](./vaadin-maps-leaflet-flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/EventDemo.java).
21+
> Event listeners can still be registered but this needs to be done manually. An example is available [in the demo](./flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/EventDemo.java).
2222
>
23-
> <details><summary>The following code snippet is a simplification of an even more <a href="./vaadin-maps-leaflet-flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/ComplexDemo.java#L251">complex example</a> which sends (unvalidated!) client side data back to the server (click to expand)</summary>
23+
> <details><summary>The following code snippet is a simplification of an even more <a href="./flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/ComplexDemo.java#L251">complex example</a> which sends (unvalidated!) client side data back to the server (click to expand)</summary>
2424
>
2525
> ```java
2626
> this.map.on("click", "e => document.getElementById('" + ID + "').$server.mapClicked(e.latlng.lat, e.latng.lng)");
@@ -38,7 +38,7 @@ To get started it's recommended to have a look at the [demo](./vaadin-maps-leafl
3838
3939
#### Static resources
4040
Please note that Leaflet uses a few default icons for various components (e.g. Markers).<br/>
41-
These are also shipped with the library and can be found inside [``META-INF/resources``](./vaadin-maps-leaflet-flow/src/main/resources/META-INF/resources/).<br/>
41+
These are also shipped with the library and can be found inside [``META-INF/resources``](./flow/src/main/resources/META-INF/resources/).<br/>
4242
You might have to fine tune your security configuration to allow these.
4343
4444
#### Compatibility with Vaadin
@@ -51,7 +51,7 @@ You might have to fine tune your security configuration to allow these.
5151
5252
## Run the Demo
5353
* Checkout the repo
54-
* Run ``mvn install && mvn -f vaadin-maps-leaflet-flow-demo spring-boot:run``
54+
* Run ``mvn install && mvn -f flow-demo spring-boot:run``
5555
* Open http://localhost:8080
5656
5757
<details>

bom/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# BOM - [Bill of Materials](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Bill_of_Materials_.28BOM.29_POMs)
2+
3+
Add it like this
4+
```xml
5+
<dependencyManagement>
6+
<dependencies>
7+
<dependency>
8+
<groupId>software.xdev.vaadin.maps-leaflet</groupId>
9+
<artifactId>bom</artifactId>
10+
<version>...</version>
11+
<type>pom</type>
12+
<scope>import</scope>
13+
</dependency>
14+
</dependencies>
15+
</dependencyManagement>
16+
```

0 commit comments

Comments
 (0)