You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BridgeVersion.java.txt 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* ********************************************************************
  2. * Copyright (c) 1998-2001 Xerox Corporation,
  3. * 2002 Palo Alto Research Center, Incorporated (PARC).
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Common Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/cpl-v10.html
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * *******************************************************************/
  13. package org.aspectj.bridge;
  14. import java.text.ParsePosition;
  15. import java.text.SimpleDateFormat;
  16. import java.util.Date;
  17. /** release-specific version information */
  18. public class Version {
  19. // generated from build/lib/BridgeVersion.java
  20. /** default version value for development version */
  21. public static final String DEVELOPMENT = "DEVELOPMENT";
  22. // VersionUptodate.java depends on this value
  23. /** default time value for development version */
  24. public static final long NOTIME = 0L;
  25. /** set by build script */
  26. public static final String text = "@build.version@";
  27. // VersionUptodate.java scans for "static final String text = "
  28. /**
  29. * Time text set by build script using SIMPLE_DATE_FORMAT.
  30. * (if DEVELOPMENT version, invalid)
  31. */
  32. public static final String time_text = "@build.time@";
  33. /**
  34. * time in seconds-since-... format, used by programmatic clients.
  35. * (if DEVELOPMENT version, NOTIME)
  36. */
  37. public static final long time;
  38. /** format used by build script to set time_text */
  39. public static final String SIMPLE_DATE_FORMAT = "@build.time.format@";
  40. // if not DEVELOPMENT version, read time text using format used to set time
  41. static {
  42. long foundTime = NOTIME;
  43. try {
  44. SimpleDateFormat format = new SimpleDateFormat(SIMPLE_DATE_FORMAT);
  45. ParsePosition pos = new ParsePosition(0);
  46. Date date = format.parse(time_text, pos);
  47. foundTime = date.getTime();
  48. } catch (Throwable t) {
  49. }
  50. time = foundTime;
  51. }
  52. /**
  53. * Test whether the version is as specified by any first argument.
  54. * Emit text to System.err on failure
  55. * @param args String[] with first argument equal to Version.text
  56. * @see Version#text
  57. */
  58. public static void main(String[] args) {
  59. if ((null != args) && (0 < args.length)) {
  60. if (!Version.text.equals(args[0])) {
  61. System.err.println("version expected: \""
  62. + args[0]
  63. + "\" actual=\""
  64. + Version.text
  65. + "\"");
  66. }
  67. }
  68. }
  69. }