This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 49a684ad5b Set *.sh/.bat line-endings in output/build.
49a684ad5b is described below
commit 49a684ad5b55dc5a100f2c1cdfcfa2bee78f5e0b
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 13 16:34:59 2026 +0000
Set *.sh/.bat line-endings in output/build.
General clean-up of line ending setting.
---
build.xml | 131 ++++++++++++++++++++++++++-------------------
webapps/docs/changelog.xml | 6 +++
2 files changed, 81 insertions(+), 56 deletions(-)
diff --git a/build.xml b/build.xml
index d97f4c4ee0..1e6c1ee186 100644
--- a/build.xml
+++ b/build.xml
@@ -1557,6 +1557,9 @@
<include name="**/*.bat"/>
</fileset>
</copy>
+ <!-- Correct line endings and permissions on "bin" scripts -->
+ <fixcrlf srcdir="${tomcat.build}/bin" includes="*.sh" eol="lf"
encoding="ISO-8859-1" fixlast="false" />
+ <fixcrlf srcdir="${tomcat.build}/bin" includes="*.bat" eol="crlf"
encoding="ISO-8859-1" fixlast="false" />
<!-- Copy doesn't retain permissions -->
<chmod dir="${tomcat.build}/bin" includes="*.sh" perm="+x"/>
@@ -2422,9 +2425,8 @@
<touch file="${tomcat.dist}/temp/safeToDelete.tmp" />
- <!-- Correct permissions and line endings on "bin" scripts -->
- <fixcrlf srcdir="${tomcat.dist}/bin" includes="*.sh" eol="lf"
encoding="ISO-8859-1" fixlast="false" />
- <fixcrlf srcdir="${tomcat.dist}/bin" includes="*.bat" eol="crlf"
encoding="ISO-8859-1" fixlast="false" />
+ <!-- Correct permissions on "bin" scripts. Line endings were set when the
-->
+ <!-- scripts were copied to ${tomcat.build}/bin.
-->
<chmod dir="${tomcat.dist}/bin" includes="*.sh" perm="+x"/>
<!-- Windows binaries -->
@@ -2866,7 +2868,7 @@ You may need a custom build of makensis. Instructions for
this may be found in B
</target>
<target name="-installer-prep"
- depends="dist-static,-installer-checks"
+ depends="dist-static,-dist-eol-crlf,-installer-checks"
unless="${skip.installer}">
<copy todir="${tomcat.dist}">
<fileset dir="res/install-win">
@@ -2888,8 +2890,12 @@ You may need a custom build of makensis. Instructions
for this may be found in B
<filter token="OS.CMD.COPY" value="${os.cmd.copy}"/>
</filterset>
</copy>
+ <!-- The files above were added after -dist-eol-crlf ran so their line -->
+ <!-- endings need to be fixed here. -->
<fixcrlf srcdir="${tomcat.dist}" eol="crlf" encoding="ISO-8859-1"
fixlast="false">
- <patternset refid="text.files"/>
+ <include name="INSTALLLICENSE"/>
+ <include name="tomcat-users_*.xml"/>
+ <include name="tomcat.nsi"/>
</fixcrlf>
<!-- Reproducible builds: consistent timestamps for installer files -->
<touch datetime="${tstamp.file}" pattern="yyyy-MM-dd HH:mm:ss">
@@ -3181,8 +3187,12 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
</echo>
</target>
+ <!-- ORDER IS IMPORTANT: The targets that convert line endings to CRLF -->
+ <!-- (installer, package-zip, package-winzip, package-deployer-zip) -->
+ <!-- must be listed before those that convert them to LF -->
+ <!-- (package-tgz, package-deployer-tgz). See -dist-eol-crlf. -->
<target name="release"
-
depends="clean,release-init,dist-deployer,installer,package-zip,package-winzip,package-tgz,package-deployer-zip,package-deployer-tgz,javadoc,package-docs-tgz,package-src-zip,package-src-tgz,package-src-jar"
+
depends="clean,release-init,dist-deployer,installer,package-zip,package-winzip,package-deployer-zip,package-tgz,package-deployer-tgz,javadoc,package-docs-tgz,package-src-zip,package-src-tgz,package-src-jar"
description="Create a Tomcat packaged distribution">
<copy file="KEYS"
@@ -3258,13 +3268,56 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
</exec>
</target>
- <!-- Packages the core zip distro -->
- <target name="package-zip" depends="dist-static">
+ <!--
+ Line endings for the shared ${tomcat.dist} and ${tomcat.deployer} trees.
+ The CRLF and LF targets convert the trees in place. Ant runs a target at
+ most once per invocation so, in a release build, the files are converted
+ to CRLF once (installer and zip packages) and then to LF once (tar.gz
+ packages).
+ #### ORDER IS IMPORTANT ####
+ The targets that depend on -dist-eol-crlf (-deployer-eol-crlf) and those
+ that depend on -dist-eol-lf (-deployer-eol-lf) must be grouped, not
+ interleaved, in the "release" target. A package that depends on a
+ conversion that has already run is not converted again and will see
+ whatever line endings the most recent conversion left behind.
+ The CRLF group comes first because the javadoc is generated into
+ ${tomcat.dist}/webapps/docs and must be added after the binary packages
+ have been created. package-docs-tgz therefore fixes the line endings of
+ the javadoc itself.
+ The text.files patternset does not include *.sh or *.bat so the line
+ endings of those files are not changed here. They are set when the
+ scripts are copied to ${tomcat.build}/bin (*.sh use LF, *.bat use CRLF).
+ -->
+ <target name="-dist-eol-crlf" depends="dist-static">
<fixcrlf srcdir="${tomcat.dist}" eol="crlf"
encoding="ISO-8859-1" fixlast="false" >
<patternset refid="text.files" />
</fixcrlf>
+ </target>
+
+ <target name="-deployer-eol-crlf" depends="dist-deployer">
+ <fixcrlf srcdir="${tomcat.deployer}" eol="crlf"
+ encoding="ISO-8859-1" fixlast="false" >
+ <patternset refid="text.files" />
+ </fixcrlf>
+ </target>
+
+ <target name="-dist-eol-lf" depends="dist-static">
+ <fixcrlf srcdir="${tomcat.dist}" eol="lf"
+ encoding="ISO-8859-1" fixlast="false" >
+ <patternset refid="text.files" />
+ </fixcrlf>
+ </target>
+
+ <target name="-deployer-eol-lf" depends="dist-deployer">
+ <fixcrlf srcdir="${tomcat.deployer}" eol="lf"
+ encoding="ISO-8859-1" fixlast="false" >
+ <patternset refid="text.files" />
+ </fixcrlf>
+ </target>
+ <!-- Packages the core zip distro -->
+ <target name="package-zip" depends="dist-static,-dist-eol-crlf">
<zip zipfile="${tomcat.release}/v${version}/bin/${final.name}.zip"
modificationtime="${tstamp.iso.release}"
encoding="UTF8">
@@ -3302,12 +3355,7 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
</target>
<!-- Packages the core windows zip distros -->
- <target name="package-winzip" depends="dist-static">
- <fixcrlf srcdir="${tomcat.dist}" eol="crlf"
- encoding="ISO-8859-1" fixlast="false" >
- <patternset refid="text.files" />
- </fixcrlf>
-
+ <target name="package-winzip" depends="dist-static,-dist-eol-crlf">
<!-- Windows x64 package -->
<zip
zipfile="${tomcat.release}/v${version}/bin/${final.name}-windows-x64.zip"
modificationtime="${tstamp.iso.release}"
@@ -3336,16 +3384,7 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
</target>
<!-- Packages the deployer distribution in zip format -->
- <target name="package-deployer-zip">
- <fixcrlf srcdir="${tomcat.dist}" eol="crlf"
- encoding="ISO-8859-1" fixlast="false" >
- <patternset refid="text.files" />
- </fixcrlf>
- <fixcrlf srcdir="${tomcat.deployer}" eol="crlf"
- encoding="ISO-8859-1" fixlast="false" >
- <patternset refid="text.files" />
- </fixcrlf>
-
+ <target name="package-deployer-zip"
depends="-dist-eol-crlf,-deployer-eol-crlf">
<zip zipfile="${tomcat.release}/v${version}/bin/${final.name}-deployer.zip"
modificationtime="${tstamp.iso.release}"
encoding="UTF8">
@@ -3361,12 +3400,7 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
</target>
<!-- Packages the core tar.gz distro -->
- <target name="package-tgz" depends="dist-static">
- <fixcrlf srcdir="${tomcat.dist}" eol="lf"
- encoding="ISO-8859-1" fixlast="false" >
- <patternset refid="text.files" />
- </fixcrlf>
-
+ <target name="package-tgz" depends="dist-static,-dist-eol-lf">
<!-- Reproducible builds: consistent timestamps for distributed files -->
<touch datetime="${tstamp.file}" pattern="yyyy-MM-dd HH:mm:ss">
<fileset dir="${tomcat.dist}"/>
@@ -3409,16 +3443,7 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
</target>
<!-- Packages the deployer Tomcat distro in tar.gz format -->
- <target name="package-deployer-tgz">
- <fixcrlf srcdir="${tomcat.dist}" eol="lf"
- encoding="ISO-8859-1" fixlast="false" >
- <patternset refid="text.files" />
- </fixcrlf>
- <fixcrlf srcdir="${tomcat.deployer}" eol="lf"
- encoding="ISO-8859-1" fixlast="false" >
- <patternset refid="text.files" />
- </fixcrlf>
-
+ <target name="package-deployer-tgz" depends="-dist-eol-lf,-deployer-eol-lf">
<!-- Reproducible builds: consistent timestamps for distributed files -->
<touch datetime="${tstamp.file}" pattern="yyyy-MM-dd HH:mm:ss">
<fileset dir="${tomcat.dist}"/>
@@ -3442,8 +3467,10 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
</target>
<!-- Packages the documentation distro in tar.gz format -->
- <target name="package-docs-tgz" depends="dist-static">
- <fixcrlf srcdir="${tomcat.dist}" eol="lf"
+ <target name="package-docs-tgz" depends="dist-static,-dist-eol-lf">
+ <!-- The javadoc is generated after -dist-eol-lf has run so its text files
-->
+ <!-- need their line endings fixing here.
-->
+ <fixcrlf srcdir="${tomcat.dist}/webapps/docs" eol="lf"
encoding="ISO-8859-1" fixlast="false" >
<patternset refid="text.files" />
</fixcrlf>
@@ -3491,13 +3518,9 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
<fixcrlf srcdir="${tomcat.dist}/src" eol="crlf"
encoding="ISO-8859-1" fixlast="false" >
<patternset refid="text.files"/>
- <include name="bin/*.bat" />
- <include name="bin/*.sh" />
- <include name=".travis/*.sh" />
- <include name="res/graal/*.sh" />
- <include name="res/openssl/*.sh" />
- <include name="test/org/apache/tomcat/util/net/*.sh" />
- <include name="test/org/apache/tomcat/util/net/ocsp/*.sh" />
+ <include name="**/*.bat" />
+ <include name="**/*.sh" />
+ <include name="**/*.py" />
</fixcrlf>
<zip zipfile="${tomcat.release}/v${version}/src/${final-src.name}.zip"
@@ -3515,13 +3538,9 @@ Configured for ${release.asfusername} to release Tomcat
${version.major}.${versi
<fixcrlf srcdir="${tomcat.dist}/src" eol="lf"
encoding="ISO-8859-1" fixlast="false" >
<patternset refid="text.files"/>
- <include name="bin/*.bat" />
- <include name="bin/*.sh" />
- <include name=".travis/*.sh" />
- <include name="res/graal/*.sh" />
- <include name="res/openssl/*.sh" />
- <include name="test/org/apache/tomcat/util/net/*.sh" />
- <include name="test/org/apache/tomcat/util/net/ocsp/*.sh" />
+ <include name="**/*.bat" />
+ <include name="**/*.sh" />
+ <include name="**/*.py" />
</fixcrlf>
<!-- Reproducible builds: consistent timestamps for distributed files -->
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f7aa3b3eb5..e1bcbc1f7f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -436,6 +436,12 @@
report when the build is run with code coverage enabled. (dsoumis)
</add>
<!-- Entries for backport and removal before 12.0.0-M1 below this line
-->
+ <fix>
+ Configure appropriate line endings for <code>*.bat</code> and
+ <code>*.sh</code> files in <code>build/output</code> when building
+ Tomcat locally. Refactoring line-ending management in build.xml to
+ reduce repeated line-ending changes. (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]