-
Notifications
You must be signed in to change notification settings - Fork 6k
Expose the Flutter engine, Dart and Skia versions to Dart. #7634
Conversation
lib/ui/window.dart
Outdated
@@ -841,6 +841,11 @@ class Window { | |||
void _respondToPlatformMessage(int responseId, ByteData data) | |||
native 'Window_respondToPlatformMessage'; | |||
|
|||
/// Return the version information for the engine, skia and dart. | |||
String getFlutterEngineVersion() native 'Window_GetFlutterEngineVersion'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be simplified by merging these into one private native method that returns a list of version strings. Then wrap that with a public Dart method that unpacks the list into a Dart object with fields for each version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds better, will do it.
runtime/runtime_controller.cc
Outdated
@@ -326,7 +331,18 @@ RuntimeController::Locale::Locale(std::string language_code_, | |||
|
|||
RuntimeController::Locale::~Locale() = default; | |||
|
|||
RuntimeController::WindowData::WindowData() = default; | |||
RuntimeController::Versions::Versions(const char * dart_version_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to avoid defining this structure by adding a GetVersions method to the RuntimeDelegate
interface implemented by the Engine
.
RuntimeController
can invoke the engine's GetVersions through the client_
. The engine can then construct a WindowClient::Versions
and return it through the chain of callers.
Are the versions a property of a window? Would it make sense to expose them as a top level dart:ui property instead? |
lib/ui/window.dart
Outdated
@@ -841,6 +841,11 @@ class Window { | |||
void _respondToPlatformMessage(int responseId, ByteData data) | |||
native 'Window_respondToPlatformMessage'; | |||
|
|||
/// Return the version information for the engine, skia and dart. | |||
String getFlutterEngineVersion() native 'Window_GetFlutterEngineVersion'; | |||
String getSkiaVersion() native 'Window_GetSkiaVersion'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalization of the native entrypoints does not match the convention of existing calls.
lib/ui/window/window.h
Outdated
@@ -38,6 +38,20 @@ enum class AccessibilityFeatureFlag : int32_t { | |||
|
|||
class WindowClient { | |||
public: | |||
struct Versions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems redundant as you can directly call Get*Version()
. from any point within the engine. Versions will remain the same for all Flutter applications created using the same engine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what i was able to gather, you can only call Get*Version
from within the shell and runtime code, adding a dependency on shell
code from within ui
, causes one of the build checks to be triggered. I added this struct as a convenience wrapper around it.
// found in the LICENSE file. | ||
|
||
// HACK: pretend to be dart.ui in order to access its internals | ||
library dart.ui; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test isn't tied to any harness. Did you forget to check in changes to a GN file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, forgot to check it in!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like flutter/testing/dart/*.dart
are all being run by run_tests.sh
.
expect(_isNotEmpty(flutterEngineVersion), equals(true)); | ||
}); | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Newline at the end of the file please.
@amirh, I was also thinking along similar lines. Versions don't really make sense to be on the Window object. Will move them to an outer class of their own. For the backgrounded app point, do you think I should have to do anything special to accommodate that case or was it more of a concern if I put it on the window? |
Just a concern if it's a window property. |
I decided to move |
lib/ui/versions.cc
Outdated
void GetVersions(Dart_NativeArguments args) { | ||
const std::vector<std::string> versions_list = { | ||
GetDartVersion(), GetSkiaVersion(), GetFlutterEngineVersion()}; | ||
const auto& dart_val = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare this as a Dart_Handle, not a reference
lib/ui/versions.dart
Outdated
|
||
part of dart.ui; | ||
|
||
/// Wraps version information for dart, skia and flutter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize "Dart", "Skia", and "Flutter" in this and other comments
flutter/engine@e7eb1c8...74839e2 git log e7eb1c8..74839e2 --no-merges --oneline 74839e2 Roll src/third_party/skia 8c14038e56c3..d7a5a1d27e1d (5 commits) (flutter/engine#7683) 615ca59 Roll src/third_party/skia 69130631e23d..8c14038e56c3 (1 commits) (flutter/engine#7682) 482e43f Roll src/third_party/skia 21ca3702f8eb..69130631e23d (2 commits) (flutter/engine#7681) cc349a3 Roll src/third_party/skia b45f47dc3ef5..21ca3702f8eb (1 commits) (flutter/engine#7680) 26b8339 Roll src/third_party/skia 9c7a006a8e2d..b45f47dc3ef5 (1 commits) (flutter/engine#7679) 940b420 Roll src/third_party/skia 32d8cce070dd..9c7a006a8e2d (1 commits) (flutter/engine#7677) 0a9dadb Roll src/third_party/skia 71e434dc9dea..32d8cce070dd (1 commits) (flutter/engine#7675) 6266da8 Roll src/third_party/skia d396dd0347d3..71e434dc9dea (1 commits) (flutter/engine#7674) 94ec2c5 Roll src/third_party/skia 0d84e805c30c..d396dd0347d3 (1 commits) (flutter/engine#7673) 48055b1 Roll src/third_party/skia 48913465db5f..0d84e805c30c (1 commits) (flutter/engine#7672) 7f9d59c Roll src/third_party/skia d6a45a8aee6e..48913465db5f (1 commits) (flutter/engine#7671) 3f4ac2b Roll src/third_party/skia 8ec9a60bdb6f..d6a45a8aee6e (2 commits) (flutter/engine#7670) b00c7c8 Roll src/third_party/skia 72c687807f5e..8ec9a60bdb6f (2 commits) (flutter/engine#7669) 1b6f139 Roll src/third_party/skia 8f5aeebdd8eb..72c687807f5e (3 commits) (flutter/engine#7668) 637fadb Roll src/third_party/skia 3ed198faf93a..8f5aeebdd8eb (8 commits) (flutter/engine#7667) 1b65785 Add kernel-worker and dart2js to BUILD.gn (flutter/engine#7660) 1cf6061 Roll src/third_party/skia 5892553ad020..3ed198faf93a (3 commits) (flutter/engine#7666) 377e665 Roll src/third_party/skia 569dda7216cd..5892553ad020 (5 commits) (flutter/engine#7665) 44245c8 Roll src/third_party/skia 72a0e3347cdf..569dda7216cd (1 commits) (flutter/engine#7664) 80db23f Roll src/third_party/skia ae64f52786b3..72a0e3347cdf (2 commits) (flutter/engine#7663) 4889c74 Roll src/third_party/skia 95b014790f93..ae64f52786b3 (3 commits) (flutter/engine#7662) fac24d9 Roll src/third_party/skia 88bfed46ab6e..95b014790f93 (3 commits) (flutter/engine#7661) 5dcf3cf Roll src/third_party/skia 5b257abb87d2..88bfed46ab6e (8 commits) (flutter/engine#7657) 9345274 Initial import of FDE macOS framework (flutter/engine#7642) 54f5467 Roll src/third_party/skia 1bd245b91801..5b257abb87d2 (5 commits) (flutter/engine#7656) e71daf6 Roll src/third_party/skia ea2dc6a6bc11..1bd245b91801 (1 commits) (flutter/engine#7655) 4f5e170 Roll src/third_party/skia e9742a5a0db1..ea2dc6a6bc11 (1 commits) (flutter/engine#7654) ef1a7f8 Roll src/third_party/skia 8a484d0203d9..e9742a5a0db1 (2 commits) (flutter/engine#7653) 28339c8 Roll src/third_party/skia b7af275ebbf5..8a484d0203d9 (3 commits) (flutter/engine#7652) 7fa77ef Fix two typos in embedder docs (flutter/engine#7649) e9419bf Roll src/third_party/skia 9c8ad0316147..b7af275ebbf5 (3 commits) (flutter/engine#7650) b94e759 Expose the Flutter engine, Dart and Skia versions to Dart. (flutter/engine#7634) 64e1707 Document make_resource_current on FlutterOpenGLRendererConfig and warn if the callback is not set. (flutter/engine#7648) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (dnfield@google.com), and stop the roller if necessary.
I don't think we should do this. It's not at all clear to me what the use case is, and historically adding version numbers to APIs has always led to more strife. |
flutter/engine@e7eb1c8...74839e2 git log e7eb1c8..74839e2 --no-merges --oneline 74839e2 Roll src/third_party/skia 8c14038e56c3..d7a5a1d27e1d (5 commits) (flutter/engine#7683) 615ca59 Roll src/third_party/skia 69130631e23d..8c14038e56c3 (1 commits) (flutter/engine#7682) 482e43f Roll src/third_party/skia 21ca3702f8eb..69130631e23d (2 commits) (flutter/engine#7681) cc349a3 Roll src/third_party/skia b45f47dc3ef5..21ca3702f8eb (1 commits) (flutter/engine#7680) 26b8339 Roll src/third_party/skia 9c7a006a8e2d..b45f47dc3ef5 (1 commits) (flutter/engine#7679) 940b420 Roll src/third_party/skia 32d8cce070dd..9c7a006a8e2d (1 commits) (flutter/engine#7677) 0a9dadb Roll src/third_party/skia 71e434dc9dea..32d8cce070dd (1 commits) (flutter/engine#7675) 6266da8 Roll src/third_party/skia d396dd0347d3..71e434dc9dea (1 commits) (flutter/engine#7674) 94ec2c5 Roll src/third_party/skia 0d84e805c30c..d396dd0347d3 (1 commits) (flutter/engine#7673) 48055b1 Roll src/third_party/skia 48913465db5f..0d84e805c30c (1 commits) (flutter/engine#7672) 7f9d59c Roll src/third_party/skia d6a45a8aee6e..48913465db5f (1 commits) (flutter/engine#7671) 3f4ac2b Roll src/third_party/skia 8ec9a60bdb6f..d6a45a8aee6e (2 commits) (flutter/engine#7670) b00c7c8 Roll src/third_party/skia 72c687807f5e..8ec9a60bdb6f (2 commits) (flutter/engine#7669) 1b6f139 Roll src/third_party/skia 8f5aeebdd8eb..72c687807f5e (3 commits) (flutter/engine#7668) 637fadb Roll src/third_party/skia 3ed198faf93a..8f5aeebdd8eb (8 commits) (flutter/engine#7667) 1b65785 Add kernel-worker and dart2js to BUILD.gn (flutter/engine#7660) 1cf6061 Roll src/third_party/skia 5892553ad020..3ed198faf93a (3 commits) (flutter/engine#7666) 377e665 Roll src/third_party/skia 569dda7216cd..5892553ad020 (5 commits) (flutter/engine#7665) 44245c8 Roll src/third_party/skia 72a0e3347cdf..569dda7216cd (1 commits) (flutter/engine#7664) 80db23f Roll src/third_party/skia ae64f52786b3..72a0e3347cdf (2 commits) (flutter/engine#7663) 4889c74 Roll src/third_party/skia 95b014790f93..ae64f52786b3 (3 commits) (flutter/engine#7662) fac24d9 Roll src/third_party/skia 88bfed46ab6e..95b014790f93 (3 commits) (flutter/engine#7661) 5dcf3cf Roll src/third_party/skia 5b257abb87d2..88bfed46ab6e (8 commits) (flutter/engine#7657) 9345274 Initial import of FDE macOS framework (flutter/engine#7642) 54f5467 Roll src/third_party/skia 1bd245b91801..5b257abb87d2 (5 commits) (flutter/engine#7656) e71daf6 Roll src/third_party/skia ea2dc6a6bc11..1bd245b91801 (1 commits) (flutter/engine#7655) 4f5e170 Roll src/third_party/skia e9742a5a0db1..ea2dc6a6bc11 (1 commits) (flutter/engine#7654) ef1a7f8 Roll src/third_party/skia 8a484d0203d9..e9742a5a0db1 (2 commits) (flutter/engine#7653) 28339c8 Roll src/third_party/skia b7af275ebbf5..8a484d0203d9 (3 commits) (flutter/engine#7652) 7fa77ef Fix two typos in embedder docs (flutter/engine#7649) e9419bf Roll src/third_party/skia 9c8ad0316147..b7af275ebbf5 (3 commits) (flutter/engine#7650) b94e759 Expose the Flutter engine, Dart and Skia versions to Dart. (flutter/engine#7634) 64e1707 Document make_resource_current on FlutterOpenGLRendererConfig and warn if the callback is not set. (flutter/engine#7648) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (dnfield@google.com), and stop the roller if necessary.
…lutter#7634)" This reverts commit b94e759.
…lutter#7634)" This reverts commit b94e759.
This addresses flutter/flutter#26380
Add
get*Version
methods to the Window class.We pass the needed information from shell.