Closed bookshiyi closed 11 months ago
Interesting attempt :) but isn't it possible to do this with build.rs
file?
Also, what do you think about inspecting the issue that you've left a month ago? I will be happy to fix that problem with you for good 👀
Interesting attempt :) but isn't it possible to do this with
build.rs
file?
Yeah, it is a good idea than implements in pod, Gradle, cmake separately. But I don's think clearly how to organize these codes yet.
Also, what do you think about inspecting the issue that you've left a month ago? I will be happy to fix that problem with you for good 👀
Glad to hear that. The heteromorphism build CI feature and arm macOS build bug is need more continuous time for me. I only have a little spare time recently, so the focus of programming is not on those two issues. Do you think these two issues have greatly improved the whole project? If it's not big, could we consider delaying it?
btw, I also want to fixed them and make the issues list clean.
Interesting attempt :) but isn't it possible to do this with
build.rs
file?
In your opinion, where build.rs
is placed is an appropriate path?
It's a Rust module that's invoked on compilation
https://doc.rust-lang.org/cargo/reference/build-scripts.html https://doc.rust-lang.org/cargo/reference/build-script-examples.html
In my opinion, always generating the message code automatically whenever building or running the app can be kind of aggressive. We've been using 'manual message code generation' with rifs message
because it's more clear and explicit.
rifs message
is used on various situations:
.proto
filesand only automating the situation where the user is running or building the app, let alone implicitly, can be kind of confusing..
I appreciate your effort, but maybe we can think about the development experience first. Right now, I believe we can tell users how to write optional ./native/hub/build.rs
to automate the message generation in the docs, which runs rifs message
:)
I believe the guided ./native/hub/build.rs
content would be something like this(not tested yet):
use std::process::Command;
use std::env;
fn main() {
// Set the working directory to ../../
let working_dir = env::current_dir().unwrap().join("../../");
// Run the "rifs message" command
let _ = Command::new("rifs")
.arg("message")
.current_dir(&working_dir)
.status()
.expect("Failed to run 'rifs message'");
}
In my humble opinion, protobuf messages generation should seem like RIF itself —— users don't need to care about the build process.
At the same time, maybe there are two direction to improve:
dart run rust_in_flutter message
support .proto
files changes detection to decrease create message files frequency and the time spent on build.rifs msg gen
, rifs msg clean
How do you think about it?
Whether it's implemented using Rust, Dart, Python, or separately implemented in pod, Gradle, or CMake. I just think the generation of messages should be automated, but it should also support manual generation methods.
I see your point. For 'change detection', I think it's worth implementing.
For automated message code generation, I believe we need to allow this scenario to happen.
.proto
file..proto
files are automatically compiled into Dart and Rust code. In short, if we are going to introduce automatic message code generation, I think it should be done in WRITE TIME, rather than COMPILE TIME. Also, being explicit would be better than being implicit. Maybe some kind of rifs message --watch
will do the trick. What do you think?
Thank you for your patient reply.
In terms of my personal development habits, I prefer Coding(dart, rust, protobuf)
-> Flutter run
-> Coding(dart, rust, protobuf)
-> Flutter run
, the files which dart or rust or protobuf both are source code of project for me.
But I also agree you mentioned that stages when auto generate message while WRITE TIME
is better than COMPILE TIME
.
rifs message --watch
is a elegant implement, it should bring a good user experience.
Changes
Integrate command
dart run rust_in_flutter message
to compilation process, without run it manually.