提交 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=".">
<property file="ant-build.properties" />
<!-- jar files required by the benchmark -->
<path id="benchmark.drivers.path">
<pathelement location="bin"/>
<pathelement path="${java.class.path}/"/>
<fileset dir="${benchmark.drivers.dir}">
<pathelement path="data/java"/>
<fileset dir="benchmark.drivers.dir">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="all" depends="jar, javadoc, docs">
<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 name="all" depends="jar">
</target>
<target name="benchmark" depends="compile">
......@@ -45,7 +35,7 @@
</target>
<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/lucene-core-2.2.0.jar" />
<src path="src/main"/>
......@@ -67,24 +57,8 @@
<java classname="org.h2.test.coverage.Coverage" classpath="." dir="bin" fork="true">
<arg line="-r org/h2"/>
</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 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">
<get dest="ext/servlet-api-2.4.jar"
......@@ -118,21 +92,8 @@
</jar>
</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">
<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/engine/**" />
<include name="org/h2/jdbc/**" />
......@@ -145,88 +106,14 @@
</jar>
</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">
<mkdir dir="bin/META-INF"/>
<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-URL" value="http://www.h2database.com"/>
<attribute name="Implementation-Version" value="${version.name.maven}"/>
<attribute name="Build-Jdk" value="${java.specification.version}"/>
</manifest>
</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">
<mkdir dir="bin/org/h2/util"/>
......@@ -237,7 +124,7 @@
</target>
<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 name="switchSourceAndroid" depends="switchSourcePrepare">
......@@ -286,15 +173,4 @@
</war>
</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>
\ No newline at end of file
......@@ -44,10 +44,10 @@ Newer version or compatible software works too.
<ul>
<li>Windows XP
</li><li>Sun JDK Version 1.4
</li><li>Apache Ant Version 1.6.5
</li><li>Mozilla Firefox 1.5
</li><li>Eclipse Version 3.2.2
</li><li>YourKit Java Profiler
</li><li>Apache Ant Version 1.6.5
</li></ul>
<br /><a name="building"></a>
......@@ -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:
</p>
<pre>
ant -projecthelp
build -?
</pre>
<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>
<pre>
ant jar
build jar
</pre>
<p>
To create a jar file with the JDBC API and the classes required to connect to a server only,
use the target jarClient:
</p>
<pre>
ant jarClient
build jarClient
</pre>
<p>
The other targets may be used as well.
......@@ -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:
</p>
<pre>
ant mavenInstallLocal
build mavenInstallLocal
</pre>
<p>
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:
<p>
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,
using <code>ant docs</code>.
using <code>build docs</code>.
</p>
</div></td></tr></table><!-- analytics --></body></html>
......@@ -107,6 +107,7 @@ via PayPal:
</li><li>Harpal Grover Consulting Inc., USA
</li><li>Elisabetta Berlini, Italy
</li><li>William Gilbert, USA
</li><li>Antonio Dieguez, Chile
</li></ul>
</div></td></tr></table><!-- analytics --></body></html>
......@@ -410,6 +410,7 @@ Roadmap
</li><li>Support CREATE TEMPORARY LINKED TABLE.
</li><li>MySQL compatibility: SELECT @variable := x FROM SYSTEM_RANGE(1, 50);
</li><li>Oracle compatibility: support NLS_DATE_FORMAT.
</li><li>Support flashback queries as in Oracle.
</li></ul>
<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 {
}
public void all() {
jarSmall();
jar();
docs();
}
public void spellcheck() {
java("org.h2.build.doc.SpellChecker", null);
public void clean() {
delete("temp");
delete("docs");
mkdir("docs");
mkdir("bin");
}
public void docs() {
......@@ -44,6 +47,15 @@ public class Build extends BuildBase {
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() {
delete("docs");
mkdir("docs/javadoc");
......@@ -52,19 +64,50 @@ public class Build extends BuildBase {
"-doclet", "org.h2.build.doclet.Doclet" });
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").
exclude("*.java").
exclude("*/package.html").
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);
}
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) {
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}", version);
manifest = replaceAll(manifest, "${version}", getVersion());
manifest = replaceAll(manifest, "${buildJdk}", getJavaSpecVersion());
String createdBy = System.getProperty("java.runtime.version") +
" (" + System.getProperty("java.vm.vendor") + ")";
......@@ -73,6 +116,35 @@ public class Build extends BuildBase {
manifest = replaceAll(manifest, "${mainClassTag}", mainClassTag);
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() {
compile();
......@@ -88,8 +160,21 @@ public class Build extends BuildBase {
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() {
compile(false);
compile(false, false);
FileList files = getFiles("temp").
exclude("temp/org/h2/dev/*").
exclude("temp/org/h2/build/*").
......@@ -106,20 +191,11 @@ public class Build extends BuildBase {
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() {
compile(true);
compile(true, false);
}
private void compile(boolean debugInfo) {
private void compile(boolean debugInfo, boolean clientOnly) {
try {
SwitchSource.main(new String[] { "-dir", "src", "-auto" });
} catch (IOException e) {
......@@ -127,46 +203,57 @@ public class Build extends BuildBase {
}
clean();
mkdir("temp");
resources();
resources(clientOnly);
download();
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")
+ "/../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) {
javac(new String[] { "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath }, files);
} else {
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");
copy("temp", files, "src/main");
files = getFiles("src/installer").keep("*.bat");
files.addAll(getFiles("src/installer").keep("*.sh"));
copy("temp", files, "src/installer");
if (!clientOnly) {
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/test").
exclude("*.java").
exclude("*/package.html");
copy("temp", files, "src/test");
}
public void clean() {
delete("temp");
delete("docs");
mkdir("docs");
mkdir("bin");
files = getFiles("src/installer").keep("*.bat");
files.addAll(getFiles("src/installer").keep("*.sh"));
copy("temp", files, "src/installer");
files = getFiles("src/test").
exclude("*.java").
exclude("*/package.html");
copy("temp", files, "src/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 {
}
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 {
out.print(command);
for (int i = 0; args != null && i < args.length; i++) {
......@@ -150,7 +173,12 @@ public class BuildBase {
out.print(args[i]);
}
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.getErrorStream(), out);
return p.exitValue();
......@@ -261,7 +289,7 @@ public class BuildBase {
if (targetFile.exists()) {
return;
}
targetFile.getParentFile().mkdirs();
targetFile.getAbsoluteFile().getParentFile().mkdirs();
ByteArrayOutputStream buff = new ByteArrayOutputStream();
try {
out.println("Downloading " + fileURL);
......@@ -335,7 +363,7 @@ public class BuildBase {
throw new Error("Unsupported pattern, may only start or end with *:" + pattern);
}
// normalize / and \
pattern = new File(pattern).getPath();
pattern = replaceAll(pattern, "/", File.separator);
FileList list = new FileList();
for (int i = 0; i < files.size(); i++) {
File f = (File) files.get(i);
......@@ -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)
basePath = new File(basePath).getPath();
try {
......@@ -593,7 +621,7 @@ public class BuildBase {
* @param after the new substring
* @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;
while (true) {
int next = s.indexOf(before, index);
......
......@@ -505,4 +505,5 @@ material hereto equipment copyrighted enforceability excludes licensees
estoppel manner reserves defense complies suitable identify infringe
originator brought contribution effectively assumes waives conjunction
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论