Adding source.jar targets to build zipfiles containing the exact sources used to build each .jar. This can help with IDEs who want to attach a specific source .jar for each binary .jar

git-svn-id: https://google-guice.googlecode.com/svn/trunk@467 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/build.xml b/build.xml
index 6141167..db484eb 100644
--- a/build.xml
+++ b/build.xml
@@ -24,15 +24,15 @@
     </jarjar>
   </target>
 
-  <target name="dist" depends="jar, javadoc"
+  <target name="dist" depends="distjars, javadoc"
        description="Build entire distribution.">
-    <ant antfile="servlet/build.xml" target="jar" inheritAll="false"/>
-    <ant antfile="spring/build.xml" target="jar" inheritAll="false"/>
-    <ant antfile="struts2/plugin/build.xml" target="jar" inheritAll="false"/>
-    <ant antfile="extensions/assistedinject/build.xml" target="jar" inheritAll="false"/>
-    <ant antfile="extensions/throwingproviders/build.xml" target="jar" inheritAll="false"/>
-    <ant antfile="extensions/multibindings/build.xml" target="jar" inheritAll="false"/>
-    <ant antfile="extensions/commands/build.xml" target="jar" inheritAll="false"/>
+    <ant antfile="servlet/build.xml" target="distjars" inheritAll="false"/>
+    <ant antfile="spring/build.xml" target="distjars" inheritAll="false"/>
+    <ant antfile="struts2/plugin/build.xml" target="distjars" inheritAll="false"/>
+    <ant antfile="extensions/assistedinject/build.xml" target="distjars" inheritAll="false"/>
+    <ant antfile="extensions/throwingproviders/build.xml" target="distjars" inheritAll="false"/>
+    <ant antfile="extensions/multibindings/build.xml" target="distjars" inheritAll="false"/>
+    <ant antfile="extensions/commands/build.xml" target="distjars" inheritAll="false"/>
 
     <copy toDir="${build.dir}/dist"> 
       <fileset dir="servlet/build" includes="*.jar"/>
@@ -104,7 +104,7 @@
         <pathelement location="${servlet.src.dir}"/>
         <pathelement location="${spring.src.dir}"/>
         <pathelement location="${assistedinject.src.dir}"/>
-        <pathelement location="${throwingproviders  .src.dir}"/>
+        <pathelement location="${throwingproviders.src.dir}"/>
         <pathelement location="${multibindings.src.dir}"/>
         <pathelement location="${commands.src.dir}"/>
       </sourcepath>
diff --git a/common.xml b/common.xml
index 31133ca..4bf0416 100644
--- a/common.xml
+++ b/common.xml
@@ -56,4 +56,16 @@
     <delete dir="${build.dir}"/>
   </target>
   
+  <target name="source.jar"
+      description="Create a .jar file with sources">
+    <mkdir dir="${build.dir}"/>
+    <zip destfile="${build.dir}/${ant.project.name}-${version}-src.jar">
+      <fileset dir="src"/>
+    </zip>
+  </target>
+
+  <target name="distjars"
+      depends="source.jar, jar"
+      description="Build jar files"/>
+
 </project>