提交 156828c8 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Merge manifest generation methods

上级 56517d95
Manifest-Version: 1.0
Implementation-Title: ${title}
Implementation-Title: H2 Database Engine
Implementation-URL: http://www.h2database.com
Implementation-Version: ${version}
Build-Jdk: ${buildJdk}
Created-By: ${createdBy}
${mainClassTag}
Main-Class: org.h2.tools.Console
Bundle-Activator: org.h2.util.DbDriverActivator
Bundle-ManifestVersion: 2
Bundle-Name: H2 Database Engine
......
......@@ -15,6 +15,7 @@ import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map.Entry;
......@@ -518,7 +519,7 @@ public class Build extends BuildBase {
public void jar() {
compile();
addVersions(true);
manifest("H2 Database Engine", "org.h2.tools.Console");
manifest("src/main/META-INF/MANIFEST.MF");
FileList files = files("temp").
exclude("temp/org/h2/build/*").
exclude("temp/org/h2/dev/*").
......@@ -574,7 +575,7 @@ public class Build extends BuildBase {
public void jarMVStore() {
compileMVStore(true);
addVersions(false);
manifestMVStore();
manifest("src/installer/mvstore/MANIFEST.MF");
FileList files = files("temp");
files.exclude("*.DS_Store");
files = excludeTestMetaInfFiles(files);
......@@ -690,23 +691,8 @@ public class Build extends BuildBase {
copy("docs/javadocImpl", files("src/docsrc/javadoc"), "src/docsrc/javadoc");
}
private static void manifest(String title, String mainClassName) {
String manifest = new String(readFile(new File(
"src/main/META-INF/MANIFEST.MF")));
manifest = replaceAll(manifest, "${title}", title);
manifest = replaceAll(manifest, "${version}", getVersion());
manifest = replaceAll(manifest, "${buildJdk}", getJavaSpecVersion());
String createdBy = System.getProperty("java.runtime.version") +
" (" + System.getProperty("java.vm.vendor") + ")";
manifest = replaceAll(manifest, "${createdBy}", createdBy);
String mainClassTag = manifest == null ? "" : "Main-Class: " + mainClassName;
manifest = replaceAll(manifest, "${mainClassTag}", mainClassTag);
writeFile(new File("temp/META-INF/MANIFEST.MF"), manifest.getBytes());
}
private static void manifestMVStore() {
String manifest = new String(readFile(new File(
"src/installer/mvstore/MANIFEST.MF")));
private static void manifest(String path) {
String manifest = new String(readFile(new File(path)), StandardCharsets.UTF_8);
manifest = replaceAll(manifest, "${version}", getVersion());
manifest = replaceAll(manifest, "${buildJdk}", getJavaSpecVersion());
String createdBy = System.getProperty("java.runtime.version") +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论