@@ -219,6 +219,11 @@ os::build::internal::build_binaries() {
219
219
local_ldflags+=" -s"
220
220
fi
221
221
222
+ # Add Windows File Properties/Version Info and Icon Resource for oc.exe
223
+ if [[ " $platform " == " windows/amd64" ]]; then
224
+ os::build::generate_windows_versioninfo
225
+ fi
226
+
222
227
if [[ ${# nonstatics[@]} -gt 0 ]]; then
223
228
GOOS=${platform%/* } GOARCH=${platform##*/ } go install \
224
229
-pkgdir " ${OS_OUTPUT_PKGDIR} /${platform} " \
@@ -234,6 +239,10 @@ os::build::internal::build_binaries() {
234
239
fi
235
240
fi
236
241
242
+ if [[ " $platform " == " windows/amd64" ]]; then
243
+ rm ${OS_ROOT} /cmd/oc/oc.syso
244
+ fi
245
+
237
246
for test in " ${tests[@]: +${tests[@]} } " ; do
238
247
local outfile=" ${OS_OUTPUT_BINPATH} /${platform} /$( basename ${test} ) "
239
248
# disabling cgo allows use of delve
@@ -249,7 +258,64 @@ os::build::internal::build_binaries() {
249
258
}
250
259
readonly -f os::build::build_binaries
251
260
252
- # Generates the set of target packages, binaries, and platforms to build for.
261
+ # Generates the .syso file used to add compile-time VERSIONINFO metadata to the
262
+ # Windows binary.
263
+ function os::build::generate_windows_versioninfo() {
264
+ os::util::ensure::gopath_binary_exists ' goversioninfo' ' github.com/josephspurrier/goversioninfo/cmd/goversioninfo'
265
+ os::build::version::get_vars
266
+ local major=" ${OS_GIT_MAJOR} "
267
+ local minor=" ${OS_GIT_MINOR% +} "
268
+ local patch=" ${OS_GIT_PATCH} "
269
+ local windows_versioninfo_file=` mktemp --suffix=" .versioninfo.json" `
270
+ cat << EOF >"${windows_versioninfo_file} "
271
+ {
272
+ "FixedFileInfo":
273
+ {
274
+ "FileVersion": {
275
+ "Major": ${major} ,
276
+ "Minor": ${minor} ,
277
+ "Patch": ${patch}
278
+ },
279
+ "ProductVersion": {
280
+ "Major": ${major} ,
281
+ "Minor": ${minor} ,
282
+ "Patch": ${patch}
283
+ },
284
+ "FileFlagsMask": "3f",
285
+ "FileFlags ": "00",
286
+ "FileOS": "040004",
287
+ "FileType": "01",
288
+ "FileSubType": "00"
289
+ },
290
+ "StringFileInfo":
291
+ {
292
+ "Comments": "",
293
+ "CompanyName": "Red Hat, Inc.",
294
+ "InternalName": "openshift client",
295
+ "FileVersion": "${OS_GIT_VERSION} ",
296
+ "InternalName": "oc",
297
+ "LegalCopyright": "© Red Hat, Inc. Licensed under the Apache License, Version 2.0",
298
+ "LegalTrademarks": "",
299
+ "OriginalFilename": "oc.exe",
300
+ "PrivateBuild": "",
301
+ "ProductName": "OpenShift Client",
302
+ "ProductVersion": "${OS_GIT_VERSION} ",
303
+ "SpecialBuild": ""
304
+ },
305
+ "VarFileInfo":
306
+ {
307
+ "Translation": {
308
+ "LangID": "0409",
309
+ "CharsetID": "04B0"
310
+ }
311
+ }
312
+ }
313
+ EOF
314
+ goversioninfo -o ${OS_ROOT} /cmd/oc/oc.syso ${windows_versioninfo_file}
315
+ }
316
+ readonly -f os::build::generate_windows_versioninfo
317
+
318
+ # Generates the set of target packages, binaries, and platforms to build for.
253
319
# Accepts binaries via $@, and platforms via OS_BUILD_PLATFORMS, or defaults to
254
320
# the current platform.
255
321
function os::build::export_targets() {
@@ -533,4 +599,4 @@ function os::build::commit_range() {
533
599
534
600
echo " $1 "
535
601
}
536
- readonly -f os::build::commit_range
602
+ readonly -f os::build::commit_range
0 commit comments