Author: cutting
Date: Thu Oct 22 22:24:28 2009
New Revision: 828875

URL: http://svn.apache.org/viewvc?rev=828875&view=rev
Log:
AVRO-146.  Add support for using Eclipse to develop Avro's Java.  Contributed 
by Philip Zeyliger.

Added:
    hadoop/avro/trunk/.eclipse_launchers/
    hadoop/avro/trunk/.eclipse_launchers/AllTests.launch
Modified:
    hadoop/avro/trunk/   (props changed)
    hadoop/avro/trunk/.gitignore
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/README.txt
    hadoop/avro/trunk/build.xml

Propchange: hadoop/avro/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Oct 22 22:24:28 2009
@@ -1 +1,4 @@
+.classpath
+.eclipse
+.project
 build

Added: hadoop/avro/trunk/.eclipse_launchers/AllTests.launch
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/.eclipse_launchers/AllTests.launch?rev=828875&view=auto
==============================================================================
--- hadoop/avro/trunk/.eclipse_launchers/AllTests.launch (added)
+++ hadoop/avro/trunk/.eclipse_launchers/AllTests.launch Thu Oct 22 22:24:28 
2009
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/avro/src/test/java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="2"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" 
value="=avro/src\/test\/java"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" 
value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="avro"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" 
value="-Dtest.dir=${workspace_loc:avro}/build/test"/>
+</launchConfiguration>

Modified: hadoop/avro/trunk/.gitignore
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/.gitignore?rev=828875&r1=828874&r2=828875&view=diff
==============================================================================
--- hadoop/avro/trunk/.gitignore (original)
+++ hadoop/avro/trunk/.gitignore Thu Oct 22 22:24:28 2009
@@ -1,4 +1,7 @@
-build
 *.pyc
 .svn
+/.classpath
+/.eclipse
+/.project
+/build
 test-output

Modified: hadoop/avro/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=828875&r1=828874&r2=828875&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Thu Oct 22 22:24:28 2009
@@ -26,6 +26,9 @@
     AVRO-167. Refactor Java SpecificCompiler to simplify testing, and
     add some tests. (Philip Zeyliger via cutting)
 
+    AVRO-146. Add support for using Eclipse to develop Avro's Java.
+    (Philip Zeyliger via cutting)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/avro/trunk/README.txt
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/README.txt?rev=828875&r1=828874&r2=828875&view=diff
==============================================================================
--- hadoop/avro/trunk/README.txt (original)
+++ hadoop/avro/trunk/README.txt Thu Oct 22 22:24:28 2009
@@ -25,3 +25,15 @@
  'ant jar' creates a jar in build/avro-X.X.jar
  'ant tar' makes a "release" with docs, jar, src, etc. in build/avro-X.X.tar.gz
  'ant clean' removes all generated artifacts
+
+USING ECLIPSE
+
+To use Eclipse, use the "ant eclipse" target to trigger the generation
+of an Eclipse project.  This project is automatically created by 
+the ant-eclipse tool (see http://ant-eclipse.sourceforge.net/).
+Note that to build completely, you still have to use "ant", because
+the Eclipse project depends on some generated code.
+
+You should be able to run all the java tests in Eclipse, except
+for the InteropTest.  There is a launcher in .eclipse_launchers,
+that should work if your checkout directory is "avro".

Modified: hadoop/avro/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/avro/trunk/build.xml?rev=828875&r1=828874&r2=828875&view=diff
==============================================================================
--- hadoop/avro/trunk/build.xml (original)
+++ hadoop/avro/trunk/build.xml Thu Oct 22 22:24:28 2009
@@ -61,8 +61,10 @@
   <property name="test.java.src.dir" value="${basedir}/src/test/java"/>
   <property name="test.schemata.dir" value="${basedir}/src/test/schemata"/>
   <property name="test.java.build.dir" value="${build.dir}/test"/>
-  <property name="test.java.generated.dir" value="${test.java.build.dir}/src"/>
+  <property name="test.java.generated.build.dir" 
value="${test.java.build.dir}/generated"/>
+  <property name="test.java.generated.dir" 
value="${test.java.generated.build.dir}/src"/>
   <property name="test.java.classes" value="${test.java.build.dir}/classes"/>
+  <property name="test.java.generated.classes" 
value="${test.java.generated.build.dir}/classes"/>
   <property name="test.java.include" value="Test*"/>
 
   <property name="javadoc.link.java"
@@ -88,6 +90,12 @@
   <property name="ivy.lib" value="${build.dir}/lib"/>
   <property name="ivy.test.lib" value="${build.dir}/test/lib"/>
 
+  <!-- Eclipse properties -->
+  <property name="build.dir.eclipse" value=".eclipse"/>
+  <property name="build.dir.eclipse-main-classes" 
value="${build.dir.eclipse}/classes-main"/>
+  <property name="build.dir.eclipse-main-generated-classes" 
value="${build.dir.eclipse}/classes-main-generated"/>
+  <property name="build.dir.eclipse-test-classes" 
value="${build.dir.eclipse}/classes-test"/>
+
   <!-- the normal classpath -->
   <path id="java.classpath">
     <pathelement location="${build.classes}"/>
@@ -105,6 +113,7 @@
 
   <path id="test.java.classpath">
     <pathelement location="${test.java.classes}" />
+    <pathelement location="${test.java.generated.classes}" />
     <fileset dir="${ivy.test.lib}">
       <include name="**/*.jar" />
     </fileset>
@@ -117,6 +126,7 @@
  
     <mkdir dir="${test.java.build.dir}"/>
     <mkdir dir="${test.java.classes}"/>
+    <mkdir dir="${test.java.generated.classes}"/>
 
     <mkdir dir="${ivy.lib}"/>
     <mkdir dir="${ivy.test.lib}"/>
@@ -222,7 +232,7 @@
   <target name="compile-test-java" depends="ivy-retrieve-test,compile-java">
     <java-avro-compiler src="${test.schemata.dir}"
                        generated="${test.java.generated.dir}"
-                       dest="${test.java.classes}"
+                       dest="${test.java.generated.classes}"
                        classpath="test.java.classpath"/>
     <java-compiler src="${test.java.src.dir}"
                   dest="${test.java.classes}"
@@ -684,4 +694,62 @@
   </target>
   <!-- End C++ Targets -->
 
+  <!-- Begin Eclipse targets -->
+  <condition property="ant-eclipse.jar.exists">
+    <available file="${lib.dir}/ant-eclipse-1.0-jvm1.2.jar"/>
+  </condition>
+
+  <target name="ant-eclipse-download" unless="ant-eclipse.jar.exists"
+          description="Downloads the ant-eclipse binary.">
+    <get 
src="http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2";
+         dest="${build.dir}/ant-eclipse-1.0.bin.tar.bz2" usetimestamp="false" 
/>
+
+    <untar src="${build.dir}/ant-eclipse-1.0.bin.tar.bz2"
+           dest="${build.dir}" compression="bzip2">
+      <patternset>
+        <include name="lib/ant-eclipse-1.0-jvm1.2.jar"/>
+      </patternset>
+    </untar>
+    <delete file="${src.dir}/java/ant-eclipse-1.0.bin.tar.bz2" />
+  </target>
+
+  <target name="eclipse" 
+          depends="compile-test-java,ant-eclipse-download"
+          description="Create eclipse project files">
+    <ivy:resolve useOrigin="true" conf="test"/>
+    <ivy:cachepath pathid="default.path.id" conf="default" />
+    <ivy:cachepath pathid="junit.path.id" conf="test" transitive="false"/>
+    <taskdef name="eclipse"
+             classname="prantl.ant.eclipse.EclipseTask"
+             classpathref="java.classpath" />
+    <eclipse updatealways="true">
+      <project name="${ant.project.name}" />
+      <classpath>
+        <!-- Use Eclipse to compile Avro runtime -->
+        <source path="${java.src.dir}"
+                output="${build.dir.eclipse-main-classes}" />
+        <source path="${test.java.src.dir}"
+                output="${build.dir.eclipse-test-classes}" />
+        <!-- Even though these are generated, Eclipse can compile these -->
+        <source path="${build.dir}/src"
+                output="${build.dir.eclipse-main-generated-classes}" />
+        <output path="${build.dir.eclipse-main-classes}" />
+        <!-- Tests require that the generated code has paranamer applied to it,
+             so we use the ant build for that. -->
+        <library path="${test.java.generated.classes}" 
source="${test.java.generated.dir}"/>
+        <library pathref="default.path.id" exported="true" />
+        <library pathref="junit.path.id" exported="false" />
+       </classpath>
+    </eclipse>
+  </target>
+
+  <target name="clean-eclipse" description="Clean eclipse files">
+    <delete file=".classpath" />
+    <delete file=".eclipse" />
+    <delete file=".project" />
+    <delete dir=".settings" />
+    <delete dir="${build.dir.eclipse}" />
+  </target>
+  <!-- End Eclipse targets -->
+
 </project>


Reply via email to