Skip to content

Commit

Permalink
[build-jre] adding jdk.jdwp.agent for debugging
Browse files Browse the repository at this point in the history
-Added an aLternative jre pom file to build it with jdk.jdwp.agent included, allowing to do remote debugging on it.

- Modified the Makefile to only use this file when a DEV variable is declared on calling make.
(like make <anytarget> DEV=1)
  • Loading branch information
NPavie committed Nov 22, 2023
1 parent e8bb3bd commit 0c0ba12
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -425,25 +425,40 @@ endif
ifeq ($(OS), MACOSX)
-Pbuild-jre-linux -Pbuild-jre-win32 -Pbuild-jre-win64 -Pbuild-jre-mac : src/main/jre/OpenJDK17U-jdk_x64_mac_hotspot_17.0.7_7/jdk-17.0.7+7
ifndef DUMP_PROFILES
rm("target/classes"); \
rm("target/classes");
ifdef DEV
exec(env("JAVA_HOME", "$(CURDIR)/$</Contents/Home"), \
"$(MVN)", "-f", "build-jre-dev.xml", "jlink:jlink", "$@");
else
exec(env("JAVA_HOME", "$(CURDIR)/$</Contents/Home"), \
"$(MVN)", "-f", "build-jre.xml", "jlink:jlink", "$@");
endif # DEV
endif
else ifeq ($(OS), WINDOWS)
-Pbuild-jre-linux -Pbuild-jre-win32 -Pbuild-jre-win64 : src/main/jre/OpenJDK17U-jdk_x64_windows_hotspot_17.0.7_7/jdk-17.0.7+7
ifndef DUMP_PROFILES
rm("target/classes"); \
rm("target/classes");
ifdef DEV
exec(env("JAVA_HOME", "$(CURDIR)/$<"), \
"$(MVN)", "-f", "build-jre-dev.xml", "jlink:jlink", "$@");
else
exec(env("JAVA_HOME", "$(CURDIR)/$<"), \
"$(MVN)", "-f", "build-jre.xml", "jlink:jlink", "$@");
endif
endif
else
-Pbuild-jre-linux -Pbuild-jre-win32 -Pbuild-jre-win64 : src/main/jre/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7/jdk-17.0.7+7
ifndef DUMP_PROFILES
rm("target/classes"); \
rm("target/classes");
ifdef DEV
exec(env("JAVA_HOME", "$(CURDIR)/$<"), \
"$(MVN)", "-f", "build-jre-dev.xml", "jlink:jlink", "$@");
else
exec(env("JAVA_HOME", "$(CURDIR)/$<"), \
"$(MVN)", "-f", "build-jre.xml", "jlink:jlink", "$@");
endif
endif
endif

# for dependencies to jmods
-Pbuild-jre-mac : src/main/jre/OpenJDK17U-jdk_x64_mac_hotspot_17.0.7_7/jdk-17.0.7+7
Expand Down
174 changes: 174 additions & 0 deletions build-jre-dev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>
<parent>
<groupId>org.daisy</groupId>
<artifactId>daisy</artifactId>
<version>5</version>
<relativePath />
</parent>
<groupId>org.daisy.pipeline</groupId>
<artifactId>jre</artifactId>
<version>0.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jlink-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<noHeaderFiles>true</noHeaderFiles>
<noManPages>true</noManPages>
<compress>1</compress>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>build-jre-linux</id>
<!--
this profile needs to be run with JDK 17
-->
<build>
<plugins>
<plugin>
<artifactId>maven-jlink-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id> <!-- run directly from Makefile -->
<goals>
<goal>jlink</goal>
</goals>
<configuration>
<classifier>linux</classifier>
<addModules>
<addModule>java.base</addModule>
<addModule>java.desktop</addModule>
<addModule>java.instrument</addModule>
<addModule>java.security.jgss</addModule>
<addModule>java.scripting</addModule> <!-- for gui -->
<addModule>java.sql</addModule>
<addModule>java.xml</addModule>
<addModule>jdk.management.agent</addModule>
<addModule>jdk.unsupported</addModule> <!-- for gui -->
<addModule>jdk.zipfs</addModule>
<addModule>jdk.jdwp.agent</addModule>
</addModules>
<modulePaths>
<modulePath>src/main/jre/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7/jdk-17.0.7+7/jmods</modulePath>
</modulePaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>build-jre-mac</id>
<!--
this profile needs to be run with JDK 17
-->
<build>
<plugins>
<plugin>
<artifactId>maven-jlink-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id> <!-- run directly from Makefile -->
<configuration>
<classifier>mac</classifier>
<addModules>
<addModule>java.base</addModule>
<addModule>java.desktop</addModule>
<addModule>java.instrument</addModule>
<addModule>java.security.jgss</addModule>
<addModule>java.scripting</addModule> <!-- for gui -->
<addModule>java.sql</addModule>
<addModule>java.xml</addModule>
<addModule>jdk.management.agent</addModule>
<addModule>jdk.unsupported</addModule> <!-- for gui -->
<addModule>jdk.zipfs</addModule>
<addModule>jdk.jdwp.agent</addModule>
</addModules>
<modulePaths>
<modulePath>src/main/jre/OpenJDK17U-jdk_x64_mac_hotspot_17.0.7_7/jdk-17.0.7+7/Contents/Home/jmods</modulePath>
</modulePaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>build-jre-win32</id>
<!--
this profile needs to be run with JDK 17
-->
<build>
<plugins>
<plugin>
<artifactId>maven-jlink-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id> <!-- run directly from Makefile -->
<configuration>
<classifier>win32</classifier>
<addModules>
<addModule>java.base</addModule>
<addModule>java.desktop</addModule>
<addModule>java.instrument</addModule>
<addModule>java.sql</addModule>
<addModule>java.xml</addModule>
<addModule>jdk.management.agent</addModule>
<addModule>jdk.zipfs</addModule>
<addModule>jdk.jdwp.agent</addModule>s
</addModules>
<modulePaths>
<modulePath>src/main/jre/OpenJDK17U-jdk_x86-32_windows_hotspot_17.0.7_7/jdk-17.0.7+7/jmods</modulePath>
</modulePaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>build-jre-win64</id>
<build>
<plugins>
<plugin>
<artifactId>maven-jlink-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id> <!-- run directly from Makefile -->
<configuration>
<classifier>win64</classifier>
<addModules>
<addModule>java.base</addModule>
<addModule>java.desktop</addModule>
<addModule>java.instrument</addModule>
<addModule>java.sql</addModule>
<addModule>java.xml</addModule>
<addModule>jdk.management.agent</addModule>
<addModule>jdk.zipfs</addModule>
<addModule>jdk.jdwp.agent</addModule>
</addModules>
<modulePaths>
<modulePath>src/main/jre/OpenJDK17U-jdk_x64_windows_hotspot_17.0.7_7/jdk-17.0.7+7/jmods</modulePath>
</modulePaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 0c0ba12

Please sign in to comment.