This is an automated email from the ASF dual-hosted git repository.

dsoumis pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new c25d665d97 Improve IntelliJ IDEA support for the FFM code and name the 
SDK after the JDK running Ant.
c25d665d97 is described below

commit c25d665d9791def131804a2e17483fc362d3ce49
Author: Dimitris Soumis <[email protected]>
AuthorDate: Mon Nov 9 12:35:10 2026 +0200

    Improve IntelliJ IDEA support for the FFM code and name the SDK after the 
JDK running Ant.
---
 build.xml                           | 35 ++++++++++++++++++++++++++-------
 res/ide-support/idea/misc.xml       |  5 ++++-
 res/ide-support/idea/modules.xml    |  1 +
 res/ide-support/idea/tomcat-ffm.iml | 39 +++++++++++++++++++++++++++++++++++++
 res/ide-support/idea/tomcat.iml     | 16 ++++++++-------
 5 files changed, 81 insertions(+), 15 deletions(-)

diff --git a/build.xml b/build.xml
index 0fb81c5066..b1aed424b9 100644
--- a/build.xml
+++ b/build.xml
@@ -307,6 +307,7 @@
     <filter token="GIT_BRANCH" value="${git.branch}"/>
     <filter token="MIN_JAVA_VERSION" value="${min.java.version}"/>
     <filter token="BUILD_JAVA_VERSION" value="${build.java.version}"/>
+    <filter token="RELEASE_JAVA_VERSION" value="${release.java.version}"/>
     <filter token="ANT_VERSION_REQUIRED" value="${ant.version.required}"/>
     <filter token="SERVLET_SPEC_VERSION" value="${servlet.spec.version}"/>
     <filter token="JSP_SPEC_VERSION" value="${jsp.spec.version}"/>
@@ -4370,22 +4371,42 @@ Read the Building page on the Apache Tomcat 
documentation site for details on ho
           description="Creates project directory .idea for IntelliJ IDEA">
 
     <copy todir="${tomcat.home}/.idea" overwrite="true">
-      <fileset dir="${tomcat.home}/res/ide-support/idea"/>
+      <fileset dir="${tomcat.home}/res/ide-support/idea">
+        <exclude name="tomcat-ffm.iml" unless:set="has-ffm"/>
+      </fileset>
       <filterset refid="classpath.filters"/>
       <filterset refid="version.filters"/>
+      <filterset>
+        <!-- The SDK is named after the Java version this runs on, as the 
build compiles with that JDK -->
+        <filter token="ANT_JAVA_VERSION" value="${ant.java.version}"/>
+      </filterset>
+      <filterchain>
+        <!-- As for the build, the code that uses the FFM API is only included 
when this runs on a Java version
+             that supports it. It then belongs to the tomcat-ffm module rather 
than being excluded. -->
+        <linecontains negate="true" if:set="has-ffm">
+          <contains value="IDEA-FFM-EXCLUDE"/>
+        </linecontains>
+        <linecontains negate="true" unless:set="has-ffm">
+          <contains value="IDEA-FFM-MODULE"/>
+        </linecontains>
+      </filterchain>
     </copy>
 
     <mkdir dir="${tomcat.home}/lib"/>
 
     <echo>IntelliJ IDEA project directory created.
 
-The SDK was set to &quot;${build.java.version}&quot; so make sure that your 
IDE has an SDK with that name,
+The SDK was set to &quot;${ant.java.version}&quot;, the Java version that ran 
this build.
+Make sure that your IDE has an SDK with that name,
 or update the Project Settings accordingly. Choose [File &gt; Project 
Structure] to open the settings dialog
-and set the SDK level, language level, etc. as needed.
-
-Some folders have been excluded by default as they require the latest SDK 
version and enabling of preview
-features. You can remove or comment out the exclusions to enable the 
directories in the .idea/tomcat.iml
-file, or via the IDEA UI by right-clicking folders, and choosing [Mark 
Directory as &gt; Cancel Exclusion]</echo>
+and set the SDK level, language level, etc. as needed.</echo>
+    <echo if:set="has-ffm">
+The code that uses the FFM API is in a separate module, tomcat-ffm. Its 
language level follows
+the SDK, while the build compiles that code for Java ${release.java.version}. 
The rest of the project
+does not depend on that module.</echo>
+    <echo unless:set="has-ffm">
+The code that uses the FFM API has been excluded as it requires Java 
${release.java.version} or later.
+Run ant ide-intellij with Java ${release.java.version} or later to include it 
in a separate module, tomcat-ffm.</echo>
   </target>
 
   <!-- ============================ NetBeans =============================== 
-->
diff --git a/res/ide-support/idea/misc.xml b/res/ide-support/idea/misc.xml
index 0f6a7a25c6..d45ce16e53 100644
--- a/res/ide-support/idea/misc.xml
+++ b/res/ide-support/idea/misc.xml
@@ -15,8 +15,11 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+<!-- The SDK is named after the Java version ant ide-intellij ran on, as the 
build compiles with that JDK. The
+     project language level is the SDK default, which the tomcat-ffm module 
uses. The tomcat module sets its own
+     level, the minimum Java version to build Tomcat. !-->
 <project version="4">
-  <component name="ProjectRootManager" version="2" 
languageLevel="JDK_@BUILD_JAVA_VERSION@" default="false" 
project-jdk-name="@BUILD_JAVA_VERSION@" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" 
languageLevel="JDK_@BUILD_JAVA_VERSION@" default="true" 
project-jdk-name="@ANT_JAVA_VERSION@" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/.idea/output" />
   </component>
 </project>
\ No newline at end of file
diff --git a/res/ide-support/idea/modules.xml b/res/ide-support/idea/modules.xml
index 03c9e26914..d001f58441 100644
--- a/res/ide-support/idea/modules.xml
+++ b/res/ide-support/idea/modules.xml
@@ -19,6 +19,7 @@
   <component name="ProjectModuleManager">
     <modules>
       <module fileurl="file://$PROJECT_DIR$/.idea/tomcat.iml" 
filepath="$PROJECT_DIR$/.idea/tomcat.iml" />
+      <module fileurl="file://$PROJECT_DIR$/.idea/tomcat-ffm.iml" 
filepath="$PROJECT_DIR$/.idea/tomcat-ffm.iml" /><!-- IDEA-FFM-MODULE -->
     </modules>
   </component>
 </project>
\ No newline at end of file
diff --git a/res/ide-support/idea/tomcat-ffm.iml 
b/res/ide-support/idea/tomcat-ffm.iml
new file mode 100644
index 0000000000..cef3969923
--- /dev/null
+++ b/res/ide-support/idea/tomcat-ffm.iml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<!-- The code that uses the FFM API. It needs Java @RELEASE_JAVA_VERSION@ or 
later, unlike the rest of Tomcat, so it is
+     a module of its own. It uses the project SDK and the project language 
level, which follows the SDK. The build
+     compiles this code for Java @RELEASE_JAVA_VERSION@, so code that needs a 
later version is accepted here but
+     fails the build. Its content roots are nested in the java folder of the 
tomcat module, which gives this module
+     those directories. ant ide-intellij only adds this module when it runs on 
Java @RELEASE_JAVA_VERSION@ or
+     later. !-->
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content 
url="file://$MODULE_DIR$/java/org/apache/tomcat/util/net/openssl/panama">
+      <sourceFolder 
url="file://$MODULE_DIR$/java/org/apache/tomcat/util/net/openssl/panama" 
isTestSource="false"
+          packagePrefix="org.apache.tomcat.util.net.openssl.panama" />
+    </content>
+    <content url="file://$MODULE_DIR$/java/org/apache/tomcat/util/openssl">
+      <sourceFolder 
url="file://$MODULE_DIR$/java/org/apache/tomcat/util/openssl" 
isTestSource="false"
+          packagePrefix="org.apache.tomcat.util.openssl" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="tomcat" />
+  </component>
+</module>
diff --git a/res/ide-support/idea/tomcat.iml b/res/ide-support/idea/tomcat.iml
index fe7d0ef201..42deee13d8 100644
--- a/res/ide-support/idea/tomcat.iml
+++ b/res/ide-support/idea/tomcat.iml
@@ -16,19 +16,21 @@
   limitations under the License.
 -->
 <module type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
+  <!-- The language level is the minimum Java version to build Tomcat, not the 
project level that follows the SDK !-->
+  <component name="NewModuleRootManager" 
LANGUAGE_LEVEL="JDK_@BUILD_JAVA_VERSION@" inherit-compiler-output="true">
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/webapps/examples/WEB-INF/classes" 
isTestSource="true" />
 
-      <!-- The directories below are excluded by default as they require the 
FFM API which is
-          available as a preview feature in Java SDK 22. If you wish to use 
the FFM API in the
-          IDE then set your project and module SDK levels to Java 22 or later, 
enable preview
-          features if needed, and comment out or remove the excludeFolder 
lines below. !-->
-      <excludeFolder 
url="file://$MODULE_DIR$/java/org/apache/tomcat/util/net/openssl/panama" />
-      <excludeFolder 
url="file://$MODULE_DIR$/java/org/apache/tomcat/util/openssl" />
+      <!-- The code that uses the FFM API is only compiled when the build runs 
on Java
+          @RELEASE_JAVA_VERSION@ or later. When ant ide-intellij runs on such 
a version it omits the
+          excludeFolder lines below, so that code belongs to the tomcat-ffm 
module, whose content roots
+          are nested in the java folder above. An exclusion in this module 
would also hide those
+          directories from that module. On an earlier version the code is 
excluded instead. !-->
+      <excludeFolder 
url="file://$MODULE_DIR$/java/org/apache/tomcat/util/net/openssl/panama" /><!-- 
IDEA-FFM-EXCLUDE -->
+      <excludeFolder 
url="file://$MODULE_DIR$/java/org/apache/tomcat/util/openssl" /><!-- 
IDEA-FFM-EXCLUDE -->
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to