-
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][native_assets_builder] Supporting version skew between SDK and build.dart #93
Comments
In short, I would suggest that you version the protocol based on the default So specify input/output like:
If name: my_package
environment:
sdk: ^3.1.0 # This will make the default languageVersion in package_config `3.1` Then my build script would :
Thus, if Similarly, if It's a bit of work, but a table with inputs and output, field name, description and minimum language version would go far. |
After more discussions with @jonasfj, relying on the language versions of a package doesn't work. A package with language version 3.4 could use a helper package to parse If we would like to support version skew, we should do protocol negotiation. If we would like to completely avoid version skew, we could consider not exposing a JSON protocol, but only A poor mans version of a |
Update on the approach:
This means maintaining an implementation for older versions of A changelog for both can be found in:
If we ever want to support breaking "1.", we should implement a handshake. E.g. |
We run into a similar issue with versioning Ways to handle this more gracefully:
For all three options, we still want to aim to not do major version bumps, so these are all in case we really need to in the future. From an encapsulation POV, I believe option 3 to be the cleanest. The package itself deals with version skew internally, it doesn't leak out into the API, and the callers don't have to know about it. @mosuem Did I miss any pros/cons for the different options? You were advocating for option 2, some pros I missed there? |
Actually, this could probably be made to work. But it might not be easy. Suppose we have a world with:
When the build system has to build
For this to work, then
Obviously not all versions of
Maybe, I'm missing something, and maybe it's too complicated. But it kind of feel like writing the native build protocol version in the And the best way to write the native protocol version in the Or maybe the native build protocol version should be a completely different field in |
Talking to Daco, I can certainly see how (3) is just much simpler all around 😄 |
Some notes from discussion with @jonasfj: Exploring tying protocol version to Dart SDK version
|
Ways to handle this more gracefully:
For both option 3 and 4, the Then the question is should these formats have a version at all? Shouldn't they simply be versioned with the SDK? I believe it's always safe to have a version. The question is more what kind of logic is tied to that version. Should users ever have to worry about it? Does it show up in error messages etc? I think our goal could be for Dart & Flutter stable releases that these versions are never really visible for users. On dart dev releases and Flutter master channel they might show up while things are rolling. (Version skew between (From an implementation point of view, writing the parser and serializer from a certain version is easier than just assuming everything is nullable. It simplifies writing unit tests for checking that version skew works. Of course this is not really a concern for users.) |
I believe we have explored enough alternatives and will stick with the current approach:
|
With #26 we added a version number to to the
BuildConfig
andBuildOutput
.The way this works is that the SDK passes the version of the protocol that has rolled in to the Dart (and Flutter) SDK. If a user's
build.dart
cannot deal with that, the build is supposed to fail.Similarly, the
build.dart
passes its value of the protocol in the build output. The Dart (and Flutter) SDK check the version and error if the output cannot be used.@jonasfj suggested that we could use the Dart SDK version instead of the a version number in the protocol and use the SDK lower bound on the package being build to determine what version of the
BuildConfig
to provide to a package. The main benefit of this approach would be that if we need to do a breaking change to the build configuration, we don't end up in a situation where all dependencies with native assets need to be migrated before developers can update their Dart / Flutter SDK.If the resolved
package:native_assets_cli
dependency in the package uniquely determines the protocol version (e.g. all protocol version bump also are a package version bump) we can also support the same behavior by looking at version of that package a package requires.(With both approaches, the implementation in
package:native_asset_cli
needs to have a version number in the build config construction so it can keep constructing older versions.)The text was updated successfully, but these errors were encountered: