From 33afa7fa52b4c2580691251a02c23f4053d80987 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Thu, 28 Mar 2024 20:01:52 -0400 Subject: [PATCH] perf: don't set JsInfo declarations and transitive_declarations in npm_link_package_store --- js/private/test/js_library_test.bzl | 16 ++-------------- npm/private/npm_link_package_store.bzl | 3 --- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/js/private/test/js_library_test.bzl b/js/private/test/js_library_test.bzl index 8aa8fb70e..8c40a179a 100644 --- a/js/private/test/js_library_test.bzl +++ b/js/private/test/js_library_test.bzl @@ -39,15 +39,9 @@ def _declarations_test_impl(ctx): # transitive_declarations should have the source declarations and transitive declarations transitive_declarations = target_under_test[JsInfo].transitive_declarations.to_list() - - # the transitive count might be 3 or 4 depending on the type of symlink created. - # See utils.make_symlink() - asserts.true(env, len(transitive_declarations) == 3 or len(transitive_declarations) == 4) + asserts.true(env, len(transitive_declarations) == 2) asserts.true(env, transitive_declarations[0].path.find("/importing.d.ts") != -1) asserts.true(env, transitive_declarations[1].path.find("/data.json") != -1) - asserts.true(env, transitive_declarations[2].path.find("/@types/node") != -1) - if len(transitive_declarations) == 4: - asserts.true(env, transitive_declarations[3].path.find("/@types/node") != -1) # types OutputGroupInfo should be the same as direct declarations asserts.equals(env, declarations, target_under_test[OutputGroupInfo].types.to_list()) @@ -66,15 +60,9 @@ def _explicit_declarations_test_impl(ctx): # transitive_declarations should have the source declarations and transitive declarations transitive_declarations = target_under_test[JsInfo].transitive_declarations.to_list() - - # the transitive count might be 3 or 4 depending on the type of symlink created. - # See utils.make_symlink() - asserts.true(env, len(transitive_declarations) == 3 or len(transitive_declarations) == 4) + asserts.true(env, len(transitive_declarations) == 2) asserts.true(env, transitive_declarations[0].path.find("/data.json") != -1) asserts.true(env, transitive_declarations[1].path.find("/index.js") != -1) - asserts.true(env, transitive_declarations[2].path.find("/@types/node") != -1) - if len(transitive_declarations) == 4: - asserts.true(env, transitive_declarations[3].path.find("/@types/node") != -1) # types OutputGroupInfo should be the same as direct declarations asserts.equals(env, declarations, target_under_test[OutputGroupInfo].types.to_list()) diff --git a/npm/private/npm_link_package_store.bzl b/npm/private/npm_link_package_store.bzl index 65a21310e..472bca3a4 100644 --- a/npm/private/npm_link_package_store.bzl +++ b/npm/private/npm_link_package_store.bzl @@ -126,9 +126,6 @@ def _npm_link_package_store_impl(ctx): runfiles = ctx.runfiles(transitive_files = transitive_files_depset), ), js_info( - # assume a directory contains declarations since we can't know that it doesn't - declarations = files_depset, - transitive_declarations = transitive_files_depset, npm_linked_package_files = files_depset, npm_linked_packages = depset([npm_linked_package_info]), # only propagate non-dev npm dependencies to use as direct dependencies when linking downstream npm_package targets with npm_link_package