-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathutils.bzl
More file actions
18 lines (18 loc) · 781 Bytes
/
utils.bzl
File metadata and controls
18 lines (18 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def select_os(linux = None, macos = None, windows = None, posix = None, otherwise = []):
selection = {}
if posix != None:
if linux != None or macos != None:
fail("select_os: cannot specify both posix and linux or macos")
selection["@platforms//os:linux"] = posix
selection["@platforms//os:macos"] = posix
if linux != None:
selection["@platforms//os:linux"] = linux
if macos != None:
selection["@platforms//os:macos"] = macos
if windows != None:
selection["@platforms//os:windows"] = windows
if len(selection) < 3:
selection["//conditions:default"] = otherwise
elif otherwise != []:
fail("select_os: cannot specify all three OSes and an otherwise")
return select(selection)