aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/c_templates/svn_interface.c
blob: 4bc8fa87d6a589b8802df3c33cb3ef8950ad1d09 (plain) (blame)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// Used indirectly. See build/scripts/vcs_info.py
// ya-bin dump vcs-info > vcs.json
// python build/scripts/vcs_info.py vcs.json out.c build/scripts/c_templates/svn_interface.c <any_prefix>library/cpp/svnversion<any_suffix>
// DO_NOT_STYLE because this script is sometimes implicilty added as a styling target to STYLE_CPP

#include "build/scripts/c_templates/svnversion.h"

#define STR1(x) #x
#define STR2(x) STR1(x)

const char* GetProgramSvnVersion() {
#if defined(REVISION)
    // for package systems generating from svn export but providing REVISION macro
    #define STRREVISION STR2(REVISION)
    #define REVISIONINFO "r" STRREVISION
    #if defined(PROGRAM_VERSION)
    return PROGRAM_VERSION "\n\n" REVISIONINFO;
    #else
    return REVISIONINFO " "__DATE__
                        " "__TIME__;
    #endif
#elif defined(PROGRAM_VERSION)
    return PROGRAM_VERSION;
#else
    return "No program version found";
#endif
}

const char* GetArcadiaSourcePath() {
#if defined(ARCADIA_SOURCE_PATH)
    return ARCADIA_SOURCE_PATH;
#else
    return "";
#endif
}

const char* GetArcadiaSourceUrl() {
#if defined(ARCADIA_SOURCE_URL)
    return ARCADIA_SOURCE_URL;
#else
    return "";
#endif
}

int GetArcadiaLastChangeNum() {
#if defined(ARCADIA_SOURCE_LAST_CHANGE)
    return ARCADIA_SOURCE_LAST_CHANGE;
#else
    return 0;
#endif
}

const char* GetArcadiaLastChange() {
#if defined(ARCADIA_SOURCE_LAST_CHANGE)
    return STR2(ARCADIA_SOURCE_LAST_CHANGE);
#else
    return "";
#endif
}

const char* GetArcadiaLastAuthor() {
#if defined(ARCADIA_SOURCE_LAST_AUTHOR)
    return ARCADIA_SOURCE_LAST_AUTHOR;
#else
    return "";
#endif
}

int GetProgramSvnRevision() {
#if defined(ARCADIA_SOURCE_REVISION)
    return ARCADIA_SOURCE_REVISION;
#else
    return 0;
#endif
}

const char* GetVCSDirty()
{
#if defined(DIRTY)
    return DIRTY;
#else
    return 0;
#endif
}

const char* GetProgramHash() {
#if defined(ARCADIA_SOURCE_HG_HASH)
    return ARCADIA_SOURCE_HG_HASH;
#else
    return "";
#endif
}

const char* GetProgramCommitId() {
#if defined(ARCADIA_SOURCE_REVISION)
    if (ARCADIA_SOURCE_REVISION <= 0) {
        return GetProgramHash();
    }
    return STR2(ARCADIA_SOURCE_REVISION);
#else
    return GetProgramHash();
#endif
}

const char* GetProgramScmData() {
#if defined(SCM_DATA)
    return SCM_DATA;
#else
    return "";
#endif
}

const char* GetProgramShortVersionData() {
#if defined(SVN_REVISION) && defined(SVN_TIME)
    return STR2(SVN_REVISION) " (" SVN_TIME ")";
#else
    return GetProgramHash();
#endif
}

const char* GetProgramBuildUser() {
#if defined(BUILD_USER)
    return BUILD_USER;
#else
    return "";
#endif
}

const char* GetProgramBuildHost() {
#if defined(BUILD_HOST)
    return BUILD_HOST;
#else
    return "";
#endif
}

const char* GetProgramBuildDate() {
#if defined(BUILD_DATE)
    return BUILD_DATE;
#else
    return "";
#endif
}

const char* GetCustomVersion() {
#if defined(CUSTOM_VERSION)
    return CUSTOM_VERSION;
#else
    return "";
#endif
}

const char* GetReleaseVersion() {
#if defined(RELEASE_VERSION)
    return RELEASE_VERSION;
#else
    return "";
#endif
}

int GetProgramBuildTimestamp() {
#if defined(BUILD_TIMESTAMP)
    return BUILD_TIMESTAMP;
#else
    return 0;
#endif
}

const char* GetVCS() {
#if defined(VCS)
    return VCS;
#else
    return "";
#endif
}

const char* GetBranch() {
#if defined(BRANCH)
    return BRANCH;
#else
    return "";
#endif
}

int GetArcadiaPatchNumber() {
#if defined(ARCADIA_PATCH_NUMBER)
    return ARCADIA_PATCH_NUMBER;
#else
    return 42;
#endif
}

const char* GetTag() {
#if defined(ARCADIA_TAG)
    return ARCADIA_TAG;
#else
    return "";
#endif
}