This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new d19bc72c6b Set *.sh/.bat line-endings in output/build.
d19bc72c6b is described below
commit d19bc72c6bcefdd3b1315ef023bc72959a140b3f
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 | 130 ++++++++++++++++++++++++++-------------------
webapps/docs/changelog.xml | 10 ++++
2 files changed, 85 insertions(+), 55 deletions(-)
diff --git a/build.xml b/build.xml
index 29a2312583..a9c249afe2 100644
--- a/build.xml
+++ b/build.xml
@@ -1543,6 +1543,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"/>
@@ -2447,9 +2450,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 -->
@@ -2903,7 +2905,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">
@@ -2925,8 +2927,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">
@@ -3218,8 +3224,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"
@@ -3295,13 +3305,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">
@@ -3340,11 +3393,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 x86 package -->
<zip
zipfile="${tomcat.release}/v${version}/bin/${final.name}-windows-x86.zip"
@@ -3409,16 +3458,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">
@@ -3434,12 +3474,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}"/>
@@ -3483,16 +3518,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}"/>
@@ -3516,8 +3542,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>
@@ -3565,13 +3593,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"
@@ -3589,13 +3613,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 b88392a6d3..eeede59f06 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -185,6 +185,16 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Other">
+ <changelog>
+ <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>
<section name="Tomcat 9.0.124 (remm)" rtext="release in progress">
<subsection name="General">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]