blob: 6bbe0b16e12260686db3265282135c2878f13319 [file] [log] [blame]
Ulf Adams3e87c622017-06-13 10:53:13 +02001# Bazel - Google's Build System
2
brandjondb063a82019-07-30 21:41:37 -07003load("//tools/python:private/defs.bzl", "py_binary")
4
Damien Martin-Guillerezd019eea2015-07-24 12:40:48 +00005package(default_visibility = ["//scripts/release:__pkg__"])
6
Philipp Wollermann02401d92017-03-17 13:51:14 +00007exports_files(["LICENSE"])
8
Damien Martin-Guillerezd019eea2015-07-24 12:40:48 +00009filegroup(
Ulf Adams3e87c622017-06-13 10:53:13 +020010 name = "srcs",
11 srcs = glob(
12 ["*"],
13 exclude = [
14 "bazel-*", # convenience symlinks
15 "out", # IntelliJ with setup-intellij.sh
16 "output", # output of compile.sh
17 ".*", # mainly .git* files
18 ],
19 ) + [
20 "//examples:srcs",
21 "//scripts:srcs",
22 "//site:srcs",
23 "//src:srcs",
24 "//tools:srcs",
25 "//third_party:srcs",
Jakob Buchgraber8da42b62019-04-24 07:37:07 -070026 ] + glob([".bazelci/*"]) + [".bazelrc"],
Damien Martin-Guillerez0baff0f2017-08-22 17:40:37 +020027 visibility = ["//src/test/shell/bazel:__pkg__"],
Ulf Adams3e87c622017-06-13 10:53:13 +020028)
29
30filegroup(
Damien Martin-Guillerezd019eea2015-07-24 12:40:48 +000031 name = "git",
Andreas Bergmeier062da5c2017-12-01 07:30:35 -080032 srcs = glob(
33 [".git/**"],
34 exclude = [".git/**/*[*"], # gitk creates temp files with []
35 ),
Damien Martin-Guillerezd019eea2015-07-24 12:40:48 +000036)
Lukacs Berki678ba232015-09-03 13:28:55 +000037
38filegroup(
39 name = "dummy",
40 visibility = ["//visibility:public"],
41)
Han-Wen Nienhuys47182322015-10-09 17:56:52 +000042
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000043filegroup(
Damien Martin-Guillerez9b889202016-03-03 00:35:13 +000044 name = "workspace-file",
cushonb6646232018-09-07 01:44:10 -070045 srcs = [
46 ":WORKSPACE",
47 ":distdir.bzl",
48 ],
Cal Peyser2152bc12016-04-22 17:08:59 +000049 visibility = [
John Cater214a7ae2017-08-09 17:24:53 +020050 "//src/test/shell/bazel:__subpackages__",
Cal Peyser2152bc12016-04-22 17:08:59 +000051 ],
Damien Martin-Guillerez9b889202016-03-03 00:35:13 +000052)
53
54filegroup(
Yun Penga50635d2016-07-26 13:29:03 +000055 name = "changelog-file",
56 srcs = [":CHANGELOG.md"],
57 visibility = [
John Caterb0308d42017-01-30 17:49:26 +000058 "//scripts/packages:__subpackages__",
Yun Penga50635d2016-07-26 13:29:03 +000059 ],
60)
61
62filegroup(
Jakob Buchgraber6073f1d2017-06-06 11:58:26 -040063 name = "bootstrap-derived-java-srcs",
Laurent Le Brun6fbfe5c2019-07-05 03:10:52 -070064 srcs = glob(
65 ["derived/**/*.java"],
66 allow_empty = True,
67 ),
Jakob Buchgraber6073f1d2017-06-06 11:58:26 -040068 visibility = ["//:__subpackages__"],
69)
70
aiuto11462d12019-07-23 14:46:46 -070071load("@rules_pkg//:pkg.bzl", "pkg_tar")
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000072
73pkg_tar(
74 name = "bazel-srcs",
John Cater214a7ae2017-08-09 17:24:53 +020075 srcs = [":srcs"],
John Cater2f838922018-11-12 08:19:03 -080076 remap_paths = {
77 # Rewrite paths coming from local repositories back into third_party.
78 "../googleapis": "third_party/googleapis",
79 "../remoteapis": "third_party/remoteapis",
80 },
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000081 strip_prefix = ".",
82 # Public but bazel-only visibility.
83 visibility = ["//:__subpackages__"],
84)
Klaus Aehlig4ca79d42016-10-22 07:59:41 +000085
hlopkoaaf64572019-06-14 02:33:56 -070086pkg_tar(
87 name = "platforms-srcs",
88 srcs = ["@platforms//:srcs"],
89 package_dir = "platforms",
90 strip_prefix = ".",
91 visibility = ["//:__subpackages__"],
92)
93
László Csomor0783b9e2017-08-11 10:28:36 +020094py_binary(
95 name = "combine_distfiles",
96 srcs = ["combine_distfiles.py"],
97 visibility = ["//visibility:private"],
98 deps = ["//src:create_embedded_tools_lib"],
99)
100
Klaus Aehlig4ca79d42016-10-22 07:59:41 +0000101genrule(
102 name = "bazel-distfile",
103 srcs = [
104 ":bazel-srcs",
hlopkoaaf64572019-06-14 02:33:56 -0700105 ":platforms-srcs",
Klaus Aehlig4ca79d42016-10-22 07:59:41 +0000106 "//src:derived_java_srcs",
Shahan Yang1a4f7912017-12-19 14:50:53 -0800107 "//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec:bootstrap_autocodec.tar",
Klaus Aehlig3c9cd822018-05-24 03:35:42 -0700108 "@additional_distfiles//:archives.tar",
Klaus Aehlig4ca79d42016-10-22 07:59:41 +0000109 ],
110 outs = ["bazel-distfile.zip"],
László Csomor0783b9e2017-08-11 10:28:36 +0200111 cmd = "$(location :combine_distfiles) $@ $(SRCS)",
112 tools = [":combine_distfiles"],
Klaus Aehlig279a0612016-11-11 09:51:44 +0000113 # Public but bazel-only visibility.
114 visibility = ["//:__subpackages__"],
Klaus Aehlig4ca79d42016-10-22 07:59:41 +0000115)
Klaus Aehlig52b03d12016-11-24 15:16:01 +0000116
117genrule(
118 name = "bazel-distfile-tar",
119 srcs = [
120 ":bazel-srcs",
hlopkoaaf64572019-06-14 02:33:56 -0700121 ":platforms-srcs",
Klaus Aehlig52b03d12016-11-24 15:16:01 +0000122 "//src:derived_java_srcs",
Shahan Yang1a4f7912017-12-19 14:50:53 -0800123 "//src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec:bootstrap_autocodec.tar",
Klaus Aehlig3c9cd822018-05-24 03:35:42 -0700124 "@additional_distfiles//:archives.tar",
Klaus Aehlig52b03d12016-11-24 15:16:01 +0000125 ],
126 outs = ["bazel-distfile.tar"],
László Csomor0783b9e2017-08-11 10:28:36 +0200127 cmd = "$(location :combine_distfiles_to_tar.sh) $@ $(SRCS)",
128 tools = ["combine_distfiles_to_tar.sh"],
Klaus Aehlig52b03d12016-11-24 15:16:01 +0000129 # Public but bazel-only visibility.
130 visibility = ["//:__subpackages__"],
131)
Googlercc858622017-07-25 21:03:05 +0200132
133# This is a workaround for fetching Bazel toolchains, for remote execution.
134# See https://github.com/bazelbuild/bazel/issues/3246.
135# Will be removed once toolchain fetching is supported.
136filegroup(
137 name = "dummy_toolchain_reference",
xingaobea67122018-01-16 08:29:59 -0800138 srcs = ["@bazel_toolchains//configs/debian8_clang/0.2.0/bazel_0.9.0:empty"],
Googlercc858622017-07-25 21:03:05 +0200139 visibility = ["//visibility:public"],
140)
philwo3a3a37a2019-02-05 07:33:47 -0800141
Jakob Buchgraber593c5302019-04-16 10:12:20 -0700142constraint_setting(name = "machine_size")
143
144# A machine with "high cpu count".
145constraint_value(
146 name = "highcpu_machine",
147 constraint_setting = ":machine_size",
148 visibility = ["//visibility:public"],
149)
150
philwo3a3a37a2019-02-05 07:33:47 -0800151platform(
Jakob Buchgraber593c5302019-04-16 10:12:20 -0700152 name = "default_host_platform",
153 constraint_values = [
154 ":highcpu_machine",
155 ],
156 parents = ["@bazel_tools//platforms:host_platform"],
157)
158
Jakob Buchgraber60df9052019-07-11 06:08:00 -0700159REMOTE_PLATFORMS = ("rbe_ubuntu1604_java8", "rbe_ubuntu1804_java11")
160
161[
162 platform(
163 name = platform_name + "_platform",
164 parents = ["@" + platform_name + "//config:platform"],
165 remote_execution_properties = """
166 {PARENT_REMOTE_EXECUTION_PROPERTIES}
167 properties: {
168 name: "dockerNetwork"
169 value: "standard"
170 }
171 properties: {
172 name: "dockerPrivileged"
173 value: "true"
174 }
175 """,
176 )
177 for platform_name in REMOTE_PLATFORMS
178]
179
180[
181 # The highcpu RBE platform where heavy actions run on. In order to
182 # use this platform add the highcpu_machine constraint to your target.
183 platform(
184 name = platform_name + "_highcpu_platform",
185 constraint_values = [
186 "//:highcpu_machine",
187 ],
188 parents = ["//:" + platform_name + "_platform"],
189 remote_execution_properties = """
190 {PARENT_REMOTE_EXECUTION_PROPERTIES}
191 properties: {
192 name: "gceMachineType"
buchgr627ef9c2019-07-11 08:20:18 -0700193 value: "n1-highcpu-32"
Jakob Buchgraber60df9052019-07-11 06:08:00 -0700194 }
195 """,
196 )
197 for platform_name in REMOTE_PLATFORMS
198]