Skip to content

Commit de1134d

Browse files
authored
Add emscripten-releases support for release tags (#243)
* Structures emscripten-releases-tags.txt to mention the latest release, and then a list of all previous releases. * Adds a new release for 1.38.33. * If the manifest has emscripten_releases_hash, then we write out emscripten-version.txt with the proper version. We start with the hash, and check if there is a released version for it, if so we emit that, otherwise we emit the hash. * Windows zipfile fix.
1 parent 7c9b509 commit de1134d

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

emscripten-releases-tags.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"latest": "0ea08ee8a5f0524b4c9ac94de4f161ceeacb3e74"
2+
"latest": "1.38.33",
3+
"releases": {
4+
"1.38.33": "3b8cff670e9233a6623563add831647e8689a86b"
5+
}
36
}
47

emsdk

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ def unzip(source_filename, dest_dir, unpack_even_if_exists=False):
475475
if not os.path.isdir(d): os.mkdir(d)
476476
else:
477477
tmp_dst_filename = os.path.join(unzip_to_dir, member.filename)
478+
parent_dir = os.path.dirname(fix_potentially_long_windows_pathname(final_dst_filename))
479+
if parent_dir and not os.path.exists(parent_dir):
480+
os.makedirs(parent_dir)
478481
os.rename(fix_potentially_long_windows_pathname(tmp_dst_filename), fix_potentially_long_windows_pathname(final_dst_filename))
479482

480483
if common_subdir:
@@ -1501,11 +1504,17 @@ class Tool(object):
15011504
if dst_file: success = True
15021505
else: success = False
15031506

1504-
if success and hasattr(self, 'custom_install_script'):
1505-
if self.custom_install_script == 'build_optimizer': success = build_optimizer_tool(self)
1506-
elif self.custom_install_script == 'build_fastcomp': pass # 'build_fastcomp' is a special one that does the download on its own, others do the download manually.
1507-
elif self.custom_install_script == 'build_binaryen': success = build_binaryen_tool(self)
1508-
else: raise Exception('Unknown custom_install_script command "' + self.custom_install_script + '"!')
1507+
if success:
1508+
if hasattr(self, 'custom_install_script'):
1509+
if self.custom_install_script == 'build_optimizer': success = build_optimizer_tool(self)
1510+
elif self.custom_install_script == 'build_fastcomp': pass # 'build_fastcomp' is a special one that does the download on its own, others do the download manually.
1511+
elif self.custom_install_script == 'build_binaryen': success = build_binaryen_tool(self)
1512+
else: raise Exception('Unknown custom_install_script command "' + self.custom_install_script + '"!')
1513+
1514+
# Install an emscripten-version.txt file if told to.
1515+
if hasattr(self, 'emscripten_releases_hash'):
1516+
emscripten_version_file_path = os.path.join(to_native_path(self.expand_vars(self.activated_path)), 'emscripten-version.txt')
1517+
open(emscripten_version_file_path, 'w').write('"%s"' % get_emscripten_release_version(self.emscripten_releases_hash))
15091518

15101519
if not success:
15111520
print("Installation failed!")
@@ -1666,7 +1675,20 @@ def find_latest_waterfall_sdk(which):
16661675

16671676
def find_latest_releases_sdk(which):
16681677
releases_info = load_releases_info()
1669-
return 'sdk-releases-%s-%s-64bit' % (which, releases_info['latest'])
1678+
latest = releases_info['latest']
1679+
ident = releases_info['releases'][latest]
1680+
return 'sdk-releases-%s-%s-64bit' % (which, ident)
1681+
1682+
1683+
# Given a git hash in emscripten-releases, find the emscripten
1684+
# version for it. There may not be one if this is not the hash of
1685+
# a release, in which case we just use the hash.
1686+
def get_emscripten_release_version(emscripten_releases_hash):
1687+
releases_info = load_releases_info()
1688+
for key, value in dict(releases_info['releases']).items():
1689+
if value == emscripten_releases_hash:
1690+
return key
1691+
return emscripten_releases_hash
16701692

16711693

16721694
# Finds the best-matching python tool for use.
@@ -1875,7 +1897,7 @@ def load_releases_info():
18751897
# Get a list of tags for emscripten-releases.
18761898
def load_releases_tags():
18771899
info = load_releases_info()
1878-
return list(info.values())
1900+
return list(info['releases'].values())
18791901

18801902

18811903
def is_string(s):

emsdk_manifest.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,25 @@
217217
"bitness": 64,
218218
"linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries.tbz2",
219219
"osx_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries.tbz2",
220-
"windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/windows/%releases-tag%/wasm-binaries.tbz2",
220+
"windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/win/%releases-tag%/wasm-binaries.zip",
221221
"zipfile_prefix": "%releases-tag%-",
222222
"install_path": "upstream/%releases-tag%",
223223
"activated_path": "%installation_dir%/emscripten",
224-
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%'"
224+
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%'",
225+
"emscripten_releases_hash": "%releases-tag%"
225226
},
226227
{
227228
"id": "releases",
228229
"version": "fastcomp-%releases-tag%",
229230
"bitness": 64,
230231
"linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries.tbz2",
231232
"osx_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries.tbz2",
232-
"windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/windows/%releases-tag%/wasm-binaries.zip",
233+
"windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/win/%releases-tag%/wasm-binaries.zip",
233234
"zipfile_prefix": "%releases-tag%-",
234235
"install_path": "fastcomp/%releases-tag%",
235236
"activated_path": "%installation_dir%/emscripten",
236-
"activated_cfg": "LLVM_ROOT='%installation_dir%/fastcomp/bin';BINARYEN_ROOT='%installation_dir%'"
237+
"activated_cfg": "LLVM_ROOT='%installation_dir%/fastcomp/bin';BINARYEN_ROOT='%installation_dir%'",
238+
"emscripten_releases_hash": "%releases-tag%"
237239
},
238240

239241
{

0 commit comments

Comments
 (0)