Skip to content

Introduce conversion between chrono::NaiveDate and DateTime avoiding RustOpaque#2968

Open
TrackerSB wants to merge 34 commits intofzyzcjy:masterfrom
TrackerSB:master
Open

Introduce conversion between chrono::NaiveDate and DateTime avoiding RustOpaque#2968
TrackerSB wants to merge 34 commits intofzyzcjy:masterfrom
TrackerSB:master

Conversation

@TrackerSB
Copy link
Copy Markdown
Contributor

@TrackerSB TrackerSB commented Jan 17, 2026

Changes

Fixes #1833

Procedure and Checklist

In order to quickly iterate and avoid slowing down development pace by making CI pass, only the following simplified steps are needed, and I (fzyzcjy) will handle the rest of CI / moving the tests currently (will have more automation in the future).

  • Implement the feature / fix the bug.
  • Add tests in frb_example/dart_minimal.
  • Make dart_minimal's CI green.

Utility commands

  • Run codegen: cargo run --manifest-path /path/to/flutter_rust_bridge/frb_codegen/Cargo.toml -- generate
  • Run tests: ./frb_internal test-dart-native --package frb_example/dart_minimal

@TrackerSB
Copy link
Copy Markdown
Contributor Author

As far as I can see meanwhile (since my last attempt) the PR template changed in the way that I should have made an example in dart_minimal.
Unknowingly, I added the implementation and the tests in dart_pure and generated all the other variants. At least I guess I did that.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 86.44068% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.75%. Comparing base (7ce1020) to head (eaf057c).

Files with missing lines Patch % Lines
...st/spec_generator/codec/cst/decoder/ty/delegate.rs 0.00% 2 Missing ⚠️
frb_dart/lib/src/misc/rust_opaque.dart 33.33% 2 Missing ⚠️
...rt/spec_generator/codec/cst/encoder/ty/delegate.rs 0.00% 1 Missing ⚠️
frb_dart/lib/src/cli/build_web/executor.dart 66.66% 1 Missing ⚠️
frb_dart/lib/src/codec/dco.dart 0.00% 1 Missing ⚠️
frb_dart/test/typed_data_test.dart 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2968      +/-   ##
==========================================
- Coverage   98.34%   90.75%   -7.60%     
==========================================
  Files         470      470              
  Lines       19428    18025    -1403     
==========================================
- Hits        19106    16358    -2748     
- Misses        322     1667    +1345     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fzyzcjy
Copy link
Copy Markdown
Owner

fzyzcjy commented Jan 19, 2026

As far as I can see meanwhile (since my last attempt) the PR template changed in the way that I should have made an example in dart_minimal.
Unknowingly, I added the implementation and the tests in dart_pure and generated all the other variants. At least I guess I did that.

It is better to directly add things in pure_dart etc! :)

@TrackerSB
Copy link
Copy Markdown
Contributor Author

I recognized that the regeneration of files resulted in automatically added explicit lifetime annotations. Is this expected, is it a problem, does it depend on the used Rust version?
Additionally, for some files the year in generated comments changed:

-            VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0"
+            VALUE "LegalCopyright", "Copyright (C) 2026 com.example. All rights reserved." "\0"

@TrackerSB
Copy link
Copy Markdown
Contributor Author

What next steps are left for me to do to make this PR worth to be merged?

@fzyzcjy
Copy link
Copy Markdown
Owner

fzyzcjy commented Jan 24, 2026

I recognized that the regeneration of files resulted in automatically added explicit lifetime annotations. Is this expected, is it a problem, does it depend on the used Rust version?
Additionally, for some files the year in generated comments changed:

Feel free to make a separate PR to firstly update code for these!

What next steps are left for me to do to make this PR worth to be merged?

I am sorry that I am having a very tight deadline recently :( I will try my best to find some time after the ddl to review and merge all pending PRs. At the same time, feel free to use your branch if you need this feature, as long as the critical tests in CI passes then usually the branch is good to use.

@TrackerSB TrackerSB marked this pull request as ready for review February 20, 2026 11:56
@sumitsharansatsangi
Copy link
Copy Markdown

@fzyzcjy , Please give this a release .
Thank you !!

@fzyzcjy
Copy link
Copy Markdown
Owner

fzyzcjy commented Feb 27, 2026

@sumitsharansatsangi I have added some agent Skills a bit time ago, and plan to let agents help me do some updates to code when I review it. too busy recently but will handle it asap!

@sumitsharansatsangi
Copy link
Copy Markdown

Thanks for assurance, @fzyzcjy !!!

generate-internal-frb-example-pure-dart && ./frb_internal
generate-run-frb-codegen-command-generate --package
frb_example/pure_dart && ./frb_internal
generate-internal-frb-example-pure-dart-pde && ./frb_internal
generate-run-frb-codegen-command-generate --package
frb_example/pure_dart_pde && ./frb_internal precommit --mode fast
@TrackerSB
Copy link
Copy Markdown
Contributor Author

I merged origin/master trying to update my PR.
How to handle problems that arise from files of one of the cargokit submodules like the following?

--- a/frb_example/flutter_via_integrate/rust_builder/cargokit/gradle/plugin.gradle
+++ b/frb_example/flutter_via_integrate/rust_builder/cargokit/gradle/plugin.gradle
@@ -95,7 +95,7 @@ class CargoKitPlugin implements Plugin<Project> {
    private Plugin _findFlutterPlugin(Map projects) {
         for (project in projects) {
             for (plugin in project.value.getPlugins()) {
-                if (plugin.class.name == "com.flutter.gradle.FlutterPlugin" || plugin.class.name == "FlutterPlugin") {
+                if (plugin.class.name == "com.flutter.gradle.FlutterPlugin") {
                     return plugin;
                 }
             }
@@ -132,12 +132,7 @@ class CargoKitPlugin implements Plugin<Project> {
             def jniLibs = project.android.sourceSets.maybeCreate(buildType).jniLibs;
             jniLibs.srcDir(new File(cargoOutputDir))
 
-            def List<String> platforms
-            try {
-                platforms = com.flutter.gradle.FlutterPluginUtils.getTargetPlatforms(project).collect()
-            } catch (Exception ignored) {
-                platforms = plugin.getTargetPlatforms().collect()
-            }
+            def platforms = com.flutter.gradle.FlutterPluginUtils.getTargetPlatforms(project).collect()
 
             // Same thing addFlutterDependencies does in flutter.gradle
             if (buildType == "debug") {
Unhandled exception:
ProcessException: Bad exit code (1). If you want to see extra information, set FRB_DART_RUN_COMMAND_STDERR=1
  Command: /bin/sh -c git diff --exit-code ':(exclude)frb_example/flutter_via_integrate/macos/Flutter/Flutter-Debug.xcconfig' ':(exclude)frb_example/flutter_via_integrate/macos/Flutter/Flutter-Release.xcconfig' ':(exclude)frb_example/flutter_via_integrate/rust/Cargo.lock'
{code}

@fzyzcjy
Copy link
Copy Markdown
Owner

fzyzcjy commented Apr 18, 2026

hmm I guess maybe try to update the submodule

btw I did plan to add sth like #3051 to make it easier to make CI pass. I have emergent ddl recently and cannot continue though :(

@TrackerSB
Copy link
Copy Markdown
Contributor Author

This would be amazing. 👍🏻🏆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support converting chrono::NaiveDate to Dart

3 participants