Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit bd74a0d

Browse files
author
Ian Sturdy
authored
Add queries to build.bat and test.bat. (#81)
Full builds and tests are not yet enabled due to lingering compilation errors.
1 parent 73941af commit bd74a0d

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

WORKSPACE

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,24 @@ new_http_archive(
6767
strip_prefix = "benchmark-master",
6868
build_file_content =
6969
"""
70+
config_setting(
71+
name = "windows",
72+
values = {"cpu": "x64_windows"},
73+
visibility = [ "//visibility:private" ],
74+
)
75+
7076
cc_library(
7177
name = "benchmark",
7278
srcs = glob([
7379
"src/*.h",
7480
"src/*.cc",
7581
]),
7682
hdrs = glob(["include/benchmark/*.h"]),
77-
copts = ["-DHAVE_POSIX_REGEX"], # HAVE_STD_REGEX didn't work.
83+
copts = select({
84+
"//:windows": ["-DHAVE_STD_REGEX"],
85+
# HAVE_STD_REGEX didn't work.
86+
"//conditions:default": ["-DHAVE_POSIX_REGEX"],
87+
}),
7888
includes = ["include"],
7989
visibility = ["//visibility:public"],
8090
)

opencensus/copts.bzl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ load(
3333

3434
DEFAULT_COPTS = select({
3535
"//opencensus:llvm_compiler": LLVM_FLAGS,
36-
"//opencensus:windows": MSVC_FLAGS,
36+
# Disable "not all control paths return a value"; functions that return
37+
# out of a switch on an enum cause build errors otherwise.
38+
"//opencensus:windows": MSVC_FLAGS + ["/wd4715"],
3739
"//conditions:default": GCC_FLAGS,
3840
})
3941

4042
TEST_COPTS = DEFAULT_COPTS + select({
4143
"//opencensus:llvm_compiler": LLVM_TEST_FLAGS,
42-
"//opencensus:windows": MSVC_TEST_FLAGS,
44+
# Disable "not all control paths return a value"; functions that return
45+
# out of a switch on an enum cause build errors otherwise.
46+
"//opencensus:windows": MSVC_TEST_FLAGS + ["/wd4715"],
4347
"//conditions:default": GCC_TEST_FLAGS,
4448
})

tools/appveyor/build.bat

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
REM See the License for the specific language governing permissions and
1313
REM limitations under the License.
1414

15-
REM TODO: Get everything to build on Windows:
16-
REM bazel build //...
15+
REM We need this to append a variable within a loop.
16+
setlocal enabledelayedexpansion
17+
18+
REM TODO: Is there an easier way to convert lines to a space-separated list?
19+
SET BUILDABLES=
20+
FOR /F usebackq %%T IN (`bazel query "kind(rule, //...)" ^| FINDSTR /C:"\:_" /V`) DO (
21+
SET BUILDABLES=!BUILDABLES! %%T
22+
)
1723

1824
REM TODO: Remove --output_user_root after https://github.com/bazelbuild/bazel/issues/4149 is fixed.
19-
bazel --output_user_root=c:/t/ build //opencensus/trace
25+
REM TODO: enable the full build when errors are resolved.
26+
bazel --output_user_root=c:/t/ build //opencensus/trace //opencensus/stats
27+
REM bazel --output_user_root=c:/t/ build %BUILDABLES%
2028

2129
IF %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
2230
EXIT /b 0

tools/appveyor/test.bat

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
REM See the License for the specific language governing permissions and
1313
REM limitations under the License.
1414

15-
REM TODO: Make all tests pass on Windows:
16-
REM bazel test //...
15+
REM We need this to append a variable within a loop.
16+
setlocal enabledelayedexpansion
17+
18+
REM TODO: Is there an easier way to convert lines to a space-separated list?
19+
SET TESTS=
20+
FOR /F usebackq %%T IN (`bazel query "kind(test, //...) except attr('tags', 'manual|noci', //...)" ^| FINDSTR /C:"\:_" /V`) DO (
21+
SET TESTS=!TESTS! %%T
22+
)
1723

1824
REM TODO: Remove --output_user_root after https://github.com/bazelbuild/bazel/issues/4149 is fixed.
19-
REM bazel --output_user_root=c:/t/ test //opencensus/trace:all
2025
echo TODO: Make all tests pass on Windows.
26+
REM bazel --output_user_root=c:/t/ test --test_output=errors %TESTS%
2127

2228
IF %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
2329
EXIT /b 0

0 commit comments

Comments
 (0)