-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[native_assets_cli] dry-run
option
#51
Comments
@stuartmorgan @vashworth I presume the XCode projects also have a late value for ios-device vs ios-simulator and the minimum ios-sdk-version? |
Yes, target device in general (which isn't just device vs simulator; when devices have arch differences, which has happened before, there are more arch options controlled by this).
In theory any build setting can be gated on build mode (debug/release/etc.), so this could be dynamic. |
Notes from discussion with @mkustermann :
|
Just some clarifications
It seems like this embedding step is using The embedding step runs after linking, so one would need a different approach for that. The flutter build could always make one static library to be linked into the app - and we could combine all static libraries into one, making the build rules simple. |
list
commanddry-run
option
One thing I forgot to mention in the discussions earlier: for hot-restart in For this, we could also use the |
I don't understand; what happens when someone provides different output from the different runs? As we discussed before, breaking symmetry is a feature, because it makes it unambiguous, and enforced, that the output list cannot be a function of those inputs. |
Flutter would run all the dry-runs for all the combinations of params that a XCode/Gradle/CMake project that is generated can target. Flutter would then issue an error if the list of dynamic libraries is not equal.
This is a Flutter-specific requirement, and might not be specific to other embedders/launchers of Dart. Maybe some other launcher generates files in a build system which will have a different set of parameters that should not be creating differences in the output (something else than arch and debug/release). Baking in this Flutter-specific requirement into the protocol is the wrong place. The Flutter specific aspect can be done in Flutter by doing multiple dry-runs. We will enforce that the list is identical in Flutter by running dry-run N (arch x debug/release) times and checking that the list of dylibs is identical. I'm happy to set up a chat to discuss this further. |
How are you planning to enumerate every possible value of those parameters? |
The set of architecture, build modes, and iOS sdks is limited. As an alternative to enumerating, we could keep passing in the native-assets list from the "outer" invocation, set it as a property so that it will also be passed when running directly from xcode. We can then check that list of dylibs against the list of dylibs produced by the "inner" invocation in flutter assemble. (Maybe we need this anyway, as a sanity check that users don't do something completely different in dry-run ...) @stuartmorgan do we have reasons to believe that (Thinking about it, we probably need to also at least pass the |
At least CMake allows defining arbitrary build modes.
I'm not sure what this question means exactly. Are you asking if it's possible to construct a build system that requires creating a different artifact set based on parameters other than those? Maybe, but it seems like the safest/easiest way to figure out if we can get away with not providing information that's a foot-gun in some build systems would be to start out with the most restrictive set of information possible, and then see if there are any actual use cases for expanding that, rather than providing everything (which isn't actually everything that would generalize to any embedder we could ever have on the planet, but only the things we include now based on a best guess of what the relevant information might be to future theoretical embedder) first. I'm approaching this not from the standpoint of baking in something inherently Flutter-specific, but that starting with a structure where we assert, structurally, that the artifact list can only vary on a very, very limited set of inputs reduces complexity (including for Flutter, but just in general), and so we should start there until/unless we have a concrete use case for increasing the complexity. |
I was thinking that having the same set of inputs and having a I do agree though that if we lock it down at first, and open it up later if needed, that that is less breaking than the other way around. |
Sorry, "complexity" was a pretty vague way for me to describe that. I agree it's somewhat more complexity in the tool, but it reduces the potential complexity in the set of all possible behaviors that package developers can create and which we would be stuck supporting (which is a scarier type of complexity IMO, since it's outside of our direct control). |
The main thing we should take into account is that a package's
I fully agree with this. The communication between flutter tools / dart tools and the
or for producing native assets for dart2wasm:
The // The package needs the `libfoo.so` only on linux, on mac the package has a different implementation.
if (config.targetPlatform == 'native' && config.native.targetOs == 'linux') {
final cbuilder = CBuilder.library(
name: 'libfoo.so',
assetName: 'package:<foo>/<bar>',
sources: ['src/foo.c', ...],
);
await cbuilder.run(config, output);
} Given this structure, I suggested that we re-use this configuration mechanism for a I agree with @stuartmorgan that there's no need to supply |
The native/pkgs/native_assets_cli/lib/src/model/build_config.dart Lines 39 to 45 in 2de8813
They cannot be supplied by the launcher, nor read by the user. |
In the context of Flutter, we need to know the list of dynamic libraries to bundle before we know the architecture and build mode.
The generated CMake (Windows, Linux), XCodeProject/CocoaPods/SwiftPackageManager (MacOS, iOS), Gradle (Android) need to know the list of dynamic libaries to bundle, they don't support "dynamic dependencies".
Moreover, the generated projects can be used to build for another architecture and another build-mode.
Consequently, the protocol in this package
native_assets_cli
needs alist
command that lists the native assets that are going to be be build.The
list
command will be invoked on the "outer"flutter build
/flutter run
command that generates the various build system projects.The
build
command will then be invoked in the "inner"flutter assemble
that is called from within these projects will then produce the native assets.Currently, it is already the case that if you change your pub dependencies, you have to rerun the outer flutter command to have the right XCode/Gradle/CMake project. For native assets we'd have the same constraint, if you change the list of native assets (by having new dependency or a different version of a dependency) you need to run the "outer" flutter command.
We don't need a
list
command for the Dart ecosystem, because we don't have to deal with the constraints of existing build systems not supporting dynamic dependencies. We use no native build system for Dart apps.@stuartmorgan @vashworth Do you have some references to previous issues with "dynamic dependencies" and workarounds for those with the build systems that Flutter is using? Feel free to add more color to this constraint.
cc @mkustermann @HosseinYousefi
The text was updated successfully, but these errors were encountered: