Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to Vaadin 24.4 #117

Merged
merged 11 commits into from
Aug 22, 2024
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/deploy-classifiers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
packages: write
strategy:
matrix:
branch: [ "development", "vaadin-23" ]
branch: [ "development", "vaadin-24.3", "vaadin-23" ]

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
default: 'development'
options:
- "development"
- "vaadin-24.3"
- "vaadin-23"
version:
description: "Version to release (e.g. 1.1.0 or 1.2.0-alpha1)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validation-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
java: [21, 17]
branch: [ development, vaadin-23 ]
branch: [ development, vaadin-24.3, vaadin-23 ]
include:
- branch: vaadin-23
java: 11
Expand Down
15 changes: 4 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.mcollovati.vertx</groupId>
<artifactId>vertx-vaadin-root</artifactId>
<version>24.3-SNAPSHOT</version>
<version>24.4-SNAPSHOT</version>
<packaging>pom</packaging>

<description>Vertx Vaadin root Pom</description>
Expand Down Expand Up @@ -109,9 +109,9 @@
<spotless-maven-plugin.version>2.41.1</spotless-maven-plugin.version>

<vertx.version>4.3.8</vertx.version>
<vaadin.platform.version>24.3.15</vaadin.platform.version>
<vaadin.flow.version>24.3.13</vaadin.flow.version>
<hilla.version>2.5.7</hilla.version>
<vaadin.platform.version>24.4.10</vaadin.platform.version>
<vaadin.flow.version>24.4.6</vaadin.flow.version>
<hilla.version>24.4.6</hilla.version>

<jakarta.servlet.version>6.0.0</jakarta.servlet.version>
<byte-buddy.version>1.14.11</byte-buddy.version>
Expand All @@ -137,13 +137,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>dev.hilla</groupId>
<artifactId>hilla-bom</artifactId>
<version>${hilla.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>io.vertx</groupId>
Expand Down
6 changes: 1 addition & 5 deletions tools/release_flow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@ _base_dir="$(dirname $(realpath $0))/.."
_newVersion=${1:?New version is missing}
_mvn="$_base_dir/mvnw -f $_base_dir/pom.xml"

$_mvn -Prelease-flow -pl :vaadin-flow-sockjs versions:set -DnewVersion=${_newVersion}
$_mvn -Prelease-flow -pl :vertx-vaadin-flow versions:set -DnewVersion=${_newVersion}
$_mvn -Prelease-flow -pl :vertx-vaadin-flow-jandex versions:set -DnewVersion=${_newVersion}
$_mvn -Prelease-flow -pl :vertx-vaadin-quarkus-extension-parent versions:set -DnewVersion=${_newVersion}
$_mvn -Prelease-flow,flow-ui-tests -pl :vertx-vaadin-test versions:set -DnewVersion=${_newVersion}
$_mvn -Pflow-ui-tests versions:set -DnewVersion=${_newVersion}
2 changes: 1 addition & 1 deletion vaadin-flow-sockjs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.mcollovati.vertx</groupId>
<artifactId>vertx-vaadin-root</artifactId>
<version>24.3-SNAPSHOT</version>
<version>24.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion vertx-vaadin-flow-jandex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.mcollovati.vertx</groupId>
<artifactId>vertx-vaadin-root</artifactId>
<version>24.3-SNAPSHOT</version>
<version>24.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
26 changes: 19 additions & 7 deletions vertx-vaadin-flow/frontend/generated/vaadin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@ import 'Frontend/generated/jar-resources/copilot/copilot.js';
if (import.meta.hot) {
// @ts-ignore
import.meta.hot.on('vite:afterUpdate', () => {
(window as any).Vaadin.copilotPlugins._internals.copilotEventBus.emit('vite-after-update',{});
const eventbus = (window as any).Vaadin.copilot.eventbus;
if (eventbus) {
eventbus.emit('vite-after-update',{});
}
});
}

import '@vaadin/vertical-layout/src/vaadin-vertical-layout.js';
import '@vaadin/context-menu/src/vaadin-context-menu.js';
import '@vaadin/vertical-layout/theme/lumo/vaadin-vertical-layout.js';
import '@vaadin/horizontal-layout/theme/lumo/vaadin-horizontal-layout.js';
import '@vaadin/context-menu/theme/lumo/vaadin-context-menu.js';
import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
import '@vaadin/text-area/theme/lumo/vaadin-text-area.js';
import '@vaadin/menu-bar/theme/lumo/vaadin-menu-bar.js';
import '@vaadin/grid/theme/lumo/vaadin-grid.js';
import '@vaadin/grid/theme/lumo/vaadin-grid-tree-column.js';
import '@vaadin/details/theme/lumo/vaadin-details.js';
import '@vaadin/select/theme/lumo/vaadin-select.js';
import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
import '@vaadin/combo-box/theme/lumo/vaadin-combo-box.js';
import '@vaadin/item/theme/lumo/vaadin-item.js';
import '@vaadin/dialog/theme/lumo/vaadin-dialog.js';
import '@vaadin/icons/vaadin-iconset.js';
import '@vaadin/menu-bar/src/vaadin-menu-bar.js';
import '@vaadin/icon/vaadin-icon.js';
import '@vaadin/text-field/src/vaadin-text-field.js';
import '@vaadin/grid/src/vaadin-grid.js';
import '@vaadin/grid/src/vaadin-grid-tree-column.js';
import './vaadin-featureflags.js';

import './index';
Expand Down
7 changes: 3 additions & 4 deletions vertx-vaadin-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.mcollovati.vertx</groupId>
<artifactId>vertx-vaadin-root</artifactId>
<version>24.3-SNAPSHOT</version>
<version>24.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -77,10 +77,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.hilla</groupId>
<artifactId>endpoint</artifactId>
<groupId>com.vaadin</groupId>
<artifactId>hilla-endpoint</artifactId>
<scope>provided</scope>
<version>${hilla.version}</version>
</dependency>
<!-- Only to avoid compilation errors -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import com.vaadin.flow.server.startup.WebComponentConfigurationRegistryInitializer;
import com.vaadin.flow.server.startup.WebComponentExporterAwareValidator;
import com.vaadin.flow.shared.ApplicationConstants;
import dev.hilla.startup.EndpointsValidator;
import com.vaadin.hilla.startup.EndpointsValidator;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ClassInfoList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.vaadin.base.devserver.ViteHandler;
import com.vaadin.flow.function.DeploymentConfiguration;
import com.vaadin.flow.internal.ApplicationClassLoaderAccess;
import com.vaadin.flow.internal.BrowserLiveReloadAccessor;
import com.vaadin.flow.internal.CurrentInstance;
import com.vaadin.flow.internal.DevModeHandler;
import com.vaadin.flow.internal.DevModeHandlerManager;
Expand Down Expand Up @@ -298,8 +299,10 @@ private void initRouters() {
vaadinRouter.routeWithRegex("/.*\\.js").handler(proxy::forward);
vaadinRouter.routeWithRegex("/(index|web-component)\\.html").handler(proxy::forward);

BrowserLiveReloadAccessor.getLiveReloadFromService(service);
VertxDebugWindowConnection windowConnection =
service.getContext().getAttribute(VertxDebugWindowConnection.class);

windowConnection.attachService(service);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.github.mcollovati.vertx.vaadin;

import java.util.stream.Stream;

import org.slf4j.LoggerFactory;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasElement;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.di.Instantiator;
import com.vaadin.flow.i18n.I18NProvider;
import com.vaadin.flow.router.NavigationEvent;
import com.vaadin.flow.server.DependencyFilter;
import com.vaadin.flow.server.VaadinServiceInitListener;
import com.vaadin.flow.server.auth.MenuAccessControl;
import com.vaadin.flow.server.communication.IndexHtmlRequestListener;

public class VertxVaadinInstantiator implements Instantiator {

private static Class<?> copilotInitListener;
static {
try{
copilotInitListener = VertxVaadinInstantiator.class.getClassLoader().loadClass("com.vaadin.copilot.CopilotIndexHtmlLoader");
} catch (Exception ex) {
LoggerFactory.getLogger(VertxVaadinInstantiator.class).debug("Copilot not present");
}
}

@Override
public Stream<VaadinServiceInitListener> getServiceInitListeners() {
return delegate.getServiceInitListeners()
// Disable Copilot because of hard-coded Servlet API usage
.filter(listener -> copilotInitListener == null || !copilotInitListener.isInstance(listener));
}

@Override
public Stream<IndexHtmlRequestListener> getIndexHtmlRequestListeners(Stream<IndexHtmlRequestListener> indexHtmlRequestListeners) {
return delegate.getIndexHtmlRequestListeners(indexHtmlRequestListeners);
}

@Override
public Stream<DependencyFilter> getDependencyFilters(Stream<DependencyFilter> serviceInitFilters) {
return delegate.getDependencyFilters(serviceInitFilters);
}

@Override
public <T> T getOrCreate(Class<T> type) {
return delegate.getOrCreate(type);
}

@Override
public Class<?> getApplicationClass(Object instance) {
return delegate.getApplicationClass(instance);
}

@Override
public Class<?> getApplicationClass(Class<?> clazz) {
return delegate.getApplicationClass(clazz);
}

@Override
public <T extends HasElement> T createRouteTarget(Class<T> routeTargetType, NavigationEvent event) {
return delegate.createRouteTarget(routeTargetType, event);
}

@Override
public <T extends Component> T createComponent(Class<T> componentClass) {
return delegate.createComponent(componentClass);
}

public static Instantiator get(UI ui) {
return Instantiator.get(ui);
}

@Override
public I18NProvider getI18NProvider() {
return delegate.getI18NProvider();
}

@Override
public MenuAccessControl getMenuAccessControl() {
return delegate.getMenuAccessControl();
}

private final Instantiator delegate;

public VertxVaadinInstantiator(Instantiator delegate) {
this.delegate = delegate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@
import java.util.Objects;
import java.util.Optional;

import com.github.mcollovati.vertx.support.BufferInputStreamAdapter;
import com.github.mcollovati.vertx.vaadin.communication.RequestHandlerReplacements;
import com.github.mcollovati.vertx.vaadin.communication.VertxIndexHtmlRequestHandler;
import io.vertx.core.Context;
import io.vertx.core.Vertx;
import io.vertx.core.file.FileSystem;
import io.vertx.core.file.impl.FileResolverImpl;
import io.vertx.core.http.impl.MimeMapping;
import io.vertx.core.impl.VertxInternal;
import io.vertx.core.spi.file.FileResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vaadin.flow.di.Instantiator;
import com.vaadin.flow.function.DeploymentConfiguration;
import com.vaadin.flow.internal.DevModeHandler;
import com.vaadin.flow.internal.DevModeHandlerManager;
Expand All @@ -44,23 +58,9 @@
import com.vaadin.flow.server.VaadinService;
import com.vaadin.flow.server.VaadinSession;
import com.vaadin.flow.server.communication.FaviconHandler;
import com.vaadin.flow.server.communication.IndexHtmlRequestHandler;
import com.vaadin.flow.server.communication.WebComponentProvider;
import com.vaadin.flow.server.startup.ApplicationRouteRegistry;
import com.vaadin.flow.shared.ApplicationConstants;
import io.vertx.core.Context;
import io.vertx.core.Vertx;
import io.vertx.core.file.FileSystem;
import io.vertx.core.file.impl.FileResolverImpl;
import io.vertx.core.http.impl.MimeMapping;
import io.vertx.core.impl.VertxInternal;
import io.vertx.core.spi.file.FileResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.mcollovati.vertx.support.BufferInputStreamAdapter;
import com.github.mcollovati.vertx.vaadin.communication.RequestHandlerReplacements;
import com.github.mcollovati.vertx.vaadin.communication.VertxIndexHtmlRequestHandler;

/**
* Created by marco on 16/07/16.
Expand Down Expand Up @@ -110,12 +110,10 @@ protected PwaRegistry getPwaRegistry() {
return PwaRegistry.getInstance(vertxVaadin.servletContext());
}

/*
@Override
protected Instantiator createInstantiator() throws ServiceException {
return new VertxVaadinInstantiator(super.createInstantiator());
}
*/

@Override
protected List<RequestHandler> createRequestHandlers() throws ServiceException {
Expand Down
Loading
Loading