Skip to content

Commit 68f2bcc

Browse files
committed
feat(conf+builder): remove contrib-related code
commit_hash:cfbd74bf877107b5db0cb2ea60977b4849e15af5
1 parent fe7dabb commit 68f2bcc

File tree

8 files changed

+1
-245
lines changed

8 files changed

+1
-245
lines changed

build/conf/ts/node_modules.conf

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,10 @@ NPM_SCRIPT=$NPM_ROOT/node_modules/npm/bin/npm-cli.js
77
PM_SCRIPT=
88
PM_TYPE=
99

10-
NPM_CONTRIBS_PATH=-
11-
# combined input/outputs records as list of directives ${hide;input:<path>} ${hide;output:<path>}, used in builders
10+
# combined input/outputs records as list of directives ${input;hide:<path>} ${output;hide:<path>}, used in builders
1211
_NODE_MODULES_INOUTS=
1312
_YATOOL_PREBUILDER_ARG=
1413

15-
macro CUSTOM_CONTRIB_TYPESCRIPT(P) {
16-
SET(NPM_CONTRIBS_PATH -)
17-
}
18-
19-
macro NO_CONTRIB_TYPESCRIPT() {
20-
SET(NPM_CONTRIBS_PATH -)
21-
}
22-
23-
### @usage: NPM_CONTRIBS() # internal
24-
###
25-
### Defines special module that provides contrib tarballs from internal npm registry.
26-
###
27-
### @see [FROM_NPM_LOCKFILES()](#macro_FROM_NPM_LOCKFILES)
28-
module NPM_CONTRIBS: _BARE_UNIT {
29-
.CMD=TOUCH_UNIT
30-
.PEERDIR_POLICY=as_build_from
31-
.FINAL_TARGET=no
32-
.ALLOWED=FROM_NPM_LOCKFILES
33-
.RESTRICTED=PEERDIR
34-
.EXTS=_ # Ignore all files, so module is not affected by FROM_NPM output (.EXTS=* is inherited from _BARE_UNIT)
35-
36-
SET(MODULE_TAG NPM_CONTRIBS)
37-
SET(MODULE_LANG TS)
38-
39-
# .fake tells builder to not materialize it in results
40-
SET(MODULE_SUFFIX .fake)
41-
}
42-
43-
### @usage: FROM_NPM_LOCKFILES(LOCKFILES...) # internal
44-
###
45-
### Defines lockfile list for `NPM_CONTRIBS` module.
46-
###
47-
### @see [NPM_CONTRIBS()](#module_NPM_CONTRIBS)
48-
macro FROM_NPM_LOCKFILES(LOCKFILES...) {
49-
# SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS $LOCKFILES)
50-
# See implementation in build/plugins/nots.py
51-
# _FROM_NPM_LOCKFILES($LOCKFILES)
52-
MESSAGE("NPM_CONTRIBS and FROM_NPM_LOCKFILES are disabled. Please exclude them from your build process")
53-
}
54-
55-
FROM_NPM_CWD=$ARCADIA_BUILD_ROOT/$NPM_CONTRIBS_PATH
56-
macro _FROM_NPM(TARBALL_URL, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) {
57-
.CMD=${cwd:FROM_NPM_CWD} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${hide;input:"build/scripts/fetch_from.py"} ${hide;input:"build/scripts/sky.py"} --tarball-url $TARBALL_URL --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${noauto;output:TARBALL_PATH} ${requirements;hide:"network:full"} ${hide;kv:"p TS_FNPM"} ${hide;kv:"pc magenta"}
58-
# we want output to be available for other modules without affecting NPM_CONTRIBS
59-
# we need to expose it (some details in https://st.yandex-team.ru/YMAKE-34)
60-
_EXPOSE($TARBALL_PATH)
61-
}
62-
6314
macro _TS_ADD_NODE_MODULES_FOR_BUILDER() {
6415
# Calculate inputs and outputs of node_modules, fill `_NODE_MODULES_INOUTS` variable
6516
_NODE_MODULES_CONFIGURE()

build/conf/ts/ts.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ NOTS_TOOL_BASE_ARGS=\
3333
--nodejs-bin $NODEJS_BIN \
3434
--pm-script $PM_SCRIPT \
3535
--pm-type $PM_TYPE \
36-
--contribs $NPM_CONTRIBS_PATH \
3736
--trace $TS_TRACE \
3837
--verbose $TS_LOG \
3938
$_YATOOL_PREBUILDER_ARG

build/plugins/lib/nots/package_manager/base/package_manager.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def __init__(
3434
sources_path,
3535
nodejs_bin_path,
3636
script_path,
37-
contribs_path,
3837
module_path=None,
3938
sources_root=None,
4039
):
@@ -45,7 +44,6 @@ def __init__(
4544
self.sources_root = sources_path[: -len(self.module_path) - 1] if sources_root is None else sources_root
4645
self.nodejs_bin_path = nodejs_bin_path
4746
self.script_path = script_path
48-
self.contribs_path = contribs_path
4947

5048
@classmethod
5149
def load_package_json(cls, path):
@@ -150,9 +148,6 @@ def _exec_command(self, args, include_defaults=True, script_path=None, env=None)
150148
def _nm_path(self, *parts):
151149
return os.path.join(build_nm_path(self.build_path), *parts)
152150

153-
def _contrib_tarball_path(self, pkg):
154-
return os.path.join(self.contribs_path, pkg.tarball_path)
155-
156151
def _tarballs_store_path(self, pkg, store_path):
157152
return os.path.join(self.module_path, store_path, pkg.tarball_path)
158153

build/plugins/lib/nots/package_manager/npm/npm_package_manager.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ def extract_packages_meta_from_lockfiles(self, lf_paths):
5050
if errors:
5151
raise PackageManagerError("Unable to process some lockfiles:\n{}".format("\n".join(errors)))
5252

53-
def calc_prepare_deps_inouts(self, store_path: str, has_deps: bool) -> tuple[list[str], list[str]]:
54-
raise NotImplementedError("NPM does not support contrib/typescript flow.")
55-
5653
def calc_prepare_deps_inouts_and_resources(
5754
self, store_path: str, has_deps: bool
5855
) -> tuple[list[str], list[str], list[str]]:
@@ -147,7 +144,6 @@ def create_node_modules(self, yatool_prebuilder_path=None, local_cli=False, bund
147144
sources_path=dep_source_path,
148145
nodejs_bin_path=self.nodejs_bin_path,
149146
script_path=self.script_path,
150-
contribs_path=self.contribs_path,
151147
module_path=module_path,
152148
sources_root=self.sources_root,
153149
)

build/plugins/lib/nots/package_manager/pnpm/package_manager.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,6 @@ def calc_prepare_deps_inouts_and_resources(
116116

117117
return ins, outs, resources
118118

119-
# TODO: FBP-1254
120-
# def calc_prepare_deps_inouts(self, store_path: str, has_deps: bool) -> (list[str], list[str]):
121-
def calc_prepare_deps_inouts(self, store_path, has_deps):
122-
ins = [
123-
s_rooted(build_pj_path(self.module_path)),
124-
s_rooted(build_lockfile_path(self.module_path)),
125-
]
126-
outs = [
127-
b_rooted(build_ws_config_path(self.module_path)),
128-
b_rooted(build_pre_lockfile_path(self.module_path)),
129-
]
130-
131-
if has_deps:
132-
for dep_path in self.get_local_peers_from_package_json():
133-
ins.append(b_rooted(build_ws_config_path(dep_path)))
134-
ins.append(b_rooted(build_pre_lockfile_path(dep_path)))
135-
136-
for pkg in self.extract_packages_meta_from_lockfiles([build_lockfile_path(self.sources_path)]):
137-
ins.append(b_rooted(self._contrib_tarball_path(pkg)))
138-
outs.append(b_rooted(self._tarballs_store_path(pkg, store_path)))
139-
140-
return ins, outs
141-
142119
# TODO: FBP-1254
143120
# def calc_node_modules_inouts(self, local_cli=False) -> (list[str], list[str]):
144121
def calc_node_modules_inouts(self, local_cli=False):

build/plugins/nots.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ def _create_pm(unit: NotsUnitType) -> 'BasePackageManager':
345345
sources_path=unit.resolve(sources_path),
346346
build_root="$B",
347347
build_path=unit.path().replace("$S", "$B", 1),
348-
contribs_path=unit.get("NPM_CONTRIBS_PATH"),
349348
nodejs_bin_path=None,
350349
script_path=None,
351350
module_path=module_path,
@@ -387,31 +386,6 @@ def on_set_append_with_directive(unit: NotsUnitType, var_name: str, directive: s
387386
__set_append(unit, var_name, " ".join(wrapped))
388387

389388

390-
@_with_report_configure_error
391-
def on_from_npm_lockfiles(unit, *args):
392-
from lib.nots.package_manager.base import PackageManagerError
393-
394-
# This is contrib with pnpm-lock.yaml files only
395-
# Force set to pnpm
396-
unit.set(["PM_TYPE", "pnpm"])
397-
pm = _create_pm(unit)
398-
lf_paths = []
399-
400-
for lf_path in args:
401-
abs_lf_path = unit.resolve(unit.resolve_arc_path(lf_path))
402-
if abs_lf_path:
403-
lf_paths.append(abs_lf_path)
404-
elif unit.get("TS_STRICT_FROM_NPM_LOCKFILES") == "yes":
405-
ymake.report_configure_error("lockfile not found: {}".format(lf_path))
406-
407-
try:
408-
for pkg in pm.extract_packages_meta_from_lockfiles(lf_paths):
409-
unit.on_from_npm([pkg.tarball_url, pkg.sky_id, pkg.integrity, pkg.integrity_algorithm, pkg.tarball_path])
410-
except PackageManagerError as e:
411-
logger.warn(str(e))
412-
pass
413-
414-
415389
def _check_nodejs_version(unit: NotsUnitType, major: int) -> None:
416390
if major < 14:
417391
raise Exception(
@@ -800,28 +774,6 @@ def _select_matching_version(
800774

801775
@_with_report_configure_error
802776
def on_prepare_deps_configure(unit: NotsUnitType) -> None:
803-
contrib_path = unit.get("NPM_CONTRIBS_PATH")
804-
if contrib_path == '-':
805-
unit.on_prepare_deps_configure_no_contrib()
806-
return
807-
unit.onpeerdir(contrib_path)
808-
pm = _create_pm(unit)
809-
pj = pm.load_package_json_from_dir(pm.sources_path)
810-
has_deps = pj.has_dependencies()
811-
ins, outs = pm.calc_prepare_deps_inouts(unit.get("_TARBALLS_STORE"), has_deps)
812-
813-
if has_deps:
814-
unit.onpeerdir(pm.get_local_peers_from_package_json())
815-
__set_append(unit, "_PREPARE_DEPS_INOUTS", _build_directives("input", ["hide"], sorted(ins)))
816-
__set_append(unit, "_PREPARE_DEPS_INOUTS", _build_directives("output", ["hide"], sorted(outs)))
817-
818-
else:
819-
__set_append(unit, "_PREPARE_DEPS_INOUTS", _build_directives("output", [], sorted(outs)))
820-
unit.set(["_PREPARE_DEPS_CMD", "$_PREPARE_NO_DEPS_CMD"])
821-
822-
823-
@_with_report_configure_error
824-
def on_prepare_deps_configure_no_contrib(unit: NotsUnitType) -> None:
825777
pm = _create_pm(unit)
826778
pj = pm.load_package_json_from_dir(pm.sources_path)
827779
has_deps = pj.has_dependencies()

build/scripts/fetch_from_npm.py

Lines changed: 0 additions & 113 deletions
This file was deleted.

build/scripts/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ IF (PY2)
1515
fetch_from.py
1616
fetch_from_archive.py
1717
fetch_from_mds.py
18-
fetch_from_npm.py
1918
fetch_from_sandbox.py
2019
fetch_resource.py
2120
fix_py2_protobuf.py

0 commit comments

Comments
 (0)