From e08b17c8bf666ac9e73c0b53832d0f0ec432e92a Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 10 Sep 2020 16:32:23 -0700 Subject: [PATCH] Remove copy_pregenerated_cache (#609) Newer SDKs don't require this and removing it doesn't break any older SDKs (it just slows down their first use). --- emsdk.py | 52 --------------------------------------------- emsdk_manifest.json | 6 ++---- 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/emsdk.py b/emsdk.py index d4ff109..6570e28 100755 --- a/emsdk.py +++ b/emsdk.py @@ -2403,56 +2403,6 @@ def run_emcc(tools_to_activate): return -# Copy over any emscripten cache contents that were pregenerated. This avoids -# the user needing to immediately build libc etc. on first run. -# This only applies to legacy SDK versions. Anything built after -# https://github.com/WebAssembly/waterfall/pull/644 already has the libraries -# in the correct location. -# TODO(sbc): Remove this code. -def copy_pregenerated_cache(tools_to_activate): - tools_with_cache = [t for t in tools_to_activate if hasattr(t, 'pregenerated_cache')] - if not tools_with_cache: - debug_print('Not copying pregenerated libaries (none found)') - return - - em_cache_dir = None - - # First look through all the tools to find the EMSCRIPTEN_ROOT - for tool in tools_to_activate: - config = tool.activated_config() - if 'EMSCRIPTEN_ROOT' in config: - em_cache_dir = os.path.join(config['EMSCRIPTEN_ROOT'], 'cache') - break - else: - debug_print('Not copying pregenerated libaries (no EMSCRIPTEN_ROOT found)') - return - - # Generating .emscripten will cause emcc to clear the cache on first run (emcc - # sees that the file has changed, since we write it here in the emsdk, and it - # never saw it before; so it clears the cache as it assumes a new config file - # means system libraries may need rebuilding). To avoid emcc's clearing wiping - # out the pregenerated cache contents we want to copy in, run emcc here, then - # copy the cache contents. - run_emcc(tools_to_activate) - - # If we found an EMSCRIPTEN_ROOT look for any tools that include - # "pregenerated_cache" and copy those items into the cache. - for tool in tools_with_cache: - for cache_dir in tool.pregenerated_cache: - # Finish the install of an emscripten-releases build. - install_path = to_native_path(sdk_path(tool.expand_vars(tool.install_path))) - in_cache = os.path.join(install_path, 'lib', cache_dir) - if not os.path.exists(in_cache): - continue - out_cache = os.path.join(em_cache_dir, cache_dir) - if not os.path.exists(out_cache): - os.makedirs(out_cache) - for filename in os.listdir(in_cache): - debug_print('Copying %s to cache: %s' % (filename, out_cache)) - shutil.copy2(os.path.join(in_cache, filename), - os.path.join(out_cache, filename)) - - def write_set_env_script(env_string): assert(WINDOWS) open(EMSDK_SET_ENV, 'w').write(env_string) @@ -2471,8 +2421,6 @@ def set_active_tools(tools_to_activate, permanently_activate): generate_dot_emscripten(tools_to_activate) - copy_pregenerated_cache(tools_to_activate) - # Construct a .bat script that will be invoked to set env. vars and PATH # We only do this on windows since emsdk.bat is able to modify the # calling shell environment. On other platform `source emsdk_env.sh` is diff --git a/emsdk_manifest.json b/emsdk_manifest.json index 0c9150e..51bd33d 100644 --- a/emsdk_manifest.json +++ b/emsdk_manifest.json @@ -100,8 +100,7 @@ "install_path": "upstream", "activated_path": "%installation_dir%/emscripten", "activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'", - "emscripten_releases_hash": "%releases-tag%", - "pregenerated_cache": ["asmjs", "wasm", "wasm-obj", "wasm-bc"] + "emscripten_releases_hash": "%releases-tag%" }, { "id": "releases", @@ -115,8 +114,7 @@ "install_path": "fastcomp", "activated_path": "%installation_dir%/emscripten", "activated_cfg": "LLVM_ROOT='%installation_dir%/fastcomp/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%/bin/optimizer%.exe%'", - "emscripten_releases_hash": "%releases-tag%", - "pregenerated_cache": ["asmjs", "wasm", "wasm-obj", "wasm-bc"] + "emscripten_releases_hash": "%releases-tag%" }, {