-
Notifications
You must be signed in to change notification settings - Fork 298
/
helper.bzl
54 lines (49 loc) · 1.41 KB
/
helper.bzl
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
"""This module defines some helper rules."""
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test")
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_group")
def run_command(name, cmd, **kwargs):
"""A rule to run a command."""
native.genrule(
name = "%s__gen" % name,
executable = True,
outs = ["%s.sh" % name],
cmd = "echo '#!/bin/bash' > $@ && echo '%s' >> $@" % cmd,
**kwargs
)
native.sh_binary(
name = name,
srcs = ["%s.sh" % name],
)
def santa_unit_test(
name,
srcs = [],
deps = [],
data = [],
size = "medium",
minimum_os_version = "12.0",
resources = [],
structured_resources = [],
copts = [],
**kwargs):
apple_resource_group(
name = "%s_resources" % name,
resources = resources,
structured_resources = structured_resources,
)
native.objc_library(
name = "%s_lib" % name,
testonly = 1,
srcs = srcs,
deps = deps,
copts = copts,
data = data + [":%s_resources" % name],
**kwargs
)
macos_unit_test(
name = "%s" % name,
bundle_id = "com.google.santa.UnitTest.%s" % name,
minimum_os_version = minimum_os_version,
deps = [":%s_lib" % name],
size = size,
visibility = ["//:__subpackages__"],
)