Skip to content
Closed
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
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ci

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
push:
branches:
- main

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

name: 🧪 Test

env:
FLUTTER_STORAGE_BASE_URL: https://download.shorebird.dev

steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
with:
# Fetch all branches and tags to ensure that Flutter can determine its version
fetch-depth: 0

- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1

- name: 📦 Install Dependencies
run: |
dart pub get -C ./dev/bots
dart pub get -C ./dev/tools

- name: 🧪 Run Tests
run: dart ./dev/bots/test.dart
60 changes: 60 additions & 0 deletions .github/workflows/shorebird_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: shorebird_ci

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
push:
branches:
- shorebird/dev

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

name: 🐦 Shorebird Test

# TODO(eseidel): This is also set inside shorebird_tests, unclear if
# if it's needed here as well.
env:
FLUTTER_STORAGE_BASE_URL: https://download.shorebird.dev

steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
with:
# Fetch all branches and tags to ensure that Flutter can determine its version
fetch-depth: 0

# TODO(eseidel): shorebird_tests seems to assume flutter is available
# yet it doesn't seem to set it up here?
- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1

- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"

- name: 🐦 Run Flutter Tools Tests
# TODO(eseidel): Find a nice way to run this on windows.
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
# TODO(eseidel): We can't run all flutter_tools tests until we make
# our changes not throw exceptions on missing shorebird.yaml.
# https://github.com/shorebirdtech/shorebird/issues/2392
run: ../../bin/flutter test test/general.shard/shorebird
working-directory: packages/flutter_tools

- name: 🐦 Run Shorebird Tests
# TODO(felangel): These tests have a dependency on pkg:flutter_flavorizr which
# requires XCode -- therefore they don't work on Windows.
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
run: dart test
working-directory: packages/shorebird_tests
25 changes: 16 additions & 9 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ vars = {
'skia_git': 'https://skia.googlesource.com',
'llvm_git': 'https://llvm.googlesource.com',
'skia_revision': 'e7b8d078851fd505475fe74359e31a421e6968ea',
"dart_sdk_revision": "ac7987ebdca1582a18b2426e8a4f561170f5e530",
"dart_sdk_git": "[email protected]:shorebirdtech/dart-sdk.git",
"updater_git": "https://github.com/shorebirdtech/updater.git",
"updater_rev": "ab23721e35d2e740026def44e1469e17e3440c83",

# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
Expand Down Expand Up @@ -225,14 +229,14 @@ gclient_gn_args = [
# Only these hosts are allowed for dependencies in this DEPS file.
# If you need to add a new host, contact chrome infrastructure team.
allowed_hosts = [
'boringssl.googlesource.com',
'chrome-infra-packages.appspot.com',
'chromium.googlesource.com',
'dart.googlesource.com',
'flutter.googlesource.com',
'llvm.googlesource.com',
'skia.googlesource.com',
'swiftshader.googlesource.com',
"boringssl.googlesource.com",
"chrome-infra-packages.appspot.com",
"chromium.googlesource.com",
"dart.googlesource.com",
"flutter.googlesource.com",
"llvm.googlesource.com",
"skia.googlesource.com",
"swiftshader.googlesource.com",
]

deps = {
Expand Down Expand Up @@ -296,7 +300,7 @@ deps = {
# Var('flutter_git') + '/third_party/protobuf-gn' + '@' + Var('dart_protobuf_gn_rev'),

'engine/src/flutter/third_party/dart':
Var('dart_git') + '/sdk.git' + '@' + Var('dart_revision'),
Var('dart_sdk_git') + '@' + Var('dart_sdk_revision'),

# WARNING: Unused Dart dependencies in the list below till "WARNING:" marker are removed automatically - see create_updated_flutter_deps.py.

Expand Down Expand Up @@ -484,6 +488,9 @@ deps = {
'engine/src/flutter/third_party/ocmock':
Var('flutter_git') + '/third_party/ocmock' + '@' + Var('ocmock_rev'),

'engine/src/flutter/third_party/updater':
Var('updater_git') + '@' + Var('updater_rev'),

'engine/src/flutter/third_party/libjpeg-turbo/src':
Var('flutter_git') + '/third_party/libjpeg-turbo' + '@' + '0fb821f3b2e570b2783a94ccd9a2fb1f4916ae9f',

Expand Down
2 changes: 1 addition & 1 deletion bin/internal/engine.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f73bfc4522dd0bc87bbcdb4bb3088082755c5e87
f5d3406bbc924ac26f27e2ddef6d7eef5abfebed
3 changes: 2 additions & 1 deletion bin/internal/shared.bat
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ GOTO :after_subroutine
REM The following IF conditions are all linked with a logical OR. However,
REM there is no OR operator in batch and a GOTO construct is used as replacement.

CALL :do_ensure_engine_version
REM Shorebird manages the engine version separately so we disable this logic.
REM CALL :do_ensure_engine_version
IF NOT EXIST "%engine_stamp%" GOTO do_sdk_update_and_snapshot
SET /P dart_required_version=<"%engine_version_path%"
SET /P dart_installed_version=<"%engine_stamp%"
Expand Down
3 changes: 2 additions & 1 deletion bin/internal/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ function _wait_for_lock () {
function upgrade_flutter () (
mkdir -p "$FLUTTER_ROOT/bin/cache"

# Shorebird manages the engine version separately so we disable this logic.
# Ensure the engine.version is populated
"$FLUTTER_ROOT/bin/internal/update_engine_version.sh"
# "$FLUTTER_ROOT/bin/internal/update_engine_version.sh"

local revision="$(cd "$FLUTTER_ROOT"; git rev-parse HEAD)"
local compilekey="$revision:$FLUTTER_TOOL_ARGS"
Expand Down
9 changes: 8 additions & 1 deletion engine/src/build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ config("compiler") {
# Example PR: https://github.com/dart-lang/native/pull/1615
ldflags += [
"-Wl,--no-undefined",
"-Wl,--exclude-libs,ALL",

# TODO: Terrible hack, but otherwise libupdater.a symbols can't
# be exported from libflutter.so, even when added to android_exports.lst.
# "-Wl,--exclude-libs,ALL",

# Enable identical code folding to reduce size.
"-Wl,--icf=all",
Expand Down Expand Up @@ -555,6 +558,8 @@ config("runtime_library") {
]

libs += [
# Rust requires libunwind.
"unwind",
"c",
"dl",
"m",
Expand All @@ -569,6 +574,8 @@ config("runtime_library") {
} else if (current_cpu == "x86") {
current_android_cpu = "i686"
}
# libunwind.a is located in the respective android cpu subdirectories.
lib_dirs += [ "${android_toolchain_root}/lib/clang/17/lib/linux/${current_android_cpu}/" ]
libs += [ "clang_rt.builtins-${current_android_cpu}-android" ]
}

Expand Down
5 changes: 4 additions & 1 deletion engine/src/build/toolchain/win/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ template("msvc_toolchain") {
expname = "${dllname}.exp"
pdbname = "${dllname}.pdb"
rspfile = "${dllname}.rsp"
# .def files are used to export symbols from the DLL. This arg will be
# removed by the python tool wrapper if the .def file doesn't exist.
deffile = "${dllname}.def"

link_command = "\"$python_path\" $tool_wrapper_path link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
link_command = "\"$python_path\" $tool_wrapper_path link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb /DEF:$deffile @$rspfile"

# TODO(brettw) support manifests
#manifest_command = "\"$python_path\" $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:${dllname}.manifest"
Expand Down
11 changes: 11 additions & 0 deletions engine/src/build/toolchain/win/tool_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args):
self._UseSeparateMspdbsrv(env, args)
if sys.platform == 'win32':
args = list(args) # *args is a tuple by default, which is read-only.

# Remove the /DEF arg if not provided. We would ideally be able to do this
# in build\toolchain\win\BUILD.gn, but there doesn't seem to be a way to
# conditionally add args to the command line based on whether a file exists
# or not, so we do it here instead.
def_arg_prefix = "/DEF:"
for arg in args:
if arg.startswith(def_arg_prefix):
def_file = arg[len(def_arg_prefix):]
if not os.path.exists(def_file):
args.remove(arg)
args[0] = args[0].replace('/', '\\')
# https://docs.python.org/2/library/subprocess.html:
# "On Unix with shell=True [...] if args is a sequence, the first item
Expand Down
27 changes: 20 additions & 7 deletions engine/src/flutter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,10 @@ group("flutter") {

# path_ops
"//flutter/tools/path_ops",
]

if (host_os == "linux") {
public_deps += [
# Built alongside gen_snapshot for 64 bit targets
"$dart_src/runtime/bin:analyze_snapshot",
]
}
# Built alongside gen_snapshot arm64 targets.
"$dart_src/runtime/bin:analyze_snapshot",
]

if (full_dart_sdk) {
public_deps += [ "//flutter/web_sdk" ]
Expand Down Expand Up @@ -193,6 +189,7 @@ group("unittests") {
"//flutter/runtime:no_dart_plugin_registrant_unittests",
"//flutter/runtime:runtime_unittests",
"//flutter/shell/common:shell_unittests",
"//flutter/shell/common/shorebird:shorebird_unittests",
"//flutter/shell/platform/embedder:embedder_a11y_unittests",
"//flutter/shell/platform/embedder:embedder_proctable_unittests",
"//flutter/shell/platform/embedder:embedder_unittests",
Expand Down Expand Up @@ -319,3 +316,19 @@ if (host_os == "win") {
outputs = [ "$root_build_dir/gen_snapshot/gen_snapshot.exe" ]
}
}

# A top-level target for analyze_snapshot, modeled after the gen_snapshot
# target above.
if (host_os == "win") {
_analyze_snapshot_target =
"$dart_src/runtime/bin:analyze_snapshot($host_toolchain)"

copy("analyze_snapshot") {
deps = [ _analyze_snapshot_target ]

analyze_snapshot_out_dir =
get_label_info(_analyze_snapshot_target, "root_out_dir")
sources = [ "$analyze_snapshot_out_dir/analyze_snapshot.exe" ]
outputs = [ "$root_build_dir/analyze_snapshot/analyze_snapshot.exe" ]
}
}
18 changes: 17 additions & 1 deletion engine/src/flutter/build/archives/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ generated_file("artifacts_entitlement_config") {
if (build_engine_artifacts) {
zip_bundle("artifacts") {
deps = [
"$dart_src/runtime/bin:analyze_snapshot",
"$dart_src/runtime/bin:gen_snapshot",
"//flutter/flutter_frontend_server:frontend_server",
"//flutter/impeller/compiler:impellerc",
Expand Down Expand Up @@ -139,6 +140,10 @@ if (build_engine_artifacts) {
if (host_os == "mac") {
deps += [ ":artifacts_entitlement_config" ]
files += [
{
source = "$root_out_dir/analyze_snapshot$exe"
destination = "analyze_snapshot$exe"
},
{
source = "$target_gen_dir/entitlements.txt"
destination = "entitlements.txt"
Expand Down Expand Up @@ -308,14 +313,25 @@ if (is_mac) {
}

if (host_os == "win") {
# This rule archives both gen_snapshot *and* analyze_snapshot. The name is
# misleading. We (shorebird) have updated this rule to include
# analyze_snapshot but did not update the name because it is referenced
# elsewhere in the tooling.
zip_bundle("archive_win_gen_snapshot") {
deps = [ "//flutter:gen_snapshot" ]
deps = [
"//flutter:analyze_snapshot",
"//flutter:gen_snapshot",
]
output = "$full_target_platform_name-$flutter_runtime_mode/windows-x64.zip"
files = [
{
source = "$root_out_dir/gen_snapshot/gen_snapshot.exe"
destination = "gen_snapshot.exe"
},
{
source = "$root_out_dir/analyze_snapshot/analyze_snapshot.exe"
destination = "analyze_snapshot.exe"
},
]
}
}
8 changes: 8 additions & 0 deletions engine/src/flutter/common/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ if (slimpeller) {
feature_defines_list += [ "SLIMPELLER=1" ]
}

if (is_android || is_ios || is_linux || is_mac || is_win) {
feature_defines_list += [ "SHOREBIRD_PLATFORM_SUPPORTED=1" ]
}

if (is_ios) {
feature_defines_list += [ "SHOREBIRD_USE_INTERPRETER=1" ]
}

if (is_ios || is_mac) {
flutter_cflags_objc = [
"-Werror=overriding-method-mismatch",
Expand Down
Loading