You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2009/05/13 20:31:40 UTC

svn commit: r774478 - /incubator/pdfbox/trunk/build.xml

Author: lehmi
Date: Wed May 13 18:31:37 2009
New Revision: 774478

URL: http://svn.apache.org/viewvc?rev=774478&view=rev
Log:
PDFBOX-464: auto-download of checkstyle-jars, adjusting some names and directories

Modified:
    incubator/pdfbox/trunk/build.xml

Modified: incubator/pdfbox/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/build.xml?rev=774478&r1=774477&r2=774478&view=diff
==============================================================================
--- incubator/pdfbox/trunk/build.xml (original)
+++ incubator/pdfbox/trunk/build.xml Wed May 13 18:31:37 2009
@@ -14,7 +14,7 @@
  ! See the License for the specific language governing permissions and
  ! limitations under the License.
  !-->
-<project default="dist" name="Apache PDFBox" basedir=".">
+<project default="dist" name="PDFBox" basedir=".">
 
     <!-- Use the following file to alter any of the below properties -->
     <property file="build.properties" />
@@ -23,8 +23,9 @@
 
     <property name="build.compiler" value="modern" />
     <property name="src.dir" value="src/main/java" />
+    <property name="target.dir" value="target" />
+    <property name="dest.dir" value="${target.dir}/classes" />
     <property name="test.dir" value="src/test/java" />
-    <property name="dest.dir" value="classes" />
     <property name="bin.dir" value="bin" />
     <property name="website.dir" value="website" />
     <property name="website.build.dir" value="${website.dir}/build/site" />
@@ -32,12 +33,12 @@
     <property name="lib.dir" value="lib" />
     <property name="war.dir" value="pdfbox.war" />
     <property name="licenses.dir" value="licenses" />
-    <property name="dist.dir" value="dist" />
+    <property name="tool.dir" value="tools" />
     <property name="resources.dir" value="src/main/resources" />
     <property name="checkstyle.config" value="pdfbox-checkstyle.xml" />
 
-    <property name="project.name" value="apache-pdfbox"/>
-    <property name="project.version" value="0.8.0-incubator-dev" />
+    <property name="project.name" value="pdfbox"/>
+    <property name="project.version" value="0.8.0-incubating" />
     <property name="jar.file" value="./lib/${project.name}-${project.version}.jar" />
 
     <property name="jar.dir" value="external" />
@@ -71,6 +72,17 @@
     <property name="junit.jar" value="${jar.dir}/junit.jar" />
     <property name="icu4j.jar" value="${jar.dir}/icu4j-4_0.jar" />
 
+    <property name="maven.repo" value="http://repo2.maven.org/maven2" />
+
+	<property name="checkstyle.url" value="${maven.repo}/checkstyle/checkstyle/4.4/checkstyle-4.4.jar" />
+    <property name="checkstyle.jar" value="${tool.dir}/checkstyle.jar" />
+    <property name="beanutils.url" value="${maven.repo}/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar" />
+    <property name="beanutils.jar" value="${tool.dir}/commons-beanutils.jar" />
+    <property name="logging.url" value="${maven.repo}/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar" />
+    <property name="logging.jar" value="${tool.dir}/commons-logging.jar" />
+    <property name="antlr.url" value="${maven.repo}/antlr/antlr/2.7.6/antlr-2.7.6.jar" />
+    <property name="antlr.jar" value="${tool.dir}/antlr.jar" />
+
     <property name="testoutput.dir" value="test/output"/>
     <property name="testoutput-ext.dir" value="test/output-ext"/>
 
@@ -88,6 +100,13 @@
         <pathelement path="${resources.dir}" />
     </path>
 
+    <path id="checkstyle.classpath">
+        <pathelement path="${checkstyle.jar}" />
+        <pathelement path="${beanutils.jar}" />
+        <pathelement path="${logging.jar}" />
+        <pathelement path="${antlr.jar}" />
+    </path>
+
     <target name="clean" description="Remove all generated files">
         <delete dir="${dest.dir}"/>
         <delete dir="${docs.dir}"/>
@@ -102,7 +121,6 @@
         <mkdir dir="${lib.dir}"/>
         <mkdir dir="${dest.dir}"/>
         <mkdir dir="${docs.dir}" />
-        <mkdir dir="${dist.dir}" />
         <mkdir dir="${bin.dir}" />
         <mkdir dir="${testoutput.dir}" />
         <mkdir dir="${testoutput-ext.dir}" />
@@ -207,22 +225,50 @@
         </pdf2text>
     </target>
 
-    <property name="checkstyle.lib" value="${checkstyle.home.dir}"/>
-    <path id="libs-checkstyle">
-      <fileset dir="${checkstyle.lib}">
-        <include name="*.jar"/>
-      </fileset>
-    </path>
-    <target name="checkstyle-avail" unless="checkstyle.home.dir">
-      <echo message="Checkstyle Support NOT Present. Please download it from http://checkstyle.sf.net/ and set checkstyle.home.dir in build-local.properties"/>
+    <target name="testexist">
+        <echo message="Testing for ${destfile}" level="debug"/>
+        <available file="${destfile}" property="exist"/>
+    </target>
+    <target name="downloadfile" unless="exist" depends="testexist">
+        <dirname property="destdir" file="${destfile}"/>
+        <mkdir dir="${destdir}"/>
+        <get src="${sourcefile}" dest="${destfile}"/>
+    </target>
+
+    <target name="find.checkstyle">
+        <available property="checkstyle.found"
+                   classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"
+                   classpathref="checkstyle.classpath"/>
+    </target>
+
+    <target name="get.checkstyle"
+            unless="checkstyle.found" depends="find.checkstyle">
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${checkstyle.url}"/>
+            <param name="destfile" value="${checkstyle.jar}"/>
+        </antcall>
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${beanutils.url}"/>
+            <param name="destfile" value="${beanutils.jar}"/>
+        </antcall>
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${logging.url}"/>
+            <param name="destfile" value="${logging.jar}"/>
+        </antcall>
+        <antcall target="downloadfile">
+            <param name="sourcefile" value="${antlr.url}"/>
+            <param name="destfile" value="${antlr.jar}"/>
+        </antcall>
     </target>
-    <target name="checkstyle" depends="checkstyle-avail, compile" if="checkstyle.home.dir">
-        <!--
-        This doesn't work when run from netbeans for some reason-->
+
+    <target name="checkstyle" depends="compile,get.checkstyle">
+        <!-- This doesn't work when run from netbeans for some reason -->
         <taskdef name="checkstyle"
                  classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"
-                 classpathref="libs-checkstyle" />
-        <checkstyle config="${checkstyle.config}" classpathref="build.classpath" failOnViolation="false">
+                 classpathref="checkstyle.classpath" />
+        <checkstyle config="${checkstyle.config}"
+                    classpathref="checkstyle.classpath"
+                    failOnViolation="false">
             <fileset dir="${src.dir}" />
         </checkstyle>
     </target>
@@ -238,13 +284,13 @@
                 <include name="**/*.class"/>
             </fileset>
             <fileset dir="${resources.dir}"/>
+            <metainf dir="." includes="*.txt"/>
             <manifest>
                 <attribute name="Built-By" value="${user.name}"/>
-                <section name="common">
-                    <attribute name="Specification-Title" value="PDFBox"/>
-                    <attribute name="Specification-Version" value="${project.version}"/>
-                    <attribute name="Specification-Vendor" value="PDFBox.org"/>
-                </section>
+                <attribute name="Implementation-Title" value="Apache PDFBox (incubating)"/>
+                <attribute name="Implementation-Version" value="${project.version}"/>
+                <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
+                <attribute name="Implementation-URL" value="http://incubator.apache.org/pdfbox/"/>
             </manifest>
         </jar>
         <zip zipfile="./lib/pdfbox.war">
@@ -262,13 +308,12 @@
     </target>
 
     <target name="release-dist">
-        <delete dir="${dist.dir}"/>
         <antcall target="dist" />
     </target>
 
     <target name="dist" depends="clean,package,javadoc,website,build.NET,checkstyle" description="Create zip distribution file">
 
-        <jar jarfile="${dist.dir}/${release.name}-maven.jar">
+        <jar jarfile="${target.dir}/${release.name}-maven.jar">
             <fileset dir="./lib/">
                 <include name="${release.name}.jar"/>
             </fileset>
@@ -277,7 +322,7 @@
             </fileset>
         </jar>
 
-        <zip zipfile="${dist.dir}/${release.name}.zip">
+        <zip zipfile="${target.dir}/${release.name}.zip">
             <zipfileset dir="." prefix="${release.name}">
                 <include name="${lib.dir}/*.jar"/>
                 <include name="${licenses.dir}/**/*"/>
@@ -299,6 +344,7 @@
                 <include name="${checkstyle.jar}" />
                 <include name="${icu4j.jar}" />
                 <include name="${bin.dir}/**/*" />
+                <include name="*.txt" />
                 <include name="pom.xml" />
                 <include name="build.xml" />
                 <include name="build.properties.example" />