diff --git a/npm/private/npm_package_info.bzl b/npm/private/npm_package_info.bzl index 20583ede3..9e9798c7c 100644 --- a/npm/private/npm_package_info.bzl +++ b/npm/private/npm_package_info.bzl @@ -7,6 +7,5 @@ NpmPackageInfo = provider( "version": "version of this npm package", "directory": "the directory (typically a TreeArtifact) that contains the package sources", "npm_package_store_deps": "A depset of NpmPackageStoreInfo providers from npm dependencies of the package and the packages's transitive deps to use as direct dependencies when linking with npm_link_package", - "hardlink": "internal use only", }, ) diff --git a/npm/private/npm_package_internal.bzl b/npm/private/npm_package_internal.bzl index 3cc2c76c2..ae41bc07d 100644 --- a/npm/private/npm_package_internal.bzl +++ b/npm/private/npm_package_internal.bzl @@ -34,7 +34,6 @@ def _npm_package_internal_impl(ctx): version = ctx.attr.version, directory = dst, npm_package_store_deps = depset(), - hardlink = True, # always hardlink downstream ), ] diff --git a/npm/private/npm_package_store.bzl b/npm/private/npm_package_store.bzl index b2402880d..da80d2005 100644 --- a/npm/private/npm_package_store.bzl +++ b/npm/private/npm_package_store.bzl @@ -150,6 +150,10 @@ If set, takes precendance over the package version in the NpmPackageInfo src. - "auto": hardlinks are used for generated files already in the output tree - "off": all files are copied - "on": hardlinks are used for all files (not recommended) + + NB: Hardlinking source files in external repositories as was done under the hood + prior to https://github.com/aspect-build/rules_js/pull/1533 may lead to flaky build + failures as reported in https://github.com/aspect-build/rules_js/issues/1412. """, ), "verbose": attr.bool( @@ -191,13 +195,15 @@ def _npm_package_store_impl(ctx): virtual_store_directory = src_directory else: virtual_store_directory = ctx.actions.declare_directory(virtual_store_directory_path) - hardlink = ctx.attr.src[NpmPackageInfo].hardlink if hasattr(ctx.attr.src[NpmPackageInfo], "hardlink") else False copy_directory_bin_action( ctx, src = src_directory, dst = virtual_store_directory, copy_directory_bin = ctx.toolchains["@aspect_bazel_lib//lib:copy_directory_toolchain_type"].copy_directory_info.bin, - hardlink = "on" if hardlink else ctx.attr.hardlink, + # Hardlinking source files in external repositories as was done under the hood + # prior to https://github.com/aspect-build/rules_js/pull/1533 may lead to flaky build + # failures as reported in https://github.com/aspect-build/rules_js/issues/1412. + hardlink = ctx.attr.hardlink, verbose = ctx.attr.verbose, )