db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb build.xml
Date Mon, 22 Nov 2004 09:04:12 GMT
tomdz       2004/11/22 01:04:12

  Modified:    src/ojb-blank Tag: OJB_1_0_RELEASE .classpath
                        build.properties build.xml
               .        Tag: OJB_1_0_RELEASE build.xml
  Added:       src/ojb-blank/src/resources Tag: OJB_1_0_RELEASE run.sh
                        run.bat
  Log:
  Simplified ojb-blank a bit and added batch/shell-skript generation to it
  Changed ojb-quickstart to generate a quickstart archive for tutorial 1 using ojb-blank
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.2.2.1   +1 -1      db-ojb/src/ojb-blank/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ojb-blank/.classpath,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- .classpath	26 Jun 2004 12:40:13 -0000	1.2
  +++ .classpath	22 Nov 2004 09:04:09 -0000	1.2.2.1
  @@ -11,5 +11,5 @@
   	<classpathentry kind="lib" path="lib/db-ojb-1.0.0.jar"/>
   	<classpathentry kind="lib" path="lib/hsqldb.jar"/>
   	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  -	<classpathentry kind="output" path="build/classes"/>
  +	<classpathentry kind="output" path="build"/>
   </classpath>
  
  
  
  1.3.2.1   +11 -9     db-ojb/src/ojb-blank/build.properties
  
  Index: build.properties
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ojb-blank/build.properties,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- build.properties	22 Jun 2004 19:10:49 -0000	1.3
  +++ build.properties	22 Nov 2004 09:04:09 -0000	1.3.2.1
  @@ -18,7 +18,7 @@
   # These are build properties for the ojb-blank project. In addition to
   # any customization of your build process, you will probably want
   # to change the values in the block below to map to your database
  -# rather than a generic HSQLDB instance.
  +# rather than to a generic HSQLDB instance.
   #
   jcdAlias=default
   databaseName=ojb_blank
  @@ -51,20 +51,24 @@
   # For instance, MySQL requires an url that points to the host, but without a database name
   #
   # For Hsqldb we have to mangle the path so that we can invoke Torque in the base
  -# directory but the database is created in the ${build.resource.dir} folder
  -torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${build.resource.dir}${urlDbalias}
  +# directory but the database is created in the ${build.dir} folder
  +torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${build.dir}/${urlDbalias}
   
   # This specifies the url that Torque uses to access the existing database
   #
   # For Hsqldb we use the same url as for the createUrl above
  -torque.database.buildUrl=${urlProtocol}:${urlSubprotocol}:${build.resource.dir}${urlDbalias}
  +torque.database.buildUrl=${torque.database.createUrl}
   
   
  -# Set this to the name of the jar file you want produced from the jar target
  +# Set this to the name of the jar file you want produced from the dist target
   jar.name=my-project.jar
   
  +# This is the class containing the main method. Set this so that an executable jar and
  +# appropriate batch/shell skripts can be automatically generated for you.
  +source.main.class=org.apache.ojb.tutorial1.Application
  +
   ################################################################################
  -# Build Properties
  +# Build Properties - you shouldn't have to change anything here
   #
   source.dir=src
   source.java.dir=${source.dir}/java
  @@ -73,8 +77,6 @@
   source.schema.dir=${source.dir}/schema
   
   build.dir=build
  -build.lib.dir=lib
  -build.classes.dir=${build.dir}/classes/
  -build.resource.dir=${build.dir}/resources/
  +lib.dir=lib
   
   target.dir=target
  
  
  
  1.5.2.2   +76 -42    db-ojb/src/ojb-blank/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/ojb-blank/build.xml,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- build.xml	12 Aug 2004 19:04:23 -0000	1.5.2.1
  +++ build.xml	22 Nov 2004 09:04:09 -0000	1.5.2.2
  @@ -20,7 +20,7 @@
           and lib/*.jar to a classpath and run the project.
   
           The default "build" target will build everything and copy src/resources/*
  -        over to build/resources. Class files will wind up in build/classes
  +        over to build. Class files will also wind up in build.
   
           The "jar" target kindly jars things up for you.
   
  @@ -37,16 +37,18 @@
       <property file="build.properties"/>
   
       <path id="compile-classpath">
  -        <fileset dir="${build.lib.dir}">
  +        <fileset dir="${lib.dir}">
               <include name="**/*.jar"/>
           </fileset>
       </path>
   
       <path id="runtime-classpath">
  -        <fileset dir="${build.lib.dir}">
  -            <include name="**/*.jar"/>
  +        <fileset dir="${lib.dir}">
  +            <exclude name="xdoclet*.jar"/>
  +            <exclude name="xjavadoc*.jar"/>
  +            <exclude name="torque*.jar"/>
  +            <exclude name="velocity*.jar"/>
           </fileset>
  -        <pathelement location="${build.classes.dir}"/>
       </path>
   
       <!-- ================================================================== -->
  @@ -55,17 +57,38 @@
       <target name="compile">
           <tstamp/>
           <mkdir dir="${build.dir}"/>
  -        <mkdir dir="${build.classes.dir}"/>
  -        <javac srcdir="${source.java.dir}" destdir="${build.classes.dir}">
  +        <javac srcdir="${source.java.dir}" destdir="${build.dir}">
               <classpath refid="compile-classpath"/>
           </javac>
       </target>
   
       <!-- ================================================================== -->
  +    <!-- Creates repository_user.xml and project-schema.xml from the source -->
  +    <!-- ================================================================== -->
  +    <target name="xdoclet" depends="compile">
  +        <taskdef name="ojbdoclet"
  +                 classname="xdoclet.modules.ojb.OjbDocletTask">
  +            <classpath>
  +                <path refid="compile-classpath"/>
  +                <pathelement path="${build.dir}"/>
  +            </classpath>
  +        </taskdef>
  +
  +        <ojbdoclet destdir=".">
  +            <fileset dir="${source.java.dir}"/>
  +
  +            <ojbrepository destinationFile="${build.dir}/repository_user.xml"/>
  +            <torqueschema databaseName="${databaseName}"
  +                          dtdUrl="http://db.apache.org/torque/dtd/database_3_0_1.dtd"
  +                          destinationFile="${build.dir}/project-schema.xml"/>
  +        </ojbdoclet>
  +    </target>
  +
  +    <!-- ================================================================== -->
       <!-- Builds the project and preprocesses the configuration files        -->
       <!-- ================================================================== -->
  -    <target name="build" depends="compile">
  -        <copy todir="${build.resource.dir}/">
  +    <target name="build" depends="xdoclet">
  +        <copy todir="${build.dir}/">
               <fileset dir="${source.resource.dir}">
                   <include name="*.properties"/>
                   <include name="*.dtd"/>
  @@ -84,38 +107,49 @@
                   <filter token="USER_PASSWD" value="${databasePassword}"/>
               </filterset>
           </copy>
  +        <copy todir="${build.dir}">
  +            <fileset dir="${lib.dir}">
  +                <exclude name="xdoclet*.jar"/>
  +                <exclude name="xjavadoc*.jar"/>
  +                <exclude name="torque*.jar"/>
  +                <exclude name="velocity*.jar"/>
  +            </fileset>
  +        </copy>
  +        <antcall target="build_if_with_mainclass"/>
       </target>
   
  -    <!-- ================================================================== -->
  -    <!-- Creates repository_user.xml and project-schema.xml from the source -->
  -    <!-- ================================================================== -->
  -    <target name="xdoclet" depends="compile">
  -        <taskdef name="ojbdoclet"
  -                 classname="xdoclet.modules.ojb.OjbDocletTask"
  -                 classpathref="runtime-classpath"/>
  -
  -        <ojbdoclet destdir=".">
  -            <fileset dir="${source.java.dir}"/>
  -
  -            <ojbrepository destinationFile="${build.resource.dir}/repository_user.xml"/>
  -            <torqueschema databaseName="${databaseName}"
  -                          dtdUrl="http://db.apache.org/torque/dtd/database_3_0_1.dtd"
  -                          destinationFile="${build.resource.dir}/project-schema.xml"/>
  -        </ojbdoclet>
  +    <target name="build_if_with_mainclass" if="source.main.class">
  +        <pathconvert targetos="unix" property="script.classpath.unix" refid="runtime-classpath">
  +            <map from="${basedir}/${lib.dir}" to="."/>
  +        </pathconvert>
  +        <pathconvert targetos="windows" property="script.classpath.windows" refid="runtime-classpath">
  +            <map from="${basedir}\${lib.dir}" to="."/>
  +        </pathconvert>
  +        <copy todir="${build.dir}">
  +            <fileset dir="${source.resource.dir}">
  +                <include name="*.bat"/>
  +                <include name="*.sh"/>
  +            </fileset>
  +            <filterset>
  +                <filter token="MAIN_CLASS" value="${source.main.class}"/>
  +                <filter token="CLASSPATH_UNIX" value="${script.classpath.unix}"/>
  +                <filter token="CLASSPATH_WINDOWS" value="${script.classpath.windows}"/>
  +            </filterset>
  +        </copy>
       </target>
   
       <!-- ================================================================== -->
       <!-- Sets the database up using the generated project schema            -->
       <!-- ================================================================== -->
  -    <target name="setup-db" depends="xdoclet">
  +    <target name="setup-db" depends="build">
           <property name="torque.buildFile"
                     value="${source.schema.dir}/build-torque.xml"/>
           <property name="torque.project"
                     value="${databaseName}"/>
           <property name="torque.schema.dir"
  -                  value="${build.resource.dir}"/>
  +                  value="${build.dir}"/>
           <property name="torque.output.dir"
  -                  value="${build.resource.dir}"/>
  +                  value="${build.dir}"/>
           <property name="torque.sql.dir"
                     value="${torque.output.dir}"/>
           <property name="torque.useClasspath"
  @@ -125,7 +159,7 @@
   
           <!-- We want Torque to also process the schema for OJB's internal tables.
                If you do not require them, put a comment around this copy task -->
  -        <copy todir="${build.resource.dir}">
  +        <copy todir="${build.dir}">
               <fileset dir="${source.schema.dir}" includes="*schema.xml"/>
               <filterset>
                   <filter token="DATABASE_DEFAULT" value="${databaseName}"/>
  @@ -150,23 +184,23 @@
       <!-- Cleans the project                                                 -->
       <!-- ================================================================== -->
       <target name="clean">
  -        <delete dir="target" quiet="true"/>
  -        <delete dir="build" quiet="true"/>
  -        <delete file="velocity.log"/>
  +        <delete dir="target" quiet="true" failonerror="false"/>
  +        <delete dir="build" quiet="true" failonerror="false"/>
  +        <delete file="velocity.log" quit="true" failonerror="false"/>
       </target>
   
       <!-- ================================================================== -->
  -    <!-- Creates a jar for the project                                      -->
  +    <!-- Creates a distribution jar for the project                         -->
       <!-- ================================================================== -->
  -    <target name="jar" depends="build">
  +    <target name="dist" depends="build">
           <mkdir dir="${target.dir}"/>
  -        <jar index="true" jarfile="${target.dir}/${jar.name}">
  -            <fileset dir="${build.classes.dir}/">
  -                <include name="**/*.class"/>
  -            </fileset>
  -            <fileset dir="${build.resource.dir}">
  -                <include name="**/*"/>
  -            </fileset>
  +        <jar index="true"
  +             jarfile="${target.dir}/${jar.name}"
  +             basedir="${build.dir}"
  +             excludes="*-schema.xml,*.sql,*.sql.generation,sqldb.map">
  +            <manifest>
  +                <attribute name="Built-By" value="Apache OJB Blank build script"/>
  +            </manifest>
           </jar>
       </target>
   
  @@ -185,7 +219,7 @@
                 failonerror="yes"
                 classname="com.sun.jdori.enhancer.Main"
                 classpathref="compile-classpath">
  -            <arg line="-v -f -d ${build.classes.dir} ${source.java.dir}/org/apache/ojb/tutorial5/Product.jdo
${build.classes.dir}/org/apache/ojb/tutorial5/Product.class"/>
  +            <arg line="-v -f -d ${build.dir} ${source.java.dir}/org/apache/ojb/tutorial5/Product.jdo
${build.dir}/org/apache/ojb/tutorial5/Product.class"/>
           </java>
       </target>
   </project>
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +2 -0      db-ojb/src/ojb-blank/src/resources/Attic/run.sh
  
  
  
  
  1.1.2.1   +3 -0      db-ojb/src/ojb-blank/src/resources/Attic/run.bat
  
  
  
  
  No                   revision
  No                   revision
  1.144.2.5 +40 -85    db-ojb/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/build.xml,v
  retrieving revision 1.144.2.4
  retrieving revision 1.144.2.5
  diff -u -r1.144.2.4 -r1.144.2.5
  --- build.xml	18 Nov 2004 19:11:11 -0000	1.144.2.4
  +++ build.xml	22 Nov 2004 09:04:10 -0000	1.144.2.5
  @@ -573,6 +573,11 @@
                   <include name="repository_database.xml" />
                   <include name="repository_internal.xml" />
               </fileset>
  +            <filterset>
  +                <filter token="VALIDATION_QUERY" value="${validationQuery}"/>
  +                <filter token="TEST_ON_BORROW" value="${testOnBorrow}"/>
  +                <filter token="TEST_ON_RETURN" value="${testOnReturn}"/>
  +            </filterset>
           </copy>
   
           <copy todir="${build.ojb-blank}">
  @@ -605,93 +610,43 @@
       </target>
   
       <!-- ================================================================== -->
  -    <!-- Build quickstart sample using hsqldb                               -->
  +    <!-- Build quickstart samples using hsqldb                              -->
       <!-- ================================================================== -->
  -    <target name="ojb-quickstart" depends="with-jdori, jar-debug, compile-samples, prepare-testdb"
  -            description="Build a sample project">
  -        <property name="build.ojb-quickstart" value="${build.dir}/ojb-quickstart"/>
  -
  -        <delete dir="${build.ojb-quickstart}" verbose="false"/>
  -        <mkdir dir="${build.ojb-quickstart}/lib"/>
  -        <mkdir dir="${build.ojb-quickstart}/database"/>
  -
  -	<!-- copy ojb-jars from dist -->
  -        <copy todir="${build.ojb-quickstart}/lib">
  -            <fileset dir="${dist}">
  -                <include name="${archive}.jar"/>
  -                <include name="${archive}-junit.jar"/>
  -            </fileset>
  -        </copy>
  -
  -	<!-- copy jars from lib -->
  -        <copy todir="${build.ojb-quickstart}/lib">
  -            <fileset dir="${lib}">
  -				<include name="antlr*.jar"/>
  -				<include name="commons*.jar"/>
  -                <include name="hsqldb*.jar"/>
  -                <include name="log4j*.jar"/>
  -            </fileset>
  -        </copy>
  -
  -	<!-- copy repository files, modifiy repository_database -->
  -	<copy todir="${build.ojb-quickstart}">
  -            <fileset dir="${src.test}/org/apache/ojb">
  -                <include name="OJB*.properties" />
  -                <include name="repository.dtd" />
  -                <include name="repository_database.xml" />
  -                <include name="repository_internal.xml" />
  +    <target name="ojb-quickstart"
  +            depends="with-jdori, ojb-blank"
  +            description="Build the sample projects for the tutorials">
  +        <mkdir dir="${build.dir}/ojb-quickstart"/>
  +        <property name="build.ojb-quickstart" value="${build.dir}/ojb-quickstart/ojb-blank"/>
  +
  +        <!-- We're using fresh ojb-blank's and copy the tutorial source into it
  +             to generate the quickstart apps -->
  +        <unjar src="${dist}/ojb-blank.jar" dest="${build.dir}/ojb-quickstart"/>
  +        <copy todir="${build.ojb-quickstart}/src/java">
  +            <fileset dir="${src.samples}">
  +                <include name="org/apache/ojb/tutorial1/**"/>
               </fileset>
  -            <filterset>
  -                <filter token="JCD_ALIAS" value="${jcdAlias}" />
  -                <filter token="DBMS_NAME" value="${dbmsName}" />
  -                <filter token="JDBC_LEVEL" value="${jdbcLevel}" />
  -                <filter token="DRIVER_NAME" value="${jdbcRuntimeDriver}" />
  -                <filter token="URL_PROTOCOL" value="${urlProtocol}" />
  -                <filter token="URL_SUBPROTOCOL" value="${urlSubprotocol}" />
  -                <filter token="URL_DBALIAS" value="database/OJB" />
  -                <filter token="USER_NAME" value="${databaseUser}" />
  -                <filter token="USER_PASSWD" value="${databasePassword}" />
  -                <filter token="VALIDATION_QUERY" value="${validationQuery}" />
  -                <filter token="TEST_ON_BORROW" value="${testOnBorrow}" />
  -                <filter token="TEST_ON_RETURN" value="${testOnReturn}" />
  -            </filterset>
  -        </copy>
  -
  -  		<!-- copy simple repository.xml from ojb-blank -->
  -        <copy todir="${build.ojb-quickstart}">
  -             <fileset dir="${src.ojb-blank}/src/resources">
  -                 <include name="repository.xml" />
  -             </fileset>
  -        </copy>
  -
  -        <!-- copy the sample repository_user and skripts -->
  -        <copy todir="${build.ojb-quickstart}">
  -             <fileset dir="${src.samples}">
  -                 <include name="repository_user.xml" />
  -                 <include name="tutorial*.*" />
  -             </fileset>
  -        </copy>
  -
  -		<!-- copy cp.bat from bin -->
  -        <copy todir="${build.ojb-quickstart}">
  -             <fileset dir="${basedir}/bin">
  -                 <include name="cp.bat" />
  -             </fileset>
  -        </copy>
  -
  -        <!-- copy the sample database -->
  -        <copy todir="${build.ojb-quickstart}/database">
  -             <fileset dir="${build.test}">
  -                 <include name="OJB.*" />
  -             </fileset>
  -        </copy>
  -
  -        <!-- copy the sample classes -->
  -        <copy todir="${build.ojb-quickstart}/classes">
  -             <fileset dir="${build.destsamples}">
  -                 <include name="**/*.class" />
  -             </fileset>
           </copy>
  +        <ant antfile="${build.ojb-quickstart}/build.xml"
  +             inheritall="false"
  +             dir="${build.ojb-quickstart}"
  +             target="setup-db">
  +            <property name="databaseName" value="tutorial1"/>
  +            <property name="jar.name" value="tutorial1.jar"/>
  +            <property name="source.main.class" value="org.apache.ojb.tutorial1.Application"/>
  +            <property name="target.dir" value="target"/>
  +            <property name="torque.database.createUrl" value="jdbc:hsqldb:${build.ojb-quickstart}/build/tutorial1"/>
  +        </ant>
  +        <ant antfile="${build.ojb-quickstart}/build.xml"
  +             inheritall="false"
  +             dir="${build.ojb-quickstart}"
  +             target="dist">
  +            <property name="databaseName" value="tutorial1"/>
  +            <property name="jar.name" value="tutorial1.jar"/>
  +            <property name="source.main.class" value="org.apache.ojb.tutorial1.Application"/>
  +            <property name="target.dir" value="target"/>
  +            <property name="torque.database.createUrl" value="jdbc:hsqldb:${build.ojb-quickstart}/build/tutorial1"/>
  +        </ant>
  +        <move file="${build.ojb-quickstart}/target/tutorial1.jar" tofile="${dist}/tutorial1-quickstart.jar"/>
   
       </target>
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message