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

refactor: refactored extension module #28

Merged
merged 11 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from 10 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
12 changes: 6 additions & 6 deletions code-with-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.acme</groupId>
<artifactId>code-with-quarkus</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>com.github.mcollovati</groupId>
<artifactId>quarkus-hilla-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.10.1</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>
Expand Down Expand Up @@ -39,9 +39,9 @@
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.acme</groupId>
<artifactId>hilla-test-extension</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>com.github.mcollovati</groupId>
<artifactId>quarkus-hilla</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
8 changes: 4 additions & 4 deletions hilla-jandex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.mcollovati.hilla</groupId>
<groupId>com.github.mcollovati</groupId>
<artifactId>hilla-jandex</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Hilla Jandex index</name>
<name>Hilla - Jandex</name>
<description>Jandex index for Hilla packages</description>

<properties>
Expand Down Expand Up @@ -53,9 +53,9 @@
<artifactId>engine-runtime</artifactId>
</dependency>
<dependency>
<groupId>com.github.mcollovati.hilla</groupId>
<groupId>com.github.mcollovati</groupId>
<artifactId>hilla-shaded-deps</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
</dependencies>

Expand Down
14 changes: 9 additions & 5 deletions hilla-shaded-deps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.mcollovati.hilla</groupId>
<groupId>com.github.mcollovati</groupId>
<artifactId>hilla-shaded-deps</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Hilla shaded dependencies</name>
<description>Minimal set of classes required by Hilla at runtime</description>
<name>Hilla - Shaded dependencies</name>
<description>Minimal set of Spring classes required by Hilla at runtime</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -66,7 +66,9 @@
<include>org/springframework/core/io/InputStreamSource.class</include>
<include>org/springframework/core/io/Resource.class</include>
<include>org/springframework/core/io/ResourceLoader.class</include>
<include>org/springframework/core/io/support/ResourcePatternResolver.class</include>
<include>
org/springframework/core/io/support/ResourcePatternResolver.class
</include>
<include>org/springframework/util/Assert.class</include>
<include>org/springframework/util/ClassUtils.class</include>
<include>org/springframework/util/CollectionUtils.class</include>
Expand Down Expand Up @@ -102,7 +104,9 @@
<include>org/springframework/beans/factory/*Exception.class</include>
<include>org/springframework/beans/factory/*Factory.class</include>
<include>org/springframework/beans/factory/ObjectProvider.class</include>
<include>org/springframework/beans/factory/config/AutowireCapableBeanFactory.class</include>
<include>
org/springframework/beans/factory/config/AutowireCapableBeanFactory.class
</include>
</includes>
</filter>
</filters>
Expand Down
4 changes: 4 additions & 0 deletions hilla-test-extension/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ node_modules/
frontend/generated/
pnpmfile.js
vite.generated.ts
deployment/package*.json
deployment/vite*.ts
deployment/tsconfig.json
deployment/types.d.ts

# Browser drivers for local integration tests
drivers/
Expand Down
54 changes: 54 additions & 0 deletions hilla-test-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Quarkus - Hilla

A [Quarkus](https://quarkus.io) extension to run [Hilla](https://hilla.dev)
applications on Quarkus.

Hilla is an open source framework, provided
by [Vaadin Ltd.](https://vaadin.com),
that integrates a Spring Boot Java backend with a reactive TypeScript frontend.

This extension replaces the Spring Boot backend with Quarkus Context &
Dependency Injection (CDI) and
RESTEasy Reactive for a simpler integration with Quarkus, but preserves the
main features of the Hilla Framework, such
as [Endpoints](https://hilla.dev/docs/lit/guides/endpoints),
[Reactive Endpoints](https://hilla.dev/docs/lit/guides/reactive-endpoints)
and [Security](https://hilla.dev/docs/lit/guides/security).

**NOTE**: This is an **unofficial community extension**, and it is not directly
Dudeplayz marked this conversation as resolved.
Show resolved Hide resolved
related nor supported by Vaadin Ltd.

## Limitations

The current Hilla support has some known limitations:

* The endpoint prefix is not configurable
* [Stateless Authentication](https://hilla.dev/docs/lit/guides/security/spring-stateless)
is not supported
Dudeplayz marked this conversation as resolved.
Show resolved Hide resolved
* Native image compilation does not work
Dudeplayz marked this conversation as resolved.
Show resolved Hide resolved

## Contributors ✨

Thanks goes to these wonderful
people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Dudeplayz marked this conversation as resolved.
Show resolved Hide resolved

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mcollovati"><img src="https://avatars.githubusercontent.com/u/4648894?s=100" width="100px;" alt="Marco Collovati"/><br /><sub><b>Marco Collovati</b></sub></a><br /><a href="https://github.com/mcollovati/quarkus-hilla/commits?author=mcollovati" title="Code">💻</a> <a href="#maintenance-mcollovati" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Dudeplayz"><img src="https://avatars.githubusercontent.com/u/15174076?v=4?s=100" width="100px;" alt="Dario Götze"/><br /><sub><b>Dario Götze</b></sub></a><br /><a href="https://github.com/mcollovati/quarkus-hilla/commits?author=Dudeplayz" title="Code">💻</a> <a href="#maintenance-Dudeplayz" title="Maintenance">🚧</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows
the [all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind are welcome!
187 changes: 100 additions & 87 deletions hilla-test-extension/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -1,89 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.acme</groupId>
<artifactId>hilla-test-extension-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>hilla-test-extension-deployment</artifactId>
<name>Hilla Test Extension - Deployment</name>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-quarkus-deployment</artifactId>
<version>${vaadin-quarkus.version}</version>
<exclusions>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-servlet-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.acme</groupId>
<artifactId>hilla-test-extension</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security-test-utils</artifactId>
<scope>test</scope>
<version>${quarkus.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.mcollovati</groupId>
<artifactId>quarkus-hilla-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>quarkus-hilla-deployment</artifactId>
<name>Quarkus - Hilla - Deployment</name>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-quarkus-deployment</artifactId>
<version>${vaadin-quarkus.version}</version>
<exclusions>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-servlet-deployment</artifactId>
</dependency>
<dependency>
<groupId>com.github.mcollovati</groupId>
<artifactId>quarkus-hilla</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
Dudeplayz marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security-test-utils</artifactId>
<scope>test</scope>
<version>${quarkus.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<vaadin.frontend.frontend.folder>${project.build.directory}/frontend
</vaadin.frontend.frontend.folder>
<vaadin.project.frontend.generated>${project.build.directory}/frontend/generated
</vaadin.project.frontend.generated>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.acme.hilla.test.extension.deployment;
package com.github.mcollovati.quarkus.hilla.deployment;

import javax.annotation.security.DenyAll;
import javax.annotation.security.PermitAll;
Expand All @@ -8,6 +8,13 @@
import java.util.Set;
import java.util.function.Predicate;

import com.github.mcollovati.quarkus.hilla.HillaFormAuthenticationMechanism;
import com.github.mcollovati.quarkus.hilla.HillaSecurityPolicy;
import com.github.mcollovati.quarkus.hilla.HillaSecurityRecorder;
import com.github.mcollovati.quarkus.hilla.QuarkusEndpointConfiguration;
import com.github.mcollovati.quarkus.hilla.QuarkusEndpointProperties;
import com.github.mcollovati.quarkus.hilla.deployment.asm.EndpointTransferMapperClassVisitor;
import com.github.mcollovati.quarkus.hilla.deployment.asm.PushEndpointClassVisitor;
import dev.hilla.Endpoint;
import dev.hilla.EndpointInvoker;
import dev.hilla.EndpointRegistry;
Expand Down Expand Up @@ -39,17 +46,10 @@
import io.quarkus.undertow.deployment.ServletBuildItem;
import io.quarkus.vertx.http.runtime.HttpBuildTimeConfig;
import io.quarkus.vertx.http.runtime.security.HttpAuthenticationMechanism;
import org.acme.hilla.test.extension.HillaAtmosphereObjectFactory;
import org.acme.hilla.test.extension.HillaFormAuthenticationMechanism;
import org.acme.hilla.test.extension.HillaSecurityPolicy;
import org.acme.hilla.test.extension.HillaSecurityRecorder;
import org.acme.hilla.test.extension.QuarkusEndpointConfiguration;
import org.acme.hilla.test.extension.QuarkusEndpointController;
import org.acme.hilla.test.extension.QuarkusEndpointProperties;
import org.acme.hilla.test.extension.QuarkusViewAccessChecker;
import org.acme.hilla.test.extension.deployment.asm.EndpointTransferMapperClassVisitor;
import org.acme.hilla.test.extension.deployment.asm.PushEndpointClassVisitor;
import org.acme.hilla.test.extension.deployment.asm.SpringReplacementsClassVisitor;
import com.github.mcollovati.quarkus.hilla.HillaAtmosphereObjectFactory;
import com.github.mcollovati.quarkus.hilla.QuarkusEndpointController;
import com.github.mcollovati.quarkus.hilla.QuarkusViewAccessChecker;
import com.github.mcollovati.quarkus.hilla.deployment.asm.SpringReplacementsClassVisitor;
import org.atmosphere.client.TrackMessageSizeInterceptor;
import org.atmosphere.cpr.ApplicationConfig;
import org.atmosphere.cpr.AtmosphereServlet;
Expand Down Expand Up @@ -103,7 +103,7 @@ void registerBeans(BuildProducer<AdditionalBeanBuildItem> beans) {
beans.produce(
new AdditionalBeanBuildItem(QuarkusEndpointProperties.class));
beans.produce(AdditionalBeanBuildItem.builder().addBeanClasses(
"org.acme.hilla.test.extension.QuarkusEndpointControllerConfiguration")
"com.github.mcollovati.quarkus.hilla.QuarkusEndpointControllerConfiguration")
.addBeanClasses(QuarkusEndpointConfiguration.class,
QuarkusEndpointController.class)
.setDefaultScope(BuiltinScope.SINGLETON.getName())
Expand Down
Loading