Generate fonts in the expected location. (flutter/engine#31575)

* Generate fonts in the expected location.

Fonts-subset is generated directly in out/../zip_archives but the final
destination is expected to be inside a folder like linux-x64. This PR
generates the file directly in the expected path.

Bug: https://github.com/flutter/flutter/issues/81855

* Fix font zip tests.

* Revert changes to run_tests.py

* Update host_os_cpu_name variable to report darwin for mac.

* Fix variable names.

* Calculate prebuilts path using mac instead of darwin.

* Add platform to fontset path.

* Fix platforms map.

* Add debugging.

* Add win32 to the map of artifact locations.

* Use full_platform_name instead of host_os_name.

* Use x32 for windows font binaries.

* Fix paths for debug version in windows.

* Use x64 for win32.

* Remove additional logging.

* Add linux2 to map of platforms.
This commit is contained in:
godofredoc 2022-02-23 19:35:20 -08:00 committed by GitHub
parent 7e42cbae20
commit 229e5b9a1d
5 changed files with 32 additions and 12 deletions

View File

@ -1,7 +1,7 @@
import("//flutter/build/zip_bundle.gni")
zip_bundle("artifacts") {
output = "$host_os_cpu_name/artifacts.zip"
output = "$full_platform_name/artifacts.zip"
deps = [
"//flutter/flutter_frontend_server:frontend_server",
"//flutter/lib/snapshot:generate_snapshot_bin",

View File

@ -68,14 +68,14 @@ if (is_ios || is_mac) {
# A combo of host os name and cpu is used in several locations to
# generate the names of the archived artifacts.
_host_os_name = host_os
if (_host_os_name == "mac") {
_host_os_name = "macos"
} else if (_host_os_name == "win" || _host_os_name == "winuwp") {
_host_os_name = "windows"
_platform_name = host_os
if (_platform_name == "mac") {
_platform_name = "darwin"
} else if (_platform_name == "win" || _platform_name == "winuwp") {
_platform_name = "windows"
}
host_os_cpu_name = "$_host_os_name-$host_cpu"
full_platform_name = "$_platform_name-$host_cpu"
# Prebuilt Dart SDK location
@ -87,8 +87,15 @@ if (flutter_prebuilt_dart_sdk) {
_target_os_name = "windows"
}
_host_os_name = host_os
if (_host_os_name == "mac") {
_host_os_name = "macos"
} else if (_host_os_name == "win" || _host_os_name == "winuwp") {
_host_os_name = "windows"
}
_target_prebuilt_dart_sdk_config = "$_target_os_name-$target_cpu"
_host_prebuilt_dart_sdk_config = "$host_os_cpu_name"
_host_prebuilt_dart_sdk_config = "$_host_os_name-$host_cpu"
_target_prebuilt_dart_sdk_archive = "//flutter/prebuilts/dartsdk-$_target_prebuilt_dart_sdk_config-release.zip"
_host_prebuilt_dart_sdk_archive =
"//flutter/prebuilts/dartsdk-$_host_prebuilt_dart_sdk_config-release.zip"

View File

@ -41,7 +41,7 @@ generated_file("_font-subset-license") {
}
zip_bundle("font-subset") {
output = "font-subset.zip"
output = "${full_platform_name}/font-subset.zip"
font_subset_bin = "font-subset"
if (is_win) {

View File

@ -14,6 +14,19 @@ import subprocess
import sys
from zipfile import ZipFile
# Dictionary to map the platform name to the output directory
# of the font artifacts.
PLATFORM_2_PATH = {
'darwin': 'darwin-x64',
'linux': 'linux-x64',
'linux2': 'linux-x64',
'cygwin': 'windows-x64',
'win': 'windows-x64',
'win32': 'windows-x64',
}
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, '..', '..', '..'))
MATERIAL_TTF = os.path.join(SCRIPT_DIR, 'fixtures', 'MaterialIcons-Regular.ttf')
@ -21,10 +34,10 @@ IS_WINDOWS = sys.platform.startswith(('cygwin', 'win'))
EXE = '.exe' if IS_WINDOWS else ''
BAT = '.bat' if IS_WINDOWS else ''
FONT_SUBSET = os.path.join(SRC_DIR, 'out', 'host_debug', 'font-subset' + EXE)
FONT_SUBSET_ZIP = os.path.join(SRC_DIR, 'out', 'host_debug', 'zip_archives', 'font-subset.zip')
FONT_SUBSET_ZIP = os.path.join(SRC_DIR, 'out', 'host_debug', 'zip_archives', PLATFORM_2_PATH.get(sys.platform, ''), 'font-subset.zip')
if not os.path.isfile(FONT_SUBSET):
FONT_SUBSET = os.path.join(SRC_DIR, 'out', 'host_debug_unopt', 'font-subset' + EXE)
FONT_SUBSET_ZIP = os.path.join(SRC_DIR, 'out', 'host_debug_unopt', 'zip_archives', 'font-subset.zip')
FONT_SUBSET_ZIP = os.path.join(SRC_DIR, 'out', 'host_debug_unopt', 'zip_archives', PLATFORM_2_PATH.get(sys.platform, ''), 'font-subset.zip')
if not os.path.isfile(FONT_SUBSET):
raise Exception('Could not locate font-subset%s in host_debug or host_debug_unopt - build before running this script.' % EXE)

View File

@ -568,7 +568,7 @@ _kernel_worker("flutter_dartdevc_kernel_sdk_outline_sound") {
# Archives Flutter Web SDK
if (!is_fuchsia) {
zip_bundle("flutter_web_sdk_archive") {
output = "flutter-web-sdk-${host_os_cpu_name}.zip"
output = "flutter-web-sdk-${full_platform_name}.zip"
deps = [
":flutter_dartdevc_canvaskit_html_kernel_sdk",
":flutter_dartdevc_canvaskit_html_kernel_sdk_sound",