blob: cf925932002add4f1d8e9a61d99539937415a0d9 [file] [log] [blame]
Chris Frantz74f90952022-04-18 20:57:01 -07001# Copyright lowRISC contributors.
2# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3# SPDX-License-Identifier: Apache-2.0
4
5NONHERMETIC_ENV_VARS = [
6 "HOME",
7 "PATH",
8 "XILINX_VIVADO",
9 "XILINX_HLS",
10 "XILINXD_LICENSE_FILE",
11]
12
13def _nonhermetic_repo_impl(rctx):
14 env = "\n".join([" \"{}\": \"{}\",".format(v, rctx.os.environ.get(v, "")) for v in NONHERMETIC_ENV_VARS])
15 rctx.file("env.bzl", "ENV = {{\n{}\n}}\n".format(env))
16 rctx.file("BUILD.bazel", "exports_files(glob([\"**\"]))\n")
17
18nonhermetic_repo = repository_rule(
19 implementation = _nonhermetic_repo_impl,
20 attrs = {},
21 environ = NONHERMETIC_ENV_VARS,
22)