Use fences to elide code from the published npm package. This prevents users having a transitive dependency on go rules. PiperOrigin-RevId: 232060510
diff --git a/BUILD.bazel b/BUILD.bazel index 1dffb81..df7e9b7 100644 --- a/BUILD.bazel +++ b/BUILD.bazel
@@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# BEGIN-DEV-ONLY +# Parts of this BUILD file only necessary when building within the bazelbuild/rules_typescript repo. +# The generated `@bazel/typescript` npm package contains a trimmed BUILD file using # DEV-ONLY fences. +# # To update BUILD.bazel files after changing Go code, run # bazel run //:gazelle # @@ -19,7 +23,11 @@ # https://github.com/bazelbuild/rules_go/blob/master/go/tools/gazelle/README.rst#directives # gazelle:exclude node_modules load("@bazel_gazelle//:def.bzl", "gazelle") + +# END-DEV-ONLY load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "npm_package") + +# BEGIN-DEV-ONLY load("@build_bazel_rules_nodejs//internal/js_library:js_library.bzl", "js_library") load("//:version.bzl", "COMPAT_VERSION") @@ -76,6 +84,7 @@ # from how our release is used. "//devserver:devserver_bin": "//devserver", "0.0.0-COMPAT_VERSION": COMPAT_VERSION, + "(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "", }, deps = [ "//devserver:devserver-darwin", @@ -97,7 +106,7 @@ # extension = "tgz", # ) - +# END-DEV-ONLY # A nodejs_binary for @bazel/typescript/tsc_wrapped to use by default in # ts_library that depends on @npm//@bazel/typescript instead of the # output of the //internal/tsc_wrapped ts_library rule. This
diff --git a/devserver/BUILD.bazel b/devserver/BUILD.bazel index 07e8907..a04d169 100644 --- a/devserver/BUILD.bazel +++ b/devserver/BUILD.bazel
@@ -1,3 +1,20 @@ +# Copyright 2017 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. + +# BEGIN-DEV-ONLY +# Parts of this BUILD file only necessary when building within the bazelbuild/rules_typescript repo. +# The generated `@bazel/typescript` npm package contains a trimmed BUILD file using # DEV-ONLY fences. load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( @@ -59,6 +76,7 @@ visibility = ["//visibility:public"], ) +# END-DEV-ONLY config_setting( name = "darwin_x64", constraint_values = [
diff --git a/internal/karma/BUILD.bazel b/internal/karma/BUILD.bazel index b2dd97d..815b6da 100644 --- a/internal/karma/BUILD.bazel +++ b/internal/karma/BUILD.bazel
@@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# BEGIN-DEV-ONLY +# Parts of this BUILD file only necessary when building within the bazelbuild/rules_typescript repo. +# The generated `@bazel/karma` npm package contains a trimmed BUILD file using # DEV-ONLY fences. load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "npm_package") load("@build_bazel_rules_typescript//:version.bzl", "COMPAT_VERSION") load("@build_bazel_rules_typescript//internal:defaults.bzl", "ts_library") @@ -79,6 +82,7 @@ ], replacements = { "0.0.0-COMPAT_VERSION": COMPAT_VERSION, + "(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "", }, deps = [ ":bazel_karma", @@ -86,4 +90,5 @@ ], ) +# END-DEV-ONLY exports_files(["karma.conf.js"])
diff --git a/internal/ts_repositories.bzl b/internal/ts_repositories.bzl index 6a37d98..2a90a70 100644 --- a/internal/ts_repositories.bzl +++ b/internal/ts_repositories.bzl
@@ -14,7 +14,12 @@ "Install toolchain dependencies" +# BEGIN-DEV-ONLY +# Parts of this BUILD file only necessary when building within the bazelbuild/rules_typescript repo. +# The generated `@bazel/typescript` npm package contains a trimmed BUILD file using # DEV-ONLY fences. load("@bazel_gazelle//:deps.bzl", "go_repository") + +# END-DEV-ONLY load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "check_rules_nodejs_version", "yarn_install") def ts_setup_workspace(): @@ -51,6 +56,7 @@ yarn_lock = "@build_bazel_rules_typescript//internal/protobufjs:yarn.lock", ) +# BEGIN-DEV-ONLY def ts_setup_dev_workspace(): """ Setup the toolchain needed for local development, but not needed by users. @@ -72,3 +78,5 @@ commit = "3fb116b820352b7f0c281308a4d6250c22d94e27", importpath = "github.com/mattn/go-isatty", ) + +# END-DEV-ONLY