Skip to content

Commit 5a1361b

Browse files
authored
[native_assets_builder] Rename Asset name to id (#115)
1 parent 9ee4689 commit 5a1361b

File tree

28 files changed

+56
-49
lines changed

28 files changed

+56
-49
lines changed

.github/workflows/dart.yaml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
os: [ubuntu, macos, windows]
2323
sdk: [stable, dev]
2424
package: [native_assets_builder, native_assets_cli, native_toolchain_c]
25+
# Breaking changes temporarily break the example run on the Dart SDK until native_assets_builder is rolled into the Dart SDK dev build.
26+
# TODO(https://github.com/dart-lang/native/issues/116): Set to false.
27+
breaking-change: [true]
2528
exclude:
2629
# Only run analyze against dev on one host.
2730
- os: macos
@@ -86,30 +89,21 @@ jobs:
8689
- run: dart test
8790
if: ${{ matrix.sdk == 'stable' }}
8891

89-
# This might temporarily break when doing breaking changes.
9092
- run: dart --enable-experiment=native-assets test
9193
working-directory: pkgs/${{ matrix.package }}/example/native_add_app/
92-
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' }}
94+
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
9395

94-
# This might temporarily break when doing breaking changes.
95-
- run: dart --enable-experiment=native-assets test
96-
working-directory: pkgs/${{ matrix.package }}/example/native_add_app/
97-
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' }}
98-
99-
# This might temporarily break when doing breaking changes.
10096
- run: dart --enable-experiment=native-assets run
10197
working-directory: pkgs/${{ matrix.package }}/example/native_add_app/
102-
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' }}
98+
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
10399

104-
# This might temporarily break when doing breaking changes.
105100
- run: dart --enable-experiment=native-assets build bin/native_add_app.dart
106101
working-directory: pkgs/${{ matrix.package }}/example/native_add_app/
107-
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' }}
102+
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
108103

109-
# This might temporarily break when doing breaking changes.
110104
- run: ./native_add_app.exe
111105
working-directory: pkgs/${{ matrix.package }}/example/native_add_app/bin/native_add_app/
112-
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' }}
106+
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
113107

114108
- name: Install coverage
115109
run: dart pub global activate coverage

pkgs/native_assets_builder/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Please keep consistent with .pubignore.
2+
13
# https://dart.dev/guides/libraries/private-files
24
# Created by `dart pub`
35
.dart_tool/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Please keep consistent with .gitignore.
2+
3+
# https://dart.dev/guides/libraries/private-files
4+
# Created by `dart pub`
5+
.dart_tool/
6+
7+
# Avoid committing pubspec.lock for library packages; see
8+
# https://dart.dev/guides/libraries/private-files#pubspeclock.
9+
pubspec.lock
10+
11+
coverage/
12+
13+
# Woraround https://github.com/dart-lang/pub/issues/3982
14+
test/

pkgs/native_assets_builder/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.2.0-wip
1+
## 0.2.0
22

33
- **Breaking change** `NativeAssetsBuildRunner`s methods now return an object
44
([#105](https://github.com/dart-lang/native/issues/105)).

pkgs/native_assets_builder/analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ analyzer:
44
language:
55
strict-raw-types: true
66
strict-inference: true
7+
exclude:
8+
# TODO(https://github.com/dart-lang/ecosystem/issues/150): Remove this.
9+
- test/data/
710

811
linter:
912
rules:

pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ build_output.yaml contained a format error.
371371

372372
bool validateAssetsPackage(List<Asset> assets, String packageName) {
373373
final invalidAssetIds = assets
374-
.map((a) => a.name)
374+
.map((a) => a.id)
375375
.where((n) => !n.startsWith('package:$packageName/'))
376376
.toSet()
377377
.toList()

pkgs/native_assets_builder/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: native_assets_builder
22
description: >-
33
This package is the backend that invokes top-level `build.dart` scripts.
4-
version: 0.2.0-wip
4+
version: 0.2.0
55
repository: https://github.com/dart-lang/native/tree/main/pkgs/native_assets_builder
66

77
environment:
@@ -10,7 +10,7 @@ environment:
1010
dependencies:
1111
graphs: ^2.3.1
1212
logging: ^1.2.0
13-
native_assets_cli: ^0.1.0
13+
native_assets_cli: ^0.2.0
1414
package_config: ^2.1.0
1515

1616
dev_dependencies:

pkgs/native_assets_builder/test/build_runner/build_runner_dry_run_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void main() async {
3535
final dryRunAsset = dryRunAssets[0];
3636
final buildAsset = result.assets[0];
3737
expect(dryRunAsset.linkMode, buildAsset.linkMode);
38-
expect(dryRunAsset.name, buildAsset.name);
38+
expect(dryRunAsset.id, buildAsset.id);
3939
expect(dryRunAsset.target, buildAsset.target);
4040
// The target folders are different, so the paths are different.
4141
}

pkgs/native_assets_builder/test/data/cyclic_package_1/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
cli_config: ^0.1.1
1212
cyclic_package_2:
1313
path: ../cyclic_package_2
14-
native_assets_cli: ^0.1.0
14+
native_assets_cli: ^0.2.0
1515
yaml: ^3.1.1
1616
yaml_edit: ^2.1.0
1717

pkgs/native_assets_builder/test/data/cyclic_package_2/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
cli_config: ^0.1.1
1212
cyclic_package_1:
1313
path: ../cyclic_package_1
14-
native_assets_cli: ^0.1.0
14+
native_assets_cli: ^0.2.0
1515
yaml: ^3.1.1
1616
yaml_edit: ^2.1.0
1717

0 commit comments

Comments
 (0)