You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once we also add syntax validators next to semantic validators, it will be 7 pieces of information for the build invocation and 7 slightly different pieces of information for the link invocation.
This doesn't scale.
We should introduce a concept of a protocol extension that will ensure either all or none setup/validate callbacks are passed in to the native assets builder.
A sketch:
/// An extension to the base protocol for `hook/build.dart` and/// `hook/link.dart`.////// The extension contains callbacks to/// 1. setup the config,/// 2. validate the protocol syntax, and/// 3. validate semantic constraints.abstractinterfaceclassProtocolExtension {
/// The [HookConfig.buildAssetTypes] this extension adds.List<String> get buildAssetTypes;
/// Setup the [BuildConfig] for this extension.voidsetupBuildInput(BuildInputBuilder input);
/// Setup the [HookConfig] for this extension.voidsetupLinkInput(LinkInputBuilder input);
/// Reports syntactic errors from this extension on the [BuildInput].ValidationErrorsvalidateBuildInputSyntax(Map<String, Object?> json);
/// Reports syntactic errors from this extension on the [LinkInput].ValidationErrorsvalidateLinkInputSyntax(Map<String, Object?> json);
/// Reports syntactic errors from this extension on the [BuildOutput].ValidationErrorsvalidateBuildOutputSyntax(Map<String, Object?> json);
/// Reports syntactic errors from this extension on the [LinkOutput].ValidationErrorsvalidateLinkOutputSyntax(Map<String, Object?> json);
/// Reports semantic errors from this extension on the [BuildInput]. /// /// Only run if [validateBuildInputSyntax] reports no errors.Future<ValidationErrors> validateBuildInput(BuildInput input);
/// Reports semantic errors from this extension on the [LinkInput]. /// /// Only run if [validateLinkInputSyntax] reports no errors.Future<ValidationErrors> validateBuildOutput(
BuildInput input,
BuildOutput output,
);
/// Reports semantic errors from this extension on the [LinkInput]. /// /// Only run if [validateLinkInputSyntax] reports no errors.Future<ValidationErrors> validateLinkInput(LinkInput input);
/// Reports semantic errors from this extension on the [LinkOutput]. /// /// Only run if [validateLinkOutputSyntax] reports no errors.Future<ValidationErrors> validateLinkOutput(
LinkInput input,
LinkOutput output,
);
/// Reports errors on the complete set of assets after all hooks are run. /// /// Can be used to validate that there are no asset-id or shared library name /// collisions. /// /// Only run if [validateBuildOutputSyntax] and [validateLinkOutputSyntax] /// report no errors.Future<ValidationErrors> validateApplicationAssets(List<EncodedAsset> assets);
}
@mosuem Would this fit well with the FontAssets you've been looking at? What is the JSON structure and semantic API you've come up with so far?
The text was updated successfully, but these errors were encountered:
This PR introduces a concept of protocol extensions, which package together everything belonging to a protocol extension.
Closes: #2088
As a bonus, this better abstraction reduces LOC.
The `validation` methods are now all internal to the extensions. The `setup` methods stay exported because they are used extensively in hook-helper-packages (e.g. `native_toolchain_c`).
For every extension to the protocol, the SDK authors have to pass 5 pieces of information currently:
https://github.com/flutter/flutter/blob/d452d04a07f3c37d3ed60989e01e64e0f5c34913/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart#L604-L626
Once we also add syntax validators next to semantic validators, it will be 7 pieces of information for the
build
invocation and 7 slightly different pieces of information for thelink
invocation.This doesn't scale.
We should introduce a concept of a protocol extension that will ensure either all or none setup/validate callbacks are passed in to the native assets builder.
A sketch:
@mosuem Would this fit well with the
FontAsset
s you've been looking at? What is the JSON structure and semantic API you've come up with so far?The text was updated successfully, but these errors were encountered: