Changeset 2960


Ignore:
Timestamp:
Nov 27, 2006, 1:40:06 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

References #412: Fix build.xml to make it more developer-friendly

Get version information from the file (base.version) generated at build time.

Location:
trunk/src/core
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Application.java

    r2942 r2960  
    6363
    6464  /**
    65     The major version.
    66   */
    67   private static final int MAJOR_VERSION = 2;
    68  
    69   /**
    70     The minor version.
    71   */
    72   private static final int MINOR_VERSION = 1;
    73  
    74   /**
    75     The build number.
    76     @base.internal
    77     The <code>${base.build}</code> string will be replaced with the
    78     current subversion revision by the <code>ant dist</code> command.
    79     See <code>svn.revision</code>, <code>dist.init</code> and
    80     <code>dist</code> targets in the build file.
    81 
    82   */
    83   private static final int BUILD = parseBuildNumber("${base.build}");
    84  
    85   /**
    8665    If BASE is running or not.
    8766  */
     
    171150 
    172151  /**
    173     Get the major version of Base.
    174   */
    175   public static int getMajorVersion()
    176   {
    177     return MAJOR_VERSION;
    178   }
    179  
    180   /**
    181     Get the minor version of Base.
    182   */
    183   public static int getMinorVersion()
    184   {
    185     return MINOR_VERSION;
    186   }
    187  
     152    Get the major version.
     153  */
     154  public static String getMajorVersion()
     155  {
     156    return Version.getMajor();
     157  }
     158 
     159  /**
     160    Get the minor version.
     161  */
     162  public static String getMinorVersion()
     163  {
     164    return Version.getMinor();
     165  }
     166  /**
     167    Get the maintentance version.
     168  */
     169  public static String getMaintenanceVersion()
     170  {
     171    return Version.getMaintenance();
     172  }
     173 
     174  /**
     175    Get the build number.
     176  */
     177  public static int getBuild()
     178  {
     179    return Version.getBuild();
     180  }
     181
    188182  /**
    189183    Get the BASE version string
     
    191185  public static String getVersionString()
    192186  {
    193     return ("BASE " + getMajorVersion() + "." + getMinorVersion() +
    194             " (build #" + getBuild() + ")");
    195   }
    196  
    197   /**
    198     Get the build number.
    199   */
    200   public static int getBuild()
    201   {
    202     return BUILD;
     187    return "BASE " + getMajorVersion() + "." + getMinorVersion() +
     188      "." + getMaintenanceVersion() + " (build #" + getBuild() +
     189      "; schema #" + Application.getSchemaVersion()+")";
    203190  }
    204191 
     
    321308    {
    322309      // Read settings from the configuration file
     310      Version.init();
     311      log.info("Version: " + Version.getVersion());
     312     
    323313      Config.init();
    324314      authenticationDriver = Config.getString("auth.driver");
     
    847837  }
    848838 
    849  
    850   /**
    851     Find the first digits in a string and return those as the build number.
    852   */
    853   private static int parseBuildNumber(String buildNumber)
    854   {
    855     int build = 0;
    856     Pattern p = Pattern.compile("(\\d+)");
    857     Matcher m = p.matcher(buildNumber);
    858     if (m.find())
    859     {
    860       build = Integer.parseInt(m.group());
    861     }
    862     return build;
    863   }
    864  
    865  
    866839  private static class SessionControlCacheCleaner
    867840    extends TimerTask
Note: See TracChangeset for help on using the changeset viewer.