From d25348e6e5866bd51f24da6f9507c7689732bf9c Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 12 Oct 2023 09:21:08 +0200 Subject: [PATCH 1/3] Use Quarkus Playwright --- .github/workflows/build.yml | 2 +- integration-tests/pom.xml | 6 +++--- .../test/java/io/quarkiverse/web/bundler/it/WebTest.java | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29d6118..030ac55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: fail-fast: false matrix: # os: [windows-latest, macos-latest, ubuntu-latest] - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Prepare git diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 954ad93..3da673b 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -58,9 +58,9 @@ test - io.quarkiverse.quinoa - quarkus-quinoa-testing - 2.1.0 + io.quarkiverse.playwright + quarkus-playwright + 0.0.1 test diff --git a/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java b/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java index c003654..40e26d9 100644 --- a/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java +++ b/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java @@ -4,6 +4,8 @@ import java.net.URL; +import io.quarkiverse.playwright.InjectPlaywright; +import io.quarkiverse.playwright.WithPlaywright; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -12,15 +14,13 @@ import com.microsoft.playwright.Response; import com.microsoft.playwright.assertions.PlaywrightAssertions; -import io.quarkiverse.quinoa.testing.QuarkusPlaywrightManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(QuarkusPlaywrightManager.class) +@WithPlaywright public class WebTest { - @QuarkusPlaywrightManager.InjectPlaywright + @InjectPlaywright BrowserContext context; @TestHTTPResource("/") From 250bf4bed6704018695bb6434043dafbd89c35eb Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 12 Oct 2023 09:58:28 +0200 Subject: [PATCH 2/3] Block web deps on dev too --- .../web/bundler/deployment/WebBundlerProcessor.java | 3 +-- .../src/test/java/io/quarkiverse/web/bundler/it/WebTest.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java index 367617b..e6a28db 100644 --- a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java @@ -58,7 +58,6 @@ import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.builder.BuildException; -import io.quarkus.deployment.IsNormal; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.Record; @@ -372,7 +371,7 @@ void initBundler( additionalBeans.produce(new AdditionalBeanBuildItem(Bundle.class)); } - @BuildStep(onlyIf = IsNormal.class) + @BuildStep @Record(STATIC_INIT) void webDepBlocker(WebBundlerConfig config, BuildProducer routes, WebDependenciesBlockerRecorder recorder) { if (!config.dependencies().serve()) { diff --git a/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java b/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java index 40e26d9..fccafbf 100644 --- a/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java +++ b/integration-tests/src/test/java/io/quarkiverse/web/bundler/it/WebTest.java @@ -4,8 +4,6 @@ import java.net.URL; -import io.quarkiverse.playwright.InjectPlaywright; -import io.quarkiverse.playwright.WithPlaywright; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -14,6 +12,8 @@ import com.microsoft.playwright.Response; import com.microsoft.playwright.assertions.PlaywrightAssertions; +import io.quarkiverse.playwright.InjectPlaywright; +import io.quarkiverse.playwright.WithPlaywright; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; From c2f3dee857b3c301b664b294259ebdb2eafe6c1e Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 12 Oct 2023 10:00:08 +0200 Subject: [PATCH 3/3] Update esbuild-java --- .github/workflows/build.yml | 3 ++- .../bundler/deployment/ProjectResourcesScanner.java | 11 ++++++----- .../bundler/deployment/WebAssetsScannerProcessor.java | 2 +- .../web/bundler/deployment/WebBundlerConfig.java | 4 ++-- .../web/bundler/deployment/WebBundlerProcessor.java | 4 ++-- .../GeneratedStaticResourcesProcessor.java | 8 ++++++++ .../util/{ConfiguredPaths.java => PathUtils.java} | 6 +++++- .../bundler/deployment/util/ConfiguredPathsTest.java | 8 ++++---- pom.xml | 2 +- 9 files changed, 31 insertions(+), 17 deletions(-) rename deployment/src/main/java/io/quarkiverse/web/bundler/deployment/util/{ConfiguredPaths.java => PathUtils.java} (83%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 030ac55..515045f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,4 +56,5 @@ jobs: run: mvn -B clean install -Dno-format - name: Build with Maven (Native) - run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip \ No newline at end of file + run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip + if: ${{ !startsWith(matrix.os, 'windows') }} \ No newline at end of file diff --git a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/ProjectResourcesScanner.java b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/ProjectResourcesScanner.java index 64ca1f5..2d6bd93 100644 --- a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/ProjectResourcesScanner.java +++ b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/ProjectResourcesScanner.java @@ -1,6 +1,7 @@ package io.quarkiverse.web.bundler.deployment; -import java.io.File; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.toUnixPath; + import java.io.IOException; import java.io.UncheckedIOException; import java.nio.charset.Charset; @@ -88,7 +89,7 @@ private void scanProject(Scanner scanner, // a wrong directory bundleName on case-insensitive file systems try { final Path dirPath = rootDir.resolve(scanner.dir()); - if (Files.isDirectory(dirPath) && dirPath.toString().endsWith(scanner.dir())) { + if (Files.isDirectory(dirPath) && toUnixPath(dirPath.toString()).endsWith(scanner.dir())) { scan(rootDir, dirPath, scanner.pathMatcher(), scanner.charset, webAssetConsumer, true); break; } @@ -118,14 +119,14 @@ private void scan( && filePath.getRoot() != null) { filePath = filePath.getRoot().relativize(filePath); } - final Path relativePath = directory.relativize(filePath); + final Path relativePath = toScan.relativize(filePath); final PathMatcher assetsPathMatcher = relativePath.getFileSystem() .getPathMatcher(pathMatcher); final boolean isAsset = assetsPathMatcher.matches(relativePath); if (isAsset) { String assetPath = root.relativize(filePath).normalize().toString(); - if (File.separatorChar != '/') { - assetPath = assetPath.replace(File.separatorChar, '/'); + if (assetPath.contains("\\")) { + assetPath = toUnixPath(assetPath); } if (!assetPath.isEmpty()) { webAssetConsumer.accept(toWebAsset(assetPath, diff --git a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebAssetsScannerProcessor.java b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebAssetsScannerProcessor.java index 9bed5de..7d50848 100644 --- a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebAssetsScannerProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebAssetsScannerProcessor.java @@ -1,6 +1,6 @@ package io.quarkiverse.web.bundler.deployment; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.addTrailingSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.addTrailingSlash; import java.io.IOException; import java.nio.file.Files; diff --git a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerConfig.java b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerConfig.java index 173009e..9edaa55 100644 --- a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerConfig.java +++ b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerConfig.java @@ -1,7 +1,7 @@ package io.quarkiverse.web.bundler.deployment; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.addTrailingSlash; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.removeLeadingSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.addTrailingSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.removeLeadingSlash; import static java.util.function.Predicate.not; import java.nio.charset.Charset; diff --git a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java index e6a28db..fc5f8e0 100644 --- a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/WebBundlerProcessor.java @@ -2,8 +2,8 @@ import static io.quarkiverse.web.bundler.deployment.ProjectResourcesScanner.readTemplateContent; import static io.quarkiverse.web.bundler.deployment.items.BundleWebAsset.BundleType.MANUAL; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.prefixWithSlash; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.surroundWithSlashes; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.prefixWithSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.surroundWithSlashes; import static io.quarkiverse.web.bundler.runtime.qute.WebBundlerQuteContextRecorder.WEB_BUNDLER_ID_PREFIX; import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT; import static java.util.Map.entry; diff --git a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/staticresources/GeneratedStaticResourcesProcessor.java b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/staticresources/GeneratedStaticResourcesProcessor.java index 3553bae..e9646f1 100644 --- a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/staticresources/GeneratedStaticResourcesProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/staticresources/GeneratedStaticResourcesProcessor.java @@ -13,6 +13,8 @@ import java.util.List; import java.util.Set; +import org.jboss.logging.Logger; + import io.quarkus.bootstrap.workspace.ArtifactSources; import io.quarkus.bootstrap.workspace.SourceDir; import io.quarkus.deployment.annotations.BuildProducer; @@ -26,6 +28,7 @@ import io.quarkus.vertx.http.deployment.spi.AdditionalStaticResourceBuildItem; public class GeneratedStaticResourcesProcessor { + private static final Logger LOGGER = Logger.getLogger(GeneratedStaticResourcesProcessor.class); @BuildStep public void processStaticFiles( @@ -106,6 +109,11 @@ public static File getBuildDirectory(CurateOutcomeBuildItem curateOutcomeBuildIt // pick the first resources output dir Path resourcesOutputDir = srcDirs.iterator().next().getOutputDir(); buildDir = resourcesOutputDir.toFile(); + if (srcDirs.size() > 1) { + LOGGER.warnf("Multiple resources directories found, using the first one in the list: %s", + resourcesOutputDir); + } + } } if (buildDir == null) { diff --git a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/util/ConfiguredPaths.java b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/util/PathUtils.java similarity index 83% rename from deployment/src/main/java/io/quarkiverse/web/bundler/deployment/util/ConfiguredPaths.java rename to deployment/src/main/java/io/quarkiverse/web/bundler/deployment/util/PathUtils.java index 33ada57..af0c521 100644 --- a/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/util/ConfiguredPaths.java +++ b/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/util/PathUtils.java @@ -1,6 +1,10 @@ package io.quarkiverse.web.bundler.deployment.util; -public final class ConfiguredPaths { +public final class PathUtils { + + public static String toUnixPath(String path) { + return path.replaceAll("\\\\", "/"); + } public static String prefixWithSlash(String path) { return path.startsWith("/") ? path : "/" + path; diff --git a/deployment/src/test/java/io/quarkiverse/web/bundler/deployment/util/ConfiguredPathsTest.java b/deployment/src/test/java/io/quarkiverse/web/bundler/deployment/util/ConfiguredPathsTest.java index 190d539..0cc24f9 100644 --- a/deployment/src/test/java/io/quarkiverse/web/bundler/deployment/util/ConfiguredPathsTest.java +++ b/deployment/src/test/java/io/quarkiverse/web/bundler/deployment/util/ConfiguredPathsTest.java @@ -1,9 +1,9 @@ package io.quarkiverse.web.bundler.deployment.util; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.addTrailingSlash; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.prefixWithSlash; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.removeLeadingSlash; -import static io.quarkiverse.web.bundler.deployment.util.ConfiguredPaths.removeTrailingSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.addTrailingSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.prefixWithSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.removeLeadingSlash; +import static io.quarkiverse.web.bundler.deployment.util.PathUtils.removeTrailingSlash; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; diff --git a/pom.xml b/pom.xml index 927a89b..918fbbe 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ UTF-8 3.1.3.Final - 1.0.4 + 1.0.5 4.1.1 2.4.8