Author: robbie
Date: Tue Apr  5 09:49:14 2011
New Revision: 1088946

URL: http://svn.apache.org/viewvc?rev=1088946&view=rev
Log:
QPID-3181: addition of new task 'eclipse' to the Java build system to support 
the creation of .classpath and .project files for the Eclipse IDE. Relies on 
http://ant-eclipse.sourceforge.net/

Applied patch from Keith Wall <keith.w...@gmail.com>

Modified:
    qpid/trunk/qpid/java/build.xml
    qpid/trunk/qpid/java/common.xml
    qpid/trunk/qpid/java/module.xml

Modified: qpid/trunk/qpid/java/build.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/build.xml?rev=1088946&r1=1088945&r2=1088946&view=diff
==============================================================================
--- qpid/trunk/qpid/java/build.xml (original)
+++ qpid/trunk/qpid/java/build.xml Tue Apr  5 09:49:14 2011
@@ -292,4 +292,7 @@
     </findbugs>
   </target>
 
+  <target name="eclipse" description="build eclipse project and classpath 
files">
+    <iterate target="eclipse"/>
+  </target>
 </project>

Modified: qpid/trunk/qpid/java/common.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common.xml?rev=1088946&r1=1088945&r2=1088946&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common.xml (original)
+++ qpid/trunk/qpid/java/common.xml Tue Apr  5 09:49:14 2011
@@ -63,6 +63,11 @@
   <property name="mllib.dir" value="${project.root}/../python" />
   <property name="findbugs.dir" value="${project.root}/lib/findbugs" />
 
+  <!-- properties used to control Ant Eclipse for Eclipse classpath/project 
files etc -->
+  <property name="eclipse.updatealways" value="false"/>
+  <property name="eclipse.compilercompliance" value="5.0"/>
+  <property name="eclipse.container" value="JVM 1.5"/>
+
   <path id="cobertura.classpath">
     <fileset dir="${cobertura.dir}">
         <include name="cobertura.jar" />
@@ -322,6 +327,20 @@
     results directory:
 
       ${build.results}
+
+  ant eclipse
+
+    Generates project and classpath files for the Eclispe IDE.  Requires that
+    the Ant Eclipse task (http://ant-eclipse.sourceforge.net/) has been 
installed
+    in $ANT_HOME/lib.
+
+    The following system properties will be passed to the task. These can be 
usefully
+    overridden from the command line.
+
+    eclipse.updatealways - forces Eclipse files to be regenerated even if they 
are newer then the build.xml (default ${eclipse.updatealways}).
+    eclipse.container - controls the Eclipse container (default 
${eclipse.container}).
+    eclipse.compilercompliance" - controls the Eclipse compiler compliance 
(default ${eclipse.compilercompliance}).
+
     </echo>
   </target>
 

Modified: qpid/trunk/qpid/java/module.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/module.xml?rev=1088946&r1=1088945&r2=1088946&view=diff
==============================================================================
--- qpid/trunk/qpid/java/module.xml (original)
+++ qpid/trunk/qpid/java/module.xml Tue Apr  5 09:49:14 2011
@@ -75,6 +75,7 @@
   <property name="module.coverage"     location="${module.build}/coverage"/>
   <property name="cobertura.datafile"  
location="${module.instrumented}/cobetura.ser"/>
 
+
   <available property="module.test.src.exists" file="${module.test.src}"/>
   <available property="module.etc.exists" file="${module.etc}"/>
   <available property="module.bin.exists" file="${module.bin}"/>
@@ -823,4 +824,84 @@ qpid.name=${project.name}
       <touch file="${velocity.timestamp}" />
     </target>
 
+    <target name="eclipse" 
depends="eclipse-setup,eclipse-project,eclipse-source-only,eclipse-source-and-test"/>
+
+    <target name="eclipse-setup">
+      <taskdef name="eclipse" classname="prantl.ant.eclipse.EclipseTask" />
+
+      <!-- Build set of directories representing the dependencies -->
+
+      <dirset id="eclipse.required.projectdirs.path" dir="${project.root}" 
includes="${module.depends} ${module.test.depends} neverBeEmpty">
+        <!-- Select only those projects from module.depends that contain a 
build.xml.  This serves to exclude dependencies that
+             don't become Eclipse projects e.g. broker-plugins and 
common-tests -->
+        <present targetdir="${project.root}">
+          <mapper type="glob" from="*" to="*/build.xml"/>
+        </present>
+      </dirset>
+
+      <!-- Convert from the set of directories into Eclipse project names 
proceeded by forward slashes -->
+
+      <pathconvert property="eclipse.required.projectnames" 
refid="eclipse.required.projectdirs.path" pathsep=" " dirsep="-">
+        <map from="${project.root}${file.separator}" to=''/>
+      </pathconvert>
+      <map property="eclipse.required.slashedprojectnames" 
value="${eclipse.required.projectnames}" join="${path.separator}">
+        <globmapper from="*" to="/*"/>
+      </map>
+
+      <echo message="Ant module dependencies : ${module.depends} 
${module.test.depends} converted to Eclipse required project(s): 
${eclipse.required.slashedprojectnames}"/>
+      <path id="eclipse.required.slashedprojectnames.path">
+        <pathelement path="${eclipse.required.slashedprojectnames}"/>
+      </path>
+    </target>
+
+    <!-- Create the Eclipse .project -->
+    <target name="eclipse-project">
+      <eclipse updatealways="${eclipse.updatealways}">
+        <project name="${module.name}"/>
+
+        <!-- If the Eclipse task were to ever support the generation of
+             linked resources, we would configure it to generate
+             the following:
+
+             scratch_src -> ${module.precompiled}
+
+             in each project.   This would avoid the 'linked sources'
+             manual step documented on the Wiki.
+        -->
+      </eclipse>
+    </target>
+    
+    <!-- Create the Eclipse .classpath -->
+    <target name="eclipse-source-only" unless="module.test.src.exists">
+      <eclipse updatealways="${eclipse.updatealways}">
+        <settings>
+          <jdtcore compilercompliance="${eclipse.compilercompliance}" />
+        </settings>
+        <classpath>
+          <container path="${eclipse.container}" />
+          <source path="${module.src}" />
+          <source pathref="eclipse.required.slashedprojectnames.path" />
+          <library pathref="module.libs"/>
+          <output path="classes" />
+        </classpath>
+      </eclipse>
+    </target>
+
+    <!-- Create the Eclipse .classpath -->
+    <target name="eclipse-source-and-test" if="module.test.src.exists">
+      <eclipse updatealways="${eclipse.updatealways}">
+        <settings>
+          <jdtcore compilercompliance="${eclipse.compilercompliance}" />
+        </settings>
+        <classpath>
+          <container path="${eclipse.container}" />
+          <source path="${module.src}" />
+          <source path="${module.test.src}" />
+          <source pathref="eclipse.required.slashedprojectnames.path" />
+          <library pathref="module.libs"/>
+          <library pathref="module.test.libs"/>
+          <output path="classes" />
+        </classpath>
+      </eclipse>
+    </target>
 </project>



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to