Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tot #1407

Open
wants to merge 3 commits into
base: test_spaces
Choose a base branch
from
Open

Tot #1407

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ llvm-tags-32bit.txt
llvm-tags-64bit.txt
upstream
!upstream/lkgr.json
emscripten-releases-tot.txt
10 changes: 10 additions & 0 deletions emscripten-releases-history.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
92502c924353cd84f33cc519c2c121c8a0721d9e
c34dc3ebba733a36767fd75c1348ef1ac726db4b
c964ba0138544d215aa3607c16a5c30a8ef8a6cc
62c4d736bb0a393dda9e6eec6f998111d9070208
d215321ac0e0a0b76b0e7e81c4f87adfe5d106e4
870622da9305ce5cb44987ad520827161d69df81
5e0c54a15df7dd762acb3162beee7db54c6ae197
37ff372e7389d7e2c7eb23736ad53b16f6626a05
e74d3b061d851e400ec8dff33b5b3dbc3909c009
44c1f80345b3296ff1253dd6c5f4a9ba7aa3b959
40 changes: 40 additions & 0 deletions emsdk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ emsdk_packages_url = urljoin(emsdk_master_server, 'packages/')

emscripten_git_repo = 'https://github.com/kripken/emscripten.git'
binaryen_git_repo = 'https://github.com/WebAssembly/binaryen.git'
emscripten_releases_repo = 'https://chromium.googlesource.com/emscripten-releases'

# Enable this to do very verbose printing about the different steps that are being run. Useful for debugging.
VERBOSE = bool(os.getenv('EMSDK_VERBOSE')) if os.getenv('EMSDK_VERBOSE') is not None else False
Expand Down Expand Up @@ -96,6 +97,13 @@ def os_name():
raise Exception('unknown OS')


def os_name_for_emscripten_releases():
if WINDOWS: return 'win'
elif LINUX: return 'linux'
elif OSX: return 'mac'
else:
raise Exception('unknown OS')

def to_unix_path(p):
return p.replace('\\', '/')

Expand Down Expand Up @@ -632,6 +640,14 @@ def git_repo_version(repo_path):
return ""


def git_recent_commits(repo_path, n=10):
returncode, stdout, stderr = run_get_output([GIT(), 'log', '-n', str(n), '--pretty="%H"'], cwd=repo_path)
if returncode == 0:
return stdout.strip().replace('\r', '').replace('"', '').split('\n')
else:
return []


def git_clone(url, dstpath):
if VERBOSE: print('git_clone(url=' + url + ', dstpath=' + dstpath + ')')
if os.path.isdir(os.path.join(dstpath, '.git')):
Expand Down Expand Up @@ -1690,6 +1706,25 @@ def get_emscripten_release_version(emscripten_releases_hash):
return key
return emscripten_releases_hash

def get_emscripten_releases_tot():
git_clone_checkout_and_pull(emscripten_releases_repo, sdk_path('releases'), 'master')
recent_releases = git_recent_commits(sdk_path('releases'))
# The recent releases are the latest hashes in the git repo. There
# may not be a build for the most recent ones yet; find the last
# that does.
for release in recent_releases:
url = "https://storage.googleapis.com/webassembly/emscripten-releases-builds/%s/%s/wasm-binaries.%s" % (
os_name_for_emscripten_releases(),
release,
'tbz2' if not WINDOWS else 'zip'
)
print(url)
try:
u = urlopen(url)
except:
continue
return release
return ''

# Finds the best-matching python tool for use.
def find_used_python():
Expand Down Expand Up @@ -1759,6 +1794,11 @@ def fetch_emscripten_tags():
else:
print('Done. No tagged Binaryen releases available.')

print('Fetching emscripten-releases repository...')
emscripten_releases_tot = get_emscripten_releases_tot()
if emscripten_releases_tot:
open(sdk_path('emscripten-releases-tot.txt'), 'w').write(emscripten_releases_tot)

# Emscripten Nightlies support has been removed, clear the list of known Nightlies locally.
# print('Fetching all precompiled Nightly versions..')
# download_file('https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/nightly/' + os_name() + '_32bit/index.txt', 'llvm-nightlies-32bit.txt', download_even_if_exists=True)
Expand Down