xref: /aosp_15_r20/external/bazel-skylib/rules/write_file.bzl (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1# Copyright 2019 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://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,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""A rule that writes a UTF-8 encoded text file from user-specified contents.
16
17native.genrule() is sometimes used to create a text file. The 'write_file' and
18macro does this with a simpler interface than genrule.
19
20The rules generated by the macro do not use Bash or any other shell to write the
21file. Instead they use Starlark's built-in file writing action
22(ctx.actions.write).
23"""
24
25load(
26    "//rules/private:write_file_private.bzl",
27    _write_file = "write_file",
28)
29
30write_file = _write_file
31