[jbosstools-commits] JBoss Tools SVN: r13128 - in workspace/max/jpaap: javax.persistence and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jan 19 12:16:49 EST 2009


Author: hardy.ferentschik
Date: 2009-01-19 12:16:48 -0500 (Mon, 19 Jan 2009)
New Revision: 13128

Removed:
   workspace/max/jpaap/javax.persistence/META-INF/
   workspace/max/jpaap/javax.persistence/build.properties
   workspace/max/jpaap/jpaap/META-INF/
   workspace/max/jpaap/jpaap/build.properties
   workspace/max/jpaap/jpaap/jpaap.jar
   workspace/max/jpaap/test/gen-src/
   workspace/max/jpaap/test/jpa-build.xml
   workspace/max/jpaap/test/lib/
Modified:
   workspace/max/jpaap/
   workspace/max/jpaap/javax.persistence/
   workspace/max/jpaap/javax.persistence/build.xml
   workspace/max/jpaap/jpaap/
   workspace/max/jpaap/jpaap/build.xml
   workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/MetaEntity.java
   workspace/max/jpaap/test/
   workspace/max/jpaap/test/build.xml
   workspace/max/jpaap/test/readme.txt
Log:
some build script cleanup


Property changes on: workspace/max/jpaap
___________________________________________________________________
Name: svn:ignore
   + *.iml
target



Property changes on: workspace/max/jpaap/javax.persistence
___________________________________________________________________
Name: svn:ignore
   + bin
target


Deleted: workspace/max/jpaap/javax.persistence/build.properties
===================================================================
--- workspace/max/jpaap/javax.persistence/build.properties	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/javax.persistence/build.properties	2009-01-19 17:16:48 UTC (rev 13128)
@@ -1,3 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
-               .

Modified: workspace/max/jpaap/javax.persistence/build.xml
===================================================================
--- workspace/max/jpaap/javax.persistence/build.xml	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/javax.persistence/build.xml	2009-01-19 17:16:48 UTC (rev 13128)
@@ -1,45 +1,42 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- WARNING: Eclipse auto-generated file.
-              Any modifications will be overwritten.
-              To include a user specific buildfile here, simply create one in the same
-              directory with the processing instruction <?eclipse.ant.import?>
-              as the first entry and export the buildfile again. -->
-<project basedir="." default="build" name="javax.persistence">
-    <property environment="env"/>
-    <property name="jpaap.location" value="../jpaap"/>
-    <property name="test.location" value="../test"/>
-    <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.6"/>
-    <property name="source" value="1.6"/>
-    <path id="Plug-in Dependencies.libraryclasspath"/>
-    <path id="javax.persistence.classpath">
-        <pathelement location="classes"/>
-        <pathelement location="bin"/>
-        <path refid="Plug-in Dependencies.libraryclasspath"/>
-    </path>
+
+
+<project name="Persistence API" default="jar" basedir=".">
+
     <target name="init">
-        <mkdir dir="bin"/>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="src" excludes="**/*.launch, **/*.java"/>
-        </copy>
+        <property name="debuglevel" value="source,lines,vars"/>
+        <property name="target" value="1.6"/>
+        <property name="source" value="1.6"/>
+        <property name="src.dir" value="${basedir}/src"/>
+        <property name="build.dir" value="${basedir}/target"/>
+        <property name="classes.dir" value="${build.dir}/classes"/>
+        <property name="jar.name" value="jpa"/>
+        <tstamp/>
     </target>
-    <target name="clean">
-        <delete dir="bin"/>
+
+    <!-- CLEAN TARGET -->
+    <target name="clean" depends="init">
+        <delete dir="${build.dir}"/>
     </target>
-    <target depends="clean" name="cleanall"/>
-    <target depends="build-subprojects,build-project" name="build"/>
-    <target name="build-subprojects"/>
-    <target depends="init" name="build-project">
+
+    <!-- COMPILE TARGET -->
+    <target name="compile" depends="init,clean">
+        <mkdir dir="${classes.dir}"/>
         <echo message="${ant.project.name}: ${ant.file}"/>
-        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
+        <javac debug="true" debuglevel="${debuglevel}" destdir="${classes.dir}" source="${source}" target="${target}">
             <src path="src"/>
-            <classpath refid="javax.persistence.classpath"/>
         </javac>
     </target>
-    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects">
-        <ant antfile="${jpaap.location}/build.xml" inheritAll="false" target="clean"/>
-        <ant antfile="${jpaap.location}/build.xml" inheritAll="false" target="build"/>
-        <ant antfile="${test.location}/build.xml" inheritAll="false" target="clean"/>
-        <ant antfile="${test.location}/build.xml" inheritAll="false" target="build"/>
+
+
+    <!-- MAKE JAR TARGET -->
+    <target name="jar" depends="compile">
+        <jar basedir="${classes.dir}"
+             jarfile="${build.dir}/${jar.name}.jar"
+             includes="**/*.*">
+            <manifest>
+                <attribute name="Built-By" value="${user.name}"/>
+            </manifest>
+        </jar>
     </target>
 </project>


Property changes on: workspace/max/jpaap/jpaap
___________________________________________________________________
Name: svn:ignore
   - bin

   + bin
target


Deleted: workspace/max/jpaap/jpaap/build.properties
===================================================================
--- workspace/max/jpaap/jpaap/build.properties	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/jpaap/build.properties	2009-01-19 17:16:48 UTC (rev 13128)
@@ -1,4 +0,0 @@
-source.jpaap.jar = src/
-bin.includes = META-INF/,\
-               jpaap.jar
-source.jpaap.jar = src/

Modified: workspace/max/jpaap/jpaap/build.xml
===================================================================
--- workspace/max/jpaap/jpaap/build.xml	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/jpaap/build.xml	2009-01-19 17:16:48 UTC (rev 13128)
@@ -1,53 +1,58 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- WARNING: Eclipse auto-generated file.
-              Any modifications will be overwritten.
-              To include a user specific buildfile here, simply create one in the same
-              directory with the processing instruction <?eclipse.ant.import?>
-              as the first entry and export the buildfile again. -->
-<project basedir="." default="build" name="jpaap">
-    <property environment="env"/>
-    <property name="test.location" value="../test"/>
-    <property name="javax.persistence.location" value="../javax.persistence"/>
-    <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.6"/>
-    <property name="source" value="1.6"/>
-    <path id="Plug-in Dependencies.libraryclasspath"/>
-    <path id="javax.persistence.classpath">
-        <pathelement location="${javax.persistence.location}/classes"/>
-        <pathelement location="${javax.persistence.location}/bin"/>
-        <path refid="Plug-in Dependencies.libraryclasspath"/>
-    </path>
-    <path id="jpaap.classpath">
-        <pathelement location="bin"/>
-        <path refid="Plug-in Dependencies.libraryclasspath"/>
-        <path refid="javax.persistence.classpath"/>
-    </path>
+
+
+<project name="Persistence Annotation Processor" default="jar" basedir=".">
+
     <target name="init">
-        <mkdir dir="bin"/>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="src" excludes="**/*.launch, **/*.java"/>
-        </copy>
+        <property name="debuglevel" value="source,lines,vars"/>
+        <property name="target" value="1.6"/>
+        <property name="source" value="1.6"/>
+        <property name="src.dir" value="${basedir}/src"/>
+        <property name="build.dir" value="${basedir}/target"/>
+        <property name="classes.dir" value="${build.dir}/classes"/>
+        <property name="jar.name" value="jpaap"/>
+        <tstamp/>
+        <condition property="persistence.available">
+            <available classname="javax.persistence.spi.PersistenceProvider"/>
+        </condition>
+        <path id="lib.path">
+          <fileset dir="${basedir}/../javax.persistence/target">
+            <include name="**/*.jar"/>
+          </fileset>
+        </path>
     </target>
-    <target name="clean">
-        <delete dir="bin"/>
+
+    <!-- CLEAN TARGET -->
+    <target name="clean" depends="init">
+        <delete dir="${build.dir}"/>
     </target>
-    <target depends="clean" name="cleanall">
-        <ant antfile="${javax.persistence.location}/build.xml" inheritAll="false" target="clean"/>
+
+   <!-- COMPILE TARGET -->
+    <target name="compile-dependend" unless="${persistence.available}">
+        <ant dir="../javax.persistence" inheritall="false"/>        
     </target>
-    <target depends="build-subprojects,build-project" name="build"/>
-    <target name="build-subprojects">
-        <ant antfile="${javax.persistence.location}/build.xml" inheritAll="false" target="build-project"/>
-    </target>
-    <target depends="init" name="build-project">
+
+    <!-- COMPILE TARGET -->
+    <target name="compile" depends="init,compile-dependend">
+        <mkdir dir="${classes.dir}"/>
         <echo message="${ant.project.name}: ${ant.file}"/>
-        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
-        	<compilerarg value="-proc:none"/>
-            <src path="src"/>
-            <classpath refid="jpaap.classpath"/>
+        <javac debug="true" debuglevel="${debuglevel}" destdir="${classes.dir}" source="${source}" target="${target}">
+            <src path="${src.dir}"/>
+            <classpath refid="lib.path"/>
         </javac>
+        <copy todir="${classes.dir}/META-INF">
+          <fileset dir="${src.dir}/META-INF"/>
+        </copy>
     </target>
-    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects">
-        <ant antfile="${test.location}/build.xml" inheritAll="false" target="clean"/>
-        <ant antfile="${test.location}/build.xml" inheritAll="false" target="build"/>
+
+    <!-- MAKE JAR TARGET -->
+    <target name="jar" depends="compile">
+        <jar basedir="${classes.dir}"
+             jarfile="${build.dir}/${jar.name}.jar"
+             includes="**/*.*">
+            <manifest>
+                <attribute name="Built-By" value="${user.name}"/>
+            </manifest>
+        </jar>
     </target>
 </project>

Deleted: workspace/max/jpaap/jpaap/jpaap.jar
===================================================================
(Binary files differ)

Modified: workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/MetaEntity.java
===================================================================
--- workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/MetaEntity.java	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/MetaEntity.java	2009-01-19 17:16:48 UTC (rev 13128)
@@ -23,202 +23,195 @@
 
 public class MetaEntity implements ImportContext {
 
-	final TypeElement element;
-	final protected ProcessingEnvironment pe;
+    final TypeElement element;
+    final protected ProcessingEnvironment pe;
 
-	final ImportContext importContext;
-	
-	public MetaEntity(ProcessingEnvironment pe, TypeElement element) {
-		this.element = element;
-		this.pe = pe;
-		importContext = new ImportContextImpl(getPackageName().toString());
-	}
+    final ImportContext importContext;
 
-	public Name getSimpleName() {
-		return element.getSimpleName();
-	}
+    public MetaEntity(ProcessingEnvironment pe, TypeElement element) {
+        this.element = element;
+        this.pe = pe;
+        importContext = new ImportContextImpl(getPackageName().toString());
+    }
 
-	public Element getOriginalElement() {
-		return element;
-	}
+    public Name getSimpleName() {
+        return element.getSimpleName();
+    }
 
-	public Name getQualifiedName() {
-		return element.getQualifiedName();
-	}
+    public Element getOriginalElement() {
+        return element;
+    }
 
-	public Name getPackageName() {
-		PackageElement packageOf = pe.getElementUtils().getPackageOf(element);
-		return pe.getElementUtils().getName(packageOf.getQualifiedName() + ".metamodel");		
-	}
+    public Name getQualifiedName() {
+        return element.getQualifiedName();
+    }
 
-	public List<MetaMember> getMembers() {
-		
-		List<MetaMember> members = new ArrayList<MetaMember>();
-		
-		if(useFields()) {
-					
-			List<? extends Element> myMembers = ElementFilter.fieldsIn(element.getEnclosedElements());
-		
-			System.out.println("Scanning " + myMembers.size() + " field s for " + element.toString());
-		
-			for (Element mymember : myMembers) {
+    public Name getPackageName() {
+        PackageElement packageOf = pe.getElementUtils().getPackageOf(element);
+        return pe.getElementUtils().getName(packageOf.getQualifiedName() + ".metamodel");
+    }
 
-					MetaMember result = mymember.asType().accept(new TypeVisitor(this), mymember);
-					if(result!=null) {
-						members.add(result);
-					} else {
-						pe.getMessager().printMessage(Kind.WARNING, "Could not find valid info for JPA property", mymember);
-					}
-			}
-			
-		} else {
+    public List<MetaMember> getMembers() {
 
-			
-			List<? extends Element> myMembers = ElementFilter.methodsIn(element.getEnclosedElements());
+        List<MetaMember> members = new ArrayList<MetaMember>();
 
-			System.out.println("Scanning " + myMembers.size() + " methods for " + element.toString());		
-			for (Element mymember : myMembers) {
+        if (useFields()) {
 
-					MetaMember result = mymember.asType().accept(new TypeVisitor(this), mymember);
-					if(result!=null) {
-						members.add(result);
-					} else {
-						//pe.getMessager().printMessage(Kind.WARNING, "Not a valid JPA property", mymember);
-					}
-			}
-			
-		}
+            List<? extends Element> myMembers = ElementFilter.fieldsIn(element.getEnclosedElements());
 
-		if(members.size()==0) {
-				pe.getMessager().printMessage(Kind.WARNING, "No properties found on " + element, element);
-			}
-		return members;
-	}
+            System.out.println("Scanning " + myMembers.size() + " field s for " + element.toString());
 
-	
-	//TODO: Find more efficient way to identify wether we should use fields or properties
-	private boolean useFields() {
-		List<? extends Element> myMembers = element.getEnclosedElements();
-		for (Element element : myMembers) {
-			List<? extends AnnotationMirror> entityAnnotations =
-	            pe.getElementUtils().getAllAnnotationMirrors(element);
-			
-			for (Iterator<?> iterator = entityAnnotations.iterator(); iterator
-					.hasNext();) {
-				AnnotationMirror annotationMirror = (AnnotationMirror) iterator
-						.next();
-				
-				 final String annotationType = annotationMirror.getAnnotationType().toString();
+            for (Element mymember : myMembers) {
 
-		            if ( annotationType.equals(javax.persistence.Id.class.getName()) ||
-		            	annotationType.equals(javax.persistence.EmbeddedId.class.getName()))
-		            {
-		               if(element.getKind()==ElementKind.FIELD) {
-		            	   return true;
-		               } 
-		            }
-			}
-		}
-		
-		return false;
-	}
-	
-	
+                MetaMember result = mymember.asType().accept(new TypeVisitor(this), mymember);
+                if (result != null) {
+                    members.add(result);
+                } else {
+                    pe.getMessager().printMessage(Kind.WARNING, "Could not find valid info for JPA property", mymember);
+                }
+            }
 
-	static Map<String, String> COLLECTIONS = new HashMap<String, String>();
-	static {
-		COLLECTIONS.put("java.util.Collection", "javax.jpa.metamodel.Collection");
-		COLLECTIONS.put("java.util.Set", "javax.jpa.metamodel.Set");
-		COLLECTIONS.put("java.util.List", "javax.jpa.metamodel.List");
-		COLLECTIONS.put("java.util.Map", "javax.jpa.metamodel.Map");			
-	}
-	
-	class TypeVisitor extends SimpleTypeVisitor6<MetaMember, Element> {
-		
-		MetaEntity parent;
-		
-		TypeVisitor(MetaEntity parent) {
-			this.parent = parent;						
-		}
-		
-		@Override
-		protected MetaMember defaultAction(TypeMirror e, Element p) {
-			//System.out.println("Default action for: " + e + " on " + p);
-			//new Exception().printStackTrace();
-			return super.defaultAction(e, p);
-		}
-		@Override
-		public MetaMember visitPrimitive(PrimitiveType t, Element p) {
-			return new MetaAttribute(parent, p, TypeUtils.toTypeString(t));
-		}
-		
-		
+        } else {
 
-		@Override
-		public MetaMember visitDeclared(DeclaredType t, Element p) {
-			TypeElement e = (TypeElement) pe.getTypeUtils().asElement(t);
-			
-			String collection = COLLECTIONS.get(e.getQualifiedName().toString()); // WARNING: .toString() is necessary here since Name equals does not compare to String
-			if(collection!=null) {
-				if(collection.equals("javax.jpa.metamodel.Map")) {
-					return new MetaMap(parent, p, collection, getKeyType(t), getElementType(t));
-				} else {
-					return new MetaCollection(parent, p, collection, getElementType(t));
-				}
-			} else {
-				return new MetaAttribute(parent, p, e.getQualifiedName().toString());
-			}
-		}
-		
-		
-		
-		@Override
-		public MetaMember visitExecutable(ExecutableType t, Element p) {
-			String string = p.getSimpleName().toString();
 
-			// TODO: implement proper property get/is/boolean detection
-			if(string.startsWith("get") || string.startsWith("is")) {
-				TypeMirror returnType = t.getReturnType();
+            List<? extends Element> myMembers = ElementFilter.methodsIn(element.getEnclosedElements());
 
-				return returnType.accept(this, p);		
-			} else {
-				return null;
-			}
-		}
-	}
+            System.out.println("Scanning " + myMembers.size() + " methods for " + element.toString());
+            for (Element mymember : myMembers) {
 
-	@Override
-	public String generateImports() {
-		return importContext.generateImports();
-	}
+                MetaMember result = mymember.asType().accept(new TypeVisitor(this), mymember);
+                if (result != null) {
+                    members.add(result);
+                } else {
+                    //pe.getMessager().printMessage(Kind.WARNING, "Not a valid JPA property", mymember);
+                }
+            }
 
-	@Override
-	public String importType(String fqcn) {
-		return importContext.importType(fqcn);
-	}
+        }
 
-	@Override
-	public String staticImport(String fqcn, String member) {
-		return importContext.staticImport(fqcn, member);
-	}
+        if (members.size() == 0) {
+            pe.getMessager().printMessage(Kind.WARNING, "No properties found on " + element, element);
+        }
+        return members;
+    }
 
-	public String importType(Name qualifiedName) {
-		return importType(qualifiedName.toString());
-	}
 
-	private String getKeyType(DeclaredType t) {
-			System.out.println("key type" + t);
-			return t.getTypeArguments().get(0).toString();
-	}
+    //TODO: Find more efficient way to identify wether we should use fields or properties
+    private boolean useFields() {
+        List<? extends Element> myMembers = element.getEnclosedElements();
+        for (Element element : myMembers) {
+            List<? extends AnnotationMirror> entityAnnotations =
+                    pe.getElementUtils().getAllAnnotationMirrors(element);
 
-      
-   private String getElementType(DeclaredType declaredType) {
-   	if(declaredType.getTypeArguments().size()==1) {
-	   return declaredType.getTypeArguments().get(0).toString();
-	} else {
-		return declaredType.getTypeArguments().get(1).toString();
-	}
-   }
+            for (Iterator<?> iterator = entityAnnotations.iterator(); iterator
+                    .hasNext();) {
+                AnnotationMirror annotationMirror = (AnnotationMirror) iterator
+                        .next();
 
-   
+                final String annotationType = annotationMirror.getAnnotationType().toString();
+
+                if (annotationType.equals(javax.persistence.Id.class.getName()) ||
+                        annotationType.equals(javax.persistence.EmbeddedId.class.getName())) {
+                    if (element.getKind() == ElementKind.FIELD) {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
+
+    static Map<String, String> COLLECTIONS = new HashMap<String, String>();
+
+    static {
+        COLLECTIONS.put("java.util.Collection", "javax.jpa.metamodel.Collection");
+        COLLECTIONS.put("java.util.Set", "javax.jpa.metamodel.Set");
+        COLLECTIONS.put("java.util.List", "javax.jpa.metamodel.List");
+        COLLECTIONS.put("java.util.Map", "javax.jpa.metamodel.Map");
+    }
+
+    class TypeVisitor extends SimpleTypeVisitor6<MetaMember, Element> {
+
+        MetaEntity parent;
+
+        TypeVisitor(MetaEntity parent) {
+            this.parent = parent;
+        }
+
+        @Override
+        protected MetaMember defaultAction(TypeMirror e, Element p) {
+            //System.out.println("Default action for: " + e + " on " + p);
+            //new Exception().printStackTrace();
+            return super.defaultAction(e, p);
+        }
+
+        @Override
+        public MetaMember visitPrimitive(PrimitiveType t, Element p) {
+            return new MetaAttribute(parent, p, TypeUtils.toTypeString(t));
+        }
+
+
+        @Override
+        public MetaMember visitDeclared(DeclaredType t, Element p) {
+            TypeElement e = (TypeElement) pe.getTypeUtils().asElement(t);
+
+            String collection = COLLECTIONS.get(e.getQualifiedName().toString()); // WARNING: .toString() is necessary here since Name equals does not compare to String
+            if (collection != null) {
+                if (collection.equals("javax.jpa.metamodel.Map")) {
+                    return new MetaMap(parent, p, collection, getKeyType(t), getElementType(t));
+                } else {
+                    return new MetaCollection(parent, p, collection, getElementType(t));
+                }
+            } else {
+                return new MetaAttribute(parent, p, e.getQualifiedName().toString());
+            }
+        }
+
+
+        @Override
+        public MetaMember visitExecutable(ExecutableType t, Element p) {
+            String string = p.getSimpleName().toString();
+
+            // TODO: implement proper property get/is/boolean detection
+            if (string.startsWith("get") || string.startsWith("is")) {
+                TypeMirror returnType = t.getReturnType();
+
+                return returnType.accept(this, p);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    public String generateImports() {
+        return importContext.generateImports();
+    }
+
+    public String importType(String fqcn) {
+        return importContext.importType(fqcn);
+    }
+
+    public String staticImport(String fqcn, String member) {
+        return importContext.staticImport(fqcn, member);
+    }
+
+    public String importType(Name qualifiedName) {
+        return importType(qualifiedName.toString());
+    }
+
+    private String getKeyType(DeclaredType t) {
+        System.out.println("key type" + t);
+        return t.getTypeArguments().get(0).toString();
+    }
+
+
+    private String getElementType(DeclaredType declaredType) {
+        if (declaredType.getTypeArguments().size() == 1) {
+            return declaredType.getTypeArguments().get(0).toString();
+        } else {
+            return declaredType.getTypeArguments().get(1).toString();
+        }
+    }
 }


Property changes on: workspace/max/jpaap/test
___________________________________________________________________
Name: svn:ignore
   - build
bin

   + build
bin
target


Modified: workspace/max/jpaap/test/build.xml
===================================================================
--- workspace/max/jpaap/test/build.xml	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/test/build.xml	2009-01-19 17:16:48 UTC (rev 13128)
@@ -1,73 +1,68 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- WARNING: Eclipse auto-generated file.
-              Any modifications will be overwritten.
-              To include a user specific buildfile here, simply create one in the same
-              directory with the processing instruction <?eclipse.ant.import?>
-              as the first entry and export the buildfile again. -->
-<project basedir="." default="build" name="test">
-    <property environment="env"/>
-    <property name="javax.persistence.location" value="../javax.persistence"/>
-    <property name="jpaap.location" value="../jpaap"/>
-    <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.6"/>
-    <property name="source" value="1.6"/>
-    <path id="Plug-in Dependencies.libraryclasspath"/>
-    <path id="javax.persistence.classpath">
-        <pathelement location="${javax.persistence.location}/classes"/>
-        <pathelement location="${javax.persistence.location}/bin"/>
-        <path refid="Plug-in Dependencies.libraryclasspath"/>
-    </path>
-    <path id="jpaap.classpath">
-        <pathelement location="${jpaap.location}/bin"/>
-        <path refid="Plug-in Dependencies.libraryclasspath"/>
-        <path refid="javax.persistence.classpath"/>
-    </path>
-    <path id="test.classpath">
-        <pathelement location="bin"/>
-        <path refid="javax.persistence.classpath"/>
-        <path refid="jpaap.classpath"/>
-    </path>
+<project name="Test JPA2 Project" default="jar" basedir=".">
+
     <target name="init">
-        <mkdir dir="bin"/>
-    	<mkdir dir="build/classes"/>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="build/classes" excludes="**/*.launch, **/*.java"/>
-        </copy>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="src" excludes="**/*.launch, **/*.java"/>
-        </copy>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="gen-src" excludes="**/*.launch, **/*.java"/>
-        </copy>
+        <property name="debuglevel" value="source,lines,vars"/>
+        <property name="target" value="1.6"/>
+        <property name="source" value="1.6"/>
+        <property name="src.dir" value="${basedir}/src"/>
+        <property name="build.dir" value="${basedir}/target"/>
+        <property name="gen.dir" value="${build.dir}/gen-src"/>
+        <property name="classes.dir" value="${build.dir}/classes"/>
+        <property name="jar.name" value="jpaap"/>
+        <tstamp/>
+        <condition property="jpaap.available">
+            <available classname="org.jboss.jpa.metamodel.ap.JPAMetaModelEntityProcessor"/>
+        </condition>
+        <path id="lib.path">
+            <pathelement location="${classes.dir}"/>
+            <fileset dir="${basedir}/../javax.persistence/target">
+                <include name="**/*.jar"/>
+            </fileset>
+            <fileset dir="${basedir}/../jpaap/target">
+                <include name="**/*.jar"/>
+            </fileset>
+        </path>
     </target>
-    <target name="clean">
-        <delete dir="bin"/>
+
+    <!-- CLEAN TARGET -->
+    <target name="clean" depends="init">
+        <delete dir="${build.dir}"/>
     </target>
-    <target depends="clean" name="cleanall">
-        <ant antfile="${javax.persistence.location}/build.xml" inheritAll="false" target="clean"/>
-        <ant antfile="${jpaap.location}/build.xml" inheritAll="false" target="clean"/>
+
+    <target name="clean-all" depends="init">
+        <delete dir="${build.dir}"/>
+        <ant dir="../javax.persistence" inheritall="false" target="clean"/>
+        <ant dir="../jpaap" inheritall="false" target="clean"/>
     </target>
-    <target depends="build-subprojects,build-project" name="build"/>
-    <target name="build-subprojects">
-        <ant antfile="${javax.persistence.location}/build.xml" inheritAll="false" target="build-project"/>
-        <ant antfile="${jpaap.location}/build.xml" inheritAll="false" target="build-project"/>
+
+    <!-- COMPILE TARGET -->
+    <target name="compile-dependend" unless="${jpaap.available}">
+        <ant dir="../jpaap" inheritall="false"/>
     </target>
-    <target depends="init" name="build-project">
+
+    <!-- COMPILE TARGET -->
+    <target name="compile" depends="init,compile-dependend">
+        <mkdir dir="${classes.dir}"/>
+        <mkdir dir="${gen.dir}"/>
         <echo message="${ant.project.name}: ${ant.file}"/>
-    	 <mkdir dir="build/classes" />
-    		
-        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
-            <src path="build/classes"/>
-            <classpath refid="test.classpath"/>
+        <javac debug="true" debuglevel="${debuglevel}" destdir="${classes.dir}" source="${source}" target="${target}">
+            <src path="${src.dir}"/>
+            <classpath refid="lib.path"/>
         </javac>
-        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
-            <src path="src"/>
-            <classpath refid="test.classpath"/>
-        </javac>
-        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
-            <src path="gen-src"/>
-            <classpath refid="test.classpath"/>
-        </javac>
     </target>
-    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
+
+    <!-- MAKE JAR TARGET -->
+    <target name="jar" depends="compile">
+        <jar basedir="${classes.dir}"
+             jarfile="${build.dir}/${jar.name}.jar"
+             includes="**/*.*">
+            <manifest>
+                <attribute name="Built-By" value="${user.name}"/>
+            </manifest>
+        </jar>
+    </target>
 </project>
+
+
+

Deleted: workspace/max/jpaap/test/jpa-build.xml
===================================================================
--- workspace/max/jpaap/test/jpa-build.xml	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/test/jpa-build.xml	2009-01-19 17:16:48 UTC (rev 13128)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project basedir="." default="build" name="jpa-test">
-    <import file="build.xml"/>
-    	
-	
-	
-    <target depends="init" name="build-project">
-        <echo message="${ant.project.name}: ${ant.file}"/>
-    	<!-- Remove this delete to have the processor only generated for changed files --> 
-    	<delete dir="build/classes" />
-    	<mkdir dir="build/classes"/>
-    	
-    	
-        <javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" source="${source}" target="${target}">
-<!--        	<compilerarg value="-XprintProcessorInfo" />
-        	<compilerarg value="-XprintRounds" /> -->
-        	
-            <src path="src"/>
-            	
-            <classpath refid="test.classpath"/>
-        </javac>
-    </target>
-    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
-	
-	
-</project>

Modified: workspace/max/jpaap/test/readme.txt
===================================================================
--- workspace/max/jpaap/test/readme.txt	2009-01-19 17:13:50 UTC (rev 13127)
+++ workspace/max/jpaap/test/readme.txt	2009-01-19 17:16:48 UTC (rev 13128)
@@ -2,9 +2,9 @@
 
 src/ contains code that uses the Criteria API and depends on a metamodel to be generated. Without it there will be compile errors.
 
-jpa-build.xml - Ant file that compiles via javac src/ with jpaap.jar on classpath resulting in generation of metamodel into build/classes 
+build.xml - Ant file that compiles via javac src/ with jpaap.jar on classpath resulting in generation of metamodel into build/classes
 
-gen-src/ will be created if you enable APT processing in Eclipse
+/target/gen-src/ will be created if you enable APT processing
 
 goal/ example of what should be generated
 




More information about the jbosstools-commits mailing list