diff --git a/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart b/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart index e5278254b2..10d8fcc10f 100644 --- a/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/package_reading_metadata/hook/build.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// ignore_for_file: deprecated_member_use + import 'package:native_assets_cli/native_assets_cli.dart'; void main(List args) async { diff --git a/pkgs/native_assets_builder/test_data/package_with_metadata/hook/build.dart b/pkgs/native_assets_builder/test_data/package_with_metadata/hook/build.dart index 87be9a0da5..214bac4b82 100644 --- a/pkgs/native_assets_builder/test_data/package_with_metadata/hook/build.dart +++ b/pkgs/native_assets_builder/test_data/package_with_metadata/hook/build.dart @@ -6,6 +6,7 @@ import 'package:native_assets_cli/native_assets_cli.dart'; void main(List arguments) async { await build(arguments, (config, output) async { + // ignore: deprecated_member_use output.addMetadata({ 'some_key': 'some_value', 'some_int': 3, diff --git a/pkgs/native_assets_cli/CHANGELOG.md b/pkgs/native_assets_cli/CHANGELOG.md index 4a22200260..ae5b84e622 100644 --- a/pkgs/native_assets_cli/CHANGELOG.md +++ b/pkgs/native_assets_cli/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.7.2-wip -- Nothing yet. +- Deprecate metadata concept. ## 0.7.1 diff --git a/pkgs/native_assets_cli/lib/src/api/build_config.dart b/pkgs/native_assets_cli/lib/src/api/build_config.dart index 653168b7aa..7fe7c16b95 100644 --- a/pkgs/native_assets_cli/lib/src/api/build_config.dart +++ b/pkgs/native_assets_cli/lib/src/api/build_config.dart @@ -17,6 +17,7 @@ import 'asset.dart'; import 'build.dart'; import 'build_mode.dart'; import 'build_output.dart'; +import 'deprecation_messages.dart'; import 'hook_config.dart'; import 'ios_sdk.dart'; import 'link_mode_preference.dart'; @@ -41,6 +42,7 @@ abstract final class BuildConfig implements HookConfig { /// /// Not available during a [dryRun]. Will throw a [StateError] if accessed /// during a [dryRun]. + @Deprecated(metadataDeprecation) Object? metadatum(String packageName, String key); /// Whether link hooks will be run after the build hooks. @@ -106,6 +108,7 @@ abstract final class BuildConfig implements HookConfig { /// /// Parameter [dependencyMetadata] must be a nested map `{'packageName' : /// {'key' : 'value'}}` where `packageName` and `key` correspond to the + // ignore: deprecated_member_use_from_same_package /// parameters in [metadatum]. factory BuildConfig.build({ required Uri outputDirectory, @@ -120,6 +123,7 @@ abstract final class BuildConfig implements HookConfig { int? targetAndroidNdkApi, CCompilerConfig? cCompiler, required LinkModePreference linkModePreference, + @Deprecated(metadataDeprecation) Map>? dependencyMetadata, Iterable? supportedAssetTypes, required bool linkingEnabled, diff --git a/pkgs/native_assets_cli/lib/src/api/build_output.dart b/pkgs/native_assets_cli/lib/src/api/build_output.dart index 922c480877..a8aa084b9c 100644 --- a/pkgs/native_assets_cli/lib/src/api/build_output.dart +++ b/pkgs/native_assets_cli/lib/src/api/build_output.dart @@ -20,6 +20,7 @@ import 'asset.dart'; import 'build.dart'; import 'build_config.dart'; import 'builder.dart'; +import 'deprecation_messages.dart'; import 'hook_config.dart'; import 'link.dart'; import 'linker.dart'; @@ -96,12 +97,13 @@ abstract final class BuildOutput { /// /// Metadata can be passed to build hook invocations of dependent packages. It /// must be provided to the constructor as [metadata], or added later with + // ignore: deprecated_member_use_from_same_package /// [addMetadatum] and [addMetadata]. factory BuildOutput({ DateTime? timestamp, Iterable? assets, Iterable? dependencies, - Map? metadata, + @Deprecated(metadataDeprecation) Map? metadata, }) => HookOutputImpl( timestamp: timestamp, @@ -139,10 +141,12 @@ abstract final class BuildOutput { /// Adds metadata to be passed to build hook invocations of dependent /// packages. + @Deprecated(metadataDeprecation) void addMetadatum(String key, Object value); /// Adds metadata to be passed to build hook invocations of dependent /// packages. + @Deprecated(metadataDeprecation) void addMetadata(Map metadata); /// The version of [BuildOutput]. diff --git a/pkgs/native_assets_cli/lib/src/api/builder.dart b/pkgs/native_assets_cli/lib/src/api/builder.dart index 682ca7de19..e5455bbcaa 100644 --- a/pkgs/native_assets_cli/lib/src/api/builder.dart +++ b/pkgs/native_assets_cli/lib/src/api/builder.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:logging/logging.dart'; import 'build_config.dart'; diff --git a/pkgs/native_assets_cli/lib/src/api/deprecation_messages.dart b/pkgs/native_assets_cli/lib/src/api/deprecation_messages.dart new file mode 100644 index 0000000000..407e547e8b --- /dev/null +++ b/pkgs/native_assets_cli/lib/src/api/deprecation_messages.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +const metadataDeprecation = ''' +Metadata will be reworked to merge concepts with assets. +If you're currently using metadata, please report your use case in the tracking +issue: https://github.com/dart-lang/native/issues/1251. +'''; diff --git a/pkgs/native_assets_cli/lib/src/api/linker.dart b/pkgs/native_assets_cli/lib/src/api/linker.dart index 1cc8e04c9a..1bb080c451 100644 --- a/pkgs/native_assets_cli/lib/src/api/linker.dart +++ b/pkgs/native_assets_cli/lib/src/api/linker.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:logging/logging.dart'; import 'build_output.dart'; diff --git a/pkgs/native_assets_cli/test/api/build_config_test.dart b/pkgs/native_assets_cli/test/api/build_config_test.dart index 20dc884d85..564861c79f 100644 --- a/pkgs/native_assets_cli/test/api/build_config_test.dart +++ b/pkgs/native_assets_cli/test/api/build_config_test.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +// ignore_for_file: deprecated_member_use_from_same_package + import 'dart:io'; import 'package:native_assets_cli/native_assets_cli.dart'; diff --git a/pkgs/native_assets_cli/test/api/build_output_test.dart b/pkgs/native_assets_cli/test/api/build_output_test.dart index 88993a72cd..a8e15d4cdf 100644 --- a/pkgs/native_assets_cli/test/api/build_output_test.dart +++ b/pkgs/native_assets_cli/test/api/build_output_test.dart @@ -41,6 +41,7 @@ void main() { dependencies: [ Uri.file('path/to/file.ext'), ], + // ignore: deprecated_member_use_from_same_package metadata: { 'key': 'value', },