-
Notifications
You must be signed in to change notification settings - Fork 42
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
Unify <Foo> and <Foo>Impl classes that are effectively simple enums or data classes #1604
Merged
Commits on Sep 27, 2024
-
Unify <Foo> and <Foo>Impl classes that are effectively enums or simpl…
…e data classes The API of `package:native_assets_cli` uses currently a one-size-fits-all approach: * almost every API class is duplicated between a `<Foo>` and `<Foo>Impl` * `package:native_assets_cli/native_assets_cli.dart` exposes `<Foo>` * `package:native_assets_cli/native_assets_cli_internal.dart` exposes `<Foo>Impl` This has a number of issues * The `_internal.dart` is actually a public API: It's used e.g. by flutter tools and breaking changes to it need major version bumps. * A user of the `<Foo>` API doesn't know that such objects are for example * hashable (e.g. go-to-definition to `<Foo>` there's no indication of that), e.g. `DynamicLoadingSystem` makes no mention of it, no `get hashCode` override, ... only in `DynamicLoadingSystemImpl` there is. * have a `toString()` that code can rely on the returned string not changing * ... * It causes code to have to choose between e.g. `OS` and `OSImpl` - which is very confusing as it's just one concept. * It causes code to have to downcast e.g. `os as OSImpl`. => This is a very bad smell, as generally it's an unsafe operation to downcast. * It's code duplication across the api/ and model/ folders, make it harder to navigate in codebase (as one may have to constantly switch between the files), ... One original intention for this seperation may have been to hide all traces of the json protocol in the non-internal version, but I think this is not needed at all, because the protocol itself will be *more* stable than the APIs offered by the package itself (much easier to break the dart API and publish and new version of the package than to break the CLI protocol). => So this PR starts to merge some `<Foo>` and `<Foo>Impl` classes into one `<Foo>`. => This simplifies the code, removes `as ...Impl` downcasts, etc One extra thing this CL does is remove some members from e.g. `OS`. This is part of disentangling the concepts. The build protocol may always expose the target operating system, but it may only expose the target ABI if the building code supports code assets. => So one should be able to use `OS` without `OS.dylibFileName` / `OS.architectures` / ... => We may even decide to move code asset related code into it's own package, making the core build protocol package not need the concept of `Architecture` at all.
Configuration menu - View commit details
-
Copy full SHA for b0516b2 - Browse repository at this point
Copy the full SHA b0516b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6c0b6ee - Browse repository at this point
Copy the full SHA 6c0b6eeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8196551 - Browse repository at this point
Copy the full SHA 8196551View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1aeb7f2 - Browse repository at this point
Copy the full SHA 1aeb7f2View commit details -
Also CCompilerConfig{,Impl} -> CCompilerConfig (now that CCompilerCon…
…fig is a plain data class)
Configuration menu - View commit details
-
Copy full SHA for e82adae - Browse repository at this point
Copy the full SHA e82adaeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 03169e5 - Browse repository at this point
Copy the full SHA 03169e5View commit details -
Configuration menu - View commit details
-
Copy full SHA for c213f66 - Browse repository at this point
Copy the full SHA c213f66View commit details -
Configuration menu - View commit details
-
Copy full SHA for e480b33 - Browse repository at this point
Copy the full SHA e480b33View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.