-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Currently engine artifacts for each host platform (e.g. linux-x64.zip if on Linux) are cached by the launcher script before any Dart code is executed:
flutter-tizen/bin/flutter-tizen
Lines 140 to 176 in 7c33915
| if engineVersion != engineStamp: | |
| if os.path.isdir(engineCacheDir): | |
| shutil.rmtree(engineCacheDir) | |
| os.makedirs(engineCacheDir) | |
| if 'BASE_URL' in os.environ: | |
| baseUrl = os.environ['BASE_URL'] | |
| else: | |
| baseUrl = 'https://github.com/flutter-tizen/engine/releases' | |
| archiveUrl = f'{baseUrl}/download/{engineVersion[:7]}/{platform}-x64.zip' | |
| archivePath = engineCacheDir + '/artifacts.zip' | |
| try: | |
| download(f'Downloading {platform}-x64 tools...', archiveUrl, | |
| archivePath) | |
| except: | |
| print(f'Failed to download engine artifacts from:\n {archiveUrl}') | |
| raise | |
| try: | |
| with zipfile.ZipFile(archivePath, 'r') as zipRef: | |
| zipRef.extractall(engineCacheDir) | |
| except zipfile.BadZipFile: | |
| print('Unable to extract files. Check if the URL is valid:\n' | |
| f' {archiveUrl}') | |
| exit(1) | |
| finally: | |
| os.remove(archivePath) | |
| # ZipFile.extractall() does not retain file permissions. | |
| if platform != 'windows': | |
| for root, _, files in os.walk(engineCacheDir): | |
| for path in [f'{root}/{f}' for f in files if f == 'gen_snapshot']: | |
| os.chmod(path, 0o755) | |
| with open(engineStampPath, 'w') as f: | |
| f.write(engineVersion) |
The zip archive size is only about 30 MB now so it doesn't make any big issue, but the size will be doubled if we enable arm64 builds of the engine in the near future. It would be better to separate artifacts for each target arch and download only when necessary (e.g. download x86 artifacts when building for emulator).
For the implementation, we may refer to EngineCachedArtifact.updateInner() in package:flutter_tools/src/cache.dart.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request