Browse Source

conf(feat): do not inputs from peers' outputs
commit_hash:2310b62b5ef95f4fc7ee6b278d8d4a71a9c3817c

zaverden 4 months ago
parent
commit
e0af5b9afc

+ 5 - 5
build/conf/ts/ts_test.conf

@@ -32,7 +32,7 @@ module TS_TEST_JEST_FOR: _TS_TEST_BASE {
     .CMD=TS_TEST_JEST_CMD
 
     # for multimodule peers we should choose NODE_MODULES
-    SET(PEERDIR_TAGS TS)
+    SET(PEERDIR_TAGS TS TS_PROTO)
 
     # compatibility with old TS_TEST_SRCS
     SET(TS_TEST_EXTENSION test.(ts|tsx|js|jsx))
@@ -46,7 +46,7 @@ module TS_TEST_JEST_FOR: _TS_TEST_BASE {
     _TS_ADD_NODE_MODULES_FOR_BUILDER()
 }
 
-TS_TEST_HERMIONE_CMD=$TOUCH_UNIT \
+TS_TEST_HERMIONE_CMD=$TOUCH_UNIT ${hide:PEERS} \
     && ${cwd:BINDIR} $MOVE_FILE ${input:TS_TEST_NM} ${output:"workspace_node_modules.tar"} \
     ${hide;kv:"p TSHRM"} ${hide;kv:"pc magenta"}
 
@@ -67,7 +67,7 @@ module TS_TEST_HERMIONE_FOR: _TS_TEST_BASE {
     .CMD=TS_TEST_HERMIONE_CMD
 
     # for multimodule peers we should choose TS
-    SET(PEERDIR_TAGS TS)
+    SET(PEERDIR_TAGS TS TS_PROTO)
 
     # compatibility with old TS_TEST_SRCS
     SET(TS_TEST_EXTENSION hermione.(ts|js))
@@ -101,7 +101,7 @@ module TS_TEST_PLAYWRIGHT_FOR: _TS_TEST_BASE {
     .CMD=TS_TEST_PLAYWRIGHT_CMD
 
     # for multimodule peers we should choose TS
-    SET(PEERDIR_TAGS TS)
+    SET(PEERDIR_TAGS TS TS_PROTO)
 
     # compatibility with old TS_TEST_SRCS
     SET(TS_TEST_EXTENSION (playwright|spec).(ts|js))
@@ -134,7 +134,7 @@ module TS_TEST_PLAYWRIGHT_LARGE_FOR: _TS_TEST_BASE {
     .CMD=TS_TEST_PLAYWRIGHT_LARGE_CMD
 
     # for multimodule peers we should choose TS
-    SET(PEERDIR_TAGS TS)
+    SET(PEERDIR_TAGS TS TS_PROTO)
 
     # compatibility with old TS_TEST_SRCS
     SET(TS_TEST_EXTENSION (playwright|spec).(ts|js))

+ 1 - 1
build/plugins/lib/nots/package_manager/base/package_manager.py

@@ -102,7 +102,7 @@ class BasePackageManager(object):
         pass
 
     @abstractmethod
-    def calc_node_modules_inouts(self, local_cli=False) -> tuple[list[str], list[str]]:
+    def calc_node_modules_inouts(self, local_cli: bool, has_deps: bool) -> tuple[list[str], list[str]]:
         pass
 
     @abstractmethod

+ 3 - 13
build/plugins/lib/nots/package_manager/npm/npm_package_manager.py

@@ -64,38 +64,28 @@ class NpmPackageManager(BasePackageManager):
         resources = []
 
         if has_deps:
-            for dep_path in self.get_local_peers_from_package_json():
-                ins.append(b_rooted(build_ws_config_path(dep_path)))
-
             for pkg in self.extract_packages_meta_from_lockfiles([build_lockfile_path(self.sources_path)]):
                 resources.append(pkg.to_uri())
                 outs.append(b_rooted(self._tarballs_store_path(pkg, store_path)))
 
         return ins, outs, resources
 
-    def calc_node_modules_inouts(self, local_cli=False) -> tuple[list[str], list[str]]:
+    def calc_node_modules_inouts(self, local_cli: bool, has_deps: bool) -> tuple[list[str], list[str]]:
         """
         Returns input and output paths for command that creates `node_modules` bundle.
         It relies on .PEERDIRSELF=TS_PREPARE_DEPS
         Inputs:
             - source package.json
-            - merged pre-lockfiles and workspace configs of TS_PREPARE_DEPS
         Outputs:
             - created node_modules bundle
         """
         ins = [
             s_rooted(build_pj_path(self.module_path)),
-            b_rooted(build_ws_config_path(self.module_path)),
         ]
         outs = []
 
-        pj = self.load_package_json_from_dir(self.sources_path)
-        if pj.has_dependencies():
-            ins.append(b_rooted(build_pre_lockfile_path(self.module_path)))
-            if not local_cli:
-                outs.append(b_rooted(build_nm_bundle_path(self.module_path)))
-            for dep_path in self.get_local_peers_from_package_json():
-                ins.append(b_rooted(build_pj_path(dep_path)))
+        if not local_cli and has_deps:
+            outs.append(b_rooted(build_nm_bundle_path(self.module_path)))
 
         return ins, outs
 

+ 3 - 16
build/plugins/lib/nots/package_manager/pnpm/package_manager.py

@@ -106,39 +106,26 @@ class PnpmPackageManager(BasePackageManager):
         resources = []
 
         if has_deps:
-            for dep_path in self.get_local_peers_from_package_json():
-                ins.append(b_rooted(build_ws_config_path(dep_path)))
-                ins.append(b_rooted(build_pre_lockfile_path(dep_path)))
-
             for pkg in self.extract_packages_meta_from_lockfiles([build_lockfile_path(self.sources_path)]):
                 resources.append(pkg.to_uri())
                 outs.append(b_rooted(self._tarballs_store_path(pkg, store_path)))
 
         return ins, outs, resources
 
-    # TODO: FBP-1254
-    # def calc_node_modules_inouts(self, local_cli=False) -> (list[str], list[str]):
-    def calc_node_modules_inouts(self, local_cli=False):
+    def calc_node_modules_inouts(self, local_cli: bool, has_deps: bool) -> tuple[list[str], list[str]]:
         """
         Returns input and output paths for command that creates `node_modules` bundle.
         It relies on .PEERDIRSELF=TS_PREPARE_DEPS
         Inputs:
             - source package.json
-            - merged pre-lockfiles and workspace configs of TS_PREPARE_DEPS
         Outputs:
             - created node_modules bundle
         """
         ins = [s_rooted(build_pj_path(self.module_path))]
         outs = []
 
-        pj = self.load_package_json_from_dir(self.sources_path)
-        if pj.has_dependencies():
-            ins.append(b_rooted(build_pre_lockfile_path(self.module_path)))
-            ins.append(b_rooted(build_ws_config_path(self.module_path)))
-            if not local_cli:
-                outs.append(b_rooted(build_nm_bundle_path(self.module_path)))
-            for dep_path in self.get_local_peers_from_package_json():
-                ins.append(b_rooted(build_pj_path(dep_path)))
+        if not local_cli and has_deps:
+            outs.append(b_rooted(build_nm_bundle_path(self.module_path)))
 
         return ins, outs
 

+ 3 - 2
build/plugins/nots.py

@@ -795,11 +795,12 @@ def on_prepare_deps_configure(unit: NotsUnitType) -> None:
 def on_node_modules_configure(unit: NotsUnitType) -> None:
     pm = _create_pm(unit)
     pj = pm.load_package_json_from_dir(pm.sources_path)
+    has_deps = pj.has_dependencies()
 
-    if pj.has_dependencies():
+    if has_deps:
         unit.onpeerdir(pm.get_local_peers_from_package_json())
         local_cli = unit.get("TS_LOCAL_CLI") == "yes"
-        ins, outs = pm.calc_node_modules_inouts(local_cli)
+        ins, outs = pm.calc_node_modules_inouts(local_cli, has_deps)
 
         __set_append(unit, "_NODE_MODULES_INOUTS", _build_directives("input", ["hide"], sorted(ins)))
         if not unit.get("TS_TEST_FOR"):