• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load("@rules_python//python:defs.bzl", "py_library", "py_test")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21exports_files([
22    "pw_env_setup/cipd_setup/.cipd_version",
23    "pw_env_setup/cipd_setup/.cipd_version.digests",
24] + glob(["pw_env_setup/**/*.json"]))
25
26# Downstream projects should set this label flag to point to their pigweed.json
27# file.
28label_flag(
29    name = "pigweed_json",
30    # We don't provide a default pigweed.json. Every project needs their own!
31    build_setting_default = "//pw_build:unspecified_backend",
32)
33
34py_library(
35    name = "pw_env_setup",
36    srcs = [
37        "pw_env_setup/__init__.py",
38        "pw_env_setup/config_file.py",
39    ],
40    data = [
41        ":pigweed_json",
42    ],
43    imports = ["."],
44    deps = [
45        "@rules_python//python/runfiles",
46    ],
47)
48
49py_test(
50    name = "config_file_test",
51    srcs = ["config_file_test.py"],
52    deps = [
53        ":pw_env_setup",
54    ],
55)
56