Skip to content

Commit 1983957

Browse files
authored
Add Dart native (#492)
* Updates * Add list format * Add listfmt to runconfig * Fix * rev dart version * fix * format * fix * add datetime * add datetime to config * build dart native * fix * fix? * don't run likely subtags in dart web * Add gitignore * fix * add test for datetiem * Pin dart version * Fixes for native * Pin intl4x
1 parent 1b2a290 commit 1983957

31 files changed

+515
-204
lines changed

.github/workflows/dart.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ jobs:
2424
working-directory: executors/dart
2525
strategy:
2626
matrix:
27-
sdk: [stable]
2827
os: [ubuntu-latest, windows-latest, macos-latest]
29-
include:
30-
- sdk: stable
31-
run-tests: true
3228
steps:
3329
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
3430

3531
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
3632
with:
37-
sdk: ${{ matrix.sdk }}
33+
sdk: 3.10.0-37.0.dev
3834

3935
- run: dart pub get
4036

@@ -47,15 +43,10 @@ jobs:
4743
if: always()
4844

4945
- run: dart test
50-
if: false # reenable when Dart Native is not causing errors (fixed/removed)
51-
# if: ${{ matrix.run-tests }}
5246

5347
- run: dart test -p chrome
54-
if: false # reenable when Dart Native is not causing errors (fixed/removed)
55-
# if: ${{ matrix.run-tests && matrix.os == 'ubuntu-latest' }}
5648

5749
- name: Check if version is set correctly
58-
if: false # reenable when Dart Native is not causing errors (fixed/removed)
5950
run: |
6051
dart bin/set_version.dart
6152
dart bin/make_runnable_by_node.dart

.github/workflows/e2e.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232

3333
- name: Setup version of Dart
3434
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
35+
with:
36+
sdk: 3.10.0-37.0.dev
3537
- name: Set version of Rust
3638
uses: actions-rs/toolchain@v1
3739
with:

executors/dart/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
out/*Dart.js
55
out/*Dart.js.deps
66
out/*Dart.js.map
7-
pubspec.lock
7+
pubspec.lock
8+
build/

executors/dart/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ linter:
1818
- non_constant_identifier_names
1919
- prefer_final_locals
2020
- unnecessary_this
21+
- omit_local_variable_types

executors/dart/bin/executor.dart

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import 'dart:io';
55

66
import 'package:collection/collection.dart';
77
import 'package:dart_executor/collator.dart';
8+
import 'package:dart_executor/datetime_format.dart';
89
import 'package:dart_executor/lang_names.dart';
10+
import 'package:dart_executor/list_format.dart';
911
import 'package:dart_executor/numberformat.dart';
12+
import 'package:dart_executor/plural_rules.dart';
1013
import 'package:dart_executor/version.dart' show intl4xVersion;
1114

1215
Map<String, List<String>> supportedTests = {
@@ -21,6 +24,8 @@ enum TestTypes {
2124
lang_names,
2225
number_fmt,
2326
likely_subtags,
27+
list_fmt,
28+
plural_rules,
2429
}
2530

2631
void main() {
@@ -49,19 +54,22 @@ void main() {
4954
final outputLine = switch (testType) {
5055
TestTypes.collation => testCollation(line),
5156
TestTypes.decimal_fmt => testDecimalFormatWrapped(line),
52-
TestTypes.datetime_fmt =>
53-
throw UnimplementedError('datetime_fmt is not supported yet'),
54-
TestTypes.display_names =>
55-
throw UnimplementedError('display_names is not supported yet'),
56-
TestTypes.lang_names => testLangNames(line),
5757
TestTypes.number_fmt => testDecimalFormatWrapped(line),
58+
TestTypes.datetime_fmt => testDateTimeFmt(line),
59+
TestTypes.display_names => throw UnimplementedError(
60+
'display_names is not supported yet',
61+
),
62+
TestTypes.lang_names => testLangNames(line),
5863
// TestTypes.likely_subtags => testLikelySubtags(line),
59-
TestTypes.likely_subtags =>
60-
throw UnimplementedError(
61-
'likely_subtags is not supported yet, as the Locale object is not yet migrated to ICU4X',
62-
),
63-
null =>
64-
throw ArgumentError.value(decoded['test_type'], 'Unknown test type'),
64+
TestTypes.likely_subtags => throw UnimplementedError(
65+
'likely_subtags is not supported yet, as the Locale object is not yet migrated to ICU4X',
66+
),
67+
TestTypes.list_fmt => testListFmt(line),
68+
TestTypes.plural_rules => testPluralRules(line),
69+
null => throw ArgumentError.value(
70+
decoded['test_type'],
71+
'Unknown test type',
72+
),
6573
};
6674

6775
print(outputLine);

executors/dart/bin/make_runnable_by_node.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ Future<void> main(List<String> args) async {
1717
name: 'testDecimalFormat',
1818
argNames: ['encoded', 'log', 'version'],
1919
),
20-
'likely_subtags': ExportFunction(
21-
name: 'testLikelySubtags',
20+
'lang_names': ExportFunction(name: 'testLangNames', argNames: ['encoded']),
21+
'plural_rules': ExportFunction(
22+
name: 'testPluralRules',
23+
argNames: ['encoded'],
24+
),
25+
'list_format': ExportFunction(name: 'testListFmt', argNames: ['encoded']),
26+
'datetimeformat': ExportFunction(
27+
name: 'testDateTimeFmt',
2228
argNames: ['encoded'],
2329
),
24-
'lang_names': ExportFunction(name: 'testLangNames', argNames: ['encoded']),
2530
};
2631
for (final MapEntry(key: name, value: function) in names.entries) {
2732
await compile(name, function);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'package:dart_executor/datetime_format.dart';
2+
3+
void main(List<String> args) {
4+
//just some call to not treeshake the function
5+
testDateTimeFmt(args.first);
6+
}

executors/dart/bin/web_wrappers/likely_subtags_executor.dart

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'package:dart_executor/list_format.dart';
2+
3+
void main(List<String> args) {
4+
//just some call to not treeshake the function
5+
testListFmt(args.first);
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'package:dart_executor/plural_rules.dart';
2+
3+
void main(List<String> args) {
4+
//just some call to not treeshake the function
5+
testPluralRules(args.first);
6+
}

0 commit comments

Comments
 (0)