blob: e6d9a51d4106e06909a252e4a0cfa7090719d8e8 [file] [edit]
# Copyright 2026 The Pigweed Authors
#
# 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
#
# https://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.
"""Repository rule for the global Zephyr discovery state."""
def _zephyr_state_repo_impl(rctx):
rctx.file("BUILD.bazel", 'exports_files(["state.json"])')
rctx.file("state.json", rctx.attr.content)
zephyr_state_repo = repository_rule(
implementation = _zephyr_state_repo_impl,
attrs = {
"content": attr.string(mandatory = True),
},
)
def _zephyr_index_repo_impl(rctx):
build_content = 'package(default_visibility = ["//visibility:public"])\n\n'
build_content += 'exports_files(["index.bzl"])\n\n'
rctx.file("BUILD.bazel", build_content)
rctx.file("index.bzl", rctx.attr.content)
zephyr_index_repo = repository_rule(
implementation = _zephyr_index_repo_impl,
attrs = {
"content": attr.string(mandatory = True),
},
)