Skip to content

Commit

Permalink
[native_toolchain_c] Rename assetName to assetId (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes authored Aug 8, 2023
1 parent 0187d0e commit 9ee4689
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 15 deletions.
4 changes: 3 additions & 1 deletion pkgs/native_toolchain_c/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 0.1.1-wip
## 0.2.0

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

## 0.1.0

Expand Down
10 changes: 5 additions & 5 deletions pkgs/native_toolchain_c/lib/src/cbuilder/cbuilder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CBuilder implements Builder {
/// Used to output the [BuildOutput.assets].
///
/// If omitted, no asset will be added to the build output.
final String? assetName;
final String? assetId;

/// Sources to build the library or executable.
///
Expand All @@ -59,7 +59,7 @@ class CBuilder implements Builder {

CBuilder.library({
required this.name,
required this.assetName,
required this.assetId,
this.sources = const [],
this.dartBuildFiles = const ['build.dart'],
@visibleForTesting this.installName,
Expand All @@ -70,7 +70,7 @@ class CBuilder implements Builder {
this.sources = const [],
this.dartBuildFiles = const ['build.dart'],
}) : _type = _CBuilderType.executable,
assetName = null,
assetId = null,
installName = null;

/// Runs the C Compiler with on this C build spec.
Expand Down Expand Up @@ -116,7 +116,7 @@ class CBuilder implements Builder {
await task.run();
}

if (assetName != null) {
if (assetId != null) {
final targets = [
if (!buildConfig.dryRun)
buildConfig.target
Expand All @@ -126,7 +126,7 @@ class CBuilder implements Builder {
];
for (final target in targets) {
buildOutput.assets.add(Asset(
name: assetName!,
id: assetId!,
linkMode: linkMode,
target: target,
path: AssetAbsolutePath(libUri),
Expand Down
4 changes: 2 additions & 2 deletions pkgs/native_toolchain_c/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: native_toolchain_c
description: >-
A library to invoke the native C compiler installed on the host machine.
version: 0.1.1-wip
version: 0.2.0
repository: https://github.com/dart-lang/native/tree/main/pkgs/native_toolchain_c

topics:
Expand All @@ -19,7 +19,7 @@ dependencies:
glob: ^2.1.1
logging: ^1.1.1
meta: ^1.9.1
native_assets_cli: ^0.1.0
native_assets_cli: ^0.2.0
pub_semver: ^2.1.3

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void main() {
final cbuilder = CBuilder.library(
sources: [addCUri.toFilePath()],
name: name,
assetName: name,
assetId: name,
);
expect(
() => cbuilder.run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Future<Uri> buildLib(

final cbuilder = CBuilder.library(
name: name,
assetName: name,
assetId: name,
sources: [addCUri.toFilePath()],
);
await cbuilder.run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void main() {

final cbuilder = CBuilder.library(
name: name,
assetName: name,
assetId: name,
sources: [addCUri.toFilePath()],
installName: installName,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void main() {

final cbuilder = CBuilder.library(
name: name,
assetName: name,
assetId: name,
sources: [addCUri.toFilePath()],
);
await cbuilder.run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void main() {

final cbuilder = CBuilder.library(
name: name,
assetName: name,
assetId: name,
sources: [addCUri.toFilePath()],
);
await cbuilder.run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void main() {

final cbuilder = CBuilder.library(
name: name,
assetName: name,
assetId: name,
sources: [addCUri.toFilePath()],
);
await cbuilder.run(
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_toolchain_c/test/cbuilder/cbuilder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void main() {
final cbuilder = CBuilder.library(
sources: [addCUri.toFilePath()],
name: name,
assetName: name,
assetId: name,
);
await cbuilder.run(
buildConfig: buildConfig,
Expand Down

0 comments on commit 9ee4689

Please sign in to comment.