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