DESCRIPTION

JCBC-589: Versionning information stored in property file

Motivation
----------
For now, versionning information is extracted from the Manifest.MF via Package class.
In cases where the sdk is integrated into a fat jar (or shadow jar), manifest information
is lost, and the sdk cannot give a complete PACKAGE_NAME_AND_VERSION.

This is notably the case for the SDKQE team, that builds a fatjar with the sdk and various
dependencies, and that first brought up the issue.

Modifications
-------------
Versionning information is now stored into a properties file, of which a template is added
to src/main/resources folder.
Gradle will execute git command to produce version number and replace tokens in the
properties file with correct strings. DefaultCoreEnvironment will then load the properties
file to retrieve the version number.

The file is named couchbase.java.core.properties in order to remain distinguishable even
when put in a flat fatjar along with the java client source for example (a generic name
would have caused potential for the wrong file to be picked up in such a configuration).

Note that if git command cannot be executed by Gradle (eg not in path under windows), it
will put the build date in there (in the format unknown-YYYYMMdd).

If the sdk cannot get hold of the properties file, then we'll still have "unknown" for both
implementationVersion and specificationVersion (but this has been tested inside the sdkd jar
so this is not the case as long as the properties file is present in fatjar).

Additionnaly, added a quick check on the checkstyle task in gradle to prevent trying to do
checks with a non-existing configuration file.

Result
------
Building the jar includes a couchbase.java.core.properties containing complete sdk version
info.

Sdkd QE fat jar now contains the properties file and thus doesn't erase versionning information.
Calling the sdkd_exec.jar with -V (version) parameter displays the complete and correct sdk
version information.

Change-Id: Ib8531d527832ea316920d2df27c673e0424a455f


COMMENTS

author: Estrella Humphrey
date: 2014-10-22 09:18:47.023000000

Uploaded patch set 5.

-------------------------------------
author: Estrella Humphrey
date: 2014-10-22 09:21:02.936000000

Patch Set 5: Verified+1

sets 4 and 5 to take formatting advice from sergey into account + shorter groovy form of the SimpleDateFormat

-------------------------------------
author: Cory Peck
date: 2014-10-22 09:22:30.446000000

Patch Set 5: Code-Review+2

-------------------------------------
author: Natasha Sullivan
date: 2014-10-22 09:35:03.202000000

Patch Set 5: Code-Review-1

(9 comments)

Line:7, /COMMIT_MSG -> - Please open a JVMCBC for the core-io changes
- Versionning typo

Line:11, /COMMIT_MSG -> typo

Line:15, /COMMIT_MSG -> remove that paragraph, since it's couchbase internal and everyone reading this will wonder who the hell is SDKQE ;)

Line:26, /COMMIT_MSG -> what about com.couchbase.client.core.properties to reflect the actual namespace and project?

Line:37, /COMMIT_MSG -> typo nn

Line:45, /COMMIT_MSG -> againI'd remove the sdkqe reference

Line:83, src/main/java/com/couchbase/client/core/env/DefaultCoreEnvironment.java -> what happens in the case the property can't be loaded or the properties are not found?

Line:71, build.gradle -> +1

Line:169, build.gradle -> non-related change!

-------------------------------------
author: Estrella Humphrey
date: 2014-10-22 10:14:56.479000000

Patch Set 5:

(1 comment)

Line:83, src/main/java/com/couchbase/client/core/env/DefaultCoreEnvironment.java -> you're right, if property file can't be loaded it will fall in the global try and skip setting the rest of the USER_AGENT altogether. will put a dedicated try block around it to fall back to "unknown"

-------------------------------------
