Merge lp:~ralf-claussnitzer-deactivatedaccount/goobi-production/standalone-cli into lp:goobi-production/1.7

Proposed by Ralf Claussnitzer
Status: Merged
Approved by: Henning Gerhardt
Approved revision: 58
Merged at revision: 53
Proposed branch: lp:~ralf-claussnitzer-deactivatedaccount/goobi-production/standalone-cli
Merge into: lp:goobi-production/1.7
Diff against target: 118 lines (+53/-5)
2 files modified
build.xml (+27/-1)
src/org/goobi/production/cli/CommandLineInterface.java (+26/-4)
To merge this branch: bzr merge lp:~ralf-claussnitzer-deactivatedaccount/goobi-production/standalone-cli
Reviewer Review Type Date Requested Status
Henning Gerhardt Approve
Review via email: mp+102142@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Henning Gerhardt (henning-gerhardt) wrote :

looks ok.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'build.xml'
--- build.xml 2012-04-16 08:47:18 +0000
+++ build.xml 2012-04-16 16:33:23 +0000
@@ -43,6 +43,7 @@
43 <property name="build.dist.vendor" value="SLUB Dresden"/>43 <property name="build.dist.vendor" value="SLUB Dresden"/>
44 <property name="build.dist.url" value="http://launchpad.net/goobi-production"/>44 <property name="build.dist.url" value="http://launchpad.net/goobi-production"/>
45 <property name="build.dist.war" value="${build.dist.dir}/${build.dist.name}-${build.dist.version}.war"/>45 <property name="build.dist.war" value="${build.dist.dir}/${build.dist.name}-${build.dist.version}.war"/>
46 <property name="build.dist.jar" value="${build.dist.dir}/${build.dist.name}-${build.dist.version}.jar"/>
4647
47 <property name="lib.dir" value="${basedir}/lib"/>48 <property name="lib.dir" value="${basedir}/lib"/>
4849
@@ -93,7 +94,7 @@
93 <echoproperties/>94 <echoproperties/>
94 </target>95 </target>
9596
96 <target name="dist" depends="war" description="Produce the distributable."/>97 <target name="dist" depends="war, jar" description="Produce the distributables."/>
9798
98 <target name="distclean" description="Clean up the distribution files only.">99 <target name="distclean" description="Clean up the distribution files only.">
99 <delete dir="${build.dist.dir}"/>100 <delete dir="${build.dist.dir}"/>
@@ -154,6 +155,7 @@
154 <!-- Create needed directories -->155 <!-- Create needed directories -->
155 <target name="createDirs">156 <target name="createDirs">
156 <mkdir dir="${build.dir}"/>157 <mkdir dir="${build.dir}"/>
158 <mkdir dir="${build.dist.dir}"/>
157 <mkdir dir="${build.classes}"/>159 <mkdir dir="${build.classes}"/>
158 <mkdir dir="${build.classes.test}"/>160 <mkdir dir="${build.classes.test}"/>
159 <delete dir="${doc.javadocs.dir}"/>161 <delete dir="${doc.javadocs.dir}"/>
@@ -269,6 +271,30 @@
269271
270 </target>272 </target>
271273
274 <!-- Build standalone CLI jar -->
275 <target name="jar" depends="compile, copy-config">
276
277 <manifestclasspath property="manifest.classpath" jarfile="${build.dist.jar}">
278 <classpath>
279 <fileset dir="${lib.dir}" includes="*.jar"/>
280 </classpath>
281 </manifestclasspath>
282
283 <jar destfile="${build.dist.jar}">
284 <fileset dir="${build.classes}" includes="**/*.class, log4j.properties, GoobiConfig.properties, hibernate.cfg.xml"/>
285 <zipfileset dir="${lib.dir}" prefix="lib"/>
286
287 <manifest>
288 <attribute name="Implementation-Title" value="${ant.project.name}"/>
289 <attribute name="Implementation-Version" value="${build.dist.version}"/>
290 <attribute name="Implementation-Vendor" value="${build.dist.vendor}"/>
291 <attribute name="Implementation-URL" value="${build.dist.url}"/>
292 <attribute name="Implementation-Build-Date" value="${TODAY_UK}"/>
293 <attribute name="Class-Path" value=". ${manifest.classpath}"/>
294 <attribute name="Main-Class" value="org.goobi.production.cli.CommandLineInterface"/>
295 </manifest>
296 </jar>
297 </target>
272298
273 <!-- Copy configuration files to build directory -->299 <!-- Copy configuration files to build directory -->
274 <target name="copy-config">300 <target name="copy-config">
275301
=== modified file 'src/org/goobi/production/cli/CommandLineInterface.java'
--- src/org/goobi/production/cli/CommandLineInterface.java 2012-02-22 07:43:02 +0000
+++ src/org/goobi/production/cli/CommandLineInterface.java 2012-04-16 16:33:23 +0000
@@ -24,10 +24,12 @@
2424
25import java.io.File;25import java.io.File;
26import java.io.IOException;26import java.io.IOException;
27import java.net.URL;
27import java.util.ArrayList;28import java.util.ArrayList;
28import java.util.Collections;29import java.util.Collections;
29import java.util.HashMap;30import java.util.HashMap;
30import java.util.List;31import java.util.List;
32import java.util.jar.Manifest;
3133
32import org.apache.commons.cli.CommandLine;34import org.apache.commons.cli.CommandLine;
33import org.apache.commons.cli.CommandLineParser;35import org.apache.commons.cli.CommandLineParser;
@@ -91,9 +93,18 @@
9193
92 // Version.94 // Version.
93 if (commandLine.hasOption('V')) {95 if (commandLine.hasOption('V')) {
94 System.out.println("Goobi version: " + GoobiVersion.getVersion());96 try {
95 System.out.println("Goobi build date: " + GoobiVersion.getBuilddate());97 // Use Manifest to setup version information
96 System.out.println("Goobi build version: " + GoobiVersion.getBuildversion());98 Manifest m = getManifestForClass(CommandLineInterface.class);
99 GoobiVersion.setupFromManifest(m);
100
101 System.out.println("Goobi version: " + GoobiVersion.getVersion());
102 System.out.println("Goobi build date: " + GoobiVersion.getBuilddate());
103 System.out.println("Goobi build version: " + GoobiVersion.getBuildversion());
104 } catch (Exception e) {
105 System.err.println("Cannot obtain version information from MANIFEST file: " + e.getMessage());
106 return 1;
107 }
97 return 0;108 return 0;
98 }109 }
99 // testing command110 // testing command
@@ -228,7 +239,18 @@
228 return 0;239 return 0;
229 }240 }
230241
231 242 private static Manifest getManifestForClass(Class c) throws IOException {
243 String className = c.getSimpleName() + ".class";
244 String classPath = c.getResource(className).toString();
245
246 if (!classPath.startsWith("jar")) {
247 throw new IOException("Cannot read Manifest file.");
248 }
249
250 String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
251 return new Manifest(new URL(manifestPath).openStream());
252 }
253
232 public static int generateNewProcess(Integer vorlageId, String importFolder) throws ReadException, PreferencesException, SwapException, DAOException, WriteException, IOException, InterruptedException { 254 public static int generateNewProcess(Integer vorlageId, String importFolder) throws ReadException, PreferencesException, SwapException, DAOException, WriteException, IOException, InterruptedException {
233 Prozess vorlage = new ProzessDAO().get(vorlageId);255 Prozess vorlage = new ProzessDAO().get(vorlageId);
234 File dir = new File(importFolder);256 File dir = new File(importFolder);

Subscribers

People subscribed via source and target branches

to all changes: