Avoid re-downloading files that are already downloaded (#460)

* Writes a .emsdk_version file to output directories using the name (which contains a version number and/or hash) once all installation steps have completed successfully.
* If that file exists, skip downloading/installation hooks.
This commit is contained in:
Dan Field
2020-04-01 13:46:22 -07:00
committed by GitHub
parent a490cd1222
commit 009ab2c77f
2 changed files with 26 additions and 13 deletions

29
test.py
View File

@@ -6,6 +6,19 @@ import subprocess
import sys
import tempfile
WINDOWS = sys.platform.startswith('win')
MACOS = sys.platform == 'darwin'
upstream_emcc = os.path.join('upstream', 'emscripten', 'emcc')
fastcomp_emcc = os.path.join('fastcomp', 'emscripten', 'emcc')
emsdk = './emsdk'
if WINDOWS:
upstream_emcc += '.bat'
fastcomp_emcc += '.bat'
emsdk = 'emsdk.bat'
else:
emsdk = './emsdk'
# Utilities
@@ -71,6 +84,9 @@ print('test .emscripten contents (latest was installed/activated in test.sh)')
assert 'fastcomp' not in open(os.path.expanduser('~/.emscripten')).read()
assert 'upstream' in open(os.path.expanduser('~/.emscripten')).read()
# Test we don't re-download unnecessarily
checked_call_with_output(emsdk + ' install latest', expected='already installed', unexpected='Downloading:')
print('building proper system libraries')
@@ -108,19 +124,6 @@ def run_emsdk(cmd):
check_call([emsdk] + cmd)
WINDOWS = sys.platform.startswith('win')
MACOS = sys.platform == 'darwin'
upstream_emcc = os.path.join('upstream', 'emscripten', 'emcc')
fastcomp_emcc = os.path.join('fastcomp', 'emscripten', 'emcc')
emsdk = './emsdk'
if WINDOWS:
upstream_emcc += '.bat'
fastcomp_emcc += '.bat'
emsdk = 'emsdk.bat'
else:
emsdk = './emsdk'
test_lib_building(upstream_emcc, use_asmjs_optimizer=True)
print('update')