Expose version information more cleanly
---------------------------------------

                 Key: PIG-2380
                 URL: https://issues.apache.org/jira/browse/PIG-2380
             Project: Pig
          Issue Type: Improvement
            Reporter: Jonathan Coveney
            Assignee: Jonathan Coveney
            Priority: Minor
             Fix For: 0.11
         Attachments: PIG2380.patch

Currently, there is no clean way to get version information (short of trying to 
instantiate a class that only exists in the version you want and catching an 
exception, or something like that). This patch exposes major, minor, patch, svn 
revision, and build time (basically, all of the pieces of the current version).

Example:
{code}
import org.apache.pig.Main;

public class Thing {
  public static void main(String[] args) {
    System.out.println(Main.getMajorVersion());
    System.out.println(Main.getMinorVersion());
    System.out.println(Main.getPatchVersion());
    System.out.println(Main.getSvnRevision());
    System.out.println(Main.getBuildTime());
  }
}
{code}

will return

{code}
0
11
0
1202387
Nov 15 2011, 15:37:14
0
{code}

which comprises

{code}
Apache Pig version 0.11.0-SNAPSHOT (r1202387) 
compiled Nov 15 2011, 15:37:14
{code}

I've run ant test-commit, but not ant test. This can easily be ported to old 
version, but I only tested it against trunk.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to