Skip to content

Commit

Permalink
Build JavaScript projects in parallel from root POM
Browse files Browse the repository at this point in the history
Closes keycloak#35365

Signed-off-by: Jon Koops <[email protected]>
  • Loading branch information
jonkoops committed Dec 4, 2024
1 parent e488f34 commit 0188871
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 38 deletions.
6 changes: 4 additions & 2 deletions js/apps/account-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
6 changes: 4 additions & 2 deletions js/apps/admin-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
9 changes: 9 additions & 0 deletions js/libs/keycloak-admin-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>pnpm-build</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
<execution>
<id>pnpm-pack</id>
<phase>package</phase>
Expand Down
5 changes: 0 additions & 5 deletions js/libs/keycloak-js/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<!-- Skip execution of build with an empty phase. -->
<id>pnpm-build</id>
<phase/>
</execution>
<execution>
<id>pnpm-pack</id>
<phase>package</phase>
Expand Down
9 changes: 9 additions & 0 deletions js/libs/ui-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>pnpm-build</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
<execution>
<id>pnpm-pack</id>
<phase>package</phase>
Expand Down
12 changes: 11 additions & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
"type": "module",
"packageManager": "[email protected]+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab",
"scripts": {
"prepare": "cd .. && husky js/.husky"
"prepare": "cd .. && husky js/.husky",
"build": "wireit"
},
"wireit": {
"build": {
"dependencies": [
"./apps/account-ui:build",
"./apps/admin-ui:build",
"./themes-vendor:build"
]
}
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
Expand Down
77 changes: 51 additions & 26 deletions js/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,6 @@
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>install-node-and-pnpm</goal>
</goals>
</execution>
<execution>
<id>pnpm-install</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>install --prefer-offline --frozen-lockfile --ignore-scripts</arguments>
<workingDirectory>${maven.multiModuleProjectDirectory}/js</workingDirectory>
</configuration>
</execution>
<execution>
<id>pnpm-build</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
</executions>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<pnpmVersion>${pnpm.version}</pnpmVersion>
Expand All @@ -73,5 +47,56 @@
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<!-- Clean child modules from parent, as we trigger the build here for parallelization. -->
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>apps/account-ui/target</directory>
</fileset>
<fileset>
<directory>apps/admin-ui/target</directory>
</fileset>
<fileset>
<directory>themes-vendor/target</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend.plugin.version}</version>
<inherited>false</inherited>
<executions>
<execution>
<goals>
<goal>install-node-and-pnpm</goal>
</goals>
</execution>
<execution>
<id>pnpm-install</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>install --prefer-offline --frozen-lockfile --ignore-scripts</arguments>
</configuration>
</execution>
<execution>
<id>pnpm-build</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
6 changes: 4 additions & 2 deletions js/themes-vendor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Expand Down

0 comments on commit 0188871

Please sign in to comment.