1*bcb5dc79SHONG Yifan# Copyright 2019 The Bazel Authors. All rights reserved. 2*bcb5dc79SHONG Yifan# 3*bcb5dc79SHONG Yifan# Licensed under the Apache License, Version 2.0 (the "License"); 4*bcb5dc79SHONG Yifan# you may not use this file except in compliance with the License. 5*bcb5dc79SHONG Yifan# You may obtain a copy of the License at 6*bcb5dc79SHONG Yifan# 7*bcb5dc79SHONG Yifan# http://www.apache.org/licenses/LICENSE-2.0 8*bcb5dc79SHONG Yifan# 9*bcb5dc79SHONG Yifan# Unless required by applicable law or agreed to in writing, software 10*bcb5dc79SHONG Yifan# distributed under the License is distributed on an "AS IS" BASIS, 11*bcb5dc79SHONG Yifan# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*bcb5dc79SHONG Yifan# See the License for the specific language governing permissions and 13*bcb5dc79SHONG Yifan# limitations under the License. 14*bcb5dc79SHONG Yifan 15*bcb5dc79SHONG Yifan"""A rule that writes a UTF-8 encoded text file from user-specified contents. 16*bcb5dc79SHONG Yifan 17*bcb5dc79SHONG Yifannative.genrule() is sometimes used to create a text file. The 'write_file' and 18*bcb5dc79SHONG Yifanmacro does this with a simpler interface than genrule. 19*bcb5dc79SHONG Yifan 20*bcb5dc79SHONG YifanThe rules generated by the macro do not use Bash or any other shell to write the 21*bcb5dc79SHONG Yifanfile. Instead they use Starlark's built-in file writing action 22*bcb5dc79SHONG Yifan(ctx.actions.write). 23*bcb5dc79SHONG Yifan""" 24*bcb5dc79SHONG Yifan 25*bcb5dc79SHONG Yifanload( 26*bcb5dc79SHONG Yifan "//rules/private:write_file_private.bzl", 27*bcb5dc79SHONG Yifan _write_file = "write_file", 28*bcb5dc79SHONG Yifan) 29*bcb5dc79SHONG Yifan 30*bcb5dc79SHONG Yifanwrite_file = _write_file 31