Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
- 'assets/**'

env:
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
DEMO_MAVEN_MODULE: flow-demo

jobs:
build:
Expand Down
50 changes: 33 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches: [ master ]

env:
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}

permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -66,10 +63,9 @@ jobs:
- name: Get version
id: version
run: |
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "release=$version" >> $GITHUB_OUTPUT
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}

- name: Commit and Push
run: |
Expand All @@ -94,12 +90,14 @@ jobs:
Add the following lines to your pom:
```XML
<dependency>
<groupId>software.xdev</groupId>
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
<groupId>software.xdev.vaadin.maps-leaflet</groupId>
<artifactId>flow</artifactId>
<version>${{ steps.version.outputs.release }}</version>
</dependency>
```

You can also use the [BOM](https://github.com/${{ github.repository }}/tree/develop/bom) for easier dependency management.

### Additional notes
* [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)

Expand All @@ -125,14 +123,19 @@ jobs:
server-password: PACKAGES_CENTRAL_TOKEN
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once

- name: Publish to GitHub Packages Central
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}

- name: Publish to GitHub Packages
run: |
modules=("bom")
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
printf -v modules_joined '%s,' "${modules[@]}"
modules_arg=$(echo "${modules_joined%,}")
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
env:
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Set up JDK
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
Expand All @@ -144,12 +147,17 @@ jobs:
gpg-passphrase: MAVEN_GPG_PASSPHRASE

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

publish-pages:
runs-on: ubuntu-latest
Expand All @@ -172,14 +180,22 @@ jobs:
cache: 'maven'

- name: Build site
run: ../mvnw -B compile site -DskipTests -T2C
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
run: ./mvnw -B compile site -DskipTests -T2C

- name: Aggregate site
run: |
modules=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
for m in "${modules[@]}"
do
echo "$m/target/site -> ./target/site/$m"
cp -r $m/target/site ./target/site/$m
done

- name: Deploy to Github pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
publish_dir: ./target/site
force_orphan: true

after-release:
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with: # running setup-java overwrites the settings.xml
distribution: 'temurin'
java-version: '17'
server-id: github-central
server-password: PACKAGES_CENTRAL_TOKEN
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once

- name: Publish to GitHub Packages Central
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
- name: Publish to GitHub Packages
run: |
modules=("bom")
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
printf -v modules_joined '%s,' "${modules[@]}"
modules_arg=$(echo "${modules_joined%,}")
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
env:
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Set up JDK
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
Expand All @@ -41,8 +36,13 @@ jobs:
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Central Portal
run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
run: |
modules=("bom")
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
printf -v modules_joined '%s,' "${modules[@]}"
modules_arg=$(echo "${modules_joined%,}")
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish,publish-sonatype-central-portal -DskipTests
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .run/Run Demo.run.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="software.xdev.vaadin.Application" />
<module name="vaadin-maps-leaflet-flow-demo" />
<module name="flow-demo" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<extension name="coverage">
<pattern>
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 5.0.0

> [!WARNING]
> Breaking change - Artifact relocation: <br/>
> ``software.xdev:vaadin-maps-leaflet-flow`` was moved to ``software.xdev.vaadin.maps-leaflet:flow``

* Introduced support for Leaflet plugins #307
* Plugins can be installed from ``software.xdev.vaadin.maps-leaflet.plugins:<artifactId>``
* The following [plugins](./plugins/) are currently available:
* geoman
* leaflet-markercluster
* maplibre-gl-leaflet
* You can also use the [``bom``](./bom/) for easier dependency management

# 4.6.4
* Updated dependencies

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ A Vaadin Flow Java API for [Leaflet](https://leafletjs.com/)

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).

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).
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).

> [!NOTE]
> **The API only supports sending instructions to the client**<br/>
> Due to data integrity retrieving client-side data (that can be modified by users) is not supported.
>
> 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).
> 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).
>
> <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>
> <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>
>
> ```java
> this.map.on("click", "e => document.getElementById('" + ID + "').$server.mapClicked(e.latlng.lat, e.latng.lng)");
Expand All @@ -38,7 +38,7 @@ To get started it's recommended to have a look at the [demo](./vaadin-maps-leafl

#### Static resources
Please note that Leaflet uses a few default icons for various components (e.g. Markers).<br/>
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/>
These are also shipped with the library and can be found inside [``META-INF/resources``](./flow/src/main/resources/META-INF/resources/).<br/>
You might have to fine tune your security configuration to allow these.

#### Compatibility with Vaadin
Expand All @@ -51,7 +51,7 @@ You might have to fine tune your security configuration to allow these.

## Run the Demo
* Checkout the repo
* Run ``mvn install && mvn -f vaadin-maps-leaflet-flow-demo spring-boot:run``
* Run ``mvn install && mvn -f flow-demo spring-boot:run``
* Open http://localhost:8080

<details>
Expand Down
16 changes: 16 additions & 0 deletions bom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# BOM - [Bill of Materials](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Bill_of_Materials_.28BOM.29_POMs)

Add it like this
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>software.xdev.vaadin.maps-leaflet</groupId>
<artifactId>bom</artifactId>
<version>...</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
```
Loading