flutter_flutter/engine/src/flutter/tools/activate_emsdk.py
Jackson Gardner 8cced6a0ac Reland single threaded Skwasm (flutter/engine#56282)
This attempts to reland the single-threaded Skwasm PR: https://github.com/flutter/engine/pull/56206

The main changes here are in the second commit:
* We need to actually bundle the `skwasm_st` artifacts in `flutter_web_sdk.zip`
* The `locateFile` hack no longer works since emscripten doesn't actually create a worker.js file anymore. So instead, that has been modified to use the `mainScriptUrlOrBlob` module API to do a very similar hack.

Note: I did presubmit testing with the framework CI and it appears the pertinent tests pass. See https://github.com/flutter/flutter/pull/157967
2024-11-01 19:00:08 +00:00

37 lines
963 B
Python

#!/usr/bin/env python
# Copyright 2022 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
EMSDK_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', 'prebuilts', 'emsdk'))
EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')
# See lib/web_ui/README.md for instructions on updating the EMSDK version.
EMSDK_VERSION = '3.1.70'
def main():
try:
subprocess.check_call([sys.executable, EMSDK_PATH, 'install', EMSDK_VERSION],
stdout=subprocess.DEVNULL)
except subprocess.CalledProcessError:
print('Failed to install emsdk')
return 1
try:
subprocess.check_call([sys.executable, EMSDK_PATH, 'activate', EMSDK_VERSION],
stdout=subprocess.DEVNULL)
except subprocess.CalledProcessError:
print('Failed to activate emsdk')
return 1
if __name__ == '__main__':
sys.exit(main())