diff --git a/README.md b/README.md index e3d45ab1..add32ce7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | | Chromium 89.0.4344.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| WebKit 14.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| WebKit 14.1 | ✅ | ✅ | ✅ | | Firefox 84.0b9 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/#?path=docs/intro.md&q=system-requirements) for details. diff --git a/pom.xml b/pom.xml index e15dd9d7..29654784 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,6 @@ - api-generator driver driver-bundle playwright diff --git a/scripts/generate_api.sh b/scripts/generate_api.sh index cfb13fee..d9748cc3 100755 --- a/scripts/generate_api.sh +++ b/scripts/generate_api.sh @@ -9,9 +9,9 @@ cd "$(dirname $0)/.." PLAYWRIGHT_CLI=./driver-bundle/src/main/resources/driver/linux/playwright-cli echo "Updating api.json from $($PLAYWRIGHT_CLI --version)" -$PLAYWRIGHT_CLI print-api-json > ./api-generator/src/main/resources/api.json +$PLAYWRIGHT_CLI print-api-json > ./tools/api-generator/src/main/resources/api.json -mvn compile -projects api-generator --no-transfer-progress +mvn compile -f ./tools/api-generator --no-transfer-progress echo "Regenerating Java interfaces" -mvn exec:java --projects api-generator -Dexec.mainClass=com.microsoft.playwright.tools.ApiGenerator +mvn exec:java --f ./tools/api-generator -Dexec.mainClass=com.microsoft.playwright.tools.ApiGenerator diff --git a/scripts/set_maven_version.sh b/scripts/set_maven_version.sh new file mode 100755 index 00000000..726a7e9f --- /dev/null +++ b/scripts/set_maven_version.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e +set +x + +if [[ $# == 0 ]]; then + echo "Missing version parameter." + echo "Usage:" + echo " $(basename $0) 0.170.3-SNAPSHOT" + exit 1 +fi + +trap "cd $(pwd -P)" EXIT +cd "$(dirname $0)/.." + +VERSION=$1 + +mvn versions:set -DnewVersion=$VERSION + +cd tools/api-generator +mvn versions:set -DnewVersion=$VERSION + +cd - +cd tools/update-docs-version +mvn versions:set -DnewVersion=$VERSION diff --git a/scripts/update_api.sh b/scripts/update_api.sh new file mode 100755 index 00000000..183251ba --- /dev/null +++ b/scripts/update_api.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e +set +x + +trap "cd $(pwd -P)" EXIT + +cd "$(dirname $0)/.." + +./scripts/generate_api.sh + +# Built from source and do local install. +mvn clean install --no-transfer-progress -DskipTests + +echo "Updating browser versions in README.md" +mvn exec:java --f ./tools/update-docs-version -Dexec.mainClass=com.microsoft.playwright.tools.UpdateBrowserVersions diff --git a/api-generator/pom.xml b/tools/api-generator/pom.xml similarity index 51% rename from api-generator/pom.xml rename to tools/api-generator/pom.xml index e5417a6f..40b8c10b 100644 --- a/api-generator/pom.xml +++ b/tools/api-generator/pom.xml @@ -4,47 +4,30 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - com.microsoft.playwright - parent-pom - 0.170.3-SNAPSHOT - - + com.microsoft.playwright api-generator + 0.170.3-SNAPSHOT Playwright - API Generator - Java library to automate Chromium, Firefox and WebKit with a single API. - Playwright is built to enable cross-browser web automation that is ever-green, capable, - reliable and fast. - + This is an internal module used to generate Java API from the upstream Playwright definitions. It's an internal development module not intended for external use. + + 1.8 + 2.8.6 + UTF-8 + - - org.apache.maven.plugins - maven-source-plugin - - - org.apache.maven.plugins - maven-javadoc-plugin - - 8 - false - - - - attach-javadocs - - jar - - - - org.apache.maven.plugins maven-compiler-plugin + 3.1 + + ${compiler.version} + ${compiler.version} + @@ -52,6 +35,7 @@ com.google.code.gson gson + ${gson.version} diff --git a/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java similarity index 99% rename from api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java rename to tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java index caa0ba72..2885cc73 100644 --- a/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java +++ b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java @@ -1202,7 +1202,7 @@ public class ApiGenerator { public static void main(String[] args) throws IOException { File cwd = FileSystems.getDefault().getPath(".").toFile(); System.out.println(cwd.getCanonicalPath()); - File file = new File(cwd, "api-generator/src/main/resources/api.json"); + File file = new File(cwd, "tools/api-generator/src/main/resources/api.json"); System.out.println("Reading from: " + file.getCanonicalPath()); new ApiGenerator(new FileReader(file)); } diff --git a/api-generator/src/main/java/com/microsoft/playwright/tools/Types.java b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/Types.java similarity index 100% rename from api-generator/src/main/java/com/microsoft/playwright/tools/Types.java rename to tools/api-generator/src/main/java/com/microsoft/playwright/tools/Types.java diff --git a/api-generator/src/main/resources/.gitignore b/tools/api-generator/src/main/resources/.gitignore similarity index 100% rename from api-generator/src/main/resources/.gitignore rename to tools/api-generator/src/main/resources/.gitignore diff --git a/tools/update-docs-version/pom.xml b/tools/update-docs-version/pom.xml new file mode 100644 index 00000000..fb560212 --- /dev/null +++ b/tools/update-docs-version/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + com.microsoft.playwright + update-version + 0.170.3-SNAPSHOT + Playwright - Update Version in Documentation + + This is an internal module used to update versions in the documentation based on + current driver. + + + 1.8 + 2.8.6 + UTF-8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${compiler.version} + ${compiler.version} + + + + + + + com.microsoft.playwright + playwright + ${project.version} + + + diff --git a/tools/update-docs-version/src/main/java/com/microsoft/playwright/tools/UpdateBrowserVersions.java b/tools/update-docs-version/src/main/java/com/microsoft/playwright/tools/UpdateBrowserVersions.java new file mode 100644 index 00000000..3cd8217c --- /dev/null +++ b/tools/update-docs-version/src/main/java/com/microsoft/playwright/tools/UpdateBrowserVersions.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.microsoft.playwright.tools; + +import com.microsoft.playwright.Browser; +import com.microsoft.playwright.BrowserType; +import com.microsoft.playwright.Playwright; + +import java.io.FileWriter; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; + +import static java.nio.charset.StandardCharsets.UTF_8; + +public class UpdateBrowserVersions { + public static void main(String[] args) throws Exception { + Path path = Paths.get("README.md"); + String readme = new String(Files.readAllBytes(path), UTF_8); + + Playwright playwright = Playwright.create(); + List browserTypes = Arrays.asList( + playwright.chromium(), + playwright.webkit(), + playwright.firefox() + ); + for (BrowserType browserType : browserTypes) { + Browser browser = browserType.launch(); + String version = browser.version(); + browser.close(); + readme = readme.replaceAll( + "([^<]+)", + "" + version + ""); + try (FileWriter writer = new FileWriter(path.toFile())) { + writer.write(readme); + } + } + playwright.close(); + } +}