Fix zip or tgz archives depending on host OS EOL setting (contributed by sebb)

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@788503 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2009-06-25 20:44:21 +00:00
parent 4569c7d8ea
commit 794d64098e
3 changed files with 40 additions and 22 deletions

View File

@ -88,6 +88,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>

20
pom.xml
View File

@ -155,25 +155,21 @@
<inherited>false</inherited>
<configuration>
<tasks>
<ant antfile="src/main/assembly/build.xml" target="fixzip">
<ant antfile="src/main/assembly/build.xml">
<property name="target" value="${project.build.directory}" />
<property name="package.zip" value="${pom.artifactId}-${pom.version}-bin.zip" />
<property name="package.name" value="${pom.artifactId}-${pom.version}-bin" />
</ant>
<ant antfile="src/main/assembly/build.xml" target="fixzip">
<ant antfile="src/main/assembly/build.xml">
<property name="target" value="${project.build.directory}" />
<property name="package.zip" value="${pom.artifactId}-${pom.version}-osgi-bin.zip" />
<property name="package.name" value="${pom.artifactId}-${pom.version}-bin-with-dependencies" />
</ant>
<ant antfile="src/main/assembly/build.xml" target="fixzip">
<ant antfile="src/main/assembly/build.xml">
<property name="target" value="${project.build.directory}" />
<property name="package.zip" value="${pom.artifactId}-${pom.version}-bin-with-dependencies.zip" />
<property name="package.name" value="${pom.artifactId}-${pom.version}-osgi-bin" />
</ant>
<ant antfile="src/main/assembly/build.xml" target="fixzip">
<ant antfile="src/main/assembly/build.xml">
<property name="target" value="${project.build.directory}" />
<property name="package.zip" value="${pom.artifactId}-${pom.version}-src.zip" />
</ant>
<ant antfile="src/main/assembly/build.xml" target="fixtar">
<property name="target" value="${project.build.directory}" />
<property name="package.tar" value="${pom.artifactId}-${pom.version}-bin-with-dependencies.tar.gz" />
<property name="package.name" value="${pom.artifactId}-${pom.version}-src" />
</ant>
</tasks>
</configuration>

View File

@ -22,23 +22,44 @@
information on the Apache Software Foundation, please see
<http://www.apache.org />.
-->
<project name="assembly-postprocess" default="fixzip" basedir=".">
<target name="fixzip">
<project name="assembly-postprocess" default="fixarchives" basedir=".">
<target name="fixarchives" depends="_eolcheck,fixzip,fixtgz">
</target>
<target name="fixzip" unless="native.crlf">
<property name="tmp.dir" location="${target}/tmp"/>
<property name="zip.file" location="${target}/${package.zip}"/>
<property name="zip.file" location="${target}/${package.name}.zip"/>
<delete dir="${tmp.dir}" />
<unzip src="${zip.file}" dest="${tmp.dir}"/>
<fixcrlf srcdir="${tmp.dir}" eol="dos" eof="remove"
<fixcrlf srcdir="${tmp.dir}" eol="crlf" eof="remove" fixlast="false"
includes="**/*.txt, **/*.xml, **/*.properties, **/*.java, **/*.html, **/*.css" />
<zip destfile="${zip.file}" basedir="${tmp.dir}" />
<zip destfile="${zip.file}" basedir="${tmp.dir}" duplicate="preserve" />
<delete dir="${tmp.dir}" />
</target>
<target name="fixtar">
<target name="fixtgz" unless="native.lf">
<property name="tmp.dir" location="${target}/tmp"/>
<property name="tar.file" location="${target}/${package.tar}"/>
<delete dir="${tmp.dir}" />
<untar src="${tar.file}" dest="${tmp.dir}" compression="gzip" />
<tar destfile="${tar.file}" basedir="${tmp.dir}" compression="gzip" longfile="gnu" />
<property name="gz.file" location="${target}/${package.name}.tar.gz"/>
<property name="tar.file" location="${target}/${package.name}.tar"/>
<delete dir="${tmp.dir}" />
<gunzip src="${gz.file}" dest="${tar.file}"/>
<untar src="${tar.file}" dest="${tmp.dir}"/>
<fixcrlf srcdir="${tmp.dir}" eol="lf" eof="remove" fixlast="false"
includes="**/*.txt, **/*.xml, **/*.properties, **/*.java, **/*.html, **/*.css" />
<tar destfile="${tar.file}" basedir="${tmp.dir}" longfile="gnu"/>
<gzip src="${tar.file}" destfile="${gz.file}"/>
<delete file="${tar.file}"/>
<delete dir="${tmp.dir}"/>
</target>
<!-- Determine if the native format is CRLF or LF (or neither) -->
<target name="_eolcheck">
<condition property="native.lf">
<os family="unix"/>
</condition>
<condition property="native.crlf">
<os family="dos"/>
</condition>
</target>
</project>