You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/04/26 09:01:18 UTC
(logging-log4j2) 01/02: Refactor the `java8-tests` profile
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch features/2.x/mac-java17-only
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit c29d83e92cb435f3a097070abee2dea3ea70c438
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Fri Apr 26 10:27:27 2024 +0200
Refactor the `java8-tests` profile
The `java8-tests` profile is moved to `log4j-parent` and is activated by
a GitHub specific property that guarantees that JDK 8 is available. This
only happens if the architecture is `x64`.
The corrections necessary to run the tests on JDK 17 are moved to
`jvm.config`.
---
.mvn/jvm.config | 4 ++++
log4j-1.2-api/pom.xml | 39 ---------------------------------------
log4j-core-test/pom.xml | 26 ++------------------------
log4j-jpa/pom.xml | 39 ---------------------------------------
log4j-osgi-test/pom.xml | 39 ---------------------------------------
log4j-parent/pom.xml | 44 ++++++++++++++++++++++++++++++++++++++++++++
pom.xml | 44 --------------------------------------------
7 files changed, 50 insertions(+), 185 deletions(-)
diff --git a/.mvn/jvm.config b/.mvn/jvm.config
index f3b9f7db5d..98f9aaaafd 100644
--- a/.mvn/jvm.config
+++ b/.mvn/jvm.config
@@ -8,4 +8,8 @@
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
+--add-opens java.base/java.io=ALL-UNNAMED
+--add-opens java.base/java.lang=ALL-UNNAMED
+--add-opens java.base/java.net=ALL-UNNAMED
+--add-opens java.base/java.util=ALL-UNNAMED
-Dfile.encoding=UTF-8
diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml
index b9f286d49a..54b2ce0a8c 100644
--- a/log4j-1.2-api/pom.xml
+++ b/log4j-1.2-api/pom.xml
@@ -142,43 +142,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <profiles>
-
- <!-- Fixes incompatible with Java 8 -->
- <profile>
-
- <id>java8-incompat-fixes</id>
-
- <!-- CI uses Java 8 for running tests.
- Hence, we assume CI=Java8 and apply our changes elsewhere.
-
- One might think why not activate using `<jdk>[16,)` instead?
- This doesn't work, since the match is not against "the JDK running tests", but "the JDK running Maven".
- These two JDKs can differ due to Maven Toolchains.
- See `java8-tests` profile in `/pom.xml` for details. -->
- <activation>
- <property>
- <name>!env.CI</name>
- </property>
- </activation>
-
- <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
- We are relaxing it for tests. -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>--add-opens java.base/java.io=ALL-UNNAMED</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- </profile>
-
- </profiles>
-
</project>
diff --git a/log4j-core-test/pom.xml b/log4j-core-test/pom.xml
index f005dc8a95..defe32ed0e 100644
--- a/log4j-core-test/pom.xml
+++ b/log4j-core-test/pom.xml
@@ -385,16 +385,10 @@
<id>java8-incompat-fixes</id>
- <!-- CI uses Java 8 for running tests.
- Hence, we assume CI=Java8 and apply our changes elsewhere.
-
- One might think why not activate using `<jdk>[16,)` instead?
- This doesn't work, since the match is not against "the JDK running tests", but "the JDK running Maven".
- These two JDKs can differ due to Maven Toolchains.
- See `java8-tests` profile in `/pom.xml` for details. -->
+ <!-- If this variable is present the `java8-tests` profile is active -->
<activation>
<property>
- <name>!env.CI</name>
+ <name>!env.JAVA_HOME_8_X64</name>
</property>
</activation>
@@ -408,22 +402,6 @@
</dependency>
</dependencies>
- <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
- We are relaxing it for tests. -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>--add-opens java.base/java.lang=ALL-UNNAMED
- --add-opens java.base/java.net=ALL-UNNAMED
- --add-opens java.base/java.util=ALL-UNNAMED</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
</profile>
<!--
diff --git a/log4j-jpa/pom.xml b/log4j-jpa/pom.xml
index b2c873b12a..6ad186103d 100644
--- a/log4j-jpa/pom.xml
+++ b/log4j-jpa/pom.xml
@@ -96,43 +96,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <profiles>
-
- <!-- Fixes incompatible with Java 8 -->
- <profile>
-
- <id>java8-incompat-fixes</id>
-
- <!-- CI uses Java 8 for running tests.
- Hence, we assume CI=Java8 and apply our changes elsewhere.
-
- One might think why not activate using `<jdk>[16,)` instead?
- This doesn't work, since the match is not against "the JDK running tests", but "the JDK running Maven".
- These two JDKs can differ due to Maven Toolchains.
- See `java8-tests` profile in `/pom.xml` for details. -->
- <activation>
- <property>
- <name>!env.CI</name>
- </property>
- </activation>
-
- <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
- We are relaxing it for tests. -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- </profile>
-
- </profiles>
-
</project>
diff --git a/log4j-osgi-test/pom.xml b/log4j-osgi-test/pom.xml
index 19dcd37e65..97eebe5db3 100644
--- a/log4j-osgi-test/pom.xml
+++ b/log4j-osgi-test/pom.xml
@@ -225,43 +225,4 @@
</plugins>
</build>
-
- <profiles>
-
- <!-- Fixes incompatible with Java 8 -->
- <profile>
-
- <id>java8-incompat-fixes</id>
-
- <!-- CI uses Java 8 for running tests.
- Hence, we assume CI=Java8 and apply our changes elsewhere.
-
- One might think why not activate using `<jdk>[16,)` instead?
- This doesn't work, since the match is not against "the JDK running tests", but "the JDK running Maven".
- These two JDKs can differ due to Maven Toolchains.
- See `java8-tests` profile in `/pom.xml` for details. -->
- <activation>
- <property>
- <name>!env.CI</name>
- </property>
- </activation>
-
- <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
- We are relaxing it for tests. -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>--add-opens java.base/java.net=ALL-UNNAMED</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- </profile>
-
- </profiles>
-
</project>
diff --git a/log4j-parent/pom.xml b/log4j-parent/pom.xml
index 45f79523ac..e8f89c07e3 100644
--- a/log4j-parent/pom.xml
+++ b/log4j-parent/pom.xml
@@ -1248,6 +1248,50 @@
</profile>
+ <profile>
+ <id>java8-tests</id>
+ <activation>
+ <!-- This variable is present in the CI if JDK8 is available -->
+ <property>
+ <name>env.JAVA_HOME_8_X64</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <!-- Modifies only the `default-test` run -->
+ <execution>
+ <id>default-test</id>
+ <configuration>
+ <jdkToolchain>
+ <version>[1.8, 9)</version>
+ </jdkToolchain>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>sequential-tests</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkCount>1</forkCount>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
diff --git a/pom.xml b/pom.xml
index a70186b600..35f215e046 100644
--- a/pom.xml
+++ b/pom.xml
@@ -858,50 +858,6 @@
<profiles>
- <profile>
- <id>java8-tests</id>
- <activation>
- <property>
- <name>env.CI</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <!-- Modifies only the `default-test` run -->
- <execution>
- <id>default-test</id>
- <configuration>
- <jdkToolchain>
- <version>[1.8, 9)</version>
- </jdkToolchain>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>sequential-tests</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkCount>1</forkCount>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
<profile>
<id>rewrite</id>