refactor: remove vendored write_file.bzl
We didn't have local modifications so we can just depend directly on upstream
diff --git a/internal/generated_file_test/BUILD.bazel b/internal/generated_file_test/BUILD.bazel
index c18b447..59a2f74 100644
--- a/internal/generated_file_test/BUILD.bazel
+++ b/internal/generated_file_test/BUILD.bazel
@@ -1,6 +1,6 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//packages/rollup:index.bzl", "rollup_bundle")
-load("//third_party/github.com/bazelbuild/bazel-skylib:rules/write_file.bzl", "write_file")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
package(default_visibility = ["//visibility:public"])
diff --git a/internal/node/test/BUILD.bazel b/internal/node/test/BUILD.bazel
index 70088d1..f8b8ced 100644
--- a/internal/node/test/BUILD.bazel
+++ b/internal/node/test/BUILD.bazel
@@ -3,7 +3,7 @@
load("//:index.bzl", "js_library")
load("//packages/jasmine:index.bzl", "jasmine_node_test")
load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file")
-load("//third_party/github.com/bazelbuild/bazel-skylib:rules/write_file.bzl", "write_file")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
# You can have a nodejs_binary with no node_modules attribute
# and no fine grained deps
diff --git a/internal/pkg_npm/test/BUILD.bazel b/internal/pkg_npm/test/BUILD.bazel
index bc0fde5..688e59e 100644
--- a/internal/pkg_npm/test/BUILD.bazel
+++ b/internal/pkg_npm/test/BUILD.bazel
@@ -2,7 +2,7 @@
load("//packages/jasmine:index.bzl", "jasmine_node_test")
load("//packages/rollup:index.bzl", "rollup_bundle")
load("//packages/concatjs:index.bzl", "ts_library")
-load("//third_party/github.com/bazelbuild/bazel-skylib:rules/write_file.bzl", "write_file")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
write_file(
name = "produces_files",
diff --git a/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel b/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel
index 02219d9..63893dc 100644
--- a/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel
+++ b/packages/typescript/test/ts_project/generated_tsconfig/gen_src/BUILD.bazel
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
-load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/write_file.bzl", "write_file")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//packages/typescript:index.bzl", "ts_project")
write_file(
diff --git a/packages/typescript/test/ts_project/rootdir/BUILD.bazel b/packages/typescript/test/ts_project/rootdir/BUILD.bazel
index fb564ef..9985734 100644
--- a/packages/typescript/test/ts_project/rootdir/BUILD.bazel
+++ b/packages/typescript/test/ts_project/rootdir/BUILD.bazel
@@ -1,4 +1,4 @@
-load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/write_file.bzl", "write_file")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//packages/typescript:index.bzl", "ts_project")
write_file(
diff --git a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/write_file_private.bzl b/third_party/github.com/bazelbuild/bazel-skylib/rules/private/write_file_private.bzl
deleted file mode 100644
index a5a69ae..0000000
--- a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/write_file_private.bzl
+++ /dev/null
@@ -1,114 +0,0 @@
-# Copyright 2019 The Bazel Authors. All rights reserved.
-#
-# 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
-#
-# http://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.
-
-"""Implementation of write_file macro and underlying rules.
-
-These rules write a UTF-8 encoded text file, using Bazel's FileWriteAction.
-'_write_xfile' marks the resulting file executable, '_write_file' does not.
-"""
-
-def _common_impl(ctx, is_windows, is_executable):
- if ctx.attr.newline == "auto":
- newline = "\r\n" if is_windows else "\n"
- elif ctx.attr.newline == "windows":
- newline = "\r\n"
- else:
- newline = "\n"
-
- # ctx.actions.write creates a FileWriteAction which uses UTF-8 encoding.
- ctx.actions.write(
- output = ctx.outputs.out,
- content = newline.join(ctx.attr.content) if ctx.attr.content else "",
- is_executable = is_executable,
- )
- files = depset(direct = [ctx.outputs.out])
- runfiles = ctx.runfiles(files = [ctx.outputs.out])
- if is_executable:
- return [DefaultInfo(files = files, runfiles = runfiles, executable = ctx.outputs.out)]
- else:
- return [DefaultInfo(files = files, runfiles = runfiles)]
-
-def _impl(ctx):
- return _common_impl(ctx, ctx.attr.is_windows, False)
-
-def _ximpl(ctx):
- return _common_impl(ctx, ctx.attr.is_windows, True)
-
-# @unsorted-dict-items
-_ATTRS = {
- "out": attr.output(mandatory = True),
- "content": attr.string_list(mandatory = False, allow_empty = True),
- "newline": attr.string(values = ["unix", "windows", "auto"], default = "auto"),
- "is_windows": attr.bool(mandatory = True),
-}
-
-_write_file = rule(
- implementation = _impl,
- provides = [DefaultInfo],
- attrs = _ATTRS,
-)
-
-_write_xfile = rule(
- implementation = _ximpl,
- executable = True,
- provides = [DefaultInfo],
- attrs = _ATTRS,
-)
-
-def write_file(
- name,
- out,
- content = [],
- is_executable = False,
- newline = "auto",
- **kwargs):
- """Creates a UTF-8 encoded text file.
-
- Args:
- name: Name of the rule.
- out: Path of the output file, relative to this package.
- content: A list of strings. Lines of text, the contents of the file.
- Newlines are added automatically after every line except the last one.
- is_executable: A boolean. Whether to make the output file executable.
- When True, the rule's output can be executed using `bazel run` and can
- be in the srcs of binary and test rules that require executable
- sources.
- newline: one of ["auto", "unix", "windows"]: line endings to use. "auto"
- for platform-determined, "unix" for LF, and "windows" for CRLF.
- **kwargs: further keyword arguments, e.g. <code>visibility</code>
- """
- if is_executable:
- _write_xfile(
- name = name,
- content = content,
- out = out,
- newline = newline or "auto",
- is_windows = select({
- "@bazel_tools//src/conditions:host_windows": True,
- "//conditions:default": False,
- }),
- **kwargs
- )
- else:
- _write_file(
- name = name,
- content = content,
- out = out,
- newline = newline or "auto",
- is_windows = select({
- "@bazel_tools//src/conditions:host_windows": True,
- "//conditions:default": False,
- }),
- **kwargs
- )
diff --git a/third_party/github.com/bazelbuild/bazel-skylib/rules/write_file.bzl b/third_party/github.com/bazelbuild/bazel-skylib/rules/write_file.bzl
deleted file mode 100644
index 602f78d..0000000
--- a/third_party/github.com/bazelbuild/bazel-skylib/rules/write_file.bzl
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2019 The Bazel Authors. All rights reserved.
-#
-# 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
-#
-# http://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.
-
-"""A rule that writes a UTF-8 encoded text file from user-specified contents.
-
-native.genrule() is sometimes used to create a text file. The 'write_file' and
-macro does this with a simpler interface than genrule.
-
-The rules generated by the macro do not use Bash or any other shell to write the
-file. Instead they use Starlark's built-in file writing action
-(ctx.actions.write).
-"""
-
-load(
- "//third_party/github.com/bazelbuild/bazel-skylib:rules/private/write_file_private.bzl",
- _write_file = "write_file",
-)
-
-write_file = _write_file
diff --git a/tools/npm_packages/bazel_workspaces_consistent/BUILD.bazel b/tools/npm_packages/bazel_workspaces_consistent/BUILD.bazel
index 5764dd8..d84bacd 100644
--- a/tools/npm_packages/bazel_workspaces_consistent/BUILD.bazel
+++ b/tools/npm_packages/bazel_workspaces_consistent/BUILD.bazel
@@ -1,4 +1,4 @@
-load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/write_file.bzl", "write_file")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
load(":index.bzl", "some_rule")
# Just a dumb target to make sure we can use it from code that installs this npm package