Skip to content

Commit

Permalink
Undo native_assets_cli changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Sep 3, 2024
1 parent 728fb3d commit 621088c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
5 changes: 0 additions & 5 deletions pkgs/native_assets_cli/lib/src/api/link_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -32,10 +31,6 @@ abstract class LinkConfig implements HookConfig {
/// `build.dart` script destined for this packages `link.dart`.
Iterable<Asset> get assets;

///
@experimental
Uri? get recordedUsages;

/// Generate the [LinkConfig] from the input arguments to the linking script.
factory LinkConfig.fromArguments(List<String> arguments) =>
LinkConfigImpl.fromArguments(arguments);
Expand Down
17 changes: 8 additions & 9 deletions pkgs/native_assets_cli/lib/src/model/link_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -73,8 +72,8 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig {
@override
Map<String, Object> toJson() => {
...hookToJson(),
if (recordedUsages != null)
resourceIdentifierKey: recordedUsages!.toFilePath(),
if (resourceIdentifierUri != null)
resourceIdentifierKey: resourceIdentifierUri!.toFilePath(),
assetsKey: AssetImpl.listToJson(assets, version),
}.sortOnKey();

Expand Down Expand Up @@ -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,
);
}
Expand All @@ -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)) {
Expand All @@ -146,7 +145,7 @@ class LinkConfigImpl extends HookConfigImpl implements LinkConfig {
@override
int get hashCode => Object.hashAll([
super.hashCode,
recordedUsages,
resourceIdentifierUri,
const DeepCollectionEquality().hash(assets),
]);

Expand Down
6 changes: 3 additions & 3 deletions pkgs/native_assets_cli/test/model/link_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void main() async {
),
buildMode: BuildModeImpl.release,
assets: assets,
recordedUsages: resources,
resourceIdentifierUri: resources,
linkModePreference: LinkModePreferenceImpl.preferStatic,
);

Expand All @@ -91,7 +91,7 @@ void main() async {
targetAndroidNdkApi: 30,
buildMode: BuildModeImpl.release,
assets: [],
recordedUsages: null,
resourceIdentifierUri: null,
linkModePreference: LinkModePreferenceImpl.preferStatic,
);

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 621088c

Please sign in to comment.