From d2daea21f698110e5f1d1c9941a8389c88b53447 Mon Sep 17 00:00:00 2001 From: Bryan Oltman Date: Fri, 23 Aug 2024 17:59:12 -0400 Subject: [PATCH] chore: move command metadata classes (#2442) --- .github/codecov.yml | 1 + cspell.config.yaml | 201 +++++++++--------- .../lib/src/code_push_client_wrapper.dart | 10 +- .../commands/patch/ios_framework_patcher.dart | 1 + .../lib/src/commands/patch/ios_patcher.dart | 1 + .../lib/src/commands/patch/patch_command.dart | 6 +- .../lib/src/commands/patch/patcher.dart | 1 + .../commands/release/android_releaser.dart | 1 + .../release/ios_framework_releaser.dart | 1 + .../src/commands/release/ios_releaser.dart | 1 + .../src/commands/release/release_command.dart | 5 +- .../lib/src/commands/release/releaser.dart | 1 + .../lib/src/config/shorebird_yaml.dart | 1 - .../lib/src/config/shorebird_yaml.g.dart | 8 + .../metadata}/build_environment_metadata.dart | 0 .../build_environment_metadata.g.dart | 2 +- .../src/metadata}/create_patch_metadata.dart | 3 +- .../metadata}/create_patch_metadata.g.dart | 6 +- .../lib/src/metadata/metadata.dart | 3 + .../metadata}/update_release_metadata.dart | 3 +- .../metadata}/update_release_metadata.g.dart | 4 +- packages/shorebird_cli/pubspec.lock | 2 +- packages/shorebird_cli/pubspec.yaml | 1 + .../src/code_push_client_wrapper_test.dart | 19 +- .../src/commands/patch/aar_patcher_test.dart | 1 + .../commands/patch/android_patcher_test.dart | 1 + .../patch/ios_framework_patcher_test.dart | 1 + .../src/commands/patch/ios_patcher_test.dart | 1 + .../commands/patch/patch_command_test.dart | 3 +- .../test/src/commands/patch/patcher_test.dart | 8 - .../commands/release/aar_releaser_test.dart | 1 + .../release/android_releaser_test.dart | 1 + .../release/ios_framework_releaser_test.dart | 1 + .../commands/release/ios_releaser_test.dart | 1 + .../release/release_command_test.dart | 1 + .../src/commands/release/releaser_test.dart | 2 +- .../build_environment_metadata_test.dart | 3 +- .../metadata}/create_patch_metadata_test.dart | 1 + .../update_release_metadata_test.dart | 1 + .../example/main.dart | 17 +- .../test/src/code_push_client_test.dart | 18 +- .../lib/src/models/models.dart | 3 - .../create_patch_request_test.dart | 21 +- .../update_release_request_test.dart | 14 +- 44 files changed, 187 insertions(+), 195 deletions(-) rename packages/{shorebird_code_push_protocol/lib/src/models => shorebird_cli/lib/src/metadata}/build_environment_metadata.dart (100%) rename packages/{shorebird_code_push_protocol/lib/src/models => shorebird_cli/lib/src/metadata}/build_environment_metadata.g.dart (97%) rename packages/{shorebird_code_push_protocol/lib/src/models => shorebird_cli/lib/src/metadata}/create_patch_metadata.dart (96%) rename packages/{shorebird_code_push_protocol/lib/src/models => shorebird_cli/lib/src/metadata}/create_patch_metadata.g.dart (98%) create mode 100644 packages/shorebird_cli/lib/src/metadata/metadata.dart rename packages/{shorebird_code_push_protocol/lib/src/models => shorebird_cli/lib/src/metadata}/update_release_metadata.dart (96%) rename packages/{shorebird_code_push_protocol/lib/src/models => shorebird_cli/lib/src/metadata}/update_release_metadata.g.dart (97%) rename packages/{shorebird_code_push_protocol/test/src/models => shorebird_cli/test/src/metadata}/build_environment_metadata_test.dart (95%) rename packages/{shorebird_code_push_protocol/test/src/models => shorebird_cli/test/src/metadata}/create_patch_metadata_test.dart (99%) rename packages/{shorebird_code_push_protocol/test/src/models => shorebird_cli/test/src/metadata}/update_release_metadata_test.dart (98%) diff --git a/.github/codecov.yml b/.github/codecov.yml index 3d396f21..7ecb4df0 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -16,6 +16,7 @@ coverage: # and enforce that all changes have 100% coverage of affected lines. ignore: - third_party + - lib/**.g.dart flag_management: default_rules: # the rules that will be followed for any flag added, generally diff --git a/cspell.config.yaml b/cspell.config.yaml index f6c15cc1..a1c4c7f0 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -3,112 +3,113 @@ version: "0.2" ignorePaths: ["coverage", "bin/cache", "third_party", "build", "*.xcscheme", "fixtures"] words: - - pubspec - - podfile + - ANDROIDD - Apks - - metadatas - - logcat - - mktemp - - gradlew - - bundletool - - genhtml - - sideload - - endtemplate - - mocktail - - libapp - - aarch - - codesign - - xcarchive - - xcrun - - vmcode - - xcodebuild - - sideloadable - - bryanoltman - - signup - - lerping - - precache - - devicectl - - exitcode - - writeln - - xcodeproj - - xcschemes - - xcshareddata - - armeabi - - cipd - - canvaskit - - libimobiledevice - - hotreload - - libflutter - - apigee - - pointycastle - - pkcs - - appbundle - - felangel - - bitcode - - xcscheme - - archs - - shorebirdtech - - aapt - - USERPROFILE - - LOCALAPPDATA - - Unpatchable - - multioption - - xcframework - - deflavored - - dylib - - libplist - - usbmuxd - - pwsh - - readlink - - unawaited - - NOAUTH - - WRONGPASS - - FLUSHALL - - pana - - idevicesyslog + - Azul - Entra - - xlink - - propertylistserialization + - FLUSHALL + - LOCALAPPDATA + - NOAUTH + - Oltman + - PRNG + - RSAPKCS - Retryable - - storyboardc - - iphoneos - - lproj - - iokit + - SIGSTOP + - USERPROFILE + - Unpatchable + - VCRUNTIME + - Verdana + - WRONGPASS + - aabs + - aapt + - aarch + - aars # Android Archive + - allprojects # From gradle files + - altool + - apigee + - appbundle + - archs + - armeabi - backboardd - - dyld - bintools + - bitcode + - bryanoltman + - bundletool + - canvaskit + - carryforward + - cipd + - codesign - codesigned - codesigning - - previewable - - udid # Unique Device Identifier - - podspec - - exportoptions - - ANDROIDD - - propertylistserialization - - VCRUNTIME - - Oltman - - xcworkspace - - SIGSTOP - - lldb - - nserror - - sysroot - - RSAPKCS - - PRNG - - sideloaded - - Azul - - altool - - aabs - - upvote - - Verdana - - reinit - - allprojects # From gradle files - - aars # Android Archive - - orri # Arm64 instruction, Or Register with Immediate - - unmockable + - deflavored + - devicectl - dorny # From .github dir, doesn't show up in "**" check? - - requirepass # From .github dir, doesn't show up in "**" check? - - temurin # From .github dir, doesn't show up in "**" check? - - subosito # From .github dir, doesn't show up in "**" check? - - reactivecircus # From .github dir, doesn't show up in "**" check? - - swiftshader # From .github dir, doesn't show up in "**" check? + - dyld + - dylib + - endtemplate + - exitcode + - exportoptions + - felangel + - genhtml + - gradlew + - hotreload + - idevicesyslog + - iokit + - iphoneos + - lerping + - libapp + - libflutter + - libimobiledevice + - libplist + - lldb + - logcat + - lproj + - metadatas + - mktemp + - mocktail + - multioption - noaudio # From .github dir, doesn't show up in "**" check? + - nserror + - orri # Arm64 instruction, Or Register with Immediate + - pana + - pkcs + - podfile + - podspec + - pointycastle + - precache + - previewable + - propertylistserialization + - propertylistserialization + - pubspec + - pwsh + - reactivecircus # From .github dir, doesn't show up in "**" check? + - readlink + - reinit + - requirepass # From .github dir, doesn't show up in "**" check? + - shorebirdtech + - sideload + - sideloadable + - sideloaded + - signup + - storyboardc + - subosito # From .github dir, doesn't show up in "**" check? + - swiftshader # From .github dir, doesn't show up in "**" check? + - sysroot + - temurin # From .github dir, doesn't show up in "**" check? + - udid # Unique Device Identifier + - unawaited + - unmockable + - upvote + - usbmuxd + - vmcode + - writeln + - xcarchive + - xcframework + - xcodebuild + - xcodeproj + - xcrun + - xcscheme + - xcschemes + - xcshareddata + - xcworkspace + - xlink diff --git a/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart b/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart index 4b5c0457..af2db0fa 100644 --- a/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart +++ b/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart @@ -289,7 +289,7 @@ Please create a release using "shorebird release" and try again. required int releaseId, required ReleasePlatform platform, required ReleaseStatus status, - UpdateReleaseMetadata? metadata, + Json? metadata, }) async { final updateStatusProgress = logger.progress('Updating release status'); try { @@ -298,7 +298,7 @@ Please create a release using "shorebird release" and try again. releaseId: releaseId, platform: platform, status: status, - metadata: metadata?.toJson(), + metadata: metadata, ); updateStatusProgress.complete(); } catch (error) { @@ -693,14 +693,14 @@ aar artifact already exists, continuing...''', Future createPatch({ required String appId, required int releaseId, - required CreatePatchMetadata metadata, + required Json metadata, }) async { final createPatchProgress = logger.progress('Creating patch'); try { final patch = await codePushClient.createPatch( appId: appId, releaseId: releaseId, - metadata: metadata.toJson(), + metadata: metadata, ); createPatchProgress.complete(); return patch; @@ -758,7 +758,7 @@ aar artifact already exists, continuing...''', Future publishPatch({ required String appId, required int releaseId, - required CreatePatchMetadata metadata, + required Json metadata, required ReleasePlatform platform, required DeploymentTrack track, required Map patchArtifactBundles, diff --git a/packages/shorebird_cli/lib/src/commands/patch/ios_framework_patcher.dart b/packages/shorebird_cli/lib/src/commands/patch/ios_framework_patcher.dart index ce470035..53646a99 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/ios_framework_patcher.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/ios_framework_patcher.dart @@ -16,6 +16,7 @@ import 'package:shorebird_cli/src/executables/aot_tools.dart'; import 'package:shorebird_cli/src/executables/xcodebuild.dart'; import 'package:shorebird_cli/src/extensions/arg_results.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; diff --git a/packages/shorebird_cli/lib/src/commands/patch/ios_patcher.dart b/packages/shorebird_cli/lib/src/commands/patch/ios_patcher.dart index 90864bc0..6614d105 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/ios_patcher.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/ios_patcher.dart @@ -20,6 +20,7 @@ import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/executables/executables.dart'; import 'package:shorebird_cli/src/extensions/arg_results.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_command.dart index 1d1d81ac..862a3008 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_command.dart @@ -16,6 +16,7 @@ import 'package:shorebird_cli/src/deployment_track.dart'; import 'package:shorebird_cli/src/extensions/arg_results.dart'; import 'package:shorebird_cli/src/formatters/formatters.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; @@ -315,11 +316,14 @@ NOTE: this is ${styleBold.wrap('not')} recommended. Asset changes cannot be incl shorebirdVersion: packageVersion, ), ); + final updateMetadata = await patcher.updatedCreatePatchMetadata( + baseMetadata, + ); await codePushClientWrapper.publishPatch( appId: appId, releaseId: release.id, - metadata: await patcher.updatedCreatePatchMetadata(baseMetadata), + metadata: updateMetadata.toJson(), platform: patcher.releaseType.releasePlatform, track: isStaging ? DeploymentTrack.staging : DeploymentTrack.production, diff --git a/packages/shorebird_cli/lib/src/commands/patch/patcher.dart b/packages/shorebird_cli/lib/src/commands/patch/patcher.dart index e6339809..94ea017a 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patcher.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patcher.dart @@ -8,6 +8,7 @@ import 'package:path/path.dart' as p; import 'package:shorebird_cli/src/code_push_client_wrapper.dart'; import 'package:shorebird_cli/src/common_arguments.dart'; import 'package:shorebird_cli/src/extensions/iterable.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; diff --git a/packages/shorebird_cli/lib/src/commands/release/android_releaser.dart b/packages/shorebird_cli/lib/src/commands/release/android_releaser.dart index 93451457..0747261b 100644 --- a/packages/shorebird_cli/lib/src/commands/release/android_releaser.dart +++ b/packages/shorebird_cli/lib/src/commands/release/android_releaser.dart @@ -8,6 +8,7 @@ import 'package:shorebird_cli/src/commands/release/releaser.dart'; import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/extensions/arg_results.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; import 'package:shorebird_cli/src/shorebird_android_artifacts.dart'; diff --git a/packages/shorebird_cli/lib/src/commands/release/ios_framework_releaser.dart b/packages/shorebird_cli/lib/src/commands/release/ios_framework_releaser.dart index a70d8c45..49ace4f1 100644 --- a/packages/shorebird_cli/lib/src/commands/release/ios_framework_releaser.dart +++ b/packages/shorebird_cli/lib/src/commands/release/ios_framework_releaser.dart @@ -12,6 +12,7 @@ import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/executables/xcodebuild.dart'; import 'package:shorebird_cli/src/extensions/arg_results.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/release_type.dart'; import 'package:shorebird_cli/src/shorebird_env.dart'; import 'package:shorebird_cli/src/shorebird_flutter.dart'; diff --git a/packages/shorebird_cli/lib/src/commands/release/ios_releaser.dart b/packages/shorebird_cli/lib/src/commands/release/ios_releaser.dart index bcfeb2ad..712bca6e 100644 --- a/packages/shorebird_cli/lib/src/commands/release/ios_releaser.dart +++ b/packages/shorebird_cli/lib/src/commands/release/ios_releaser.dart @@ -14,6 +14,7 @@ import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/executables/xcodebuild.dart'; import 'package:shorebird_cli/src/extensions/arg_results.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/platform/ios.dart'; import 'package:shorebird_cli/src/release_type.dart'; import 'package:shorebird_cli/src/shorebird_documentation.dart'; diff --git a/packages/shorebird_cli/lib/src/commands/release/release_command.dart b/packages/shorebird_cli/lib/src/commands/release/release_command.dart index 285dca9f..96ec5500 100644 --- a/packages/shorebird_cli/lib/src/commands/release/release_command.dart +++ b/packages/shorebird_cli/lib/src/commands/release/release_command.dart @@ -11,6 +11,7 @@ import 'package:shorebird_cli/src/config/config.dart'; import 'package:shorebird_cli/src/extensions/arg_results.dart'; import 'package:shorebird_cli/src/extensions/version.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/platform.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; @@ -488,13 +489,13 @@ ${summary.join('\n')} shorebirdVersion: packageVersion, ), ); - + final updatedMetadata = await releaser.updatedReleaseMetadata(baseMetadata); await codePushClientWrapper.updateReleaseStatus( appId: appId, releaseId: release.id, platform: releaser.releaseType.releasePlatform, status: ReleaseStatus.active, - metadata: await releaser.updatedReleaseMetadata(baseMetadata), + metadata: updatedMetadata.toJson(), ); } diff --git a/packages/shorebird_cli/lib/src/commands/release/releaser.dart b/packages/shorebird_cli/lib/src/commands/release/releaser.dart index 2fbb9956..4378f250 100644 --- a/packages/shorebird_cli/lib/src/commands/release/releaser.dart +++ b/packages/shorebird_cli/lib/src/commands/release/releaser.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:args/args.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/release_type.dart'; import 'package:shorebird_cli/src/shorebird_env.dart'; import 'package:shorebird_code_push_client/shorebird_code_push_client.dart'; diff --git a/packages/shorebird_cli/lib/src/config/shorebird_yaml.dart b/packages/shorebird_cli/lib/src/config/shorebird_yaml.dart index a7003349..3d8854e9 100644 --- a/packages/shorebird_cli/lib/src/config/shorebird_yaml.dart +++ b/packages/shorebird_cli/lib/src/config/shorebird_yaml.dart @@ -8,7 +8,6 @@ part 'shorebird_yaml.g.dart'; @JsonSerializable( anyMap: true, disallowUnrecognizedKeys: true, - createToJson: false, ) class ShorebirdYaml { /// {@macro shorebird_yaml} diff --git a/packages/shorebird_cli/lib/src/config/shorebird_yaml.g.dart b/packages/shorebird_cli/lib/src/config/shorebird_yaml.g.dart index 73d00d07..0d8620c5 100644 --- a/packages/shorebird_cli/lib/src/config/shorebird_yaml.g.dart +++ b/packages/shorebird_cli/lib/src/config/shorebird_yaml.g.dart @@ -34,3 +34,11 @@ ShorebirdYaml _$ShorebirdYamlFromJson(Map json) => $checkedCreate( 'autoUpdate': 'auto_update' }, ); + +Map _$ShorebirdYamlToJson(ShorebirdYaml instance) => + { + 'app_id': instance.appId, + 'flavors': instance.flavors, + 'base_url': instance.baseUrl, + 'auto_update': instance.autoUpdate, + }; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/build_environment_metadata.dart b/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.dart similarity index 100% rename from packages/shorebird_code_push_protocol/lib/src/models/build_environment_metadata.dart rename to packages/shorebird_cli/lib/src/metadata/build_environment_metadata.dart diff --git a/packages/shorebird_code_push_protocol/lib/src/models/build_environment_metadata.g.dart b/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.g.dart similarity index 97% rename from packages/shorebird_code_push_protocol/lib/src/models/build_environment_metadata.g.dart rename to packages/shorebird_cli/lib/src/metadata/build_environment_metadata.g.dart index 1b67bbff..cc1e3a22 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/build_environment_metadata.g.dart +++ b/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars +// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars, strict_raw_type, unnecessary_lambdas part of 'build_environment_metadata.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/create_patch_metadata.dart b/packages/shorebird_cli/lib/src/metadata/create_patch_metadata.dart similarity index 96% rename from packages/shorebird_code_push_protocol/lib/src/models/create_patch_metadata.dart rename to packages/shorebird_cli/lib/src/metadata/create_patch_metadata.dart index f2936aaa..a428abfc 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/create_patch_metadata.dart +++ b/packages/shorebird_cli/lib/src/metadata/create_patch_metadata.dart @@ -1,6 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:shorebird_code_push_protocol/src/models/models.dart'; +import 'package:shorebird_cli/src/metadata/build_environment_metadata.dart'; +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; part 'create_patch_metadata.g.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/create_patch_metadata.g.dart b/packages/shorebird_cli/lib/src/metadata/create_patch_metadata.g.dart similarity index 98% rename from packages/shorebird_code_push_protocol/lib/src/models/create_patch_metadata.g.dart rename to packages/shorebird_cli/lib/src/metadata/create_patch_metadata.g.dart index e30c8f4e..e6d26375 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/create_patch_metadata.g.dart +++ b/packages/shorebird_cli/lib/src/metadata/create_patch_metadata.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars +// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars, strict_raw_type, unnecessary_lambdas part of 'create_patch_metadata.dart'; @@ -24,12 +24,12 @@ CreatePatchMetadata _$CreatePatchMetadataFromJson(Map json) => 'used_ignore_native_changes_flag', (v) => v as bool), hasNativeChanges: $checkedConvert('has_native_changes', (v) => v as bool), - linkPercentage: $checkedConvert( - 'link_percentage', (v) => (v as num?)?.toDouble()), environment: $checkedConvert( 'environment', (v) => BuildEnvironmentMetadata.fromJson(v as Map)), + linkPercentage: $checkedConvert( + 'link_percentage', (v) => (v as num?)?.toDouble()), ); return val; }, diff --git a/packages/shorebird_cli/lib/src/metadata/metadata.dart b/packages/shorebird_cli/lib/src/metadata/metadata.dart new file mode 100644 index 00000000..b6863f17 --- /dev/null +++ b/packages/shorebird_cli/lib/src/metadata/metadata.dart @@ -0,0 +1,3 @@ +export 'build_environment_metadata.dart'; +export 'create_patch_metadata.dart'; +export 'update_release_metadata.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/update_release_metadata.dart b/packages/shorebird_cli/lib/src/metadata/update_release_metadata.dart similarity index 96% rename from packages/shorebird_code_push_protocol/lib/src/models/update_release_metadata.dart rename to packages/shorebird_cli/lib/src/metadata/update_release_metadata.dart index 337a2562..15acc86f 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/update_release_metadata.dart +++ b/packages/shorebird_cli/lib/src/metadata/update_release_metadata.dart @@ -1,6 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; -import 'package:shorebird_code_push_protocol/src/models/models.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; part 'update_release_metadata.g.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/update_release_metadata.g.dart b/packages/shorebird_cli/lib/src/metadata/update_release_metadata.g.dart similarity index 97% rename from packages/shorebird_code_push_protocol/lib/src/models/update_release_metadata.g.dart rename to packages/shorebird_cli/lib/src/metadata/update_release_metadata.g.dart index e15205d1..fcae5306 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/update_release_metadata.g.dart +++ b/packages/shorebird_cli/lib/src/metadata/update_release_metadata.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars +// ignore_for_file: implicit_dynamic_parameter, require_trailing_commas, cast_nullable_to_non_nullable, lines_longer_than_80_chars, strict_raw_type, unnecessary_lambdas part of 'update_release_metadata.dart'; @@ -19,11 +19,11 @@ UpdateReleaseMetadata _$UpdateReleaseMetadataFromJson( (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), flutterVersionOverride: $checkedConvert('flutter_version_override', (v) => v as String?), - generatedApks: $checkedConvert('generated_apks', (v) => v as bool?), environment: $checkedConvert( 'environment', (v) => BuildEnvironmentMetadata.fromJson(v as Map)), + generatedApks: $checkedConvert('generated_apks', (v) => v as bool?), ); return val; }, diff --git a/packages/shorebird_cli/pubspec.lock b/packages/shorebird_cli/pubspec.lock index 1444c3fd..3ee55a44 100644 --- a/packages/shorebird_cli/pubspec.lock +++ b/packages/shorebird_cli/pubspec.lock @@ -242,7 +242,7 @@ packages: source: hosted version: "3.0.2" equatable: - dependency: transitive + dependency: "direct main" description: name: equatable sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 diff --git a/packages/shorebird_cli/pubspec.yaml b/packages/shorebird_cli/pubspec.yaml index 7ac0fd27..bef28e5b 100644 --- a/packages/shorebird_cli/pubspec.yaml +++ b/packages/shorebird_cli/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: cli_util: ^0.4.1 collection: ^1.18.0 crypto: ^3.0.5 + equatable: ^2.0.5 googleapis_auth: ^1.6.0 http: ^1.2.1 intl: ^0.19.0 diff --git a/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart b/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart index 5e6018ac..c6d4109c 100644 --- a/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart +++ b/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart @@ -35,7 +35,6 @@ void main() { late ShorebirdFlutter shorebirdFlutter; setUpAll(() { - registerFallbackValue(CreatePatchMetadata.forTest()); registerFallbackValue(FakeBaseRequest()); }); @@ -1972,7 +1971,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' releaseId: releaseId, platform: releasePlatform, status: ReleaseStatus.active, - metadata: UpdateReleaseMetadata.forTest(), + metadata: {'foo': 'bar'}, ), ); @@ -1982,7 +1981,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' releaseId: releaseId, platform: releasePlatform, status: ReleaseStatus.active, - metadata: UpdateReleaseMetadata.forTest().toJson(), + metadata: {'foo': 'bar'}, ), ).called(1); verify(() => progress.complete()).called(1); @@ -2007,7 +2006,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' () => codePushClientWrapper.createPatch( appId: appId, releaseId: releaseId, - metadata: CreatePatchMetadata.forTest(), + metadata: {'foo': 'bar'}, ), ), exitsWithCode(ExitCode.software), @@ -2028,7 +2027,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' () => codePushClientWrapper.createPatch( appId: appId, releaseId: releaseId, - metadata: CreatePatchMetadata.forTest(), + metadata: {'foo': 'bar'}, ), ); @@ -2188,7 +2187,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' platform: releasePlatform, track: track, patchArtifactBundles: patchArtifactBundles, - metadata: CreatePatchMetadata.forTest(), + metadata: {'foo': 'bar'}, ), ); @@ -2196,7 +2195,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' () => codePushClient.createPatch( appId: appId, releaseId: releaseId, - metadata: CreatePatchMetadata.forTest().toJson(), + metadata: {'foo': 'bar'}, ), ).called(1); verify( @@ -2244,7 +2243,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' platform: releasePlatform, track: track, patchArtifactBundles: patchArtifactBundles, - metadata: CreatePatchMetadata.forTest(), + metadata: {'foo': 'bar'}, ), ); @@ -2252,7 +2251,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' () => codePushClient.createPatch( appId: appId, releaseId: releaseId, - metadata: CreatePatchMetadata.forTest().toJson(), + metadata: {'foo': 'bar'}, ), ).called(1); verify( @@ -2289,7 +2288,7 @@ You can manage this release in the ${link(uri: uri, message: 'Shorebird Console' platform: releasePlatform, track: track, patchArtifactBundles: patchArtifactBundles, - metadata: CreatePatchMetadata.forTest(), + metadata: {'foo': 'bar'}, ), ); diff --git a/packages/shorebird_cli/test/src/commands/patch/aar_patcher_test.dart b/packages/shorebird_cli/test/src/commands/patch/aar_patcher_test.dart index f8d81e38..d40b353a 100644 --- a/packages/shorebird_cli/test/src/commands/patch/aar_patcher_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/aar_patcher_test.dart @@ -12,6 +12,7 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart'; import 'package:shorebird_cli/src/commands/patch/patch.dart'; import 'package:shorebird_cli/src/engine_config.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; diff --git a/packages/shorebird_cli/test/src/commands/patch/android_patcher_test.dart b/packages/shorebird_cli/test/src/commands/patch/android_patcher_test.dart index e78b6220..b5e14ef0 100644 --- a/packages/shorebird_cli/test/src/commands/patch/android_patcher_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/android_patcher_test.dart @@ -16,6 +16,7 @@ import 'package:shorebird_cli/src/common_arguments.dart'; import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/engine_config.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/shorebird_android_artifacts.dart'; diff --git a/packages/shorebird_cli/test/src/commands/patch/ios_framework_patcher_test.dart b/packages/shorebird_cli/test/src/commands/patch/ios_framework_patcher_test.dart index 9b3f0b1c..f5279258 100644 --- a/packages/shorebird_cli/test/src/commands/patch/ios_framework_patcher_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/ios_framework_patcher_test.dart @@ -17,6 +17,7 @@ import 'package:shorebird_cli/src/engine_config.dart'; import 'package:shorebird_cli/src/executables/aot_tools.dart'; import 'package:shorebird_cli/src/executables/xcodebuild.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/os/operating_system_interface.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; diff --git a/packages/shorebird_cli/test/src/commands/patch/ios_patcher_test.dart b/packages/shorebird_cli/test/src/commands/patch/ios_patcher_test.dart index 0da629f2..b2a4cf0b 100644 --- a/packages/shorebird_cli/test/src/commands/patch/ios_patcher_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/ios_patcher_test.dart @@ -21,6 +21,7 @@ import 'package:shorebird_cli/src/engine_config.dart'; import 'package:shorebird_cli/src/executables/aot_tools.dart'; import 'package:shorebird_cli/src/executables/xcodebuild.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/os/operating_system_interface.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_command_test.dart index 7ac4113f..def4b81d 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_command_test.dart @@ -16,6 +16,7 @@ import 'package:shorebird_cli/src/config/config.dart'; import 'package:shorebird_cli/src/deployment_track.dart'; import 'package:shorebird_cli/src/executables/executables.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; @@ -604,7 +605,7 @@ void main() { () => codePushClientWrapper.publishPatch( appId: appId, releaseId: release.id, - metadata: patchMetadata, + metadata: patchMetadata.toJson(), platform: releasePlatform, patchArtifactBundles: any(named: 'patchArtifactBundles'), track: DeploymentTrack.production, diff --git a/packages/shorebird_cli/test/src/commands/patch/patcher_test.dart b/packages/shorebird_cli/test/src/commands/patch/patcher_test.dart index 67f9171d..cc9c2ca7 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patcher_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patcher_test.dart @@ -8,7 +8,6 @@ import 'package:shorebird_cli/src/common_arguments.dart'; import 'package:shorebird_cli/src/patch_diff_checker.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; -import 'package:shorebird_code_push_protocol/src/models/create_patch_metadata.dart'; import 'package:shorebird_code_push_protocol/src/models/release_artifact.dart'; import 'package:test/test.dart'; @@ -192,13 +191,6 @@ class _TestPatcher extends Patcher { throw UnimplementedError(); } - @override - Future updatedCreatePatchMetadata( - CreatePatchMetadata metadata, - ) { - throw UnimplementedError(); - } - @override Future extractReleaseVersionFromArtifact(File artifact) { throw UnimplementedError(); diff --git a/packages/shorebird_cli/test/src/commands/release/aar_releaser_test.dart b/packages/shorebird_cli/test/src/commands/release/aar_releaser_test.dart index e092e3e9..f767336f 100644 --- a/packages/shorebird_cli/test/src/commands/release/aar_releaser_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/aar_releaser_test.dart @@ -10,6 +10,7 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart'; import 'package:shorebird_cli/src/commands/release/aar_releaser.dart'; import 'package:shorebird_cli/src/engine_config.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/os/operating_system_interface.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; diff --git a/packages/shorebird_cli/test/src/commands/release/android_releaser_test.dart b/packages/shorebird_cli/test/src/commands/release/android_releaser_test.dart index 5461877b..1d748b9d 100644 --- a/packages/shorebird_cli/test/src/commands/release/android_releaser_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/android_releaser_test.dart @@ -13,6 +13,7 @@ import 'package:shorebird_cli/src/common_arguments.dart'; import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/engine_config.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/os/operating_system_interface.dart'; import 'package:shorebird_cli/src/platform/platform.dart'; import 'package:shorebird_cli/src/release_type.dart'; diff --git a/packages/shorebird_cli/test/src/commands/release/ios_framework_releaser_test.dart b/packages/shorebird_cli/test/src/commands/release/ios_framework_releaser_test.dart index 40efe4b2..32ef2bdd 100644 --- a/packages/shorebird_cli/test/src/commands/release/ios_framework_releaser_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/ios_framework_releaser_test.dart @@ -13,6 +13,7 @@ import 'package:shorebird_cli/src/commands/release/ios_framework_releaser.dart'; import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/executables/executables.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/os/operating_system_interface.dart'; import 'package:shorebird_cli/src/release_type.dart'; import 'package:shorebird_cli/src/shorebird_env.dart'; diff --git a/packages/shorebird_cli/test/src/commands/release/ios_releaser_test.dart b/packages/shorebird_cli/test/src/commands/release/ios_releaser_test.dart index 179c575e..7fdc49a9 100644 --- a/packages/shorebird_cli/test/src/commands/release/ios_releaser_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/ios_releaser_test.dart @@ -17,6 +17,7 @@ import 'package:shorebird_cli/src/common_arguments.dart'; import 'package:shorebird_cli/src/doctor.dart'; import 'package:shorebird_cli/src/executables/xcodebuild.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/os/operating_system_interface.dart'; import 'package:shorebird_cli/src/platform/ios.dart'; import 'package:shorebird_cli/src/release_type.dart'; diff --git a/packages/shorebird_cli/test/src/commands/release/release_command_test.dart b/packages/shorebird_cli/test/src/commands/release/release_command_test.dart index 9810fce7..abbc9f27 100644 --- a/packages/shorebird_cli/test/src/commands/release/release_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/release_command_test.dart @@ -11,6 +11,7 @@ import 'package:shorebird_cli/src/commands/release/release.dart'; import 'package:shorebird_cli/src/common_arguments.dart'; import 'package:shorebird_cli/src/config/config.dart'; import 'package:shorebird_cli/src/logger.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/release_type.dart'; import 'package:shorebird_cli/src/shorebird_env.dart'; import 'package:shorebird_cli/src/shorebird_flutter.dart'; diff --git a/packages/shorebird_cli/test/src/commands/release/releaser_test.dart b/packages/shorebird_cli/test/src/commands/release/releaser_test.dart index 306c1145..7bd848d0 100644 --- a/packages/shorebird_cli/test/src/commands/release/releaser_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/releaser_test.dart @@ -1,9 +1,9 @@ import 'dart:io'; import 'package:shorebird_cli/src/commands/release/releaser.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_cli/src/release_type.dart'; import 'package:shorebird_code_push_protocol/src/models/release.dart'; -import 'package:shorebird_code_push_protocol/src/models/update_release_metadata.dart'; import 'package:test/test.dart'; import '../../mocks.dart'; diff --git a/packages/shorebird_code_push_protocol/test/src/models/build_environment_metadata_test.dart b/packages/shorebird_cli/test/src/metadata/build_environment_metadata_test.dart similarity index 95% rename from packages/shorebird_code_push_protocol/test/src/models/build_environment_metadata_test.dart rename to packages/shorebird_cli/test/src/metadata/build_environment_metadata_test.dart index bcdf1c51..db5a5c9c 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/build_environment_metadata_test.dart +++ b/packages/shorebird_cli/test/src/metadata/build_environment_metadata_test.dart @@ -1,5 +1,4 @@ -import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; -import 'package:shorebird_code_push_protocol/src/models/build_environment_metadata.dart'; +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/shorebird_code_push_protocol/test/src/models/create_patch_metadata_test.dart b/packages/shorebird_cli/test/src/metadata/create_patch_metadata_test.dart similarity index 99% rename from packages/shorebird_code_push_protocol/test/src/models/create_patch_metadata_test.dart rename to packages/shorebird_cli/test/src/metadata/create_patch_metadata_test.dart index ff190feb..364d077b 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/create_patch_metadata_test.dart +++ b/packages/shorebird_cli/test/src/metadata/create_patch_metadata_test.dart @@ -1,3 +1,4 @@ +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; import 'package:test/test.dart'; diff --git a/packages/shorebird_code_push_protocol/test/src/models/update_release_metadata_test.dart b/packages/shorebird_cli/test/src/metadata/update_release_metadata_test.dart similarity index 98% rename from packages/shorebird_code_push_protocol/test/src/models/update_release_metadata_test.dart rename to packages/shorebird_cli/test/src/metadata/update_release_metadata_test.dart index 7216ec77..381cae75 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/update_release_metadata_test.dart +++ b/packages/shorebird_cli/test/src/metadata/update_release_metadata_test.dart @@ -1,3 +1,4 @@ +import 'package:shorebird_cli/src/metadata/metadata.dart'; import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; import 'package:test/test.dart'; diff --git a/packages/shorebird_code_push_client/example/main.dart b/packages/shorebird_code_push_client/example/main.dart index 20867513..28be909b 100644 --- a/packages/shorebird_code_push_client/example/main.dart +++ b/packages/shorebird_code_push_client/example/main.dart @@ -44,19 +44,10 @@ Future main() async { final patch = await client.createPatch( appId: app.id, releaseId: release.id, - metadata: const CreatePatchMetadata( - releasePlatform: ReleasePlatform.android, - usedIgnoreAssetChangesFlag: false, - hasAssetChanges: false, - usedIgnoreNativeChangesFlag: false, - hasNativeChanges: false, - environment: BuildEnvironmentMetadata( - flutterRevision: '', // e.g. '83305b5088e6' - operatingSystem: 'Windows', - operatingSystemVersion: '10', - shorebirdVersion: '1.2.3', - ), - ).toJson(), + metadata: { + 'releasePlatform': 'android', + 'usedIgnoreAssetChangesFlag': false, + }, ); // Create a patch artifact. diff --git a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart index 30da2c53..fac28b01 100644 --- a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart +++ b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart @@ -905,13 +905,11 @@ void main() { const releaseId = 0; test('makes the correct request', () async { - codePushClient - .createPatch( - appId: appId, - releaseId: releaseId, - metadata: CreatePatchMetadata.forTest().toJson(), - ) - .ignore(); + codePushClient.createPatch( + appId: appId, + releaseId: releaseId, + metadata: {'foo': 'bar'}, + ).ignore(); final request = verify(() => httpClient.send(captureAny())) .captured .single as http.BaseRequest; @@ -932,7 +930,7 @@ void main() { codePushClient.createPatch( appId: appId, releaseId: releaseId, - metadata: CreatePatchMetadata.forTest().toJson(), + metadata: {'foo': 'bar'}, ), throwsA( isA().having( @@ -956,7 +954,7 @@ void main() { codePushClient.createPatch( appId: appId, releaseId: releaseId, - metadata: CreatePatchMetadata.forTest().toJson(), + metadata: {'foo': 'bar'}, ), throwsA( isA().having( @@ -986,7 +984,7 @@ void main() { codePushClient.createPatch( appId: appId, releaseId: releaseId, - metadata: CreatePatchMetadata.forTest().toJson(), + metadata: {'foo': 'bar'}, ), completion( equals( diff --git a/packages/shorebird_code_push_protocol/lib/src/models/models.dart b/packages/shorebird_code_push_protocol/lib/src/models/models.dart index 0dac0a14..9d97941c 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/models.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/models.dart @@ -1,9 +1,7 @@ export 'app.dart'; export 'app_metadata.dart'; export 'auth_provider.dart'; -export 'build_environment_metadata.dart'; export 'channel.dart'; -export 'create_patch_metadata.dart'; export 'error_response.dart'; export 'patch.dart'; export 'patch_artifact.dart'; @@ -13,5 +11,4 @@ export 'release_artifact.dart'; export 'release_patch.dart'; export 'release_platform.dart'; export 'release_status.dart'; -export 'update_release_metadata.dart'; export 'user.dart'; diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_request_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_request_test.dart index ab0ab6a5..cbb735b3 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_request_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_patch/create_patch_request_test.dart @@ -4,22 +4,9 @@ import 'package:test/test.dart'; void main() { group(CreatePatchRequest, () { test('can be (de)serialized', () { - final request = CreatePatchRequest( + const request = CreatePatchRequest( releaseId: 1234, - metadata: const CreatePatchMetadata( - releasePlatform: ReleasePlatform.android, - usedIgnoreAssetChangesFlag: true, - usedIgnoreNativeChangesFlag: false, - hasAssetChanges: true, - hasNativeChanges: false, - linkPercentage: 99.9, - environment: BuildEnvironmentMetadata( - flutterRevision: '853d13d954df3b6e9c2f07b72062f33c52a9a64b', - operatingSystem: 'linux', - operatingSystemVersion: '1.0.0', - shorebirdVersion: '1.2.3', - ), - ).toJson(), + metadata: {'foo': 'bar'}, ); expect( CreatePatchRequest.fromJson(request.toJson()).toJson(), @@ -28,9 +15,9 @@ void main() { }); test('can be (de)serialized without metadata', () { - final request = CreatePatchRequest( + const request = CreatePatchRequest( releaseId: 1234, - metadata: CreatePatchMetadata.forTest().toJson(), + metadata: {'foo': 'bar'}, ); expect( CreatePatchRequest.fromJson(request.toJson()).toJson(), diff --git a/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart index c3007714..b7e45f3b 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart @@ -4,20 +4,10 @@ import 'package:test/test.dart'; void main() { group(UpdateReleaseRequest, () { test('can be (de)serialized', () { - final request = UpdateReleaseRequest( + const request = UpdateReleaseRequest( platform: ReleasePlatform.android, status: ReleaseStatus.active, - metadata: const UpdateReleaseMetadata( - releasePlatform: ReleasePlatform.ios, - flutterVersionOverride: null, - environment: BuildEnvironmentMetadata( - flutterRevision: '853d13d954df3b6e9c2f07b72062f33c52a9a64b', - operatingSystem: 'macos', - operatingSystemVersion: '11.1', - shorebirdVersion: '1.2.3', - xcodeVersion: '15.3', - ), - ).toJson(), + metadata: {'foo': 'bar'}, ); expect( UpdateReleaseRequest.fromJson(request.toJson()).toJson(),