| 1 |
load("//src/main/res:win_res.bzl", "windows_resources") |
| 2 |
load("@bazel_tools//tools/build_rules:test_rules.bzl", "file_test") |
| 3 |
|
| 4 |
filegroup( |
| 5 |
name = "srcs", |
| 6 |
srcs = glob(["**"]), |
| 7 |
visibility = ["//src:__pkg__"], |
| 8 |
) |
| 9 |
|
| 10 |
cc_binary( |
| 11 |
name = "app", |
| 12 |
testonly = 1, |
| 13 |
srcs = [ |
| 14 |
"app.cc", |
| 15 |
"app.h", |
| 16 |
], |
| 17 |
linkopts = select({ |
| 18 |
"//src/conditions:windows": ["-DEFAULTLIB:user32.lib"], |
| 19 |
"//conditions:default": [], |
| 20 |
}), |
| 21 |
deps = [":res"], |
| 22 |
) |
| 23 |
|
| 24 |
windows_resources( |
| 25 |
name = "res", |
| 26 |
testonly = 1, |
| 27 |
rc_files = ["app.rc"], |
| 28 |
resources = ["app.h"], |
| 29 |
) |
| 30 |
|
| 31 |
genrule( |
| 32 |
name = "run_app", |
| 33 |
testonly = 1, |
| 34 |
outs = ["app.out"], |
| 35 |
cmd = "$(location :app) > $@", |
| 36 |
tools = [":app"], |
| 37 |
) |
| 38 |
|
| 39 |
file_test( |
| 40 |
name = "res_test", |
| 41 |
content = select({ |
| 42 |
"//src/conditions:windows": "l=12, p=(Hello string)", |
| 43 |
"//conditions:default": "not supported", |
| 44 |
}), |
| 45 |
file = ":run_app", |
| 46 |
) |
| 47 |
|
| 48 |
test_suite(name = "all_tests") |