You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tdk-dev@turbine.apache.org by jv...@apache.org on 2001/05/06 19:56:22 UTC

cvs commit: jakarta-turbine-tdk/src build.bat build.properties build.sh build.xml README_FIRST.txt newapp.bat newapp.props newapp.sh newapp.xml win98.sh

jvanzyl     01/05/06 10:56:22

  Modified:    src      README_FIRST.txt
  Added:       src      build.bat build.properties build.sh build.xml
  Removed:     src      newapp.bat newapp.props newapp.sh newapp.xml
                        win98.sh
  Log:
  - standardizing the build system to use build.xml and updating the
    docs to reflect the changes.
  
  Revision  Changes    Path
  1.5       +13 -3     jakarta-turbine-tdk/src/README_FIRST.txt
  
  Index: README_FIRST.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-tdk/src/README_FIRST.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- README_FIRST.txt	2001/04/08 00:41:11	1.4
  +++ README_FIRST.txt	2001/05/06 17:56:21	1.5
  @@ -1,8 +1,18 @@
   =============================================================================
  -Creating your first Turbine application
  +C R E A T I N G  T H E  S A M P L E  A P P L I C A T I O N
  +=============================================================================
  +For those of you who do not have an installed version of Ant,
  +use the scripts provided to build the sample application:
   
  -    Execute newapp.sh  <-- Unix
  -    Execute newapp.bat <-- Windows 
  +    Execute build.sh  <-- Unix
  +    Execute build.bat <-- Windows 
  +
  +If you have an installed version of Ant, you can just
  +type:
  +
  +    ant
  +
  +And the sample application will be assembled for you.
   
   Once the sample app is generated, follow the instructions to
   configure the sample application before attempting to run
  
  
  
  1.1                  jakarta-turbine-tdk/src/build.bat
  
  Index: build.bat
  ===================================================================
  @echo off
  REM ------------------------------------------
  REM  Script for creating Turbine applications.
  REM ------------------------------------------ 
  
  REM --------------------------------------------
  REM No need to edit anything past here
  REM --------------------------------------------
  set _BUILDFILE=%BUILDFILE%
  set BUILDFILE=newapp.xml
  
  :final
  
  set _CLASSPATH=%CLASSPATH%
  
  if "%JAVA_HOME%" == "" goto javahomeerror
  if exist %JAVA_HOME%\lib\tools.jar set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
  
  set CLASSPATH=%CLASSPATH%;.\lib\ant.jar
  set CLASSPATH=%CLASSPATH%;.\share\tdk-lib\xerces-1.3.0.jar
  
  %JAVA_HOME%\bin\java.exe -classpath "%CLASSPATH%" org.apache.tools.ant.Main %1% %2% %3% %4% 
  
  goto end
  
  REM -----------ERROR-------------
  :javahomeerror
  echo "ERROR: JAVA_HOME not found in your environment."
  echo "Please, set the JAVA_HOME variable in your environment to match the"
  echo "location of the Java Virtual Machine you want to use."
  
  :end
  set CLASSPATH=%_CLASSPATH%
  set _CLASSPATH=
  
  
  
  1.1                  jakarta-turbine-tdk/src/build.properties
  
  Index: build.properties
  ===================================================================
  # -------------------------------------------------------------------------
  # This is where you control the initial generation of a Turbine
  # webapp. 
  #
  # If you don't edit this file you will have the most basic webapp
  # generated for you. This may well be a good place to start because
  # you don't have to edit anything in this file and you won't require
  # any database connectivity. You can just run the newapp script to
  # try a Turbine webapp that has a few simple screens and actions.
  #
  # If you wish to do anything more complicated you will be required
  # to edit your project properties file after the webapp is generated
  # before it will work.
  # -------------------------------------------------------------------------
  
  turbine.app.name=newapp
  turbine.app.type=peer
  
  target.package=org.mycompany.newapp
  target.directory=org/mycompany/newapp
  
  
  
  1.1                  jakarta-turbine-tdk/src/build.sh
  
  Index: build.sh
  ===================================================================
  #!/bin/sh
  #------------------------------------------
  # Script for creating Turbine applications.
  #------------------------------------------ 
  
  #--------------------------------------------
  # No need to edit anything past here
  #--------------------------------------------
  if test -z "${JAVA_HOME}" ; then
      echo "ERROR: JAVA_HOME not found in your environment."
      echo "Please, set the JAVA_HOME variable in your environment to match the"
      echo "location of the Java Virtual Machine you want to use."
      exit
  fi
  
  if test -f ${JAVA_HOME}/lib/tools.jar ; then
      CLASSPATH="${CLASSPATH}:${JAVA_HOME}/lib/tools.jar"
  fi
  
  # convert the existing path to unix
  if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
     CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
  fi
  
  # Allow the names of the core jars required
  # for build to change over time without breaking
  # this script.
  
  for i in ./lib/ant*.jar
  do
      ANT_JAR=${ANT_JAR}:$i
  done
  
  XERCES_JAR=`ls ./share/tdk-lib/xerces*.jar`
  
  CLASSPATH=${CLASSPATH}:${ANT_JAR}
  CLASSPATH=${CLASSPATH}:${XERCES_JAR}
  
  # convert the unix path to windows
  if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
     CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  fi
  
  echo "Now building ${TARGET}..."
  
  ${JAVA_HOME}/bin/java -classpath ${CLASSPATH} org.apache.tools.ant.Main "$@"
  
  
  
  1.1                  jakarta-turbine-tdk/src/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- Build file for creating new applications with Turbine -->
  
  <project name="TDK" default="compile" basedir=".">
      
    <!-- Give user a chance to override without editing this file 
         (and without typing -D each time it compiles it -->
      
    <property file="${user.home}/.ant.properties" />
    <property file="build.properties"/>
    <property name="newapp" value="${turbine.app.name}"/>
    
    <property name="tomcat.home" value="."/>
    <property name="newapp.home" value="${tomcat.home}/webapps/${newapp}"/>
    <property name="newapp.logs" value="${newapp.home}/logs"/>
    <property name="ant.home" value="."/>
  
    <property name="debug" value="on"/>
    <property name="deprecation" value="on"/>
    <property name="optimize" value="off"/>
  
    <property name="turbine.app.view" value="velocity"/>
    <property name="turbine.app.type" value="peer"/>
  
    <!-- Build classpath -->
    <path id="classpath">
      <fileset dir="./share/tdk-lib">
        <include name="**/*.jar"/>
      </fileset>
      <fileset dir="./lib">
        <include name="**/*.jar"/>
      </fileset>
    </path>
  
    <!-- =================================================================== -->
    <!-- Prepares the application directory                                  -->
    <!-- =================================================================== -->
    <target name="prepare">
      <mkdir dir="${newapp.home}"/>
          
      <mkdir dir="${newapp.home}/logs"/>
      <mkdir dir="${newapp.home}/images"/>
      <mkdir dir="${newapp.home}/templates"/>
          
      <mkdir dir="${newapp.home}/WEB-INF/build"/>
      <mkdir dir="${newapp.home}/WEB-INF/classes"/>
      <mkdir dir="${newapp.home}/WEB-INF/conf"/>
      <mkdir dir="${newapp.home}/WEB-INF/lib"/>
      <mkdir dir="${newapp.home}/WEB-INF/src"/>
      
      <!-- 
          Create separate directories for the java source
          and the SQL source as we are creating quite a
          few source files now. This follows standard
          practice more closely anyway.
      -->
        
      <mkdir dir="${newapp.home}/WEB-INF/src/java"/>
      <mkdir dir="${newapp.home}/WEB-INF/src/sql"/>
          
      <tstamp/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Copies dependent files                                              -->
    <!-- =================================================================== -->
    <target name="gather" depends="prepare">
      
      <!-- Find and replace tokens -->	        
      <filter token="date" value="${TODAY}"/>
          
      <filter token="TOMCAT_HOME" value="${tomcat.home}"/>
      <filter token="NEWAPP" value="${newapp}"/>
      <filter token="PROJECT" value="${newapp}"/>
      <filter token="DATABASE" value="mysql"/>
      <filter token="TORQUE_HOME" value="."/>
      <filter token="TEMPLATE_PATH" value="bin/torque/templates"/>
      <filter token="OUTPUT_DIRECTORY" value="../src"/>
      <filter token="SCHEMA_DIRECTORY" value="project"/>
      <filter token="TARGET_PACKAGE" value="${target.package}"/>
  
      <!-- The newapp directories -->
      <property name="newapp.conf" value="${newapp.home}/WEB-INF/conf"/>
      <property name="newapp.db" value="${newapp.home}/WEB-INF/db"/>
      <property name="newapp.src" value="${newapp.home}/WEB-INF/src"/>
      <property name="newapp.lib" value="${newapp.home}/WEB-INF/lib"/>
      <property name="newapp.build" value="${newapp.home}/WEB-INF/build"/>
      <property name="newapp.project" value="${newapp.home}/WEB-INF/build/project"/>
      <property name="newapp.torque" value="${newapp.home}/WEB-INF/build/bin/torque"/>
  
      <!-- Copy the Torque config files -->
      <copy todir="${newapp.torque}" filtering="yes">
        <fileset dir="share/conf/torque">
          <exclude name="torque.sh"/>
          <exclude name="torque.xml"/>
          <exclude name="schema/**"/>
        </fileset>
      </copy>
  
      <copy todir="${newapp.home}/WEB-INF/build" filtering="yes">
        <fileset dir="share/common/build">
          <exclude name="**/lib/*"/>
        </fileset>
      </copy>
  
      <!-- Turn the filtering off for binary files because
           Ant takes a byte off the file. -->
           
      <copy todir="${newapp.home}/WEB-INF/build">
        <fileset dir="share/common/build">
          <include name="**/lib/*"/>
        </fileset>
      </copy>
  
      <!-- 
        Little hack to make the project schema come out
        with the name of the app provided.
      -->             
  
      <move 
        file="${newapp.project}/project-schema.xml"
        tofile="${newapp.project}/${newapp}-schema.xml"
      />
  
      <move 
        file="${newapp.project}/project.properties"
        tofile="${newapp.project}/${newapp}.properties"
      />
  
      <!-- Copy master schemas into the project directory -->
  
      <copy todir="${newapp.project}" filtering="yes">
        <fileset dir="share/conf/master">
          <include name="turbine-schema.xml"/>
          <include name="id-table-schema.xml"/>
        </fileset>
      </copy>
  
      <copy todir="${newapp.home}/WEB-INF/" filtering="yes">
        <fileset dir="share/common/">
          <include name="web.xml"/>
        </fileset>
      </copy>
  
      <!--
        Copy the files specific to the application type
        specified. But we can't copy the source files
        yet because we have to change them a bit first
        and create the directory structure that matches
        the selected target package.
      -->
          
      <copy todir="${newapp.home}" filtering="yes">
        <fileset dir="share/${turbine.app.view}/${turbine.app.type}">
          <exclude name="**/*.class"/>
          <exclude name="*/src"/>
          <exclude name="**/images"/>
        </fileset>
      </copy>
      
      <!-- 
          Filtering CANNOT be on for binary files or we end up
          gaining a byte in the transfer. All I know is
          that the original size of a binary file is increased
          one byte in size. I have reported this twice now
          to the Ant dev list and have never received a
          response so this is what we're doing.
      -->
      
      <copy todir="${newapp.home}/images">
        <fileset dir="share/${turbine.app.view}/${turbine.app.type}/images"/>
      </copy>
  
      <property 
        name="module.dir" 
        value="${newapp.src}/java/${target.directory}/modules"
      />
      <mkdir dir="${module.dir}"/>
  
      <copy todir="${module.dir}" filtering="yes">
        <fileset dir="share/${turbine.app.view}/${turbine.app.type}/WEB-INF/src"/>
      </copy>
  
      <!-- ================================================================= -->
      <!-- F L U X                                                           -->
      <!-- ================================================================= -->
      
      <copy todir="${newapp.src}/java">
        <fileset dir="share/flux/src/java"/>
      </copy>
  
      <copy todir="${newapp.home}/flux-templates">
        <fileset dir="share/flux/src/templates"/>
      </copy>
  
      <copy file="share/flux/conf/Flux.properties" todir="${newapp.conf}"/>
  
      <property name="flux.modules" value="org.apache.turbine.flux.modules"/>
  
      <!-- ================================================================= -->
      <!-- T U R B I N E  R E S O U R C E S  P R O P E R T I E S             -->
      <!-- ================================================================= -->
  
      <!--
        This will dynamically generate the correct
        TurbineResources.properties file for this web
        application.
      -->
      
      <ant antfile="share/conf/build-conf.xml" target="tr-props-without-db-values">
        <property name="conf.home" value="share/conf"/>
        <property name="master.home" value="share/conf/master"/>
        <property name="target.dir" value="${newapp.home}/WEB-INF/conf"/>
        <property name="turbine.log" value="/logs/turbine.log"/>
        <property name="view.type" value="${turbine.app.view}"/>
        <property name="database.name" value="${newapp}"/>
        <property name="module.packages" value="${target.package}.modules,${flux.modules}"/>
        <property name="include.file" value="include = Flux.properties"/>
        <property name="template.path" value="/templates,/flux-templates"/>
      </ant>
  
      <!-- copy the lib directory over to the new app lib directory -->
      <copy todir="${newapp.home}/WEB-INF/lib">
        <fileset dir="${tomcat.home}/share/tdk-lib"/>
      </copy>
  
      <!-- ================================================================= -->
      <!-- F I X  P E R M I S S I O N S                                      -->
      <!-- ================================================================= -->
      
      <chmod dir="${newapp.home}" perm="ugo+rx" includes="**/*.sh" />
    
    </target>
  
    <!-- =================================================================== -->
    <!-- Make application directories                                        -->
    <!-- =================================================================== -->
    <target name="compile" depends="gather">
      <!-- Print some information -->
      <echo message=""/>
      <echo message="NEWAPP is ${newapp}"/>
      <echo message=""/>
      
      <!-- 
        Invoke the post app creation action by looking
        at the app type requested.
      -->
      
      <antcall target="post-${turbine.app.type}"/>
    
    </target>
  
    <!-- =================================================================== -->
    <!-- P O S T  P E E R  A P P  A C T I O N                                -->
    <!-- =================================================================== -->
    <!-- Here we cannot just simply compile all the sources because          -->
    <!-- Torque must be run first in order to generate the peers. Just       -->
    <!-- give the user some instructions on what to do next :-)              -->
    <!-- =================================================================== -->
    
    <target name="post-peer">
      <echo>
        
        There are few things that you must do before
        you can run the sample peer application. Everything
        will be done for you automatically, but you must
        change some properties for your project before
        your Java and SQL sources can be fully generated.
  
        Once you have made the necessary changes, you can
        then run an initialization target with the build script
        provided and the whole sample app will be setup for you!.
  
        Detailed instructions on how to precede are outlined
        outlined in the GETTING_STARTED.txt located in the
        webapps/${newapp}/WEB-INF/build directory
      
      </echo>
    </target>
  </project>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-tdk-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-tdk-dev-help@jakarta.apache.org