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

[native_assets_builder] Rename Asset name to id #115

Merged
merged 7 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions .github/workflows/dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
os: [ubuntu, macos, windows]
sdk: [stable, dev]
package: [native_assets_builder, native_assets_cli, native_toolchain_c]
# Breaking changes temporarily break the example run on the Dart SDK until native_assets_builder is rolled into the Dart SDK dev build.
# TODO(https://github.com/dart-lang/native/issues/116): Set to false.
breaking-change: [true]
exclude:
# Only run analyze against dev on one host.
- os: macos
Expand Down Expand Up @@ -86,30 +89,21 @@ jobs:
- run: dart test
if: ${{ matrix.sdk == 'stable' }}

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

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

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

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

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

- name: Install coverage
run: dart pub global activate coverage
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.2.0-wip
## 0.2.0

- **Breaking change** `NativeAssetsBuildRunner`s methods now return an object
([#105](https://github.com/dart-lang/native/issues/105)).
Expand Down
3 changes: 3 additions & 0 deletions pkgs/native_assets_builder/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ analyzer:
language:
strict-raw-types: true
strict-inference: true
exclude:
# TODO(https://github.com/dart-lang/ecosystem/issues/150): Remove this.
- test/data/

linter:
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ build_output.yaml contained a format error.

bool validateAssetsPackage(List<Asset> assets, String packageName) {
final invalidAssetIds = assets
.map((a) => a.name)
.map((a) => a.id)
.where((n) => !n.startsWith('package:$packageName/'))
.toSet()
.toList()
Expand Down
4 changes: 2 additions & 2 deletions pkgs/native_assets_builder/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: native_assets_builder
description: >-
This package is the backend that invokes top-level `build.dart` scripts.
version: 0.2.0-wip
version: 0.2.0
repository: https://github.com/dart-lang/native/tree/main/pkgs/native_assets_builder

environment:
Expand All @@ -10,7 +10,7 @@ environment:
dependencies:
graphs: ^2.3.1
logging: ^1.2.0
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
package_config: ^2.1.0

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void main() async {
final dryRunAsset = dryRunAssets[0];
final buildAsset = result.assets[0];
expect(dryRunAsset.linkMode, buildAsset.linkMode);
expect(dryRunAsset.name, buildAsset.name);
expect(dryRunAsset.id, buildAsset.id);
expect(dryRunAsset.target, buildAsset.target);
// The target folders are different, so the paths are different.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
cli_config: ^0.1.1
cyclic_package_2:
path: ../cyclic_package_2
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
yaml: ^3.1.1
yaml_edit: ^2.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
cli_config: ^0.1.1
cyclic_package_1:
path: ../cyclic_package_1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
yaml: ^3.1.1
yaml_edit: ^2.1.0

Expand Down
3 changes: 1 addition & 2 deletions pkgs/native_assets_builder/test/data/native_add/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ void main(List<String> args) async {
final buildOutput = BuildOutput();
final cbuilder = CBuilder.library(
name: packageName,
assetName:
'package:$packageName/src/${packageName}_bindings_generated.dart',
assetId: 'package:$packageName/src/${packageName}_bindings_generated.dart',
sources: [
'src/$packageName.c',
],
Expand Down
4 changes: 2 additions & 2 deletions pkgs/native_assets_builder/test/data/native_add/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ environment:
dependencies:
cli_config: ^0.1.1
logging: ^1.1.1
native_assets_cli: ^0.1.0
native_toolchain_c: ^0.1.0
native_assets_cli: ^0.2.0
native_toolchain_c: ^0.2.0

dev_dependencies:
ffigen: ^8.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ void main(List<String> args) async {
final buildOutput = BuildOutput();
final cbuilder = CBuilder.library(
name: packageName,
assetName:
'package:$packageName/src/${packageName}_bindings_generated.dart',
assetId: 'package:$packageName/src/${packageName}_bindings_generated.dart',
sources: [
'src/$packageName.c',
'src/native_multiply.c',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ environment:
dependencies:
cli_config: ^0.1.1
logging: ^1.1.1
native_assets_cli: ^0.1.0
native_toolchain_c: ^0.1.0
native_assets_cli: ^0.2.0
native_toolchain_c: ^0.2.0

dev_dependencies:
ffigen: ^8.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ void main(List<String> args) async {
final buildOutput = BuildOutput();
final cbuilder = CBuilder.library(
name: packageName,
assetName:
'package:$packageName/src/${packageName}_bindings_generated.dart',
assetId: 'package:$packageName/src/${packageName}_bindings_generated.dart',
sources: [
'src/$packageName.c',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ environment:
dependencies:
cli_config: ^0.1.1
logging: ^1.1.1
native_assets_cli: ^0.1.0
native_toolchain_c: ^0.1.0
native_assets_cli: ^0.2.0
native_toolchain_c: ^0.2.0

dev_dependencies:
ffigen: ^8.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
cli_config: ^0.1.1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
package_with_metadata:
path: ../package_with_metadata/
yaml: ^3.1.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
cli_config: ^0.1.1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
yaml: ^3.1.1
yaml_edit: ^2.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
cli_config: ^0.1.1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
yaml: ^3.1.1
yaml_edit: ^2.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
cli_config: ^0.1.1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
yaml: ^3.1.1
yaml_edit: ^2.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
cli_config: ^0.1.1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
yaml: ^3.1.1
yaml_edit: ^2.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void main(List<String> args) async {
final buildOutput = BuildOutput(
assets: [
Asset(
name: 'package:other_package/foo',
id: 'package:other_package/foo',
linkMode: LinkMode.dynamic,
target: Target.current,
path: AssetAbsolutePath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
cli_config: ^0.1.1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
yaml: ^3.1.1
yaml_edit: ^2.1.0

Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.2.0

- *Breaking change* Rename `Asset.name` to `Asset.id`
- **Breaking change** Rename `Asset.name` to `Asset.id`
([#100](https://github.com/dart-lang/native/issues/100)).
- Added topics.
- Fixed metadata example.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void main(List<String> args) async {
// Configure `package:native_toolchain_c` to build the C code for us.
final cbuilder = CBuilder.library(
name: packageName,
assetName: 'package:$packageName/${packageName}.dart',
assetId: 'package:$packageName/${packageName}.dart',
sources: [
'src/$packageName.c',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ environment:
dependencies:
cli_config: ^0.1.1
logging: ^1.1.1
native_assets_cli: ^0.1.0
native_toolchain_c: ^0.1.0
native_assets_cli: ^0.2.0
native_toolchain_c: ^0.2.0

dev_dependencies:
ffigen: ^8.0.2
Expand Down
5 changes: 1 addition & 4 deletions pkgs/native_assets_cli/lib/src/model/asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class Asset {
});

factory Asset.fromYaml(YamlMap yamlMap) => Asset(
id: as<String>(yamlMap[_idKey] ?? yamlMap[_nameKey]),
id: as<String>(yamlMap[_idKey]),
path: AssetPath.fromYaml(as<YamlMap>(yamlMap[_pathKey])),
target: Target.fromString(as<String>(yamlMap[_targetKey])),
linkMode: LinkMode.fromName(as<String>(yamlMap[_linkModeKey])),
Expand Down Expand Up @@ -266,9 +266,6 @@ class Asset {
String toYamlString() => yamlEncode(toYaml());

static const _idKey = 'id';
// TODO(https://github.com/dart-lang/native/issues/100): Remove name key when
// rolling dependencies in example.
static const _nameKey = 'name';
static const _linkModeKey = 'link_mode';
static const _pathKey = 'path';
static const _targetKey = 'target';
Expand Down
4 changes: 2 additions & 2 deletions pkgs/native_toolchain_c/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## 0.2.0

- Added topics.
- *Breaking change* Rename `assetName` to `assetId`
- **Breaking change** Rename `assetName` to `assetId`
([#100](https://github.com/dart-lang/native/issues/100)).
- Added topics.

## 0.1.0

Expand Down