Skip to content

Commit ca09d1e

Browse files
authored
Add version information to windows binaries (#61)
The information required for stamping binaries is only available when building on Linux and macOS. Therefore, the windows binary doesn't show the version with the `version` command: ``` > engflow_auth.exe version build metadata is unavailable (build with bazel's `--stamp` flag to enable) ``` This change adds the windows batch file to collect the required information on Windows systems.
1 parent 8ed260b commit ca09d1e

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ build --incompatible_strict_action_env
55

66
# The {linux,macos,windows} configs are automatically enabled by Bazel depending
77
# on the current platform due to --enable_platform_specific_config above.
8-
# Currently, there is no Windows support for building with bazel.
98
build:linux --workspace_status_command=infra/get_workspace_status
109
build:macos --workspace_status_command=infra/get_workspace_status
10+
build:windows --workspace_status_command=infra/get_workspace_status.cmd
1111

1212
test --test_summary=testcase
1313
test --test_output=errors

infra/get_workspace_status.cmd

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
:: Copyright 2024 EngFlow Inc. All rights reserved.
2+
::
3+
:: Licensed under the Apache License, Version 2.0 (the "License");
4+
:: you may not use this file except in compliance with the License.
5+
:: You may obtain a copy of the License at
6+
::
7+
:: http://www.apache.org/licenses/LICENSE-2.0
8+
::
9+
:: Unless required by applicable law or agreed to in writing, software
10+
:: distributed under the License is distributed on an "AS IS" BASIS,
11+
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
:: See the License for the specific language governing permissions and
13+
:: limitations under the License.
14+
15+
:: The variables defined here are available not only in BES logs, but also for
16+
:: stamping into built binaries (version information, etc.). Removing vars or
17+
:: changing var names may break these version stamping libraries; if this script
18+
:: is updated, also make sure the following are up-to-date:
19+
::
20+
:: - //internal/buildstamp/BUILD
21+
22+
@echo off
23+
24+
for /F %%x in ('git rev-parse --abbrev-ref HEAD') do echo BUILD_SCM_BRANCH %%x
25+
for /F %%x in ('git rev-parse --verify HEAD') do echo BUILD_SCM_REVISION %%x
26+
27+
echo STABLE_BUILD_RELEASE_VERSION %BUILD_RELEASE_VERSION%
28+
29+
git diff-index --quiet HEAD --
30+
if %ERRORLEVEL% == 0 (
31+
echo BUILD_SCM_STATUS "clean"
32+
) else (
33+
echo BUILD_SCM_STATUS "modified"
34+
)
35+
36+
for /F %%x in ('git remote get-url origin') do set REMOTE_URL=%%x
37+
if %ERRORLEVEL% == 0 (
38+
echo BUILD_SCM_REMOTE %REMOTE_URL%
39+
)

infra/internal/check_copyright_headers/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var (
4343
regexp.MustCompile(`^platform/linux_x64/builtin_include_directory_paths`),
4444
regexp.MustCompile(`^platform/linux_x64/module.modulemap`),
4545
}
46-
copyrightRegexp = regexp.MustCompile(`^(#|//) Copyright [0-9-]+ EngFlow Inc\.`)
46+
copyrightRegexp = regexp.MustCompile(`^(#|//|::) Copyright [0-9-]+ EngFlow Inc\.`)
4747
)
4848

4949
type checkerFunc func(string) bool

0 commit comments

Comments
 (0)