📄 build.xml
字号:
<!-- Hibernate ANT build script. (Originally contributed by Fabricio Goncalves)--><project name="Hibernate3" default="jar" basedir="."> <!-- Give user a chance to override without editing this file or typing -D --> <property file="build.properties"/> <property file="${user.home}/.ant.properties"/> <!-- Name of project and version, used to create filenames --> <property name="Name" value="Hibernate"/> <property name="name" value="hibernate"/> <property name="name2" value="hibernate3"/> <property name="version" value="3.0"/> <property name="patchlevel" value="5"/> <!-- set global properties for this build --> <property name="src.dir" value="src"/> <property name="test.dir" value="test"/> <property name="etc.dir" value="etc"/> <property name="grammar.dir" value="grammar"/> <property name="lib.dir" value="lib"/> <property name="jdbc.dir" value="lib"/> <property name="build.dir" value="build"/> <property name="classes.dir" value="${build.dir}/classes"/> <property name="testclasses.dir" value="${build.dir}/testclasses"/> <property name="generated.src" value="${build.dir}/gensrc"/> <property name="parser.src" value="${generated.src}/org/hibernate/hql/antlr"/> <property name="test.out.dir" value="testout"/> <property name="clover.out.dir" value="cloverout"/> <property name="dist.dir" value="../${name}"/> <property name="doc.dir" value="doc"/> <property name="doc.api.dir" value="${doc.dir}/api"/> <property name="doc.ref.dir" value="${doc.dir}/reference"/> <property name="egsrc.dir" value="eg"/> <property name="dist.doc.dir" value="${dist.dir}/doc"/> <property name="dist.api.dir" value="${dist.dir}/doc/api"/> <property name="dist.ref.dir" value="${dist.dir}/doc/reference"/> <property name="dist.src.dir" value="${dist.dir}/src"/> <property name="dist.test.dir" value="${dist.dir}/test"/> <property name="dist.etc.dir" value="${dist.dir}/etc"/> <property name="dist.eg.dir" value="${dist.dir}/eg"/> <property name="dist.lib.dir" value="${dist.dir}/lib"/> <property name="dist.grammar.dir" value="${dist.dir}/grammar"/> <property name="jar.name" value="${name2}"/> <property name="jar.path" value="${dist.dir}/${jar.name}.jar"/> <property name="javadoc" value="http://java.sun.com/j2se/1.3/docs/api"/> <property name="javac.debug" value="on"/> <property name="javac.optimize" value="off"/> <property name="driver.jar" value="${jdbc.dir}/hsqldb.jar"/> <property name="clover.jar" value="${ant.home}/lib/clover.jar"/> <property name="replace.dir" value="${src.dir}"/> <path id="lib.class.path"> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> </fileset> <pathelement path="${clover.jar}"/> </path> <patternset id="jar.files"> <include name="**/*.dtd"/> <include name="**/*.xml"/> <include name="**/*.xslt"/> </patternset> <patternset id="src.files"> <!-- include everything we want in the src directory that we didn't want in the jar itself --> <include name="**/*.java"/> </patternset> <patternset id="refdoc.files"> <include name="**/*.css"/> <include name="**/*.jpg"/> <include name="**/*.gif"/> <include name="**/*.png"/> </patternset> <!-- ############################# Tasks ##############################--> <taskdef name="antlrtask" classname="org.apache.tools.ant.taskdefs.optional.ANTLR"> <classpath> <!-- Don't include the ANTLR from checkstyle.jar --> <fileset dir="${lib.dir}"> <include name="ant-antlr-*.jar"/> <include name="antlr-*.jar"/> </fileset> </classpath> </taskdef> <taskdef name="splash" classname="org.apache.tools.ant.taskdefs.optional.splash.SplashTask"> <classpath refid="lib.class.path"/> </taskdef> <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> <classpath refid="lib.class.path"/> </taskdef> <taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"> <classpath refid="lib.class.path"/> </taskdef> <taskdef resource="checkstyletask.properties"> <classpath refid="lib.class.path"/> </taskdef> <taskdef resource="clovertasks"/> <!-- ############################ Targets #############################--> <target name="clean" depends="cleantestdb" description="Cleans up build and dist directories"> <delete dir="${build.dir}"/> <delete dir="${dist.dir}"/> <delete dir="${test.out.dir}"/> <delete dir="${clover.out.dir}"/> </target> <target name="cleantestdb" description="Clean up HSQLDB test database"> <delete> <fileset dir="." includes="test.*"/> </delete> </target> <target name="init" depends="splash" description="Initialize the build"> <tstamp> <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/> </tstamp> <echo message="Build ${Name}-${version} (${subversion})"/> <mkdir dir="${classes.dir}"/> <copy todir="${classes.dir}"> <fileset dir="${src.dir}"> <patternset refid="jar.files"/> </fileset> </copy> <echo message="JDK version: ${ant.java.version}"/> </target> <target name="init.antlr" depends="init" description="Check ANTLR dependencies."> <uptodate property="antlr.isUpToDate" targetfile="${parser.src}/.antlr_run"> <srcfiles dir="${grammar.dir}" includes="*.g"/> </uptodate> </target> <target name="antlr" depends="init.antlr" unless="antlr.isUpToDate" description="Generate ANTLR parsers."> <mkdir dir="${parser.src}"/> <!-- Create the directory for the generated sources. --> <!-- The HQL grammar --> <antlrtask target="${grammar.dir}/hql.g" outputdirectory="${parser.src}" /> <!-- The HQL-SQL tree transform grammar --> <antlrtask target="${grammar.dir}/hql-sql.g" outputdirectory="${parser.src}" /> <!-- The SQL rendering tree traversal --> <antlrtask target="${grammar.dir}/sql-gen.g" outputdirectory="${parser.src}" /> <touch file="${parser.src}/.antlr_run"/> </target> <target name="cleanantlr" depends="init" description="Clean up the generated ANTLR parsers."> <delete dir="${parser.src}"/> </target> <target name="antlr.regen" depends="init,cleanantlr,antlr" description="Regenerate all ANTLR generated code."> </target> <target name="compile" depends="init,antlr" description="Compile the Java source code"> <available classname="org.eclipse.core.launcher.Main" property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" classpath="${java.class.path}"/> <javac destdir="${classes.dir}" classpathref="lib.class.path" debug="${javac.debug}" optimize="${javac.optimize}" nowarn="on"> <src path="${src.dir}"/> <src path="${generated.src}"/> </javac> </target> <!-- If versioncheck fails two things can be "out-of-sync": '<libraryname> not found in fileset of libraries!' means that version.properties defines a library, but this library is not in the lib directory. Resolution: add the library to the lib directory or remove the definiton from version.properties '<filename> not listed in version.properties' means a file was found in the lib directory, but not in version.properties; Resolution: add the library to the version.properties or remove the library from the libraries. --> <target name="versioncheck" description="Check version.properties up against lib directory"> <taskdef classname="versioncheck.VersionCheckTask" classpath="${lib.dir}/versioncheck.jar" name="versioncheck"/> <mkdir dir="${dist.lib.dir}"/> <versioncheck versionfile="${lib.dir}/version.properties" output="${dist.lib.dir}/_README.txt"> <fileset dir="${lib.dir}"> <include name="**/*.zip"/> <include name="**/*.jar"/> </fileset> </versioncheck> <copy file="${lib.dir}/version.properties" todir="${dist.lib.dir}"/> </target> <target name="cleanimps" depends="compile" description="Clean imports"> <!-- clean the imports (is dependent on hibernate class files thus have to be done after compiling --> <taskdef classname="com.tombrus.cleanImports.ant.CleanImports" classpath="${lib.dir}/cleanimports.jar" name="cleanimps"/> <cleanimps srcdir="${generated.src}"> <classpath> <path refid="lib.class.path"/> <path location="${build.dir}/classes"/> </classpath> <cleanformat> <options collapseAbove="99999" blankLines="1" ambiguities="on"/> <import/> </cleanformat> </cleanimps> </target> <target name="compiletest" depends="compile" description="Compile the tests"> <mkdir dir="${testclasses.dir}"/> <available classname="org.eclipse.core.launcher.Main" property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" classpath="${java.class.path}"/> <javac srcdir="${test.dir}" destdir="${testclasses.dir}" debug="${javac.debug}" optimize="${javac.optimize}" nowarn="on"> <classpath> <path refid="lib.class.path"/> <pathelement path="${classes.dir}"/> </classpath> </javac> <!-- Copy over the mapping files --> <copy todir="${testclasses.dir}"> <fileset dir="${test.dir}"> <patternset refid="jar.files"/> </fileset> </copy> </target> <target name="copysource" description="Copy sources to dist dir"> <mkdir dir="${dist.src.dir}"/> <copy todir="${dist.src.dir}"> <fileset dir="${src.dir}"> <patternset refid="src.files"/> </fileset> <fileset dir="${src.dir}"> <patternset refid="jar.files"/> </fileset> </copy> <mkdir dir="${dist.test.dir}"/> <copy todir="${dist.test.dir}"> <fileset dir="${test.dir}"/> </copy> <mkdir dir="${dist.grammar.dir}"/> <copy todir="${dist.grammar.dir}"> <fileset dir="${grammar.dir}"/> </copy> </target> <target name="copylib" description="Copy jars to lib dir"> <mkdir dir="${dist.lib.dir}"/> <copy todir="${dist.lib.dir}"> <fileset dir="${lib.dir}"> <include name="*.jar"/> <exclude name="checkstyle*.jar"/> <include name="*.txt"/> <include name="version.properties"/> </fileset> </copy> </target> <target name="jar" depends="compile" description="Build the distribution .jar file"> <mkdir dir="${dist.dir}"/> <jar jarfile="${jar.path}" basedir="${classes.dir}"> <include name="org/hibernate/**/*.class"/> <patternset refid="jar.files"/> <manifest> <attribute name="Hibernate-Version" value="${version}.${patchlevel}"/> </manifest> </jar> </target> <!-- Documentation --> <target name="javadoc" description="Compile the Javadoc API documentation to dist dir" depends="splash"> <mkdir dir="${dist.api.dir}"/> <javadoc classpathref="lib.class.path" destdir="${dist.api.dir}" use="true" protected="true" version="true" windowtitle="${Name} API Documentation" Overview="${doc.api.dir}/package.html" doctitle="${Name} API Documentation" stylesheetfile="${doc.api.dir}/jdstyle.css" link="${javadoc}"> <packageset dir="${generated.src}" defaultexcludes="yes"> <include name="org/hibernate/**"/> </packageset> <packageset dir="${src.dir}" defaultexcludes="yes"> <include name="org/hibernate/**"/> </packageset>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -