From 621088c4ddced25acddad702db4e42d98df65490 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 3 Sep 2024 13:31:48 +0200 Subject: [PATCH] Undo native_assets_cli changes --- .../lib/src/api/link_config.dart | 5 ----- .../lib/src/model/link_config.dart | 17 ++++++++--------- .../test/model/link_config_test.dart | 6 +++--- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/pkgs/native_assets_cli/lib/src/api/link_config.dart b/pkgs/native_assets_cli/lib/src/api/link_config.dart index fa1168f32..f6ccc54e1 100644 --- a/pkgs/native_assets_cli/lib/src/api/link_config.dart +++ b/pkgs/native_assets_cli/lib/src/api/link_config.dart @@ -7,7 +7,6 @@ import 'dart:io'; import 'package:args/args.dart'; import 'package:cli_config/cli_config.dart'; import 'package:collection/collection.dart'; -import 'package:meta/meta.dart'; import 'package:pub_semver/pub_semver.dart'; import '../model/hook.dart'; @@ -32,10 +31,6 @@ abstract class LinkConfig implements HookConfig { /// `build.dart` script destined for this packages `link.dart`. Iterable get assets; - /// - @experimental - Uri? get recordedUsages; - /// Generate the [LinkConfig] from the input arguments to the linking script. factory LinkConfig.fromArguments(List arguments) => LinkConfigImpl.fromArguments(arguments); diff --git a/pkgs/native_assets_cli/lib/src/model/link_config.dart b/pkgs/native_assets_cli/lib/src/model/link_config.dart index 198b9e481..8c396bcf9 100644 --- a/pkgs/native_assets_cli/lib/src/model/link_config.dart +++ b/pkgs/native_assets_cli/lib/src/model/link_config.dart @@ -18,12 +18,11 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig { // TODO: Placeholder for the resources.json file URL. We don't want to change // native_assets_builder when implementing the parsing. - @override - final Uri? recordedUsages; + final Uri? resourceIdentifierUri; LinkConfigImpl({ required this.assets, - this.recordedUsages, + this.resourceIdentifierUri, required super.outputDirectory, required super.packageName, required super.packageRoot, @@ -47,7 +46,7 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig { LinkConfigImpl.dryRun({ required this.assets, - this.recordedUsages, + this.resourceIdentifierUri, required super.outputDirectory, required super.packageName, required super.packageRoot, @@ -73,8 +72,8 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig { @override Map toJson() => { ...hookToJson(), - if (recordedUsages != null) - resourceIdentifierKey: recordedUsages!.toFilePath(), + if (resourceIdentifierUri != null) + resourceIdentifierKey: resourceIdentifierUri!.toFilePath(), assetsKey: AssetImpl.listToJson(assets, version), }.sortOnKey(); @@ -115,7 +114,7 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig { targetMacOSVersion: HookConfigImpl.parseTargetMacOSVersion(config, dryRun, targetOS), assets: parseAssets(config), - recordedUsages: parseResourceIdentifier(config), + resourceIdentifierUri: parseResourceIdentifier(config), dryRun: dryRun, ); } @@ -134,7 +133,7 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig { if (other is! LinkConfigImpl) { return false; } - if (other.recordedUsages != recordedUsages) { + if (other.resourceIdentifierUri != resourceIdentifierUri) { return false; } if (!const DeepCollectionEquality().equals(other.assets, assets)) { @@ -146,7 +145,7 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig { @override int get hashCode => Object.hashAll([ super.hashCode, - recordedUsages, + resourceIdentifierUri, const DeepCollectionEquality().hash(assets), ]); diff --git a/pkgs/native_assets_cli/test/model/link_config_test.dart b/pkgs/native_assets_cli/test/model/link_config_test.dart index 069a7b768..3ded55f0b 100644 --- a/pkgs/native_assets_cli/test/model/link_config_test.dart +++ b/pkgs/native_assets_cli/test/model/link_config_test.dart @@ -78,7 +78,7 @@ void main() async { ), buildMode: BuildModeImpl.release, assets: assets, - recordedUsages: resources, + resourceIdentifierUri: resources, linkModePreference: LinkModePreferenceImpl.preferStatic, ); @@ -91,7 +91,7 @@ void main() async { targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, assets: [], - recordedUsages: null, + resourceIdentifierUri: null, linkModePreference: LinkModePreferenceImpl.preferStatic, ); @@ -330,7 +330,7 @@ void main() async { targetAndroidNdkApi: 30, buildMode: BuildModeImpl.release, assets: assets, - recordedUsages: resources, + resourceIdentifierUri: resources, linkModePreference: LinkModePreferenceImpl.preferStatic, ); final configFileContents = buildConfig.toJsonString();