Skip npm step if node_modules already exists (#640)
See https://github.com/WebAssembly/waterfall/pull/670
This commit is contained in:
8
emsdk.py
8
emsdk.py
@@ -1848,8 +1848,12 @@ class Tool(object):
|
|||||||
if getattr(self, 'custom_install_script', None) == 'emscripten_npm_install':
|
if getattr(self, 'custom_install_script', None) == 'emscripten_npm_install':
|
||||||
# upstream tools have hardcoded paths that are not stored in emsdk_manifest.json registry
|
# upstream tools have hardcoded paths that are not stored in emsdk_manifest.json registry
|
||||||
install_path = 'upstream' if 'releases-upstream' in self.version else 'fastcomp'
|
install_path = 'upstream' if 'releases-upstream' in self.version else 'fastcomp'
|
||||||
if not emscripten_npm_install(self, os.path.join(emsdk_path(), install_path, 'emscripten')):
|
emscripten_dir = os.path.join(emsdk_path(), install_path, 'emscripten')
|
||||||
exit_with_error('post-install step failed: emscripten_npm_install')
|
# Older versions of the sdk did not include the node_modules directory
|
||||||
|
# and require `npm ci` to be run post-install
|
||||||
|
if not os.path.exists(os.path.join(emscripten_dir, 'node_modules')):
|
||||||
|
if not emscripten_npm_install(self, emscripten_dir):
|
||||||
|
exit_with_error('post-install step failed: emscripten_npm_install')
|
||||||
|
|
||||||
print("Done installing SDK '" + str(self) + "'.")
|
print("Done installing SDK '" + str(self) + "'.")
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -205,6 +205,10 @@ int main() {
|
|||||||
# TODO; test on latest as well
|
# TODO; test on latest as well
|
||||||
check_call(upstream_emcc + ' hello_world.c')
|
check_call(upstream_emcc + ' hello_world.c')
|
||||||
|
|
||||||
|
def test_closure(self):
|
||||||
|
# Specificlly test with `--closure` so we know that node_modules is working
|
||||||
|
check_call(upstream_emcc + ' hello_world.c --closure=1')
|
||||||
|
|
||||||
def test_specific_old(self):
|
def test_specific_old(self):
|
||||||
print('test specific release (old, using sdk-* notation)')
|
print('test specific release (old, using sdk-* notation)')
|
||||||
run_emsdk('install sdk-fastcomp-1.38.31-64bit')
|
run_emsdk('install sdk-fastcomp-1.38.31-64bit')
|
||||||
|
|||||||
Reference in New Issue
Block a user