Skip to content

Commit ecb6901

Browse files
committed
feat(driver-bundle): split driver per platform and auto-select host
Replace the single ~194MB driver-bundle (all platforms) with one artifact per platform: driver-bundle-mac-x64, driver-bundle-mac-arm64, driver-bundle-linux-x64, driver-bundle-linux-arm64 and driver-bundle-win-x64. driver-bundle now ships only DriverJar and uses OS-activated Maven profiles to pull in the matching platform artifact for the build host, so a Maven build resolves just the driver it needs with no extra configuration. driver-bundle-all aggregates every platform for cross-platform fat jars. Fixes: #1196
1 parent ace7a12 commit ecb6901

17 files changed

Lines changed: 377 additions & 47 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ git clone https://github.com/microsoft/playwright-java
2020
cd playwright-java
2121
```
2222

23-
2. Run the following script to download and assemble the Playwright driver for all platforms into `driver-bundle/src/main/resources/driver/` directory (browser binaries for Chromium, Firefox and WebKit will be automatically downloaded later on first Playwright run).
23+
2. Run the following script to download and assemble the Playwright driver for all platforms, one per module, into the `driver-bundle-<platform>/src/main/resources/driver/<platform>/` directories (browser binaries for Chromium, Firefox and WebKit will be automatically downloaded later on first Playwright run).
2424

2525
```bash
2626
scripts/download_driver.sh

driver-bundle-all/pom.xml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.microsoft.playwright</groupId>
8+
<artifactId>parent-pom</artifactId>
9+
<version>1.50.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>driver-bundle-all</artifactId>
13+
<name>Playwright - Drivers For All Platforms</name>
14+
<description>
15+
Aggregates the Playwright driver for every supported platform (macOS, Linux and Windows).
16+
Depend on this artifact when a single build must run on more than the host platform, for
17+
example a cross-platform fat JAR. For the common case where only the host platform is needed,
18+
rely on the transitive driver-bundle dependency, which selects the right platform automatically.
19+
</description>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>com.microsoft.playwright</groupId>
24+
<artifactId>driver-bundle-mac-x64</artifactId>
25+
<version>${project.version}</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>com.microsoft.playwright</groupId>
29+
<artifactId>driver-bundle-mac-arm64</artifactId>
30+
<version>${project.version}</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>com.microsoft.playwright</groupId>
34+
<artifactId>driver-bundle-linux-x64</artifactId>
35+
<version>${project.version}</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>com.microsoft.playwright</groupId>
39+
<artifactId>driver-bundle-linux-arm64</artifactId>
40+
<version>${project.version}</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>com.microsoft.playwright</groupId>
44+
<artifactId>driver-bundle-win-x64</artifactId>
45+
<version>${project.version}</version>
46+
</dependency>
47+
</dependencies>
48+
</project>

driver-bundle-linux-arm64/pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.microsoft.playwright</groupId>
8+
<artifactId>parent-pom</artifactId>
9+
<version>1.50.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>driver-bundle-linux-arm64</artifactId>
13+
<name>Playwright - Driver For Linux arm64</name>
14+
<description>
15+
Playwright driver (Node.js binary and playwright-core package) for the Linux arm64 platform.
16+
This artifact is normally selected automatically for the host platform via the driver-bundle
17+
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
18+
</description>
19+
20+
<build>
21+
<plugins>
22+
<!-- The driver binaries live in src/main/resources and must not be packaged
23+
into the sources JAR (see issue #1913). -->
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-source-plugin</artifactId>
27+
<configuration>
28+
<excludeResources>true</excludeResources>
29+
</configuration>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
driver/
2+
local-driver/

driver-bundle-linux-x64/pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.microsoft.playwright</groupId>
8+
<artifactId>parent-pom</artifactId>
9+
<version>1.50.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>driver-bundle-linux-x64</artifactId>
13+
<name>Playwright - Driver For Linux x64</name>
14+
<description>
15+
Playwright driver (Node.js binary and playwright-core package) for the Linux x64 platform.
16+
This artifact is normally selected automatically for the host platform via the driver-bundle
17+
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
18+
</description>
19+
20+
<build>
21+
<plugins>
22+
<!-- The driver binaries live in src/main/resources and must not be packaged
23+
into the sources JAR (see issue #1913). -->
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-source-plugin</artifactId>
27+
<configuration>
28+
<excludeResources>true</excludeResources>
29+
</configuration>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
driver/
2+
local-driver/

driver-bundle-mac-arm64/pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.microsoft.playwright</groupId>
8+
<artifactId>parent-pom</artifactId>
9+
<version>1.50.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>driver-bundle-mac-arm64</artifactId>
13+
<name>Playwright - Driver For macOS arm64</name>
14+
<description>
15+
Playwright driver (Node.js binary and playwright-core package) for the macOS arm64 platform.
16+
This artifact is normally selected automatically for the host platform via the driver-bundle
17+
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
18+
</description>
19+
20+
<build>
21+
<plugins>
22+
<!-- The driver binaries live in src/main/resources and must not be packaged
23+
into the sources JAR (see issue #1913). -->
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-source-plugin</artifactId>
27+
<configuration>
28+
<excludeResources>true</excludeResources>
29+
</configuration>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
driver/
2+
local-driver/

driver-bundle-mac-x64/pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.microsoft.playwright</groupId>
8+
<artifactId>parent-pom</artifactId>
9+
<version>1.50.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>driver-bundle-mac-x64</artifactId>
13+
<name>Playwright - Driver For macOS x64</name>
14+
<description>
15+
Playwright driver (Node.js binary and playwright-core package) for the macOS x64 platform.
16+
This artifact is normally selected automatically for the host platform via the driver-bundle
17+
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
18+
</description>
19+
20+
<build>
21+
<plugins>
22+
<!-- The driver binaries live in src/main/resources and must not be packaged
23+
into the sources JAR (see issue #1913). -->
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-source-plugin</artifactId>
27+
<configuration>
28+
<excludeResources>true</excludeResources>
29+
</configuration>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
driver/
2+
local-driver/

0 commit comments

Comments
 (0)