Bug 588

Summary: Please provide a method getJoglVersion()
Product: [JogAmp] Jogl Reporter: Sylvestre Ledru <sylvestre>
Component: coreAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: enhancement CC: gouessej, sgothel
Priority: P5    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
gluegen a3f2ef50ad33c58a240a17fcf03e415d772207c3 gluegen a7834bb17673ca4eacbb6d599a39e70e00993079 gluegen 25858c68302e194da80fd9cf91cefcba426a42ea gluegen 0d459235979710be6c9cededb8d9e385fdc25d85 gluegen a256b64fa57d9f7789baaf379bd9afdc54d8095d joal e4c51369141808d61902511c738c5243c9badc62 joal ad4d7fb1e792d4a406fc828d852e624cfd144609 joal-demos 4cbde3c73227546ffc5ae6d9943eb6b910d7fd37 jogl 0b242442fba01df86be636f54e3d478aa722d6a7 jogl-demos 189149361f83ce7757824488eb3f51550cf428d3 jogl-demos f8b936ff873536d54c711ec272a2df7a1dbd5ae9 jocl 7fb2cb5ba0b3c841b50ff094163c07a7097326ef jocl-demos 65b097a9edce2a8e49235a0eb9307f65db82e722
Workaround: ---

Description Sylvestre Ledru 2012-06-13 15:56:10 CEST
It would be nice if we could have a simple method like
String getJoglVersion();
which would return:
2.0-rc8

it would help software based on jogl to check which version is used.

For the record:
JoglVersion.getInstance().toString()

returns:
Package: javax.media.opengl
Extension Name: javax.media.opengl
Specification Title: Java Bindings for OpenGL API Specification
Specification Vendor: JogAmp Community
Specification Version: 2.0
Implementation Title: Java Bindings for OpenGL Runtime Environment
Implementation Vendor: JogAmp Community - Debian package
Implementation Vendor ID: com.jogamp
Implementation URL: http://jogamp.org/
Implementation Version: 2.0-bmanual-20120523
Implementation Branch: manual
Implementation Commit: manual
Comment 1 Sven Gothel 2012-06-16 16:31:55 CEST
'JoglVersion.getInstance().getImplementationCommit()' would return the unique 
git sha1 value, accurately identifying the build, IF you building:
  [1] - as a jenkins node
  [2] - using the git source repository and having git installed, 
          instead of using a 'source tar ball'.

[1] jenkins-master passes git values as properties to the jenkins-slave
[2] build machine queries the git sha1 value, buildnumber is 'manual'

Our current release model is to identify a release _after_ it's actually build & test.
Then we tag the sources and associate the release/builds.
Hence Version is <major>.<minor>-b<buildnumber>-<date>
and not <major>.<minor>-<sub>



Note: Querying the tags belonging to one sha1 can be done like this:

git-show-tags-of-commit.sh
+++
#! /bin/sh

sha1=$1
shift

git show-ref --tags -d | grep ^$sha1 | sed -e 's,.* refs/tags/,,' -e 's/\^{}//'
+++

JOGL example:
> git-show-tags-of-commit.sh 9ff0b0dafea2a03a915c97eb1513c39c27b6a7ae
v2.0-rc8

GlueGen example:
> git-show-tags-of-commit.sh 4ce601b38ca8418eddbe8cca4d531e6161fae26b
v2.0-rc7
v2.0-rc8
Comment 2 Sylvestre Ledru 2012-10-15 09:29:11 CEST
Sven, I understand that would work from the git repository and/or with some additional information. 

In my case, if I get only a .jar without any information regarding the version, I would like, from the Java environment, to be able to retrieve the version number.

Thanks
Comment 3 Sylvestre Ledru 2012-12-07 18:48:22 CET
ping ?
Comment 4 Julien Gouesse 2013-03-27 13:56:25 CET
Sylvestre, isn't JoglVersion.getSpecificationVersion() enough for you?
Comment 5 Sylvestre Ledru 2013-03-28 15:09:38 CET
No, I need a method "getJOGLVersion()" which would return the String "2.0rc11"
This methods would have to to work from a standalone jar.
Comment 6 Julien Gouesse 2013-03-28 16:31:21 CET
Ok. I suggest to add a method called "getSpecificationDetailedVersion()" or something similar into com.jogamp.common.util.JogampVersion (JoglVersion extends JogampVersion), it would return the detailed version including indications about alpha, beta, release candidate versions. When building JOGL, JOAL and JOCL, the script would use Sven's suggestion to inject the correct tag, the end user wouldn't need to use this command to get this information. Is it ok for you Sylvestre? I'm a bit skeptical about this change as I agree with Sven but I understand this new method would ease your job as a package maintainer. The problem is that a release is tagged after it's built and tested.
Comment 7 Sylvestre Ledru 2013-03-28 17:15:39 CET
A priori, your proposal sounds good!
Comment 8 Sven Gothel 2013-03-28 18:53:16 CET
(In reply to comment #6)
> Ok. I suggest to add a method called "getSpecificationDetailedVersion()" or
> something similar into com.jogamp.common.util.JogampVersion (JoglVersion
> extends JogampVersion), it would return the detailed version including
> indications about alpha, beta, release candidate versions. When building
> JOGL, JOAL and JOCL, the script would use Sven's suggestion to inject the
> correct tag, the end user wouldn't need to use this command to get this
> information. Is it ok for you Sylvestre? I'm a bit skeptical about this
> change as I agree with Sven but I understand this new method would ease your
> job as a package maintainer. The problem is that a release is tagged after
> it's built and tested.

Who sneaks in the version ?

Well, we could do it like the maven folks do it - hardcoded like:
  - 2.0rc12-SNAPSHOT : pre 2.0rc12
  - 2.0rc12 : release of 2.0rc12
  - 2.0rc12-SNAPSHOT

This will also benefit Mark and our maven support.
Comment 9 Sven Gothel 2013-03-28 18:59:43 CET
(In reply to comment #8)
> (In reply to comment #6)
> > Ok. I suggest to add a method called "getSpecificationDetailedVersion()" or
> > something similar into com.jogamp.common.util.JogampVersion (JoglVersion
> > extends JogampVersion), it would return the detailed version including
> > indications about alpha, beta, release candidate versions. When building
> > JOGL, JOAL and JOCL, the script would use Sven's suggestion to inject the
> > correct tag, the end user wouldn't need to use this command to get this
> > information. Is it ok for you Sylvestre? I'm a bit skeptical about this
> > change as I agree with Sven but I understand this new method would ease your
> > job as a package maintainer. The problem is that a release is tagged after
> > it's built and tested.
> 
> Who sneaks in the version ?
> 
> Well, we could do it like the maven folks do it - hardcoded like:
>   - 2.0rc12-SNAPSHOT : pre 2.0rc12
>   - 2.0rc12 : release of 2.0rc12
>   - 2.0rc12-SNAPSHOT
> 
> This will also benefit Mark and our maven support.

.. and SNAPSHOT is replaced with a date like YYYYMMDDDD at build time.

this version tag, as Julien mentioned, can be added to the manifest as another special field,
exposed w/ out version class.
Comment 10 Sven Gothel 2013-03-29 08:55:12 CET
Main entry: GlueGen a3f2ef50ad33c58a240a17fcf03e415d772207c3

Adding jogamp.version property, i.e. 2.0.2-rc-<TIMESTAMP> used for Manifest 
Common jogamp_int_version for Android.

Until 2.0.2 gets released, the version string is 2.0.2-rc-<TIMESTAMP>
and used in the Manifest for IMPLEMENTATION_VERSION.

The previous build version name of IMPLEMENTATION_VERSION
goes into the new tag IMPLEMENTATION_BUILD.

Further more, we use a common jogamp_int_version for Android, to make life more easy.

Hence use [Jogamp|Jogl|*]Version.getImplementationVersion()
to get the 'human readable' version string.
Comment 11 Sylvestre Ledru 2013-03-29 09:36:39 CET
Excellent! Many thanks :)
Comment 12 Sylvestre Ledru 2013-07-10 11:58:21 CEST
Maybe I am doing something wrong bug the following code

import com.jogamp.opengl.JoglVersion;
public class foo {

    public foo() {
        JoglVersion j = JoglVersion.getInstance();
        System.out.println(j.getImplementationVersion());
    }

    public static void main(String []args) {
        foo f = new foo();

    }

}
returns:
2.0-bmanual-20130516

While I was expecting 2.0-rc12.

Am I missing something ?
Thanks
Comment 13 Sven Gothel 2013-07-10 13:18:23 CEST
Looks at:
<https://jogamp.org/deployment/jogamp-current/jogl-applet-version-napplet.html>

..
Implementation Version: 2.0.2-rc12
..

The version was set in git, but post RC12 we removed the [pre-]release tag,
similar to what folks do w/ maven snapshots.

Also, 'bmanual' means that your build was performed manual and not by jenkins.
Comment 14 Sven Gothel 2013-07-10 13:19:58 CEST
(In reply to comment #13)
> Looks at:
> <https://jogamp.org/deployment/jogamp-current/jogl-applet-version-napplet.
> html>
> 
> ..
> Implementation Version: 2.0.2-rc12
> ..
> 
> The version was set in git, but post RC12 we removed the [pre-]release tag,
> similar to what folks do w/ maven snapshots.
> 

Following commit 'rows' back to developer version:
<http://jogamp.org/git/?p=gluegen.git;a=commitdiff;h=64dcc55a0aadee4ef824cc145e936cd7bc3c1bdd>


> Also, 'bmanual' means that your build was performed manual and not by
> jenkins.
Comment 15 Sven Gothel 2013-07-10 13:35:07 CEST
(In reply to comment #12)
> Maybe I am doing something wrong bug the following code
> 
> import com.jogamp.opengl.JoglVersion;
> public class foo {
> 
>     public foo() {
>         JoglVersion j = JoglVersion.getInstance();
>         System.out.println(j.getImplementationVersion());
>     }
> 
>     public static void main(String []args) {
>         foo f = new foo();
> 
>     }
> 
> }
> returns:
> 2.0-bmanual-20130516
> 
> While I was expecting 2.0-rc12

        JoglVersion j = JoglVersion.getInstance();
        System.out.println("Implementation-Version: "+j.getImplementationVersion());
        System.out.println("Implementation-Build: "+j.getImplementationBuild());
        System.out.println("Implementation-Branch: "+j.getImplementationBranch());

Implementation-Version: 2.0.2-rc-20130710
Implementation-Build: 2.0-bmanual-20130710
Implementation-Branch: master