Skip to content
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

Adaptions for Flutter Gallery demo #736

Merged
merged 9 commits into from
Nov 17, 2023
Merged

Adaptions for Flutter Gallery demo #736

merged 9 commits into from
Nov 17, 2023

Conversation

mosuem
Copy link
Member

@mosuem mosuem commented Oct 25, 2023

A series of changes for flutter/gallery#1021.

  • Make calls to loading a locale async
  • Support arb files with different ordering and message keys than their reference file
  • Generate constant hash
  • Infer which arb file is the reference file
  • Cleanups in generated code

After this PR, the plan is to publish experimental(!) versions of the packages to ease testing with other packages and applications.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@github-actions
Copy link

Package publishing

Package Version Status Publish tag (post-merge)
package:intl 0.19.0-dev ready to publish intl-v0.19.0-dev
package:intl_translation 0.19.0-dev ready to publish intl_translation-v0.19.0-dev
package:intl4x 0.7.0 already published at pub.dev

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

@github-actions
Copy link

github-actions bot commented Oct 26, 2023

PR Health

Package publish validation ✔️

Details
Package Version Status
package:intl 0.19.0-dev ready to publish
package:intl_translation 0.19.0-dev ready to publish
package:intl4x 0.7.0 already published at pub.dev

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

Changelog Entry ✔️

Details
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ✔️

Details
File Coverage

This check for test coverage is informational (issues shown here will not fail the PR).

Breaking changes ✔️

Details
Package Change Current Version New Version Needed Version Looking good?
intl None 0.19.0-dev 0.19.0-dev 0.19.0-dev ✔️
intl_translation None 0.19.0-dev 0.19.0-dev 0.19.0-dev ✔️
intl4x None 0.7.0 0.7.0 0.7.0 ✔️

@mosuem mosuem marked this pull request as ready for review October 26, 2023 14:31
@mosuem mosuem requested a review from devoncarew November 15, 2023 09:57
@devoncarew
Copy link
Member

nit and not necessarily related to this RP - we're now using -wip to signify there are changes to the packages since the last publish and we're not yet ready to re-publish (re: the 0.19.0-dev tags above). The firehose tool special cases that extension and won't offer to publish a -wip version.

Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good! A few questions, in-line in the PR.

After this PR, the plan is to publish experimental(!) versions of the packages to ease testing with other packages and applications.

Lets publish to labs.dart.dev to start out -

pkgs/messages/example_json/pubspec.yaml Outdated Show resolved Hide resolved
});

static Future<GenerationOptions> fromPubspec(BuildStep buildStep) async {
final pubspecId = await buildStep.findAssets(Glob('pubspec.yaml')).first;
final pubspecData = await buildStep.readAsString(pubspecId);
final pubspec = loadYaml(pubspecData) as YamlMap;
final messagesOptions = pubspec['messages'] as YamlMap;
final messagesOptions = pubspec['messages'] as YamlMap?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the yaml files this is read from, the messages: key lacks a bit of context.

I do like that fact that we're not creating yet another data file in the user's directory (we have some to configure build, test, dartdoc, ...).

Should this key be messages_builder:? Should it be in a new 'options' section?

name: my_package
...

dependencies:
  path: any
  ...

options:
  messages_builder:
    use_method_names: true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I slightly prefer putting these new package options into a new category (options:), but realize there's a high degree of bike-shedding here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no opinion on whether it should be in a new options: key, but it feels a bit redundant. What is the pubspec if not a collection of options? I took the inspiration from Flutter, where top-level keys are common I believe.

Copy link
Member

@devoncarew devoncarew Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter's are in a flutter: section; it feels large enough to get it's own section.

Mostly the top-level keys are for use by pub; it's less common for tools or packages to introduce new keys.

I think the important thing would be for somebody reading the file:

messages:
  generateMethods: true
  generateFindById: false
  generateFindBy: integer

to know that:

  • these keys aren't mistaken for pub-related things
  • are pretty clear what they're associated with (the package that reads them? the functionality used by the package under development - localization, message generation, ... ?)

messages: seems a little bare to me - slightly too little context. You might want play around with a few other keys / nested keys to see if something jumps out at you.

(I did see after writing this comment that you'd changed this to messages_builder:)

pkgs/messages_builder/pubspec.yaml Outdated Show resolved Hide resolved
pkgs/messages_deserializer/pubspec.yaml Outdated Show resolved Hide resolved
pkgs/messages_deserializer/pubspec.yaml Outdated Show resolved Hide resolved
pkgs/messages_shrinker/pubspec.yaml Outdated Show resolved Hide resolved
pkgs/messages_builder/pubspec.yaml Outdated Show resolved Hide resolved
pkgs/messages/example_json/pubspec.yaml Outdated Show resolved Hide resolved
});

static Future<GenerationOptions> fromPubspec(BuildStep buildStep) async {
final pubspecId = await buildStep.findAssets(Glob('pubspec.yaml')).first;
final pubspecData = await buildStep.readAsString(pubspecId);
final pubspec = loadYaml(pubspecData) as YamlMap;
final messagesOptions = pubspec['messages'] as YamlMap;
final messagesOptions = pubspec['messages'] as YamlMap?;
Copy link
Member

@devoncarew devoncarew Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter's are in a flutter: section; it feels large enough to get it's own section.

Mostly the top-level keys are for use by pub; it's less common for tools or packages to introduce new keys.

I think the important thing would be for somebody reading the file:

messages:
  generateMethods: true
  generateFindById: false
  generateFindBy: integer

to know that:

  • these keys aren't mistaken for pub-related things
  • are pretty clear what they're associated with (the package that reads them? the functionality used by the package under development - localization, message generation, ... ?)

messages: seems a little bare to me - slightly too little context. You might want play around with a few other keys / nested keys to see if something jumps out at you.

(I did see after writing this comment that you'd changed this to messages_builder:)

@mosuem mosuem merged commit 5d16fb4 into main Nov 17, 2023
13 of 15 checks passed
@mosuem mosuem deleted the adaptToFlutterGallery branch November 17, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants