version info: option --version v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 16 Dec 2013 20:39:07 +0100
branchv_0
changeset 187900bb1666f6
parent 17 d8ab8aece6f2
child 19 873669135d97
version info: option --version
.hgignore
java/sql-dk/build.xml
java/sql-dk/data/info/globalcode/sql/dk/license.txt
java/sql-dk/nbproject/build-impl.xml
java/sql-dk/nbproject/genfiles.properties
java/sql-dk/nbproject/project.properties
java/sql-dk/nbproject/project.xml
java/sql-dk/src/info/globalcode/sql/dk/Constants.java
java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java
java/sql-dk/src/info/globalcode/sql/dk/license.txt
java/sql-dk/version-info.sh
     1.1 --- a/.hgignore	Mon Dec 16 20:20:54 2013 +0100
     1.2 +++ b/.hgignore	Mon Dec 16 20:39:07 2013 +0100
     1.3 @@ -5,3 +5,5 @@
     1.4  java/sql-dk/dist/
     1.5  java/sql-dk/build/
     1.6  java/sql-dk/nbproject/private/
     1.7 +
     1.8 +java/sql-dk/data/info/globalcode/sql/dk/version.txt
     2.1 --- a/java/sql-dk/build.xml	Mon Dec 16 20:20:54 2013 +0100
     2.2 +++ b/java/sql-dk/build.xml	Mon Dec 16 20:39:07 2013 +0100
     2.3 @@ -70,5 +70,10 @@
     2.4      properties which you can use, check the target you are overriding in the
     2.5      nbproject/build-impl.xml file. 
     2.6  
     2.7 -    -->
     2.8 +	-->
     2.9 +	
    2.10 +	<target name="-pre-compile">
    2.11 +		<exec executable="./version-info.sh" output="data/info/globalcode/sql/dk/version.txt"/>
    2.12 +	</target>
    2.13 +	
    2.14  </project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/java/sql-dk/data/info/globalcode/sql/dk/license.txt	Mon Dec 16 20:39:07 2013 +0100
     3.3 @@ -0,0 +1,1 @@
     3.4 +../../../../../../../license/gpl.txt
     3.5 \ No newline at end of file
     4.1 --- a/java/sql-dk/nbproject/build-impl.xml	Mon Dec 16 20:20:54 2013 +0100
     4.2 +++ b/java/sql-dk/nbproject/build-impl.xml	Mon Dec 16 20:39:07 2013 +0100
     4.3 @@ -141,6 +141,7 @@
     4.4          <condition property="have.sources">
     4.5              <or>
     4.6                  <available file="${src.dir}"/>
     4.7 +                <available file="${src.data.dir}"/>
     4.8              </or>
     4.9          </condition>
    4.10          <condition property="netbeans.home+have.tests">
    4.11 @@ -229,6 +230,7 @@
    4.12      </target>
    4.13      <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
    4.14          <fail unless="src.dir">Must set src.dir</fail>
    4.15 +        <fail unless="src.data.dir">Must set src.data.dir</fail>
    4.16          <fail unless="test.src.dir">Must set test.src.dir</fail>
    4.17          <fail unless="build.dir">Must set build.dir</fail>
    4.18          <fail unless="dist.dir">Must set dist.dir</fail>
    4.19 @@ -250,7 +252,7 @@
    4.20      </target>
    4.21      <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
    4.22          <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
    4.23 -            <attribute default="${src.dir}" name="srcdir"/>
    4.24 +            <attribute default="${src.dir}:${src.data.dir}" name="srcdir"/>
    4.25              <attribute default="${build.classes.dir}" name="destdir"/>
    4.26              <attribute default="${javac.classpath}" name="classpath"/>
    4.27              <attribute default="${javac.processorpath}" name="processorpath"/>
    4.28 @@ -290,7 +292,7 @@
    4.29      </target>
    4.30      <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
    4.31          <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
    4.32 -            <attribute default="${src.dir}" name="srcdir"/>
    4.33 +            <attribute default="${src.dir}:${src.data.dir}" name="srcdir"/>
    4.34              <attribute default="${build.classes.dir}" name="destdir"/>
    4.35              <attribute default="${javac.classpath}" name="classpath"/>
    4.36              <attribute default="${javac.processorpath}" name="processorpath"/>
    4.37 @@ -322,7 +324,7 @@
    4.38      </target>
    4.39      <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
    4.40          <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
    4.41 -            <attribute default="${src.dir}" name="srcdir"/>
    4.42 +            <attribute default="${src.dir}:${src.data.dir}" name="srcdir"/>
    4.43              <attribute default="${build.classes.dir}" name="destdir"/>
    4.44              <attribute default="${javac.classpath}" name="classpath"/>
    4.45              <sequential>
    4.46 @@ -920,12 +922,13 @@
    4.47                  <include name="*"/>
    4.48              </dirset>
    4.49          </pathconvert>
    4.50 -        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
    4.51 +        <j2seproject3:depend srcdir="${src.dir}:${src.data.dir}:${build.generated.subdirs}"/>
    4.52      </target>
    4.53      <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
    4.54          <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
    4.55          <copy todir="${build.classes.dir}">
    4.56              <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
    4.57 +            <fileset dir="${src.data.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
    4.58          </copy>
    4.59      </target>
    4.60      <target if="has.persistence.xml" name="-copy-persistence-xml">
    4.61 @@ -946,7 +949,7 @@
    4.62      <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
    4.63          <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
    4.64          <j2seproject3:force-recompile/>
    4.65 -        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
    4.66 +        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.data.dir}"/>
    4.67      </target>
    4.68      <target name="-post-compile-single">
    4.69          <!-- Empty placeholder for easier customization. -->
    4.70 @@ -1210,6 +1213,9 @@
    4.71              <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
    4.72                  <filename name="**/*.java"/>
    4.73              </fileset>
    4.74 +            <fileset dir="${src.data.dir}" excludes="*.java,${excludes}" includes="${includes}">
    4.75 +                <filename name="**/*.java"/>
    4.76 +            </fileset>
    4.77              <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
    4.78                  <include name="**/*.java"/>
    4.79                  <exclude name="*.java"/>
    4.80 @@ -1220,6 +1226,9 @@
    4.81              <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
    4.82                  <filename name="**/doc-files/**"/>
    4.83              </fileset>
    4.84 +            <fileset dir="${src.data.dir}" excludes="${excludes}" includes="${includes}">
    4.85 +                <filename name="**/doc-files/**"/>
    4.86 +            </fileset>
    4.87              <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
    4.88                  <include name="**/doc-files/**"/>
    4.89              </fileset>
     5.1 --- a/java/sql-dk/nbproject/genfiles.properties	Mon Dec 16 20:20:54 2013 +0100
     5.2 +++ b/java/sql-dk/nbproject/genfiles.properties	Mon Dec 16 20:39:07 2013 +0100
     5.3 @@ -1,8 +1,8 @@
     5.4 -build.xml.data.CRC32=c64bb3a1
     5.5 +build.xml.data.CRC32=b51b939b
     5.6  build.xml.script.CRC32=f55b3340
     5.7  build.xml.stylesheet.CRC32=28e38971@1.56.1.46
     5.8  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     5.9  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    5.10 -nbproject/build-impl.xml.data.CRC32=c64bb3a1
    5.11 -nbproject/build-impl.xml.script.CRC32=4453928c
    5.12 +nbproject/build-impl.xml.data.CRC32=b51b939b
    5.13 +nbproject/build-impl.xml.script.CRC32=53c1d5ab
    5.14  nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46
     6.1 --- a/java/sql-dk/nbproject/project.properties	Mon Dec 16 20:20:54 2013 +0100
     6.2 +++ b/java/sql-dk/nbproject/project.properties	Mon Dec 16 20:39:07 2013 +0100
     6.3 @@ -1,9 +1,10 @@
     6.4  annotation.processing.enabled=true
     6.5  annotation.processing.enabled.in.editor=false
     6.6 -annotation.processing.processor.options=
     6.7  annotation.processing.processors.list=
     6.8  annotation.processing.run.all.processors=true
     6.9  annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
    6.10 +application.title=sql-dk
    6.11 +application.vendor=fiki
    6.12  build.classes.dir=${build.dir}/classes
    6.13  build.classes.excludes=**/*.java,**/*.form
    6.14  # This directory is removed when the project is cleaned:
    6.15 @@ -24,6 +25,7 @@
    6.16  dist.dir=dist
    6.17  dist.jar=${dist.dir}/sql-dk.jar
    6.18  dist.javadoc.dir=${dist.dir}/javadoc
    6.19 +endorsed.classpath=
    6.20  excludes=
    6.21  includes=**
    6.22  jar.compress=false
    6.23 @@ -68,5 +70,6 @@
    6.24      ${javac.test.classpath}:\
    6.25      ${build.test.classes.dir}
    6.26  source.encoding=UTF-8
    6.27 +src.data.dir=data
    6.28  src.dir=src
    6.29  test.src.dir=test
     7.1 --- a/java/sql-dk/nbproject/project.xml	Mon Dec 16 20:20:54 2013 +0100
     7.2 +++ b/java/sql-dk/nbproject/project.xml	Mon Dec 16 20:39:07 2013 +0100
     7.3 @@ -6,6 +6,7 @@
     7.4              <name>sql-dk</name>
     7.5              <source-roots>
     7.6                  <root id="src.dir"/>
     7.7 +                <root id="src.data.dir"/>
     7.8              </source-roots>
     7.9              <test-roots>
    7.10                  <root id="test.src.dir"/>
     8.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/Constants.java	Mon Dec 16 20:20:54 2013 +0100
     8.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/Constants.java	Mon Dec 16 20:39:07 2013 +0100
     8.3 @@ -24,6 +24,8 @@
     8.4  public class Constants {
     8.5  
     8.6  	public static final String WEBSITE = "https://sql-dk.globalcode.info/";
     8.7 +	public static final String LICENSE_FILE = "info/globalcode/sql/dk/license.txt";
     8.8 +	public static final String VERSION_FILE = "info/globalcode/sql/dk/version.txt";
     8.9  
    8.10  	private Constants() {
    8.11  	}
     9.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java	Mon Dec 16 20:20:54 2013 +0100
     9.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java	Mon Dec 16 20:39:07 2013 +0100
     9.3 @@ -52,13 +52,13 @@
     9.4  					println("TODO: show some help");
     9.5  					break;
     9.6  				case LICENSE:
     9.7 -					printLicense();
     9.8 +					printResource(Constants.LICENSE_FILE);
     9.9  					break;
    9.10  				case TYPES:
    9.11  					println("TODO: list supported types");
    9.12  					break;
    9.13  				case VERSION:
    9.14 -					println("TODO: show version");
    9.15 +					printResource(Constants.VERSION_FILE);
    9.16  					break;
    9.17  				case DATABASES:
    9.18  					println("TODO: list databases");
    9.19 @@ -72,10 +72,10 @@
    9.20  		}
    9.21  	}
    9.22  
    9.23 -	private void printLicense() {
    9.24 -		try (BufferedReader license = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("info/globalcode/sql/dk/license.txt")))) {
    9.25 +	private void printResource(String fileName) {
    9.26 +		try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(fileName)))) {
    9.27  			while (true) {
    9.28 -				String line = license.readLine();
    9.29 +				String line = reader.readLine();
    9.30  				if (line == null) {
    9.31  					break;
    9.32  				} else {
    9.33 @@ -83,7 +83,7 @@
    9.34  				}
    9.35  			}
    9.36  		} catch (Exception e) {
    9.37 -			log.log(Level.SEVERE, "Unable to print license. See our website for license information.", e);
    9.38 +			log.log(Level.SEVERE, "Unable to print this info. Please see our website for it: " + Constants.WEBSITE, e);
    9.39  		}
    9.40  	}
    9.41  
    10.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/license.txt	Mon Dec 16 20:20:54 2013 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,1 +0,0 @@
    10.4 -../../../../../../../license/gpl.txt
    10.5 \ No newline at end of file
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/java/sql-dk/version-info.sh	Mon Dec 16 20:39:07 2013 +0100
    11.3 @@ -0,0 +1,5 @@
    11.4 +#!/bin/bash
    11.5 +
    11.6 +echo -n "Mercurial: "; hg identify || echo "n/a";
    11.7 +echo -n "Compiled:  "; date --rfc-3339=seconds;
    11.8 +