diff options
| -rw-r--r-- | guix-science/packages/bazel.scm | 245 | ||||
| -rw-r--r-- | patches/bazel-mock-repos.patch | 527 | ||||
| -rw-r--r-- | patches/bazel-workspace.patch | 58 |
3 files changed, 830 insertions, 0 deletions
diff --git a/guix-science/packages/bazel.scm b/guix-science/packages/bazel.scm new file mode 100644 index 0000000..0019a98 --- /dev/null +++ b/guix-science/packages/bazel.scm | |||
| @@ -0,0 +1,245 @@ | |||
| 1 | ;;; Copyright © 2023 Ricardo Wurmus <rekado@elephly.net> | ||
| 2 | ;;; | ||
| 3 | ;;; This program is free software; you can redistribute it and/or modify it | ||
| 4 | ;;; under the terms of the GNU General Public License as published by | ||
| 5 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
| 6 | ;;; your option) any later version. | ||
| 7 | ;;; | ||
| 8 | ;;; This program is distributed in the hope that it will be useful, but | ||
| 9 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | ;;; GNU General Public License for more details. | ||
| 12 | ;;; | ||
| 13 | ;;; You should have received a copy of the GNU General Public License | ||
| 14 | ;;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | |||
| 16 | (define-module (guix-science packages bazel) | ||
| 17 | #:use-module ((guix licenses) #:prefix license:) | ||
| 18 | #:use-module (guix packages) | ||
| 19 | #:use-module (guix gexp) | ||
| 20 | #:use-module (guix download) | ||
| 21 | #:use-module (guix build-system gnu) | ||
| 22 | #:use-module (gnu packages) | ||
| 23 | #:use-module (gnu packages base) | ||
| 24 | #:use-module (gnu packages bash) | ||
| 25 | #:use-module (gnu packages compression) | ||
| 26 | #:use-module (gnu packages java) | ||
| 27 | #:use-module (gnu packages java-compression) | ||
| 28 | #:use-module (gnu packages linux) | ||
| 29 | #:use-module (gnu packages protobuf) | ||
| 30 | #:use-module (gnu packages python) | ||
| 31 | #:use-module (gnu packages rpc)) | ||
| 32 | |||
| 33 | ;; TODO: all these jars need to be replaced with packages from Guix. | ||
| 34 | #; | ||
| 35 | (let ((files | ||
| 36 | '(("netty" . #f) | ||
| 37 | ("gson" . "java-gson") | ||
| 38 | ("tomcat_annotations_api" . #f) | ||
| 39 | ("allocation_instrumenter" . #f) | ||
| 40 | ("protobuf_java" . #f) | ||
| 41 | ("protobuf_java_util" . #f) | ||
| 42 | ("apache_commons_collections" . "java-commons-collections") | ||
| 43 | ("apache_commons_lang" . "java-commons-lang3") | ||
| 44 | ("apache_commons_compress" . "java-commons-compress") | ||
| 45 | ("apache_commons_pool2" . "java-commons-pool") | ||
| 46 | ("apache_velocity" . #f) | ||
| 47 | ("asm" . "java-asm") | ||
| 48 | ("jackson2" . "java-fasterxml-jackson-core") | ||
| 49 | ("jcip_annotations" . #f) | ||
| 50 | ("jsr305" . "java-jsr305") | ||
| 51 | ("javapoet" . #f) | ||
| 52 | ("jaxb" . #f) ;maybe java-fasterxml-jackson-modules-base-jaxb? | ||
| 53 | ("xz" . "java-xz") | ||
| 54 | ("javax_annotations" . #f) | ||
| 55 | ("android_common_25_0_0_lite" . #f) | ||
| 56 | ("guava" . "java-guava") | ||
| 57 | ("TODO:jacoco" . #f) | ||
| 58 | ("escapevelocity" . #f) | ||
| 59 | ("auto_common" . #f) | ||
| 60 | ("auto_service_lib" . #f) | ||
| 61 | ("auto_value_value" . #f) | ||
| 62 | ("api_client" . #f) | ||
| 63 | ("auth" . #f) | ||
| 64 | ("error_prone_annotations" . #f) | ||
| 65 | ("java-diff-utils" . #f) | ||
| 66 | ("opencensus-api" . #f) | ||
| 67 | ("perfmark-api" . #f) | ||
| 68 | ("flogger" . #f) | ||
| 69 | ("checker_framework_annotations" . #f) | ||
| 70 | ("grpc-jar" . #f) | ||
| 71 | ("junit4" . "java-junit") | ||
| 72 | ("reactive_streams" . #f) | ||
| 73 | ("rxjava3" . #f) | ||
| 74 | ("caffeine" . #f)))) | ||
| 75 | #t) | ||
| 76 | |||
| 77 | (define-public bazel-6 | ||
| 78 | (package | ||
| 79 | (name "bazel") | ||
| 80 | (version "6.3.2") | ||
| 81 | (source (origin | ||
| 82 | (method url-fetch/zipbomb) | ||
| 83 | (uri (string-append "https://github.com/bazelbuild/bazel/" | ||
| 84 | "releases/download/" version | ||
| 85 | "/bazel-" version "-dist.zip")) | ||
| 86 | (sha256 | ||
| 87 | (base32 | ||
| 88 | "0j190j7vjknlw1cgynb3r8vlv0j6i9lac6s5payf4fqrb2ngxmwc")) | ||
| 89 | (patches | ||
| 90 | (search-patches "patches/bazel-mock-repos.patch" | ||
| 91 | "patches/bazel-workspace.patch")))) | ||
| 92 | (build-system gnu-build-system) | ||
| 93 | (arguments | ||
| 94 | (list | ||
| 95 | #:tests? #false ;there are none | ||
| 96 | #:phases | ||
| 97 | #~(modify-phases %standard-phases | ||
| 98 | (delete 'configure) | ||
| 99 | (replace 'build | ||
| 100 | (lambda _ | ||
| 101 | ;; Use local JDK only | ||
| 102 | (setenv "EXTRA_BAZEL_ARGS" | ||
| 103 | (string-append | ||
| 104 | "\ | ||
| 105 | --tool_java_runtime_version=local_jdk \ | ||
| 106 | --noremote_accept_cached \ | ||
| 107 | --verbose_failures \ | ||
| 108 | --subcommands \ | ||
| 109 | --action_env=PATH \ | ||
| 110 | --action_env=LIBRARY_PATH \ | ||
| 111 | --action_env=C_INCLUDE_PATH \ | ||
| 112 | --action_env=CPLUS_INCLUDE_PATH \ | ||
| 113 | --action_env=GUIX_LOCPATH \ | ||
| 114 | --host_action_env=PATH \ | ||
| 115 | --host_action_env=LIBRARY_PATH \ | ||
| 116 | --host_action_env=C_INCLUDE_PATH \ | ||
| 117 | --host_action_env=CPLUS_INCLUDE_PATH \ | ||
| 118 | --host_action_env=GUIX_LOCPATH \ | ||
| 119 | --define=distribution=debian | ||
| 120 | --override_repository=com_google_protobuf=" (getcwd) "/tools/distributions/debian/protobuf \ | ||
| 121 | --override_repository=remote_java_tools_linux=" (getcwd) "/mock_repos/remote_java_tools_linux \ | ||
| 122 | --override_repository=io_bazel_skydoc=" (getcwd) "/mock_repos/bazel_skydoc \ | ||
| 123 | --override_repository=rules_cc=" (getcwd) "/mock_repos/rules_cc \ | ||
| 124 | --override_repository=rules_java=" (getcwd) "/mock_repos/rules_java \ | ||
| 125 | --override_repository=rules_proto=" (getcwd) "/mock_repos/rules_proto \ | ||
| 126 | --override_repository=platforms=" (getcwd) "/mock_repos/platforms \ | ||
| 127 | ")) | ||
| 128 | (substitute* "tools/distributions/debian/deps.bzl" | ||
| 129 | (("/usr/include/google/protobuf") | ||
| 130 | (string-append #$(this-package-native-input "protobuf") | ||
| 131 | "/include/google/protobuf")) | ||
| 132 | ;; TODO: /usr/bin/grpc_java_plugin | ||
| 133 | ;; TODO: add all the java things | ||
| 134 | (("\"grpc_java_plugin.*") "") | ||
| 135 | (("/usr/bin/protoc") | ||
| 136 | (string-append #$(this-package-native-input "protobuf") | ||
| 137 | "/bin/protoc")) | ||
| 138 | (("/usr/bin/grpc_cpp_plugin") | ||
| 139 | (string-append #$(this-package-input "grpc") | ||
| 140 | "/bin/grpc_cpp_plugin")) | ||
| 141 | ;; Symlink the bundled jars in derived/jars to where | ||
| 142 | ;; we can use them in debian_java.BUILD. | ||
| 143 | (("\"java\": \"/usr/share/java\",") | ||
| 144 | (string-append "\"jars\": \"" (getcwd) | ||
| 145 | "/derived/jars\","))) | ||
| 146 | ;; XXX: do not override any jar locations, because we | ||
| 147 | ;; don't have all of them and we don't have any of them | ||
| 148 | ;; in the locations that debian uses. | ||
| 149 | (substitute* "tools/distributions/distribution_rules.bzl" | ||
| 150 | (("if \"debian\"") | ||
| 151 | "if \"shmebian\"")) | ||
| 152 | ;; Make this work with our version of protobuf. | ||
| 153 | (substitute* "third_party/grpc-java/compiler/src/java_plugin/cpp/java_generator.cpp" | ||
| 154 | (("google/protobuf/compiler/java/java_names.h") | ||
| 155 | "google/protobuf/compiler/java/names.h")) | ||
| 156 | ;; XXX: override the overrides for protobuf-util.jar and | ||
| 157 | ;; protobuf.jar, because we don't have them. | ||
| 158 | (substitute* "tools/distributions/debian/debian_java.BUILD" | ||
| 159 | (("\"java/protobuf-util.jar\",") | ||
| 160 | (string-append "\"" | ||
| 161 | "jars/com_google_protobuf/java/util/libutil.jar" | ||
| 162 | "\",")) | ||
| 163 | (("\"java/protobuf.jar\",") | ||
| 164 | (string-append "\"" | ||
| 165 | "jars/com_google_protobuf/java/core/libcore.jar" | ||
| 166 | "\",")) | ||
| 167 | (("jars = \\[\"java/protobuf-util.jar\"") | ||
| 168 | (string-append "jars = [\"" | ||
| 169 | "jars/com_google_protobuf/java/util/libutil.jar" | ||
| 170 | "\"")) | ||
| 171 | (("jars = \\[\"java/protobuf.jar\"") | ||
| 172 | (string-append "jars = [\"" | ||
| 173 | "jars/com_google_protobuf/java/core/libcore.jar" | ||
| 174 | "\", \"" | ||
| 175 | "jars/com_google_protobuf/java/core/liblite.jar" | ||
| 176 | "\","))) | ||
| 177 | ;; Make sure that "cp" is found. | ||
| 178 | (substitute* "third_party/grpc/build_defs.bzl" | ||
| 179 | (("command = \"cp" m) | ||
| 180 | (string-append "use_default_shell_env = True,\n" m))) | ||
| 181 | ;; XXX: we don't have a BUILD file in protobuf:/java/util | ||
| 182 | (substitute* "src/main/java/com/google/devtools/build/lib/BUILD" | ||
| 183 | (("\"@com_google_protobuf//java/util\",") "")) | ||
| 184 | ;; XXX: these platforms are undefined | ||
| 185 | (substitute* '("src/conditions/BUILD" | ||
| 186 | "src/conditions/BUILD.tools") | ||
| 187 | (("@platforms//cpu:riscv64") "@platforms//cpu:x86_64") | ||
| 188 | (("@platforms//cpu:mips64") "@platforms//cpu:x86_64")) | ||
| 189 | ;; Ensure that "cat" can be found. | ||
| 190 | (substitute* "src/main/java/com/google/devtools/build/lib/runtime/commands/license/merge_licenses.bzl" | ||
| 191 | (("\"OUT\": ctx.outputs.out.path," m) | ||
| 192 | (string-append m "\n\"PATH\": \"" (getenv "PATH") "\","))) | ||
| 193 | (substitute* "scripts/bootstrap/compile.sh" | ||
| 194 | (("#!/bin/sh") | ||
| 195 | (string-append "#!" (which "sh")))) | ||
| 196 | |||
| 197 | ;; XXX: We need to have /bin/bash and /usr/bin/env. We | ||
| 198 | ;; can't easily override this, so we run everything | ||
| 199 | ;; inside of proot. | ||
| 200 | (invoke "proot" "-b" | ||
| 201 | (string-append | ||
| 202 | #$static-bash "/bin/bash" | ||
| 203 | ":/bin/bash") | ||
| 204 | "-b" | ||
| 205 | (string-append | ||
| 206 | #$coreutils "/bin/env" | ||
| 207 | ":/usr/bin/env") | ||
| 208 | "bash" "compile.sh"))) | ||
| 209 | (replace 'install | ||
| 210 | (lambda _ | ||
| 211 | (install-file "output/bazel" | ||
| 212 | (string-append #$output "/bin"))))))) | ||
| 213 | (inputs | ||
| 214 | (list `(,openjdk11 "jdk") | ||
| 215 | grpc | ||
| 216 | python | ||
| 217 | ;; We aren't yet using the jars provided by these packages. | ||
| 218 | java-asm | ||
| 219 | java-commons-collections | ||
| 220 | java-commons-compress | ||
| 221 | java-commons-lang3 | ||
| 222 | java-commons-pool | ||
| 223 | java-fasterxml-jackson-core | ||
| 224 | java-guava | ||
| 225 | java-gson | ||
| 226 | java-jsr305 | ||
| 227 | java-junit | ||
| 228 | java-xz | ||
| 229 | zlib)) | ||
| 230 | (native-inputs | ||
| 231 | (list proot ;yikes! | ||
| 232 | protobuf | ||
| 233 | unzip | ||
| 234 | util-linux | ||
| 235 | which | ||
| 236 | zip)) | ||
| 237 | (home-page "https://bazel.build") | ||
| 238 | (synopsis "Build and test tool") | ||
| 239 | (description | ||
| 240 | "Bazel is a build and test tool similar to Make, Maven, and | ||
| 241 | Gradle. It uses a human-readable, high-level build language. Bazel | ||
| 242 | supports projects in multiple languages and builds outputs for | ||
| 243 | multiple platforms. Bazel supports large codebases across multiple | ||
| 244 | repositories, and large numbers of users.") | ||
| 245 | (license license:asl2.0))) | ||
diff --git a/patches/bazel-mock-repos.patch b/patches/bazel-mock-repos.patch new file mode 100644 index 0000000..7cc133d --- /dev/null +++ b/patches/bazel-mock-repos.patch | |||
| @@ -0,0 +1,527 @@ | |||
| 1 | Taken from https://salsa.debian.org/bazel-team/bazel-bootstrap/-/raw/2e1af7d3d0ec789a71c16f5ecd07232efc0f262a/debian/patches/mock_repos.patch | ||
| 2 | |||
| 3 | Description: Create mock repositories to prevent packaging binary archives | ||
| 4 | Workaround created for Debian by upstream to prevent packaging archive files | ||
| 5 | in Debian "source." This recreates only the portions of those .zip and .tar.gz | ||
| 6 | files that are required for building Bazel on Debian. | ||
| 7 | Author: Yun Peng <pcloudy@google.com> | ||
| 8 | Origin: upstream, https://github.com/meteorcloudy/bazel/commit/1c38681aec9dee4eeeeac6196154c01e67878d65 | ||
| 9 | Forwarded: not-needed | ||
| 10 | Last-Update: 2020-07-22 | ||
| 11 | |||
| 12 | --- /dev/null | ||
| 13 | +++ b/mock_repos/bazel_skydoc/BUILD | ||
| 14 | @@ -0,0 +1 @@ | ||
| 15 | + | ||
| 16 | --- /dev/null | ||
| 17 | +++ b/mock_repos/bazel_skydoc/WORKSPACE | ||
| 18 | @@ -0,0 +1 @@ | ||
| 19 | + | ||
| 20 | --- /dev/null | ||
| 21 | +++ b/mock_repos/bazel_skydoc/setup.bzl | ||
| 22 | @@ -0,0 +1,18 @@ | ||
| 23 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 24 | +# | ||
| 25 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 26 | +# you may not use this file except in compliance with the License. | ||
| 27 | +# You may obtain a copy of the License at | ||
| 28 | +# | ||
| 29 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 30 | +# | ||
| 31 | +# Unless required by applicable law or agreed to in writing, software | ||
| 32 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 33 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 34 | +# See the License for the specific language governing permissions and | ||
| 35 | +# limitations under the License. | ||
| 36 | + | ||
| 37 | +"""Mocks rules defined in io_bazel_skydoc.""" | ||
| 38 | + | ||
| 39 | +def stardoc_repositories(**kwargs): | ||
| 40 | + pass | ||
| 41 | --- /dev/null | ||
| 42 | +++ b/mock_repos/bazel_skydoc/stardoc/BUILD | ||
| 43 | @@ -0,0 +1 @@ | ||
| 44 | + | ||
| 45 | --- /dev/null | ||
| 46 | +++ b/mock_repos/bazel_skydoc/stardoc/html_tables_stardoc.bzl | ||
| 47 | @@ -0,0 +1,18 @@ | ||
| 48 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 49 | +# | ||
| 50 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 51 | +# you may not use this file except in compliance with the License. | ||
| 52 | +# You may obtain a copy of the License at | ||
| 53 | +# | ||
| 54 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 55 | +# | ||
| 56 | +# Unless required by applicable law or agreed to in writing, software | ||
| 57 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 58 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 59 | +# See the License for the specific language governing permissions and | ||
| 60 | +# limitations under the License. | ||
| 61 | + | ||
| 62 | +"""Mocks rules defined in io_bazel_skydoc.""" | ||
| 63 | + | ||
| 64 | +def html_tables_stardoc(**kwargs): | ||
| 65 | + pass | ||
| 66 | --- /dev/null | ||
| 67 | +++ b/mock_repos/bazel_skydoc/stardoc/stardoc.bzl | ||
| 68 | @@ -0,0 +1,18 @@ | ||
| 69 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 70 | +# | ||
| 71 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 72 | +# you may not use this file except in compliance with the License. | ||
| 73 | +# You may obtain a copy of the License at | ||
| 74 | +# | ||
| 75 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 76 | +# | ||
| 77 | +# Unless required by applicable law or agreed to in writing, software | ||
| 78 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 79 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 80 | +# See the License for the specific language governing permissions and | ||
| 81 | +# limitations under the License. | ||
| 82 | + | ||
| 83 | +"""Mocks rules defined in io_bazel_skydoc.""" | ||
| 84 | + | ||
| 85 | +def stardoc(**kwargs): | ||
| 86 | + pass | ||
| 87 | --- /dev/null | ||
| 88 | +++ b/mock_repos/bazel_skylib/BUILD | ||
| 89 | @@ -0,0 +1 @@ | ||
| 90 | + | ||
| 91 | --- /dev/null | ||
| 92 | +++ b/mock_repos/bazel_skylib/WORKSPACE | ||
| 93 | @@ -0,0 +1 @@ | ||
| 94 | + | ||
| 95 | --- /dev/null | ||
| 96 | +++ b/mock_repos/bazel_skylib/bzl_library.bzl | ||
| 97 | @@ -0,0 +1,18 @@ | ||
| 98 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 99 | +# | ||
| 100 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 101 | +# you may not use this file except in compliance with the License. | ||
| 102 | +# You may obtain a copy of the License at | ||
| 103 | +# | ||
| 104 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 105 | +# | ||
| 106 | +# Unless required by applicable law or agreed to in writing, software | ||
| 107 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 108 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 109 | +# See the License for the specific language governing permissions and | ||
| 110 | +# limitations under the License. | ||
| 111 | + | ||
| 112 | +"""Mocks rules defined in bazel_skylib.""" | ||
| 113 | + | ||
| 114 | +def bzl_library(**kwargs): | ||
| 115 | + pass | ||
| 116 | --- /dev/null | ||
| 117 | +++ b/mock_repos/platforms/BUILD | ||
| 118 | @@ -0,0 +1,15 @@ | ||
| 119 | +package(default_visibility = ["//visibility:public"]) | ||
| 120 | + | ||
| 121 | +licenses(["notice"]) | ||
| 122 | + | ||
| 123 | +exports_files(["LICENSE"]) | ||
| 124 | + | ||
| 125 | +filegroup( | ||
| 126 | + name = "srcs", | ||
| 127 | + srcs = [ | ||
| 128 | + "BUILD", | ||
| 129 | + "WORKSPACE", | ||
| 130 | + "//cpu:srcs", | ||
| 131 | + "//os:srcs", | ||
| 132 | + ], | ||
| 133 | +) | ||
| 134 | --- /dev/null | ||
| 135 | +++ b/mock_repos/platforms/WORKSPACE | ||
| 136 | @@ -0,0 +1 @@ | ||
| 137 | +workspace(name = "platforms") | ||
| 138 | --- /dev/null | ||
| 139 | +++ b/mock_repos/platforms/cpu/BUILD | ||
| 140 | @@ -0,0 +1,76 @@ | ||
| 141 | +# Standard cpu name constraint_setting and constraint_values | ||
| 142 | +licenses(["notice"]) | ||
| 143 | + | ||
| 144 | +package( | ||
| 145 | + default_visibility = ["//visibility:public"], | ||
| 146 | +) | ||
| 147 | + | ||
| 148 | +filegroup( | ||
| 149 | + name = "srcs", | ||
| 150 | + srcs = glob(["**"]), | ||
| 151 | +) | ||
| 152 | + | ||
| 153 | +# To add a new constraint_value see https://github.com/bazelbuild/platforms. | ||
| 154 | +constraint_setting(name = "cpu") | ||
| 155 | + | ||
| 156 | +# TODO(b/136237408): Remove this generic CPU name and replace with a specific one. | ||
| 157 | +constraint_value( | ||
| 158 | + name = "aarch64", | ||
| 159 | + constraint_setting = ":cpu", | ||
| 160 | +) | ||
| 161 | + | ||
| 162 | +# TODO(b/136237408): Remove this generic CPU name and replace with a specific one. | ||
| 163 | +constraint_value( | ||
| 164 | + name = "arm", | ||
| 165 | + constraint_setting = ":cpu", | ||
| 166 | +) | ||
| 167 | + | ||
| 168 | +constraint_value( | ||
| 169 | + name = "arm64_32", | ||
| 170 | + constraint_setting = ":cpu", | ||
| 171 | +) | ||
| 172 | + | ||
| 173 | +constraint_value( | ||
| 174 | + name = "arm64", | ||
| 175 | + constraint_setting = ":cpu", | ||
| 176 | +) | ||
| 177 | + | ||
| 178 | +constraint_value( | ||
| 179 | + name = "arm64e", | ||
| 180 | + constraint_setting = ":cpu", | ||
| 181 | +) | ||
| 182 | + | ||
| 183 | +constraint_value( | ||
| 184 | + name = "armv7", | ||
| 185 | + constraint_setting = ":cpu", | ||
| 186 | +) | ||
| 187 | + | ||
| 188 | +constraint_value( | ||
| 189 | + name = "armv7k", | ||
| 190 | + constraint_setting = ":cpu", | ||
| 191 | +) | ||
| 192 | + | ||
| 193 | +constraint_value( | ||
| 194 | + name = "i386", | ||
| 195 | + constraint_setting = ":cpu", | ||
| 196 | +) | ||
| 197 | + | ||
| 198 | +constraint_value( | ||
| 199 | + name = "ppc", | ||
| 200 | + constraint_setting = ":cpu", | ||
| 201 | +) | ||
| 202 | + | ||
| 203 | +constraint_value( | ||
| 204 | + name = "s390x", | ||
| 205 | + constraint_setting = ":cpu", | ||
| 206 | +) | ||
| 207 | + | ||
| 208 | +constraint_value( | ||
| 209 | + name = "x86_32", | ||
| 210 | + constraint_setting = ":cpu", | ||
| 211 | +) | ||
| 212 | + | ||
| 213 | +constraint_value( | ||
| 214 | + name = "x86_64", | ||
| 215 | + constraint_setting = ":cpu", | ||
| 216 | +) | ||
| 217 | --- /dev/null | ||
| 218 | +++ b/mock_repos/platforms/os/BUILD | ||
| 219 | @@ -0,0 +1,78 @@ | ||
| 220 | +# Standard constraint_setting and constraint_values to be used in platforms. | ||
| 221 | +licenses(["notice"]) | ||
| 222 | + | ||
| 223 | +package( | ||
| 224 | + default_visibility = ["//visibility:public"], | ||
| 225 | +) | ||
| 226 | + | ||
| 227 | +filegroup( | ||
| 228 | + name = "srcs", | ||
| 229 | + srcs = glob(["**"]), | ||
| 230 | +) | ||
| 231 | + | ||
| 232 | +# To add a new constraint_value see https://github.com/bazelbuild/platforms. | ||
| 233 | +constraint_setting(name = "os") | ||
| 234 | + | ||
| 235 | +constraint_value( | ||
| 236 | + name = "freebsd", | ||
| 237 | + constraint_setting = ":os", | ||
| 238 | +) | ||
| 239 | + | ||
| 240 | +constraint_value( | ||
| 241 | + name = "openbsd", | ||
| 242 | + constraint_setting = ":os", | ||
| 243 | +) | ||
| 244 | + | ||
| 245 | +constraint_value( | ||
| 246 | + name = "android", | ||
| 247 | + constraint_setting = ":os", | ||
| 248 | +) | ||
| 249 | + | ||
| 250 | +constraint_value( | ||
| 251 | + name = "linux", | ||
| 252 | + constraint_setting = ":os", | ||
| 253 | +) | ||
| 254 | + | ||
| 255 | +constraint_value( | ||
| 256 | + name = "windows", | ||
| 257 | + constraint_setting = ":os", | ||
| 258 | +) | ||
| 259 | + | ||
| 260 | +# For platforms with no OS, like microcontrollers. | ||
| 261 | +constraint_value( | ||
| 262 | + name = "none", | ||
| 263 | + constraint_setting = ":os", | ||
| 264 | +) | ||
| 265 | + | ||
| 266 | +### Apple OS Values | ||
| 267 | + | ||
| 268 | +constraint_value( | ||
| 269 | + name = "ios", | ||
| 270 | + constraint_setting = ":os", | ||
| 271 | +) | ||
| 272 | + | ||
| 273 | +# TODO(b/138656886): Rename this to macos instead of osx. | ||
| 274 | +constraint_value( | ||
| 275 | + name = "osx", | ||
| 276 | + constraint_setting = ":os", | ||
| 277 | +) | ||
| 278 | + | ||
| 279 | +alias( | ||
| 280 | + name = "macos", | ||
| 281 | + actual = ":osx", | ||
| 282 | +) | ||
| 283 | + | ||
| 284 | +constraint_value( | ||
| 285 | + name = "tvos", | ||
| 286 | + constraint_setting = ":os", | ||
| 287 | +) | ||
| 288 | + | ||
| 289 | +constraint_value( | ||
| 290 | + name = "watchos", | ||
| 291 | + constraint_setting = ":os", | ||
| 292 | +) | ||
| 293 | + | ||
| 294 | +constraint_value( | ||
| 295 | + name = "qnx", | ||
| 296 | + constraint_setting = ":os", | ||
| 297 | +) | ||
| 298 | --- /dev/null | ||
| 299 | +++ b/mock_repos/remote_java_tools_linux/BUILD | ||
| 300 | @@ -0,0 +1,7 @@ | ||
| 301 | +package(default_visibility = ["//visibility:public"]) | ||
| 302 | + | ||
| 303 | +filegroup( | ||
| 304 | + name = "JacocoCoverage", | ||
| 305 | + srcs = ["java_tools/JacocoCoverage_jarjar_deploy.jar"], | ||
| 306 | +) | ||
| 307 | + | ||
| 308 | --- /dev/null | ||
| 309 | +++ b/mock_repos/remote_java_tools_linux/WORKSPACE | ||
| 310 | @@ -0,0 +1 @@ | ||
| 311 | + | ||
| 312 | --- /dev/null | ||
| 313 | +++ b/mock_repos/rules_cc/WORKSPACE | ||
| 314 | @@ -0,0 +1 @@ | ||
| 315 | + | ||
| 316 | --- /dev/null | ||
| 317 | +++ b/mock_repos/rules_cc/cc/BUILD | ||
| 318 | @@ -0,0 +1 @@ | ||
| 319 | + | ||
| 320 | --- /dev/null | ||
| 321 | +++ b/mock_repos/rules_cc/cc/defs.bzl | ||
| 322 | @@ -0,0 +1,36 @@ | ||
| 323 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 324 | +# | ||
| 325 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 326 | +# you may not use this file except in compliance with the License. | ||
| 327 | +# You may obtain a copy of the License at | ||
| 328 | +# | ||
| 329 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 330 | +# | ||
| 331 | +# Unless required by applicable law or agreed to in writing, software | ||
| 332 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 333 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 334 | +# See the License for the specific language governing permissions and | ||
| 335 | +# limitations under the License. | ||
| 336 | + | ||
| 337 | +"""Mocks rules defined in rules_cc.""" | ||
| 338 | + | ||
| 339 | +def cc_binary(**kwargs): | ||
| 340 | + native.cc_binary(**kwargs) | ||
| 341 | + | ||
| 342 | +def cc_library(**kwargs): | ||
| 343 | + native.cc_library(**kwargs) | ||
| 344 | + | ||
| 345 | +def cc_test(**kwargs): | ||
| 346 | + native.cc_test(**kwargs) | ||
| 347 | + | ||
| 348 | +def objc_library(**kwargs): | ||
| 349 | + native.objc_library(**kwargs) | ||
| 350 | + | ||
| 351 | +def cc_proto_library(**kwargs): | ||
| 352 | + native.cc_proto_library(**kwargs) | ||
| 353 | + | ||
| 354 | +def cc_toolchain(**kwargs): | ||
| 355 | + native.cc_toolchain(**kwargs) | ||
| 356 | + | ||
| 357 | +def cc_toolchain_suite(**kwargs): | ||
| 358 | + native.cc_toolchain_suite(**kwargs) | ||
| 359 | --- /dev/null | ||
| 360 | +++ b/mock_repos/rules_java/WORKSPACE | ||
| 361 | @@ -0,0 +1 @@ | ||
| 362 | + | ||
| 363 | --- /dev/null | ||
| 364 | +++ b/mock_repos/rules_java/java/BUILD | ||
| 365 | @@ -0,0 +1 @@ | ||
| 366 | + | ||
| 367 | --- /dev/null | ||
| 368 | +++ b/mock_repos/rules_java/java/defs.bzl | ||
| 369 | @@ -0,0 +1,39 @@ | ||
| 370 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 371 | +# | ||
| 372 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 373 | +# you may not use this file except in compliance with the License. | ||
| 374 | +# You may obtain a copy of the License at | ||
| 375 | +# | ||
| 376 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 377 | +# | ||
| 378 | +# Unless required by applicable law or agreed to in writing, software | ||
| 379 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 380 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 381 | +# See the License for the specific language governing permissions and | ||
| 382 | +# limitations under the License. | ||
| 383 | + | ||
| 384 | +"""Mocks rules defined in rules_java.""" | ||
| 385 | + | ||
| 386 | +def java_binary(**kwargs): | ||
| 387 | + native.java_binary(**kwargs) | ||
| 388 | + | ||
| 389 | +def java_library(**kwargs): | ||
| 390 | + native.java_library(**kwargs) | ||
| 391 | + | ||
| 392 | +def java_test(**kwargs): | ||
| 393 | + native.java_test(**kwargs) | ||
| 394 | + | ||
| 395 | +def java_proto_library(**kwargs): | ||
| 396 | + native.java_proto_library(**kwargs) | ||
| 397 | + | ||
| 398 | +def java_import(**kwargs): | ||
| 399 | + native.java_import(**kwargs) | ||
| 400 | + | ||
| 401 | +def java_toolchain(**kwargs): | ||
| 402 | + native.java_toolchain(**kwargs) | ||
| 403 | + | ||
| 404 | +def java_runtime(**kwargs): | ||
| 405 | + native.java_runtime(**kwargs) | ||
| 406 | + | ||
| 407 | +def java_plugin(**kwargs): | ||
| 408 | + native.java_plugin(**kwargs) | ||
| 409 | --- /dev/null | ||
| 410 | +++ b/mock_repos/rules_pkg/BUILD | ||
| 411 | @@ -0,0 +1 @@ | ||
| 412 | + | ||
| 413 | --- /dev/null | ||
| 414 | +++ b/mock_repos/rules_pkg/WORKSPACE | ||
| 415 | @@ -0,0 +1 @@ | ||
| 416 | + | ||
| 417 | --- /dev/null | ||
| 418 | +++ b/mock_repos/rules_pkg/deps.bzl | ||
| 419 | @@ -0,0 +1,18 @@ | ||
| 420 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 421 | +# | ||
| 422 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 423 | +# you may not use this file except in compliance with the License. | ||
| 424 | +# You may obtain a copy of the License at | ||
| 425 | +# | ||
| 426 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 427 | +# | ||
| 428 | +# Unless required by applicable law or agreed to in writing, software | ||
| 429 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 430 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 431 | +# See the License for the specific language governing permissions and | ||
| 432 | +# limitations under the License. | ||
| 433 | + | ||
| 434 | +"""Mocks rules defined in rules_pkg.""" | ||
| 435 | + | ||
| 436 | +def rules_pkg_dependencies(**kwargs): | ||
| 437 | + pass | ||
| 438 | --- /dev/null | ||
| 439 | +++ b/mock_repos/rules_pkg/pkg.bzl | ||
| 440 | @@ -0,0 +1,18 @@ | ||
| 441 | +# Copyright 2020 The Bazel Authors. All rights reserved. | ||
| 442 | +# | ||
| 443 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 444 | +# you may not use this file except in compliance with the License. | ||
| 445 | +# You may obtain a copy of the License at | ||
| 446 | +# | ||
| 447 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 448 | +# | ||
| 449 | +# Unless required by applicable law or agreed to in writing, software | ||
| 450 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 451 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 452 | +# See the License for the specific language governing permissions and | ||
| 453 | +# limitations under the License. | ||
| 454 | + | ||
| 455 | +"""Mocks rules defined in rules_pkg.""" | ||
| 456 | + | ||
| 457 | +def pkg_tar(**kwargs): | ||
| 458 | + pass | ||
| 459 | --- /dev/null | ||
| 460 | +++ b/mock_repos/rules_proto/WORKSPACE | ||
| 461 | @@ -0,0 +1 @@ | ||
| 462 | +workspace(name = "rules_proto") | ||
| 463 | --- /dev/null | ||
| 464 | +++ b/mock_repos/rules_proto/proto/BUILD | ||
| 465 | @@ -0,0 +1 @@ | ||
| 466 | +# Intentionally left empty (for now). | ||
| 467 | --- /dev/null | ||
| 468 | +++ b/mock_repos/rules_proto/proto/defs.bzl | ||
| 469 | @@ -0,0 +1,27 @@ | ||
| 470 | +# Copyright 2019 The Bazel Authors. All rights reserved. | ||
| 471 | +# | ||
| 472 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 473 | +# you may not use this file except in compliance with the License. | ||
| 474 | +# You may obtain a copy of the License at | ||
| 475 | +# | ||
| 476 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 477 | +# | ||
| 478 | +# Unless required by applicable law or agreed to in writing, software | ||
| 479 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 480 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 481 | +# See the License for the specific language governing permissions and | ||
| 482 | +# limitations under the License. | ||
| 483 | + | ||
| 484 | +load("//proto/private:native.bzl", "NativeProtoInfo", "native_proto_common") | ||
| 485 | + | ||
| 486 | +def proto_lang_toolchain(**attrs): | ||
| 487 | + native.proto_lang_toolchain(**attrs) | ||
| 488 | + | ||
| 489 | +def proto_library(**attrs): | ||
| 490 | + native.proto_library(**attrs) | ||
| 491 | + | ||
| 492 | +ProtoInfo = NativeProtoInfo | ||
| 493 | +"""Encapsulates information provided by `proto_library`. | ||
| 494 | + | ||
| 495 | +https://docs.bazel.build/versions/master/skylark/lib/ProtoInfo.html | ||
| 496 | +""" | ||
| 497 | --- /dev/null | ||
| 498 | +++ b/mock_repos/rules_proto/proto/private/BUILD | ||
| 499 | @@ -0,0 +1 @@ | ||
| 500 | +# Intentionally left empty (for now). | ||
| 501 | --- /dev/null | ||
| 502 | +++ b/mock_repos/rules_proto/proto/private/native.bzl | ||
| 503 | @@ -0,0 +1,24 @@ | ||
| 504 | +# Copyright 2019 The Bazel Authors. All rights reserved. | ||
| 505 | +# | ||
| 506 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 507 | +# you may not use this file except in compliance with the License. | ||
| 508 | +# You may obtain a copy of the License at | ||
| 509 | +# | ||
| 510 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
| 511 | +# | ||
| 512 | +# Unless required by applicable law or agreed to in writing, software | ||
| 513 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
| 514 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 515 | +# See the License for the specific language governing permissions and | ||
| 516 | +# limitations under the License. | ||
| 517 | + | ||
| 518 | +# Redefine native symbols with a new name as a workaround for | ||
| 519 | +# exporting them in `//proto:defs.bzl` with their original name. | ||
| 520 | +# | ||
| 521 | +# While we cannot force users to load these symbol due to the lack of a | ||
| 522 | +# whitelisting mechanism, we can still export them and tell users to | ||
| 523 | +# load it to make a future migration to pure Starlark easier. | ||
| 524 | + | ||
| 525 | +NativeProtoInfo = ProtoInfo | ||
| 526 | + | ||
| 527 | +native_proto_common = proto_common | ||
diff --git a/patches/bazel-workspace.patch b/patches/bazel-workspace.patch new file mode 100644 index 0000000..552b9dc --- /dev/null +++ b/patches/bazel-workspace.patch | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | Adapted from https://salsa.debian.org/bazel-team/bazel-bootstrap/-/raw/2e1af7d3d0ec789a71c16f5ecd07232efc0f262a/debian/patches/WORKSPACE.patch | ||
| 2 | |||
| 3 | Description: Debian-specific fixes in WORKSPACE file | ||
| 4 | Bazel needs to download some dependencies just to properly parse the | ||
| 5 | WORKSPACE file. We comment some load statements so that it won’t download | ||
| 6 | the things we don’t need for building Bazel binary. Also, remove @io_bazel | ||
| 7 | reference that was causing ccache failures. | ||
| 8 | Author: Yun Peng <pcloudy@google.com> | ||
| 9 | Origin: upstream, https://github.com/meteorcloudy/bazel/commit/1c38681aec9dee4eeeeac6196154c01e67878d65 | ||
| 10 | Forwarded: not-needed | ||
| 11 | Last-Update: 2020-07-22 | ||
| 12 | |||
| 13 | --- a/WORKSPACE | ||
| 14 | +++ b/WORKSPACE | ||
| 15 | @@ -1188,22 +1170,6 @@ | ||
| 16 | |||
| 17 | stardoc_repositories() | ||
| 18 | |||
| 19 | -load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies") | ||
| 20 | - | ||
| 21 | -rules_sass_dependencies() | ||
| 22 | - | ||
| 23 | -load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") | ||
| 24 | - | ||
| 25 | -build_bazel_rules_nodejs_dependencies() | ||
| 26 | - | ||
| 27 | -load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories") | ||
| 28 | - | ||
| 29 | -node_repositories() | ||
| 30 | - | ||
| 31 | -load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories") | ||
| 32 | - | ||
| 33 | -sass_repositories() | ||
| 34 | - | ||
| 35 | register_execution_platforms("//:default_host_platform") # buildozer: disable=positional-args | ||
| 36 | |||
| 37 | # Tools for building deb, rpm and tar files. | ||
| 38 | @@ -1241,20 +1211,6 @@ | ||
| 39 | ], | ||
| 40 | ) | ||
| 41 | |||
| 42 | -# Projects using gRPC as an external dependency must call both grpc_deps() and | ||
| 43 | -# grpc_extra_deps(). | ||
| 44 | -load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") | ||
| 45 | - | ||
| 46 | -grpc_deps() | ||
| 47 | - | ||
| 48 | -load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") | ||
| 49 | - | ||
| 50 | -grpc_extra_deps() | ||
| 51 | - | ||
| 52 | load("//tools/distributions/debian:deps.bzl", "debian_deps") | ||
| 53 | |||
| 54 | debian_deps() | ||
| 55 | - | ||
| 56 | -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") | ||
| 57 | - | ||
| 58 | -bazel_skylib_workspace() | ||
