Skip to content

Commit

Permalink
Changes as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Nov 16, 2023
1 parent ceedaf7 commit 98300f6
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 49 deletions.
1 change: 0 additions & 1 deletion pkgs/messages/example_json/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: example_json
description: An example on how to use `package:messages`.
version: 1.0.0
publish_to: none

environment:
Expand Down
5 changes: 1 addition & 4 deletions pkgs/messages/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ environment:
dependencies:
collection: ^1.17.1
intl: ^0.18.0
messages_deserializer:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages_deserializer
messages_deserializer: ^0.1.0

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
Expand Down
2 changes: 1 addition & 1 deletion pkgs/messages_builder/lib/arb_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ArbParser {
debugString,
messageContent,
messageKey,
addName,
addId: addName,
);
final messageMetadata = arb['@$messageKey'];
if (messageMetadata != null) {
Expand Down
23 changes: 23 additions & 0 deletions pkgs/messages_builder/lib/generation_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,34 @@ import 'package:build/build.dart';
import 'package:glob/glob.dart';
import 'package:yaml/yaml.dart';

/// Options for the message data file and code generation.
class GenerationOptions {
/// Whether to generate named message calls. Example:
/// An arb file like this
/// ```json
/// {
/// "helloName": "Hello {name}"
/// }
/// ```
/// leads to
/// ```dart
/// String helloName(String name) {
/// ```
/// being generated.
final bool messageCalls;

/// Whether to generate a method to fetch a message by its id. Leads to the
/// ids being stored in the data file.
final bool findById;

/// How the messages should be indexed, either through `int`s or an `enum`
final IndexType indexType;

/// The data file serialization, either json or (TBD) binary.
final SerializationType serialization;

/// The data file deserialization, either through browser functionalities or
/// dart native code.
final DeserializationType deserialization;

GenerationOptions({
Expand Down
4 changes: 2 additions & 2 deletions pkgs/messages_builder/lib/message_parser/message_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class MessageParser {
static MessageWithMetadata parse(
String debugString,
String fileContents,
String name, [
String name, {
bool addId = false,
]) {
}) {
final node = Parser(name, debugString, fileContents).parse();
final arguments = <String>[];
final message =
Expand Down
15 changes: 3 additions & 12 deletions pkgs/messages_builder/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@ dependencies:
dart_style: ^2.2.4
glob: ^2.1.1
intl: ^0.18.0
messages:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages
messages_serializer:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages_serializer
messages: ^0.1.0
messages_serializer: ^0.1.0
path: ^1.8.2
yaml: ^3.1.1

Expand All @@ -31,8 +25,5 @@ dev_dependencies:
build_web_compilers: ^4.0.5
dart_flutter_team_lints: ^1.0.0
lints: ^2.0.0
messages_deserializer:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages_deserializer
messages_deserializer: ^0.1.0
test: ^1.16.0
7 changes: 2 additions & 5 deletions pkgs/messages_deserializer/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ environment:
# Add regular dependencies here.
dependencies:
js: ^0.6.5
messages:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages
messages: ^0.1.0

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
dart_flutter_team_lints: ^2.0.0
lints: ^2.0.0
test: ^1.21.0
10 changes: 2 additions & 8 deletions pkgs/messages_serializer/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ environment:

# Add regular dependencies here.
dependencies:
messages:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages
messages: ^0.1.0

dev_dependencies:
dart_flutter_team_lints: ^1.0.0
lints: ^2.0.0
messages_deserializer:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages_deserializer
messages_deserializer: ^0.1.0
test: ^1.21.0
20 changes: 4 additions & 16 deletions pkgs/messages_shrinker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,10 @@ dependencies:
analyzer: ^6.2.0
args: ^2.4.2
build: ^2.4.1
messages:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages
messages_builder:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages_builder
messages_deserializer:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages_deserializer
messages_serializer:
git:
url: git@github.com:dart-lang/i18n.git
path: pkgs/messages_serializer
messages: ^0.1.0
messages_builder: ^0.1.0
messages_deserializer: ^0.1.0
messages_serializer: ^0.1.0

dev_dependencies:
dart_flutter_team_lints: ^2.0.0
Expand Down

0 comments on commit 98300f6

Please sign in to comment.