提交 5752fb83 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 40263158
#Sat Mar 29 10:53:56 CET 2008
benchmark.drivers.dir=C\:/data/java
javac=javac
version.name.maven=1.0.70
<project name="h2" default="all" basedir="."> <project name="h2" default="all" basedir=".">
<property file="ant-build.properties" />
<!-- jar files required by the benchmark --> <!-- jar files required by the benchmark -->
<path id="benchmark.drivers.path"> <path id="benchmark.drivers.path">
<pathelement location="bin"/> <pathelement location="bin"/>
<pathelement path="${java.class.path}/"/> <pathelement path="data/java"/>
<fileset dir="${benchmark.drivers.dir}"> <fileset dir="benchmark.drivers.dir">
<include name="**/*.jar"/> <include name="**/*.jar"/>
</fileset> </fileset>
</path> </path>
<target name="all" depends="jar, javadoc, docs"> <target name="all" depends="jar">
<delete includeemptydirs="true">
<fileset dir="bin" includes="**/*.txt"/>
<fileset dir="bin" includes="org/**/*"/>
<fileset dir="bin" includes="org"/>
<fileset dir="bin" includes="META-INF/**/*"/>
<fileset dir="bin" includes="META-INF"/>
<fileset dir="docs/html" includes="onePage.html"/>
</delete>
</target> </target>
<target name="benchmark" depends="compile"> <target name="benchmark" depends="compile">
...@@ -45,7 +35,7 @@ ...@@ -45,7 +35,7 @@
</target> </target>
<target name="compile" depends="switchSourceAuto, resources, downloadServletJar, downloadLuceneJar"> <target name="compile" depends="switchSourceAuto, resources, downloadServletJar, downloadLuceneJar">
<javac executable="${javac}" destdir="bin" debug="true" debuglevel="lines,source" > <javac destdir="bin" debug="true" debuglevel="lines,source" >
<classpath location="ext/servlet-api-2.4.jar" /> <classpath location="ext/servlet-api-2.4.jar" />
<classpath location="ext/lucene-core-2.2.0.jar" /> <classpath location="ext/lucene-core-2.2.0.jar" />
<src path="src/main"/> <src path="src/main"/>
...@@ -67,24 +57,8 @@ ...@@ -67,24 +57,8 @@
<java classname="org.h2.test.coverage.Coverage" classpath="." dir="bin" fork="true"> <java classname="org.h2.test.coverage.Coverage" classpath="." dir="bin" fork="true">
<arg line="-r org/h2"/> <arg line="-r org/h2"/>
</java> </java>
<javac executable="${javac}" srcdir="bin" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/**"/> <javac srcdir="bin" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/**"/>
</target> </target>
<target name="docs" depends="clean, javadoc, compile">
<copy todir="docs">
<fileset dir="src/docsrc" includes="index.html"/>
</copy>
<java classname="org.h2.build.code.CheckJavadoc" classpath="bin"/>
<java classname="org.h2.build.code.CheckTextFiles" classpath="bin"/>
<java classname="org.h2.build.doc.GenerateDoc" classpath="bin"/>
<java classname="org.h2.build.i18n.PrepareTranslation" classpath="bin"/>
<java classname="org.h2.build.indexer.Indexer" classpath="bin"/>
<java classname="org.h2.build.doc.MergeDocs" classpath="bin"/>
<java classname="org.h2.build.doc.WebSite" classpath="bin"/>
<java classname="org.h2.build.doc.LinkChecker" classpath="bin"/>
<java classname="org.h2.build.doc.XMLChecker" classpath="bin"/>
<java classname="org.h2.build.doc.SpellChecker" classpath="bin"/>
</target>
<target name="downloadServletJar" depends="init" unless="servlet.jar.present"> <target name="downloadServletJar" depends="init" unless="servlet.jar.present">
<get dest="ext/servlet-api-2.4.jar" <get dest="ext/servlet-api-2.4.jar"
...@@ -118,21 +92,8 @@ ...@@ -118,21 +92,8 @@
</jar> </jar>
</target> </target>
<target name="jarClient" depends="switchSourceAuto, resources, manifest">
<javac executable="${javac}" srcdir="src/main" destdir="bin" debug="true" debuglevel="lines,source">
<include name="org/h2/*" />
<include name="org/h2/jdbc/**" />
<include name="org/h2/jdbcx/**" />
</javac>
<jar jarfile="bin/h2client.jar" basedir="bin" manifest="bin/META-INF/MANIFEST.MF">
<include name="**/*.*"/>
<exclude name="**/*.bat"/>
<exclude name="**/*.sh"/>
</jar>
</target>
<target name="jarDb" depends="resources, manifest"> <target name="jarDb" depends="resources, manifest">
<javac executable="${javac}" srcdir="src/main" destdir="bin" debug="false"> <javac srcdir="src/main" destdir="bin" debug="false">
<include name="org/h2/*" /> <include name="org/h2/*" />
<include name="org/h2/engine/**" /> <include name="org/h2/engine/**" />
<include name="org/h2/jdbc/**" /> <include name="org/h2/jdbc/**" />
...@@ -145,88 +106,14 @@ ...@@ -145,88 +106,14 @@
</jar> </jar>
</target> </target>
<target name="javadoc">
<javac executable="${javac}" srcdir="src/main" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/util/StringUtils.java"/>
<javac executable="${javac}" srcdir="src/test" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/test/bnf/*.java"/>
<javac executable="${javac}" srcdir="src/tools" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/build/doclet/*.java"/>
<mkdir dir="docs/javadoc"/>
<javadoc
sourcepath="src/main"
packagenames="org.h2.jdbc.*,org.h2.jdbcx.*,org.h2.tools.*,org.h2.api.*,org.h2.constant.*"
doclet="org.h2.build.doclet.Doclet"
docletpath="bin"
/>
<copy todir="docs/javadoc">
<fileset dir="src/docsrc/javadoc" includes="**/*"/>
</copy>
</target>
<target name="javadocImpl" depends="javadoc">
<mkdir dir="docs/javadocImpl"/>
<javadoc
sourcepath="src/main;src/test;src/tools"
classpath="ext/servlet-api-2.4.jar;ext/lucene-core-2.2.0.jar;${java.class.path}"
packagenames="org.h2.*"
doclet="org.h2.build.doclet.Doclet"
docletpath="bin"
additionalparam="-J-Dh2.interfacesOnly=false -J-Dh2.destDir=docs/javadocImpl"
/>
<javadoc
sourcepath="src/main;src/test;src/tools"
noindex="true"
packagenames="org.h2.*"
excludepackagenames="org.h2.build.*,org.h2.dev.*"
classpath="ext/servlet-api-2.4.jar;ext/lucene-core-2.2.0.jar;${java.class.path}"
destDir="docs/javadocImpl"
/>
<copy todir="docs/javadoc">
<fileset dir="src/docsrc/javadoc" includes="**/*"/>
</copy>
</target>
<target name="manifest"> <target name="manifest">
<mkdir dir="bin/META-INF"/> <mkdir dir="bin/META-INF"/>
<manifest file="bin/META-INF/MANIFEST.MF"> <manifest file="bin/META-INF/MANIFEST.MF">
<!--
<attribute name="Bundle-Activator" value="org.h2.osgi.Activator"/>
-->
<attribute name="Implementation-Title" value="H2 Database Engine"/> <attribute name="Implementation-Title" value="H2 Database Engine"/>
<attribute name="Implementation-URL" value="http://www.h2database.com"/> <attribute name="Implementation-URL" value="http://www.h2database.com"/>
<attribute name="Implementation-Version" value="${version.name.maven}"/>
<attribute name="Build-Jdk" value="${java.specification.version}"/> <attribute name="Build-Jdk" value="${java.specification.version}"/>
</manifest> </manifest>
</target> </target>
<target name="mavenDeployCentral" depends="jar">
<copy tofile="bin/h2-${version.name.maven}.jar" file="bin/h2.jar" />
<copy tofile="bin/pom.xml" filtering="true" file="src/installer/pomUpload.xml">
<filterset>
<filter token="version" value="${version.name.maven}"/>
</filterset>
</copy>
<exec executable="mvn.bat">
<arg value="deploy:deploy-file"/>
<arg value="-Dfile=bin/h2.jar"/>
<arg value="-Durl=file://C:/data/h2database/m2-repo"/>
<arg value="-Dpackaging=jar"/>
<arg value="-DpomFile=bin/pom.xml"/>
</exec>
</target>
<target name="mavenInstallLocal" depends="jar">
<copy tofile="bin/pom.xml" filtering="true" file="src/installer/pom.xml">
<filterset>
<filter token="version" value="1.0-SNAPSHOT"/>
</filterset>
</copy>
<exec executable="mvn.bat">
<arg value="install:install-file"/>
<arg value="-Dversion=1.0-SNAPSHOT"/>
<arg value="-Dfile=bin/h2.jar"/>
<arg value="-Dpackaging=jar"/>
<arg value="-DpomFile=bin/pom.xml"/>
</exec>
</target>
<target name="resources" depends="clean"> <target name="resources" depends="clean">
<mkdir dir="bin/org/h2/util"/> <mkdir dir="bin/org/h2/util"/>
...@@ -237,7 +124,7 @@ ...@@ -237,7 +124,7 @@
</target> </target>
<target name="switchSourcePrepare" depends="clean"> <target name="switchSourcePrepare" depends="clean">
<javac executable="${javac}" srcdir="src/tools" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/build/code/SwitchSource.java"/> <javac srcdir="src/tools" destdir="bin" debug="true" debuglevel="lines,source" includes="org/h2/build/code/SwitchSource.java"/>
</target> </target>
<target name="switchSourceAndroid" depends="switchSourcePrepare"> <target name="switchSourceAndroid" depends="switchSourcePrepare">
...@@ -286,15 +173,4 @@ ...@@ -286,15 +173,4 @@
</war> </war>
</target> </target>
<target name="zip">
<zip destfile="../h2.zip">
<fileset dir=".." includes="h2/build.*"/>
<fileset dir=".." includes="h2/ant-build.properties"/>
<fileset dir=".." includes="h2/bin/**/*"/>
<fileset dir=".." includes="h2/docs/**/*"/>
<fileset dir=".." includes="h2/service/**/*"/>
<fileset dir=".." includes="h2/src/**/*"/>
</zip>
</target>
</project> </project>
\ No newline at end of file
...@@ -44,10 +44,10 @@ Newer version or compatible software works too. ...@@ -44,10 +44,10 @@ Newer version or compatible software works too.
<ul> <ul>
<li>Windows XP <li>Windows XP
</li><li>Sun JDK Version 1.4 </li><li>Sun JDK Version 1.4
</li><li>Apache Ant Version 1.6.5
</li><li>Mozilla Firefox 1.5 </li><li>Mozilla Firefox 1.5
</li><li>Eclipse Version 3.2.2 </li><li>Eclipse Version 3.2.2
</li><li>YourKit Java Profiler </li><li>YourKit Java Profiler
</li><li>Apache Ant Version 1.6.5
</li></ul> </li></ul>
<br /><a name="building"></a> <br /><a name="building"></a>
...@@ -56,20 +56,20 @@ Newer version or compatible software works too. ...@@ -56,20 +56,20 @@ Newer version or compatible software works too.
On the command line, go to the directory src and execute the following command: On the command line, go to the directory src and execute the following command:
</p> </p>
<pre> <pre>
ant -projecthelp build -?
</pre> </pre>
<p> <p>
You will get a list of targets. If you want to build the jar files, execute: You will get a list of targets. If you want to build the jar file, execute:
</p> </p>
<pre> <pre>
ant jar build jar
</pre> </pre>
<p> <p>
To create a jar file with the JDBC API and the classes required to connect to a server only, To create a jar file with the JDBC API and the classes required to connect to a server only,
use the target jarClient: use the target jarClient:
</p> </p>
<pre> <pre>
ant jarClient build jarClient
</pre> </pre>
<p> <p>
The other targets may be used as well. The other targets may be used as well.
...@@ -100,7 +100,7 @@ they are available there. ...@@ -100,7 +100,7 @@ they are available there.
To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command: To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command:
</p> </p>
<pre> <pre>
ant mavenInstallLocal build mavenInstallLocal
</pre> </pre>
<p> <p>
Afterwards, you can include the database in your Maven 2 project as a dependency: Afterwards, you can include the database in your Maven 2 project as a dependency:
...@@ -126,7 +126,7 @@ The translation of this software is split into the following parts: ...@@ -126,7 +126,7 @@ The translation of this software is split into the following parts:
<p> <p>
The conversion between UTF-8 and Java encoding (using the \u syntax), as well as the HTML entities (&amp;#..;) The conversion between UTF-8 and Java encoding (using the \u syntax), as well as the HTML entities (&amp;#..;)
is automated by running the tool PropertiesToUTF8. The web site translation is automated as well, is automated by running the tool PropertiesToUTF8. The web site translation is automated as well,
using <code>ant docs</code>. using <code>build docs</code>.
</p> </p>
</div></td></tr></table><!-- analytics --></body></html> </div></td></tr></table><!-- analytics --></body></html>
...@@ -107,6 +107,7 @@ via PayPal: ...@@ -107,6 +107,7 @@ via PayPal:
</li><li>Harpal Grover Consulting Inc., USA </li><li>Harpal Grover Consulting Inc., USA
</li><li>Elisabetta Berlini, Italy </li><li>Elisabetta Berlini, Italy
</li><li>William Gilbert, USA </li><li>William Gilbert, USA
</li><li>Antonio Dieguez, Chile
</li></ul> </li></ul>
</div></td></tr></table><!-- analytics --></body></html> </div></td></tr></table><!-- analytics --></body></html>
...@@ -410,6 +410,7 @@ Roadmap ...@@ -410,6 +410,7 @@ Roadmap
</li><li>Support CREATE TEMPORARY LINKED TABLE. </li><li>Support CREATE TEMPORARY LINKED TABLE.
</li><li>MySQL compatibility: SELECT @variable := x FROM SYSTEM_RANGE(1, 50); </li><li>MySQL compatibility: SELECT @variable := x FROM SYSTEM_RANGE(1, 50);
</li><li>Oracle compatibility: support NLS_DATE_FORMAT. </li><li>Oracle compatibility: support NLS_DATE_FORMAT.
</li><li>Support flashback queries as in Oracle.
</li></ul> </li></ul>
<h2>Not Planned</h2> <h2>Not Planned</h2>
......
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>@version@</version>
<packaging>jar</packaging>
<name>H2 Database Engine</name>
<url>http://www.h2database.com</url>
<description>H2 Database Engine</description>
<licenses>
<license>
<name>The H2 License, Version 1.0</name>
<url>http://h2database.com/html/license.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>http://h2database.googlecode.com/svn/trunk</url>
</scm>
<dependencies>
</dependencies>
</project>
\ No newline at end of file
...@@ -21,12 +21,15 @@ public class Build extends BuildBase { ...@@ -21,12 +21,15 @@ public class Build extends BuildBase {
} }
public void all() { public void all() {
jarSmall(); jar();
docs(); docs();
} }
public void spellcheck() { public void clean() {
java("org.h2.build.doc.SpellChecker", null); delete("temp");
delete("docs");
mkdir("docs");
mkdir("bin");
} }
public void docs() { public void docs() {
...@@ -44,6 +47,15 @@ public class Build extends BuildBase { ...@@ -44,6 +47,15 @@ public class Build extends BuildBase {
java("org.h2.build.doc.SpellChecker", null); java("org.h2.build.doc.SpellChecker", null);
} }
public void download() {
download("ext/servlet-api-2.4.jar",
"http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar",
"3fc542fe8bb8164e8d3e840fe7403bc0518053c0");
download("ext/lucene-core-2.2.0.jar",
"http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar",
"47b6eee2e17bd68911e7045896a1c09de0b2dda8");
}
public void javadoc() { public void javadoc() {
delete("docs"); delete("docs");
mkdir("docs/javadoc"); mkdir("docs/javadoc");
...@@ -52,19 +64,50 @@ public class Build extends BuildBase { ...@@ -52,19 +64,50 @@ public class Build extends BuildBase {
"-doclet", "org.h2.build.doclet.Doclet" }); "-doclet", "org.h2.build.doclet.Doclet" });
copy("docs/javadoc", getFiles("src/docsrc/javadoc"), "src/docsrc/javadoc"); copy("docs/javadoc", getFiles("src/docsrc/javadoc"), "src/docsrc/javadoc");
} }
public void resources() { public void javadocImpl() {
mkdir("docs/javadocImpl");
System.setProperty("h2.interfacesOnly", "false");
System.setProperty("h2.destDir", "docs/javadocImpl");
javadoc(new String[] {
"-sourcepath", "src/main" + File.pathSeparator + "src/test" + File.pathSeparator + "src/tools",
"-classpath", "ext/servlet-api-2.4.jar" + File.pathSeparator + "ext/lucene-core-2.2.0.jar" +
File.pathSeparator + System.getProperty("java.home") + "/../lib/tools.jar",
"-subpackages", "org.h2",
"-doclet", "org.h2.build.doclet.Doclet" });
javadoc(new String[] {
"-sourcepath", "src/main" + File.pathSeparator + "src/test" + File.pathSeparator + "src/tools" ,
"-noindex",
"-classpath", "ext/servlet-api-2.4.jar" + File.pathSeparator + "ext/lucene-core-2.2.0.jar" +
File.pathSeparator + System.getProperty("java.home") + "/../lib/tools.jar",
"-subpackages", "org.h2",
"-exclude", "org.h2.build.*,org.h2.dev.*",
"-doclet", "org.h2.build.doclet.Doclet" });
copy("docs/javadocImpl", getFiles("src/docsrc/javadoc"), "src/docsrc/javadoc");
}
private void resources(boolean clientOnly) {
FileList files = getFiles("src/main"). FileList files = getFiles("src/main").
exclude("*.java"). exclude("*.java").
exclude("*/package.html"). exclude("*/package.html").
exclude("*/java.sql.Driver"); exclude("*/java.sql.Driver");
if (clientOnly) {
files = files.exclude("src/main/org/h2/server/*");
}
zip("temp/org/h2/util/data.zip", files, "src/main", true, false); zip("temp/org/h2/util/data.zip", files, "src/main", true, false);
} }
public void spellcheck() {
java("org.h2.build.doc.SpellChecker", null);
}
private String getVersion() {
return getStaticField("org.h2.engine.Constants", "VERSION");
}
private void manifest(String mainClassName) { private void manifest(String mainClassName) {
String manifest = new String(readFile(new File("src/main/META-INF/MANIFEST.MF"))); String manifest = new String(readFile(new File("src/main/META-INF/MANIFEST.MF")));
String version = getStaticField("org.h2.engine.Constants", "VERSION"); manifest = replaceAll(manifest, "${version}", getVersion());
manifest = replaceAll(manifest, "${version}", version);
manifest = replaceAll(manifest, "${buildJdk}", getJavaSpecVersion()); manifest = replaceAll(manifest, "${buildJdk}", getJavaSpecVersion());
String createdBy = System.getProperty("java.runtime.version") + String createdBy = System.getProperty("java.runtime.version") +
" (" + System.getProperty("java.vm.vendor") + ")"; " (" + System.getProperty("java.vm.vendor") + ")";
...@@ -73,6 +116,35 @@ public class Build extends BuildBase { ...@@ -73,6 +116,35 @@ public class Build extends BuildBase {
manifest = replaceAll(manifest, "${mainClassTag}", mainClassTag); manifest = replaceAll(manifest, "${mainClassTag}", mainClassTag);
writeFile(new File("temp/META-INF/MANIFEST.MF"), manifest.getBytes()); writeFile(new File("temp/META-INF/MANIFEST.MF"), manifest.getBytes());
} }
public void mavenInstallLocal() {
jar();
String pom = new String(readFile(new File("src/installer/pom.xml")));
pom = replaceAll(pom, "@version@", "1.0-SNAPSHOT");
writeFile(new File("bin/pom.xml"), pom.getBytes());
execScript("mvn", "install:install-file " +
"-Dversion=1.0-SNAPSHOT " +
"-Dfile=bin/h2.jar " +
"-Dpackaging=jar " +
"-DpomFile=bin/pom.xml " +
"-DartifactId=h2 " +
"-DgroupId=com.h2database");
}
public void mavenDeployCentral() {
jar();
String pom = new String(readFile(new File("src/installer/pom.xml")));
pom = replaceAll(pom, "@version@", getVersion());
writeFile(new File("bin/pom.xml"), pom.getBytes());
execScript("mvn", "deploy:deploy-file " +
"-Dfile=bin/h2.jar " +
"-Durl=file:///data/h2database/m2-repo " +
"-Dpackaging=jar " +
"-Dversion=" + getVersion() + " " +
"-DpomFile=bin/pom.xml " +
"-DartifactId=h2 " +
"-DgroupId=com.h2database");
}
public void jar() { public void jar() {
compile(); compile();
...@@ -88,8 +160,21 @@ public class Build extends BuildBase { ...@@ -88,8 +160,21 @@ public class Build extends BuildBase {
jar("bin/h2.jar", files, "temp"); jar("bin/h2.jar", files, "temp");
} }
public void jarClient() {
compile(true, true);
FileList files = getFiles("temp").
exclude("temp/org/h2/dev/*").
exclude("temp/org/h2/build/*").
exclude("temp/org/h2/samples/*").
exclude("temp/org/h2/test/*").
exclude("*.bat").
exclude("*.sh").
exclude("*.txt");
jar("bin/h2client.jar", files, "temp");
}
public void jarSmall() { public void jarSmall() {
compile(false); compile(false, false);
FileList files = getFiles("temp"). FileList files = getFiles("temp").
exclude("temp/org/h2/dev/*"). exclude("temp/org/h2/dev/*").
exclude("temp/org/h2/build/*"). exclude("temp/org/h2/build/*").
...@@ -106,20 +191,11 @@ public class Build extends BuildBase { ...@@ -106,20 +191,11 @@ public class Build extends BuildBase {
jar("bin/h2small.jar", files, "temp"); jar("bin/h2small.jar", files, "temp");
} }
public void download() {
download("ext/servlet-api-2.4.jar",
"http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar",
"3fc542fe8bb8164e8d3e840fe7403bc0518053c0");
download("ext/lucene-core-2.2.0.jar",
"http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar",
"47b6eee2e17bd68911e7045896a1c09de0b2dda8");
}
public void compile() { public void compile() {
compile(true); compile(true, false);
} }
private void compile(boolean debugInfo) { private void compile(boolean debugInfo, boolean clientOnly) {
try { try {
SwitchSource.main(new String[] { "-dir", "src", "-auto" }); SwitchSource.main(new String[] { "-dir", "src", "-auto" });
} catch (IOException e) { } catch (IOException e) {
...@@ -127,46 +203,57 @@ public class Build extends BuildBase { ...@@ -127,46 +203,57 @@ public class Build extends BuildBase {
} }
clean(); clean();
mkdir("temp"); mkdir("temp");
resources(); resources(clientOnly);
download(); download();
String classpath = "temp" + File.pathSeparatorChar + "ext/servlet-api-2.4.jar" + File.pathSeparatorChar String classpath = "temp" + File.pathSeparatorChar + "ext/servlet-api-2.4.jar" + File.pathSeparatorChar
+ "ext/lucene-core-2.2.0.jar" + File.pathSeparator + System.getProperty("java.home") + "ext/lucene-core-2.2.0.jar" + File.pathSeparator + System.getProperty("java.home")
+ "/../lib/tools.jar"; + "/../lib/tools.jar";
FileList files = getFiles("src/main"); FileList files;
if (clientOnly) {
files = getFiles("src/main/org/h2/Driver.java");
files.addAll(getFiles("src/main/org/h2/jdbc"));
files.addAll(getFiles("src/main/org/h2/jdbcx"));
} else {
files = getFiles("src/main");
}
if (debugInfo) { if (debugInfo) {
javac(new String[] { "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath }, files); javac(new String[] { "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath }, files);
} else { } else {
javac(new String[] { "-g:none", "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath }, files); javac(new String[] { "-g:none", "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath }, files);
} }
files = getFiles("src/test");
files.addAll(getFiles("src/tools"));
javac(new String[] { "-d", "temp", "-sourcepath", "src/test" + File.pathSeparator + "src/tools",
"-classpath", classpath }, files);
files = getFiles("src/main/META-INF/services"); files = getFiles("src/main/META-INF/services");
copy("temp", files, "src/main"); copy("temp", files, "src/main");
files = getFiles("src/installer").keep("*.bat"); if (!clientOnly) {
files.addAll(getFiles("src/installer").keep("*.sh")); files = getFiles("src/test");
copy("temp", files, "src/installer"); files.addAll(getFiles("src/tools"));
javac(new String[] { "-d", "temp", "-sourcepath", "src/test" + File.pathSeparator + "src/tools",
"-classpath", classpath }, files);
files = getFiles("src/test"). files = getFiles("src/installer").keep("*.bat");
exclude("*.java"). files.addAll(getFiles("src/installer").keep("*.sh"));
exclude("*/package.html"); copy("temp", files, "src/installer");
copy("temp", files, "src/test");
} files = getFiles("src/test").
exclude("*.java").
public void clean() { exclude("*/package.html");
delete("temp"); copy("temp", files, "src/test");
delete("docs"); }
mkdir("docs");
mkdir("bin");
} }
public void test() { public void test() {
} }
public void zip() {
FileList files = getFiles("../h2").keep("../h2/build.*");
files.addAll(getFiles("../h2/bin").keep("../h2/bin/h2.*"));
files.addAll(getFiles("../h2/docs"));
files.addAll(getFiles("../h2/service"));
files.addAll(getFiles("../h2/src"));
zip("../h2.zip", files, "../", false, false);
}
} }
...@@ -141,8 +141,31 @@ public class BuildBase { ...@@ -141,8 +141,31 @@ public class BuildBase {
} }
out.println(); out.println();
} }
private boolean isWindows() {
return System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0;
}
/**
* Execute a script in a separate process.
*
* @param script the script name (for example mvn or ant)
* @param args the command line parameters
* @return the exit value
*/
protected int execScript(String script, String args) {
int testLinux;
return exec(isWindows() ? ".bat" : ".sh" + " " + args, null);
}
private int exec(String command, String[] args) { /**
* Execute a program in a separate process.
*
* @param command the program to run
* @param args the command line parameters
* @return the exit value
*/
protected int exec(String command, String[] args) {
try { try {
out.print(command); out.print(command);
for (int i = 0; args != null && i < args.length; i++) { for (int i = 0; args != null && i < args.length; i++) {
...@@ -150,7 +173,12 @@ public class BuildBase { ...@@ -150,7 +173,12 @@ public class BuildBase {
out.print(args[i]); out.print(args[i]);
} }
out.println(); out.println();
Process p = Runtime.getRuntime().exec(command, args); Process p;
if (args == null) {
p = Runtime.getRuntime().exec(command);
} else {
p = Runtime.getRuntime().exec(command, args);
}
copy(p.getInputStream(), out); copy(p.getInputStream(), out);
copy(p.getErrorStream(), out); copy(p.getErrorStream(), out);
return p.exitValue(); return p.exitValue();
...@@ -261,7 +289,7 @@ public class BuildBase { ...@@ -261,7 +289,7 @@ public class BuildBase {
if (targetFile.exists()) { if (targetFile.exists()) {
return; return;
} }
targetFile.getParentFile().mkdirs(); targetFile.getAbsoluteFile().getParentFile().mkdirs();
ByteArrayOutputStream buff = new ByteArrayOutputStream(); ByteArrayOutputStream buff = new ByteArrayOutputStream();
try { try {
out.println("Downloading " + fileURL); out.println("Downloading " + fileURL);
...@@ -335,7 +363,7 @@ public class BuildBase { ...@@ -335,7 +363,7 @@ public class BuildBase {
throw new Error("Unsupported pattern, may only start or end with *:" + pattern); throw new Error("Unsupported pattern, may only start or end with *:" + pattern);
} }
// normalize / and \ // normalize / and \
pattern = new File(pattern).getPath(); pattern = replaceAll(pattern, "/", File.separator);
FileList list = new FileList(); FileList list = new FileList();
for (int i = 0; i < files.size(); i++) { for (int i = 0; i < files.size(); i++) {
File f = (File) files.get(i); File f = (File) files.get(i);
...@@ -444,7 +472,7 @@ public class BuildBase { ...@@ -444,7 +472,7 @@ public class BuildBase {
} }
}); });
} }
new File(destFile).getParentFile().mkdirs(); new File(destFile).getAbsoluteFile().getParentFile().mkdirs();
// normalize the path (replace / with \ if required) // normalize the path (replace / with \ if required)
basePath = new File(basePath).getPath(); basePath = new File(basePath).getPath();
try { try {
...@@ -593,7 +621,7 @@ public class BuildBase { ...@@ -593,7 +621,7 @@ public class BuildBase {
* @param after the new substring * @param after the new substring
* @return the string with the string replaced * @return the string with the string replaced
*/ */
protected String replaceAll(String s, String before, String after) { protected static String replaceAll(String s, String before, String after) {
int index = 0; int index = 0;
while (true) { while (true) {
int next = s.indexOf(before, index); int next = s.indexOf(before, index);
......
...@@ -505,4 +505,5 @@ material hereto equipment copyrighted enforceability excludes licensees ...@@ -505,4 +505,5 @@ material hereto equipment copyrighted enforceability excludes licensees
estoppel manner reserves defense complies suitable identify infringe estoppel manner reserves defense complies suitable identify infringe
originator brought contribution effectively assumes waives conjunction originator brought contribution effectively assumes waives conjunction
informs negotiations collectively omissions trial nor qualify steward neither informs negotiations collectively omissions trial nor qualify steward neither
worldwide everyone additions expense lawsuit checksums jazoon worldwide everyone additions expense lawsuit checksums jazoon flashback
dieguez dfile mvn dversion dgroup dpackaging dartifact durl dpom pom
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论