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> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId> <artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<instructions> <instructions>

20
pom.xml
View File

@ -155,25 +155,21 @@
<inherited>false</inherited> <inherited>false</inherited>
<configuration> <configuration>
<tasks> <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="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>
<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="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>
<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="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>
<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="target" value="${project.build.directory}" />
<property name="package.zip" value="${pom.artifactId}-${pom.version}-src.zip" /> <property name="package.name" value="${pom.artifactId}-${pom.version}-src" />
</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" />
</ant> </ant>
</tasks> </tasks>
</configuration> </configuration>

View File

@ -22,23 +22,44 @@
information on the Apache Software Foundation, please see information on the Apache Software Foundation, please see
<http://www.apache.org />. <http://www.apache.org />.
--> -->
<project name="assembly-postprocess" default="fixzip" basedir="."> <project name="assembly-postprocess" default="fixarchives" basedir=".">
<target name="fixzip">
<target name="fixarchives" depends="_eolcheck,fixzip,fixtgz">
</target>
<target name="fixzip" unless="native.crlf">
<property name="tmp.dir" location="${target}/tmp"/> <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}" /> <delete dir="${tmp.dir}" />
<unzip src="${zip.file}" dest="${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" /> 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}" /> <delete dir="${tmp.dir}" />
</target> </target>
<target name="fixtar">
<target name="fixtgz" unless="native.lf">
<property name="tmp.dir" location="${target}/tmp"/> <property name="tmp.dir" location="${target}/tmp"/>
<property name="tar.file" location="${target}/${package.tar}"/> <property name="gz.file" location="${target}/${package.name}.tar.gz"/>
<delete dir="${tmp.dir}" /> <property name="tar.file" location="${target}/${package.name}.tar"/>
<untar src="${tar.file}" dest="${tmp.dir}" compression="gzip" />
<tar destfile="${tar.file}" basedir="${tmp.dir}" compression="gzip" longfile="gnu" />
<delete dir="${tmp.dir}" /> <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> </target>
</project> </project>