diff --git a/OAT.xml b/OAT.xml index 472375df83cdbda0e05a1c769fea1c062ba8c08a..eaadc3d1bee869dd0156ddc880b9f359d3db9ce9 100644 --- a/OAT.xml +++ b/OAT.xml @@ -95,8 +95,12 @@ used to filter file path. + + + + diff --git a/README.md b/README.md index e02286dfc41ea0eaceca86ffa3be4ed440bde1b0..05d9473e1d2c605ebb358515e256c04941574203 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,9 @@ Flutter Engine 6. 更新代码:在engine目录,执行`./update_engine.sh`(Linux/Mac平台)或`update_engine.bat`(Windows平台) +## FAQ +1. 运行项目工程报Member notfound:'isOhos'的错误:请确保src/third_party/dart目录下应用了所有的dart patch(补丁位于src/flutter/attachment/repos目录,可使用git apply应用patch)应用patch后重新编译engine + ## embedding层代码构建指导 1. 编辑shell/platform/ohos/flutter_embedding/local.properties: diff --git a/attachment/repos/bootstrap/ohos.bat b/attachment/repos/bootstrap/ohos.bat index 11f503836afb1c8cdb5f47b1f0ed8f3b802bec6d..45d771d6ecb4e94754369c5b4f2e67cc85d16186 100644 --- a/attachment/repos/bootstrap/ohos.bat +++ b/attachment/repos/bootstrap/ohos.bat @@ -15,7 +15,7 @@ setlocal EnableDelayedExpansion call python .\src\flutter\tools\gn --unoptimized --runtime-mode=debug --ohos --ohos-cpu=arm64 -call python .\src\flutter\tools\gn --runtime-mode=release --ohos --unoptimized --ohos-cpu=arm64 +call python .\src\flutter\tools\gn --runtime-mode=release --ohos --ohos-cpu=arm64 ninja -C .\src\out\ohos_debug_unopt_arm64 ninja -C .\src\out\ohos_release_arm64 diff --git a/attachment/repos/bootstrap/update_engine.bat b/attachment/repos/bootstrap/update_engine.bat index de3d208a6066f587143dbd6a9827dab6c73ffa21..1db3138353604f546d1c97ee55432cee0fc4d46c 100644 --- a/attachment/repos/bootstrap/update_engine.bat +++ b/attachment/repos/bootstrap/update_engine.bat @@ -14,4 +14,4 @@ @echo off py -3 .\src\flutter\attachment\scripts\ohos_reverse_patch.py %1 call git -C .\src\flutter checkout master && git -C .\src\flutter pull origin master -py -3 .\src\flutter\attachment\scripts\ohos_setup.py %1 \ No newline at end of file +gclient sync \ No newline at end of file diff --git a/attachment/repos/bootstrap/update_engine.sh b/attachment/repos/bootstrap/update_engine.sh index be214136b7a310d293b9a8dcefde6b62d21460b5..fca126749163328ac4aa8ccb8ef89bf127e8fee0 100644 --- a/attachment/repos/bootstrap/update_engine.sh +++ b/attachment/repos/bootstrap/update_engine.sh @@ -14,4 +14,4 @@ python3 ./src/flutter/attachment/scripts/ohos_reverse_patch.py $1 git -C ./src/flutter checkout master && git -C ./src/flutter pull origin master -python3 ./src/flutter/attachment/scripts/ohos_setup.py $1 +gclient sync \ No newline at end of file diff --git a/attachment/repos/build4.bin b/attachment/repos/build4.bin new file mode 100644 index 0000000000000000000000000000000000000000..6094a9a9cc4c32f82ba54a64d6a0e8fd2fc8c849 --- /dev/null +++ b/attachment/repos/build4.bin @@ -0,0 +1,56 @@ +diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn +index bd3476a..f1c88b9 100644 +--- a/build/config/BUILDCONFIG.gn ++++ b/build/config/BUILDCONFIG.gn +@@ -36,7 +36,7 @@ + + + if (target_os == "") { +- target_os = "ohos" ++ target_os = host_os + } + + if (target_cpu == "") { +@@ -57,11 +57,8 @@ if (current_cpu == "") { + if (current_os == "") { + if (host_os == "win") { + current_os = "win" +- } else if (host_os == "mac" && (target_os == "ohos" || target_os == "linux")) { +- current_os = "ohos" + } else { +- #current_os = target_os +- current_os = host_os ++ current_os = target_os + } + } + +@@ -261,27 +258,13 @@ if (current_os == "win") { + is_posix = true + is_win = false + is_wasm = false +-} else if (current_os == "linux" && target_os == "ohos") { +- target_os="linux" ++} else if (current_os == "ohos") { + is_android = false + is_chromeos = false + is_fuchsia = false + is_fuchsia_host = false + is_ios = false +- is_linux = true +- is_ohos = true +- is_mac = false +- is_posix = true +- is_win = false +- is_wasm = false +-} else if ((current_os == "ohos" || current_os == "linux") && host_os == "mac") { +- target_os="linux" +- is_android = false +- is_chromeos = false +- is_fuchsia = false +- is_fuchsia_host = false +- is_ios = false +- is_linux = true ++ is_linux = false + is_ohos = true + is_mac = false + is_posix = true diff --git a/attachment/repos/dart.patch1 b/attachment/repos/dart.patch1 index 8ca85171645db046ebdc346d664898d671504a6a..c76a5933e7dc7772ec96ac9d07326877398f7dad 100644 --- a/attachment/repos/dart.patch1 +++ b/attachment/repos/dart.patch1 @@ -1,25 +1,3 @@ -diff --git a/.gitignore b/.gitignore -index 3c7338f1ac8..dc54d947c56 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -76,7 +76,7 @@ packages - pubspec.lock - - # The top level package file (this is auto-generated per checkout). --/.dart_tool/package_config.json -+#/.dart_tool/package_config.json - - # Local pub storage - .pub -@@ -100,7 +100,7 @@ tools/xcodebuild - /outline.dill - /generated/ - /crash_logs/ --/build/config/gclient_args.gni -+#/build/config/gclient_args.gni - /pkg/front_end/testcases/old_dills/ - logs/logs.json - logs/results.json diff --git a/BUILD.gn b/BUILD.gn index a25f379b0ff..c413327b217 100644 --- a/BUILD.gn @@ -102,14 +80,7 @@ index 36c7e9f4fb4..00a1cb64be8 100644 default_warning_flags += [ "-Wno-type-limits" ] } -diff --git a/build/config/gclient_args.gni b/build/config/gclient_args.gni -new file mode 100755 -index 00000000000..69d89776479 ---- /dev/null -+++ b/build/config/gclient_args.gni -@@ -0,0 +1,2 @@ -+# Generated from 'DEPS' -+checkout_llvm = false + \ No newline at end of file diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni index c7da74b09fe..8c11b3401dc 100644 diff --git a/attachment/repos/dart.patch2 b/attachment/repos/dart.patch2 new file mode 100644 index 0000000000000000000000000000000000000000..2ac542f697ef00a3adfed2b05e37670b1625de3d --- /dev/null +++ b/attachment/repos/dart.patch2 @@ -0,0 +1,54 @@ +diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn +index 7f89f9fcd06..cd5494e7b33 100644 +--- a/runtime/BUILD.gn ++++ b/runtime/BUILD.gn +@@ -87,11 +87,6 @@ config("dart_precompiler_config") { + + config("dart_os_config") { + defines = [] +- if (target_os == "linux" && !is_mac) { +- target_os = "ohos" +- } else if (is_mac){ +- target_os = "mac" +- } + print("DART TARGET OS: "+target_os ) + if (target_os == "android") { + defines += [ "DART_TARGET_OS_ANDROID" ] +@@ -104,7 +99,9 @@ config("dart_os_config") { + defines += [ "DART_TARGET_OS_LINUX" ] + } else if (target_os == "ohos") { + defines += [ "DART_TARGET_OS_OHOS" ] +- print("DART TARGET OS OHOS") ++ if (is_ohos) { ++ defines += [ "DART_RUNTIME_OS_OHOS" ] ++ } + } else if (target_os == "mac") { + defines += [ "DART_TARGET_OS_MACOS" ] + } else if (target_os == "win") { +diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn +index 14548125acb..2b758ae2db9 100644 +--- a/runtime/bin/BUILD.gn ++++ b/runtime/bin/BUILD.gn +@@ -37,9 +37,6 @@ config("libdart_builtin_config") { + is_linux = false + } + +- print("dart runtime is_linux:" ,is_linux) +- print("dart runtime is_win:" ,is_win) +- print("dart runtime is_ohos:" , is_ohos) + if(is_ohos && !is_win){ + libs +=[ + "hilog_ndk.z" +diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h +index f8a861e6c54..ca859e2b421 100644 +--- a/runtime/platform/globals.h ++++ b/runtime/platform/globals.h +@@ -108,7 +108,7 @@ + // Check for Android first, to determine its difference from Linux. + #define DART_HOST_OS_ANDROID 1 + +-#elif defined(DART_TARGET_OS_OHOS) && !defined(_WIN32) ++#elif defined(DART_TARGET_OS_OHOS) && defined(DART_RUNTIME_OS_OHOS) + + #define DART_HOST_OS_OHOS 1 + diff --git a/attachment/repos/skia.patch b/attachment/repos/skia.patch index 1e6e940827a07644c75c0076c0a8659b054ff04e..10f7e8861083f9c439de7fdf0231e5d1dadc965c 100644 --- a/attachment/repos/skia.patch +++ b/attachment/repos/skia.patch @@ -1,8 +1,8 @@ diff --git a/BUILD.gn b/BUILD.gn -index ebbd898ec9..c829d7bb3f 100644 +index ebbd898ec9..660dde475a 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -26,7 +26,8 @@ import("gn/ios.gni") +@@ -26,16 +26,21 @@ import("gn/ios.gni") # Skia public API, generally provided by :skia. config("skia_public") { @@ -12,8 +12,11 @@ index ebbd898ec9..c829d7bb3f 100644 defines = [] cflags_objcc = [] -@@ -36,6 +37,10 @@ config("skia_public") { - if (is_fuchsia || is_linux) { + if (is_component_build) { + defines += [ "SKIA_DLL" ] + } +- if (is_fuchsia || is_linux) { ++ if (is_fuchsia || is_linux || is_ohos) { defines += [ "SK_R32_SHIFT=16" ] } + @@ -77,6 +80,33 @@ index ebbd898ec9..c829d7bb3f 100644 optional("fontmgr_custom") { enabled = skia_enable_fontmgr_custom_directory || +@@ -690,7 +733,7 @@ if (skia_compile_modules) { + sources += [ "tools/SkGetExecutablePath_win.cpp" ] + } else if (is_mac || is_ios) { + sources += [ "tools/SkGetExecutablePath_mac.cpp" ] +- } else if (is_linux || is_android) { ++ } else if (is_linux || is_android || is_ohos) { + sources += [ "tools/SkGetExecutablePath_linux.cpp" ] + } + if (is_win) { +@@ -818,7 +861,7 @@ if (skia_compile_sksl_tests) { + sources += [ "tools/SkGetExecutablePath_win.cpp" ] + } else if (is_mac || is_ios) { + sources += [ "tools/SkGetExecutablePath_mac.cpp" ] +- } else if (is_linux || is_android) { ++ } else if (is_linux || is_android || is_ohos) { + sources += [ "tools/SkGetExecutablePath_linux.cpp" ] + } + if (is_win) { +@@ -1077,7 +1120,7 @@ optional("gpu") { + libs += [ "EGL" ] + } else if (skia_use_webgl) { + sources += [ "src/gpu/ganesh/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ] +- } else if (is_linux && skia_use_x11) { ++ } else if ((is_linux || is_ohos) && skia_use_x11) { + sources += [ + "src/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.cpp", + "src/gpu/ganesh/gl/glx/GrGLMakeNativeInterface_glx.cpp", @@ -1092,8 +1135,16 @@ optional("gpu") { if (target_cpu != "arm64") { libs += [ "OpenGL32.lib" ] @@ -104,8 +134,101 @@ index ebbd898ec9..c829d7bb3f 100644 ":fontmgr_win_gdi", ":gpu", ":graphite", +@@ -1559,7 +1611,7 @@ skia_component("skia") { + ] + } + +- if (is_linux || is_wasm) { ++ if (is_linux || is_wasm || is_ohos) { + sources += [ "src/ports/SkDebug_stdio.cpp" ] + if (skia_use_egl) { + libs += [ "GLESv2" ] +@@ -1962,7 +2014,7 @@ if (skia_enable_tools) { + if (is_android || skia_use_egl) { + sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ] + libs += [ "EGL" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ] + libs += [ + "GLU", +@@ -2281,7 +2333,7 @@ if (skia_enable_tools) { + ] + } + +- if (is_linux || is_mac || skia_enable_optimize_size) { ++ if (is_linux || is_mac || skia_enable_optimize_size || is_ohos) { + if (skia_enable_skottie) { + test_app("skottie_tool") { + deps = [ "modules/skottie:tool" ] +@@ -2777,7 +2829,7 @@ if (skia_enable_tools) { + "tools/sk_app/android/surface_glue_android.h", + ] + libs += [ "android" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ + "tools/SkGetExecutablePath_linux.cpp", + "tools/sk_app/unix/RasterWindowContext_unix.cpp", +@@ -2830,7 +2882,7 @@ if (skia_enable_tools) { + sources += [ "tools/sk_app/GLWindowContext.h" ] + if (is_android) { + sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ] + } else if (is_win) { + sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ] +@@ -2855,7 +2907,7 @@ if (skia_enable_tools) { + sources += [ "tools/sk_app/VulkanWindowContext.h" ] + if (is_android) { + sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ] + libs += [ "X11-xcb" ] + } else if (is_win) { +@@ -2887,7 +2939,7 @@ if (skia_enable_tools) { + if (skia_use_dawn) { + sources += [ "tools/sk_app/DawnWindowContext.cpp" ] + sources += [ "tools/sk_app/DawnWindowContext.h" ] +- if (is_linux) { ++ if (is_linux || is_ohos) { + if (dawn_enable_vulkan) { + sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ] + defines = [ "VK_USE_PLATFORM_XCB_KHR" ] +@@ -2931,7 +2983,7 @@ if (skia_enable_tools) { + } + } + +- if (!skia_use_vulkan && (is_mac || is_linux || is_win)) { ++ if (!skia_use_vulkan && (is_mac || is_linux || is_win || is_ohos)) { + test_app("fiddle_examples") { + sources = [ + "tools/fiddle/all_examples.cpp", +@@ -3088,7 +3140,7 @@ if (skia_enable_tools) { + } + } + +- if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) { ++ if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac || is_ohos)) { + test_app("HelloWorld") { + sources = [ "example/HelloWorld.cpp" ] + libs = [] +diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn +index 44f39c5aaa..c4eac1eb66 100644 +--- a/gn/BUILDCONFIG.gn ++++ b/gn/BUILDCONFIG.gn +@@ -63,6 +63,7 @@ is_linux = current_os == "linux" + is_mac = current_os == "mac" + is_wasm = current_os == "wasm" + is_win = current_os == "win" ++is_ohos = current_os == "ohos" + + # This is just to make the Dawn build files happy. Skia itself uses target_os = "linux" + # for ChromeOS, so this variable will not affect Skia proper. diff --git a/gn/skia.gni b/gn/skia.gni -index b81c0dae54..af04cdacdf 100644 +index b81c0dae54..deb6451271 100644 --- a/gn/skia.gni +++ b/gn/skia.gni @@ -20,6 +20,7 @@ declare_args() { @@ -116,6 +239,35 @@ index b81c0dae54..af04cdacdf 100644 skia_enable_gpu = true skia_enable_optimize_size = false skia_enable_pdf = !is_wasm +@@ -46,9 +47,9 @@ declare_args() { + skia_use_expat = !is_wasm + skia_use_ffmpeg = false + skia_use_fixed_gamma_text = is_android +- skia_use_fontconfig = is_linux ++ skia_use_fontconfig = is_linux || is_ohos + skia_use_fonthost_mac = is_mac || is_ios +- skia_use_freetype = is_android || is_fuchsia || is_linux || is_wasm ++ skia_use_freetype = is_android || is_fuchsia || is_linux || is_wasm || is_ohos + skia_use_harfbuzz = true + skia_use_gl = !is_fuchsia + skia_use_icu = !is_fuchsia +@@ -64,14 +65,14 @@ declare_args() { + skia_use_lua = is_skia_dev_build && !is_ios + skia_use_metal = false + skia_use_ndk_images = is_android && defined(ndk_api) && ndk_api >= 30 +- skia_use_perfetto = is_linux || is_mac || is_android ++ skia_use_perfetto = is_linux || is_mac || is_android || is_ohos + skia_use_piet = false + skia_use_piex = !is_win && !is_wasm + skia_use_sfml = false + skia_use_webgl = is_wasm + skia_use_webgpu = is_wasm + skia_use_wuffs = true +- skia_use_x11 = is_linux ++ skia_use_x11 = is_linux || is_ohos + skia_use_xps = true + skia_enable_graphite = false + skia_use_zlib = true @@ -119,6 +120,8 @@ declare_args() { } @@ -136,6 +288,37 @@ index b81c0dae54..af04cdacdf 100644 skia_fontmgr_factory = ":fontmgr_empty_factory" } else if (is_android && skia_enable_fontmgr_android) { skia_fontmgr_factory = ":fontmgr_android_factory" +diff --git a/gn/skia/BUILD.gn b/gn/skia/BUILD.gn +index b43526fe1f..fb34289da7 100644 +--- a/gn/skia/BUILD.gn ++++ b/gn/skia/BUILD.gn +@@ -235,7 +235,7 @@ config("default") { + } + } + +- if (is_linux) { ++ if (is_linux || is_ohos) { + libs += [ "pthread" ] + } + +@@ -333,7 +333,7 @@ config("default") { + ldflags += [ "-fsanitize=$sanitizers" ] + } + +- if (is_linux) { ++ if (is_linux || is_ohos) { + cflags_cc += [ "-stdlib=libc++" ] + ldflags += [ "-stdlib=libc++" ] + } +@@ -685,7 +685,7 @@ config("executable") { + ] + } else if (is_mac) { + ldflags = [ "-Wl,-rpath,@loader_path/." ] +- } else if (is_linux) { ++ } else if (is_linux || is_ohos) { + ldflags = [ + "-rdynamic", + "-Wl,-rpath,\$ORIGIN", diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index ab23b24edd..c5f714712b 100644 --- a/src/core/SkCanvas.cpp diff --git a/attachment/repos/zlib.patch b/attachment/repos/zlib.patch new file mode 100644 index 0000000000000000000000000000000000000000..a7354c878f826bc3376a9eb87ec6c1d7360c541a --- /dev/null +++ b/attachment/repos/zlib.patch @@ -0,0 +1,13 @@ +diff --git a/BUILD.gn b/BUILD.gn +index 3a71693..dfd052c 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -119,7 +119,7 @@ if (use_arm_neon_optimizations) { + defines = [ "CRC32_ARMV8_CRC32" ] + if (is_android) { + defines += [ "ARMV8_OS_ANDROID" ] +- } else if (is_linux || is_chromeos) { ++ } else if (is_linux || is_chromeos || is_ohos) { + defines += [ "ARMV8_OS_LINUX" ] + } else if (is_mac) { + defines += [ "ARMV8_OS_MACOS" ] diff --git a/attachment/scripts/config.json b/attachment/scripts/config.json index 9104bbda1c706722040f09ec23f054e144cd156d..4f1847f58d18a32ca4d41157265dc90c936354c4 100644 --- a/attachment/scripts/config.json +++ b/attachment/scripts/config.json @@ -16,6 +16,12 @@ "type": "patch", "file_path": "../../flutter/attachment/repos/dart.patch1" }, + { + "name": "dart2", + "target": "./src/third_party/dart", + "type": "patch", + "file_path": "../../flutter/attachment/repos/dart.patch2" + }, { "name": "skia", "target": "./src/third_party/skia", @@ -63,5 +69,18 @@ "target": "./src/build", "type": "patch", "file_path": "../flutter/attachment/repos/build3.bin" + }, + { + "name": "build4", + "target": "./src/build", + "type": "patch", + "file_path": "../flutter/attachment/repos/build4.bin" + } + , + { + "name": "zlib", + "target": "./src/third_party/zlib", + "type": "patch", + "file_path": "../../flutter/attachment/repos/zlib.patch" } ]