diff --git a/IntegrationTests/BUCK b/IntegrationTests/BUCK index 0ebc5488ad..fa6fe51a3c 100644 --- a/IntegrationTests/BUCK +++ b/IntegrationTests/BUCK @@ -1,4 +1,4 @@ -load("@fbsource//tools/build_defs:js_glob.bzl", "js_glob") +load("@fbsource//tools/build_defs:js_library_glob.bzl", "js_library_glob") load("@fbsource//tools/build_defs/oss:metro_defs.bzl", "rn_library") # This file was generated by running @@ -6,7 +6,7 @@ load("@fbsource//tools/build_defs/oss:metro_defs.bzl", "rn_library") rn_library( name = "IntegrationTests", - srcs = js_glob( + srcs = js_library_glob( [ "**/*", ], diff --git a/ReactAndroid/src/androidTest/js/BUCK b/ReactAndroid/src/androidTest/js/BUCK index 51ad794f27..18f3ee4411 100644 --- a/ReactAndroid/src/androidTest/js/BUCK +++ b/ReactAndroid/src/androidTest/js/BUCK @@ -1,4 +1,4 @@ -load("//tools/build_defs:js_glob.bzl", "js_glob") +load("//tools/build_defs:js_library_glob.bzl", "js_library_glob") load("//tools/build_defs/oss:metro_defs.bzl", "rn_library") # This file was generated by running @@ -6,7 +6,7 @@ load("//tools/build_defs/oss:metro_defs.bzl", "rn_library") rn_library( name = "js", - srcs = js_glob( + srcs = js_library_glob( [ "**/*", ], diff --git a/packages/assets/BUCK b/packages/assets/BUCK index a89f2c5e27..826afbe6c8 100644 --- a/packages/assets/BUCK +++ b/packages/assets/BUCK @@ -1,10 +1,10 @@ -load("@fbsource//tools/build_defs:js_glob.bzl", "js_glob") +load("@fbsource//tools/build_defs:js_library_glob.bzl", "js_library_glob") load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace") load("@fbsource//xplat/js:JS_DEFS.bzl", "rn_library") rn_library( name = "assets", - srcs = js_glob([ + srcs = js_library_glob([ "**/*", "package.json", ]), diff --git a/packages/normalize-color/BUCK b/packages/normalize-color/BUCK index fd004f836c..8d58809d78 100644 --- a/packages/normalize-color/BUCK +++ b/packages/normalize-color/BUCK @@ -1,10 +1,10 @@ -load("@fbsource//tools/build_defs:js_glob.bzl", "js_glob") +load("@fbsource//tools/build_defs:js_library_glob.bzl", "js_library_glob") load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace") load("@fbsource//xplat/js:JS_DEFS.bzl", "rn_library") rn_library( name = "normalize-color", - srcs = js_glob([ + srcs = js_library_glob([ "**/*", "package.json", ]), diff --git a/packages/rn-tester/BUCK b/packages/rn-tester/BUCK index 6a1137be3e..04c75fe503 100644 --- a/packages/rn-tester/BUCK +++ b/packages/rn-tester/BUCK @@ -12,7 +12,7 @@ load( "//tools/build_defs/oss:rn_defs.bzl", "APPLE", "YOGA_APPLE_TARGET", - "js_glob", + "js_library_glob", "make_resource_glob", "react_fabric_component_plugin_provider", "react_module_plugin_providers", @@ -46,7 +46,7 @@ yarn_workspace( rn_library( name = "rn-tester", - srcs = js_glob( + srcs = js_library_glob( [ "js", "NativeModuleExample", diff --git a/tools/build_defs/js_glob.bzl b/tools/build_defs/js_glob.bzl deleted file mode 100644 index 3dc1ffd5ae..0000000000 --- a/tools/build_defs/js_glob.bzl +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -"""Special globbing for js libraries, including and excluding certain files""" - -js_glob_exts = ( - "gif", - "html", - "jpeg", - "jpg", - "js", - "js.flow", - "json", - "mp4", - "png", -) - -def js_glob(dirs, excludes = []): - globs = [] - for glob_dir in dirs: - if glob_dir == ".": - globs.extend(["*.%s" % (ext) for ext in js_glob_exts]) - elif glob_dir == "**/*": - globs.extend(["**/*.%s" % (ext) for ext in js_glob_exts]) - else: - globs.extend( - ["%s/**/*.%s" % (glob_dir, ext) for ext in js_glob_exts], - ) - return native.glob( - globs, - exclude = [ - "**/__tests__/**", - "**/__mocks__/**", - "**/__MOCKS__/**", - "**/__flowtests__/**", - "**/*.xcodeproj/**", - ] + (excludes or []), - ) diff --git a/tools/build_defs/js_library_glob.bzl b/tools/build_defs/js_library_glob.bzl new file mode 100644 index 0000000000..8e94fcede6 --- /dev/null +++ b/tools/build_defs/js_library_glob.bzl @@ -0,0 +1,9 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +"""Special globbing for js libraries, including and excluding certain files""" + +def js_library_glob(dirs, excludes = []): + return [] diff --git a/tools/build_defs/oss/rn_defs.bzl b/tools/build_defs/oss/rn_defs.bzl index b51c98be4c..b28ee634c0 100644 --- a/tools/build_defs/oss/rn_defs.bzl +++ b/tools/build_defs/oss/rn_defs.bzl @@ -12,8 +12,8 @@ This lets us build React Native: # @lint-ignore-every BUCKRESTRICTEDSYNTAX load( - "//tools/build_defs:js_glob.bzl", - _js_glob = "js_glob", + "//tools/build_defs:js_library_glob.bzl", + _js_library_glob = "js_library_glob", ) _DEBUG_PREPROCESSOR_FLAGS = [] @@ -306,7 +306,7 @@ def _paths_join(path, *others): return result -js_glob = _js_glob +js_library_glob = _js_library_glob def subdir_glob(glob_specs, exclude = None, prefix = ""): """Returns a dict of sub-directory relative paths to full paths.