forked from bazel-contrib/rules_go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.bzl
124 lines (117 loc) · 3.24 KB
/
list.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
GOOS = {
"android": None,
"darwin": "@bazel_tools//platforms:osx",
"dragonfly": None,
"freebsd": "@bazel_tools//platforms:freebsd",
"linux": "@bazel_tools//platforms:linux",
"nacl": None,
"netbsd": None,
"openbsd": None,
"plan9": None,
"solaris": None,
"windows": "@bazel_tools//platforms:windows",
"js": None,
}
GOARCH = {
"386": "@bazel_tools//platforms:x86_32",
"amd64": "@bazel_tools//platforms:x86_64",
"amd64p32": None,
"arm": "@bazel_tools//platforms:arm",
"arm64": "@bazel_tools//platforms:aarch64",
"mips": None,
"mips64": None,
"mips64le": None,
"mipsle": None,
"ppc64": None,
"ppc64le": "@bazel_tools//platforms:ppc",
"s390x": "@bazel_tools//platforms:s390x",
"wasm": None,
}
GOOS_GOARCH = (
("android", "386"),
("android", "amd64"),
("android", "arm"),
("android", "arm64"),
("darwin", "386"),
("darwin", "amd64"),
("darwin", "arm"),
("darwin", "arm64"),
("dragonfly", "amd64"),
("freebsd", "386"),
("freebsd", "amd64"),
("freebsd", "arm"),
("linux", "386"),
("linux", "amd64"),
("linux", "arm"),
("linux", "arm64"),
("linux", "mips"),
("linux", "mips64"),
("linux", "mips64le"),
("linux", "mipsle"),
("linux", "ppc64"),
("linux", "ppc64le"),
("linux", "s390x"),
("nacl", "386"),
("nacl", "amd64p32"),
("nacl", "arm"),
("netbsd", "386"),
("netbsd", "amd64"),
("netbsd", "arm"),
("openbsd", "386"),
("openbsd", "amd64"),
("openbsd", "arm"),
("plan9", "386"),
("plan9", "amd64"),
("plan9", "arm"),
("solaris", "amd64"),
("windows", "386"),
("windows", "amd64"),
("js", "wasm"),
)
RACE_GOOS_GOARCH = (
("darwin", "amd64"),
("freebsd", "amd64"),
("linux", "amd64"),
("windows", "amd64"),
)
MSAN_GOOS_GOARCH = (
("linux", "amd64"),
)
def declare_config_settings():
for goos in GOOS:
native.config_setting(
name = goos,
constraint_values = ["//go/toolchain:" + goos],
)
for goarch in GOARCH:
native.config_setting(
name = goarch,
constraint_values = ["//go/toolchain:" + goarch],
)
for goos, goarch in GOOS_GOARCH:
native.config_setting(
name = goos + "_" + goarch,
constraint_values = [
"//go/toolchain:" + goos,
"//go/toolchain:" + goarch,
],
)
def generate_toolchain_names():
# Keep in sync with generate_toolchains
return [
"go_{}_{}".format(target_goos, target_goarch)
for target_goos, target_goarch in GOOS_GOARCH
]