From 2ec5af7cf6d9fd36b04edffde428c32e4ef37004 Mon Sep 17 00:00:00 2001 From: Bryan Oltman Date: Thu, 20 Nov 2025 14:45:51 -0500 Subject: [PATCH] feat(shorebird_cli): add uses_shorebird_code_push_package to patch and release metadata (#3393) --- .../lib/src/commands/patch/patch_command.dart | 2 + .../src/commands/release/release_command.dart | 1 + .../metadata/build_environment_metadata.dart | 13 +++++ .../build_environment_metadata.g.dart | 6 +++ .../shorebird_cli/lib/src/shorebird_env.dart | 6 +++ .../src/commands/patch/aar_patcher_test.dart | 1 + .../commands/patch/android_patcher_test.dart | 1 + .../patch/ios_framework_patcher_test.dart | 4 ++ .../src/commands/patch/ios_patcher_test.dart | 4 ++ .../commands/patch/macos_patcher_test.dart | 2 + .../commands/patch/patch_command_test.dart | 1 + .../release/android_releaser_test.dart | 3 ++ .../release/ios_framework_releaser_test.dart | 2 + .../commands/release/ios_releaser_test.dart | 2 + .../commands/release/macos_releaser_test.dart | 2 + .../release/release_command_test.dart | 1 + .../build_environment_metadata_test.dart | 27 ++++++---- .../metadata/create_patch_metadata_test.dart | 25 ++++++--- .../update_release_metadata_test.dart | 9 ++++ .../test/src/shorebird_env_test.dart | 53 +++++++++++++++++++ 20 files changed, 148 insertions(+), 17 deletions(-) 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 a3d6fdca..d5305339 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_command.dart @@ -453,6 +453,8 @@ Building patch with Flutter $flutterVersionString operatingSystemVersion: platform.operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: shorebirdEnv.getShorebirdYaml()!, + usesShorebirdCodePushPackage: + shorebirdEnv.usesShorebirdCodePushPackage, ), ); final updateMetadata = await patcher.updatedCreatePatchMetadata( 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 87256a68..5c0465f4 100644 --- a/packages/shorebird_cli/lib/src/commands/release/release_command.dart +++ b/packages/shorebird_cli/lib/src/commands/release/release_command.dart @@ -570,6 +570,7 @@ ${summary.join('\n')} operatingSystemVersion: platform.operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: shorebirdEnv.getShorebirdYaml()!, + usesShorebirdCodePushPackage: shorebirdEnv.usesShorebirdCodePushPackage, ), ); final updatedMetadata = await releaser.updatedReleaseMetadata(baseMetadata); diff --git a/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.dart b/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.dart index e0d07f5b..5101dee9 100644 --- a/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.dart +++ b/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.dart @@ -23,6 +23,7 @@ class BuildEnvironmentMetadata extends Equatable { required this.operatingSystem, required this.operatingSystemVersion, required this.shorebirdYaml, + required this.usesShorebirdCodePushPackage, this.xcodeVersion, }); @@ -35,6 +36,7 @@ class BuildEnvironmentMetadata extends Equatable { String operatingSystem = 'macos', String operatingSystemVersion = '1.2.3', ShorebirdYaml shorebirdYaml = const ShorebirdYaml(appId: '123'), + bool usesShorebirdCodePushPackage = false, String? xcodeVersion = '15.0', }) => BuildEnvironmentMetadata( flutterRevision: flutterRevision, @@ -42,6 +44,7 @@ class BuildEnvironmentMetadata extends Equatable { operatingSystem: operatingSystem, operatingSystemVersion: operatingSystemVersion, shorebirdYaml: shorebirdYaml, + usesShorebirdCodePushPackage: usesShorebirdCodePushPackage, xcodeVersion: xcodeVersion, ); // coverage:ignore-end @@ -61,6 +64,7 @@ class BuildEnvironmentMetadata extends Equatable { String? operatingSystem, String? operatingSystemVersion, ShorebirdYaml? shorebirdYaml, + bool? usesShorebirdCodePushPackage, String? xcodeVersion, }) => BuildEnvironmentMetadata( flutterRevision: flutterRevision ?? this.flutterRevision, @@ -69,6 +73,8 @@ class BuildEnvironmentMetadata extends Equatable { operatingSystemVersion: operatingSystemVersion ?? this.operatingSystemVersion, shorebirdYaml: shorebirdYaml ?? this.shorebirdYaml, + usesShorebirdCodePushPackage: + usesShorebirdCodePushPackage ?? this.usesShorebirdCodePushPackage, xcodeVersion: xcodeVersion ?? this.xcodeVersion, ); @@ -99,6 +105,12 @@ class BuildEnvironmentMetadata extends Equatable { /// The shorebird.yaml file for this project. final ShorebirdYaml shorebirdYaml; + /// Whether the project uses package:shorebird_code_push. + /// + /// Reason: this helps us understand which projects are using the Shorebird + /// CodePush package and better support customers who encounter issues. + final bool usesShorebirdCodePushPackage; + /// The version of Xcode used to build the patch. Only provided for iOS /// patches. /// @@ -113,6 +125,7 @@ class BuildEnvironmentMetadata extends Equatable { operatingSystem, operatingSystemVersion, shorebirdYaml, + usesShorebirdCodePushPackage, xcodeVersion, ]; } diff --git a/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.g.dart b/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.g.dart index f7e4f5e3..59644d41 100644 --- a/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.g.dart +++ b/packages/shorebird_cli/lib/src/metadata/build_environment_metadata.g.dart @@ -29,6 +29,10 @@ BuildEnvironmentMetadata _$BuildEnvironmentMetadataFromJson( 'shorebird_yaml', (v) => ShorebirdYaml.fromJson(v as Map), ), + usesShorebirdCodePushPackage: $checkedConvert( + 'uses_shorebird_code_push_package', + (v) => v as bool, + ), xcodeVersion: $checkedConvert('xcode_version', (v) => v as String?), ); return val; @@ -39,6 +43,7 @@ BuildEnvironmentMetadata _$BuildEnvironmentMetadataFromJson( 'operatingSystem': 'operating_system', 'operatingSystemVersion': 'operating_system_version', 'shorebirdYaml': 'shorebird_yaml', + 'usesShorebirdCodePushPackage': 'uses_shorebird_code_push_package', 'xcodeVersion': 'xcode_version', }, ); @@ -51,5 +56,6 @@ Map _$BuildEnvironmentMetadataToJson( 'operating_system': instance.operatingSystem, 'operating_system_version': instance.operatingSystemVersion, 'shorebird_yaml': instance.shorebirdYaml.toJson(), + 'uses_shorebird_code_push_package': instance.usesShorebirdCodePushPackage, 'xcode_version': instance.xcodeVersion, }; diff --git a/packages/shorebird_cli/lib/src/shorebird_env.dart b/packages/shorebird_cli/lib/src/shorebird_env.dart index 84e6cd5e..317cb8bb 100644 --- a/packages/shorebird_cli/lib/src/shorebird_env.dart +++ b/packages/shorebird_cli/lib/src/shorebird_env.dart @@ -69,6 +69,12 @@ class ShorebirdEnv { ).readAsStringSync().trim(); } + /// Whether the project uses package:shorebird_code_push. + bool get usesShorebirdCodePushPackage { + final pubspec = getPubspecYaml(); + return pubspec?.dependencies.containsKey('shorebird_code_push') ?? false; + } + /// The root of the Shorebird-vended Flutter git checkout. Directory get flutterDirectory { return Directory( 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 cc03be87..09516273 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 @@ -634,6 +634,7 @@ void main() { operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, ), ); 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 de8c31cd..6fb89b39 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 @@ -736,6 +736,7 @@ Looked in: operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, ), ); 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 32bd5a0c..c048cb6e 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 @@ -1023,6 +1023,7 @@ void main() { operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, ), ); @@ -1044,6 +1045,7 @@ void main() { operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, xcodeVersion: xcodeVersion, ), ), @@ -1076,6 +1078,7 @@ void main() { operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, ), ); @@ -1099,6 +1102,7 @@ void main() { operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, xcodeVersion: xcodeVersion, ), ), 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 7d980c3c..ee18a121 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 @@ -1540,6 +1540,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}'''), operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, ), ); @@ -1561,6 +1562,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}'''), operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: xcodeVersion, ), ), @@ -1593,6 +1595,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}'''), operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, ), ); @@ -1616,6 +1619,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}'''), operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, xcodeVersion: xcodeVersion, + usesShorebirdCodePushPackage: false, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), ), ), diff --git a/packages/shorebird_cli/test/src/commands/patch/macos_patcher_test.dart b/packages/shorebird_cli/test/src/commands/patch/macos_patcher_test.dart index 1effbeeb..f6ad8c80 100644 --- a/packages/shorebird_cli/test/src/commands/patch/macos_patcher_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/macos_patcher_test.dart @@ -1158,6 +1158,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}'''), operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, ), ); @@ -1178,6 +1179,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}'''), shorebirdVersion: packageVersion, xcodeVersion: xcodeVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, ), ), ), 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 a7a0cc04..194cb9ce 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 @@ -313,6 +313,7 @@ void main() { return shorebirdEnv; }); when(() => shorebirdEnv.canAcceptUserInput).thenReturn(true); + when(() => shorebirdEnv.usesShorebirdCodePushPackage).thenReturn(false); when( () => shorebirdFlutter.getVersionAndRevision(), 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 a6efd9ca..e6ca1d19 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 @@ -598,6 +598,7 @@ To change the version of this release, change your app's version in your pubspec operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, ), ); @@ -622,6 +623,7 @@ To change the version of this release, change your app's version in your pubspec operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, ), ), ), @@ -650,6 +652,7 @@ To change the version of this release, change your app's version in your pubspec operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, ), ), ), 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 37bb8307..d8bb2ffc 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 @@ -454,6 +454,7 @@ void main() { operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, ), ); @@ -476,6 +477,7 @@ void main() { operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: xcodeVersion, ), ), 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 ab0d28a3..a3258018 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 @@ -693,6 +693,7 @@ To change the version of this release, change your app's version in your pubspec operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, ), ); @@ -713,6 +714,7 @@ To change the version of this release, change your app's version in your pubspec operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, xcodeVersion: xcodeVersion, ), ), diff --git a/packages/shorebird_cli/test/src/commands/release/macos_releaser_test.dart b/packages/shorebird_cli/test/src/commands/release/macos_releaser_test.dart index a6778e77..1d8a4bf3 100644 --- a/packages/shorebird_cli/test/src/commands/release/macos_releaser_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/macos_releaser_test.dart @@ -620,6 +620,7 @@ To change the version of this release, change your app's version in your pubspec operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, ), ); @@ -640,6 +641,7 @@ To change the version of this release, change your app's version in your pubspec operatingSystemVersion: operatingSystemVersion, shorebirdVersion: packageVersion, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: xcodeVersion, ), ), 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 9db6a4ab..a6a8dd9c 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 @@ -182,6 +182,7 @@ void main() { ).thenReturn(projectRoot); when(() => shorebirdEnv.flutterRevision).thenReturn(flutterRevision); when(() => shorebirdEnv.canAcceptUserInput).thenReturn(true); + when(() => shorebirdEnv.usesShorebirdCodePushPackage).thenReturn(true); when( () => shorebirdFlutter.getVersionAndRevision(), diff --git a/packages/shorebird_cli/test/src/metadata/build_environment_metadata_test.dart b/packages/shorebird_cli/test/src/metadata/build_environment_metadata_test.dart index 7bb1fe13..9c7c2714 100644 --- a/packages/shorebird_cli/test/src/metadata/build_environment_metadata_test.dart +++ b/packages/shorebird_cli/test/src/metadata/build_environment_metadata_test.dart @@ -10,8 +10,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ); expect( BuildEnvironmentMetadata.fromJson(metadata.toJson()).toJson(), @@ -26,8 +27,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ); expect(metadata.copyWith(), equals(metadata)); @@ -39,16 +41,18 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ); final newMetadata = metadata.copyWith( flutterRevision: 'asdf', operatingSystem: 'windows', operatingSystemVersion: '11', shorebirdVersion: '1.2.3', - xcodeVersion: '14.0', shorebirdYaml: const ShorebirdYaml(appId: 'app-id2'), + usesShorebirdCodePushPackage: true, + xcodeVersion: '14.0', ); expect( newMetadata, @@ -58,8 +62,9 @@ void main() { operatingSystem: 'windows', operatingSystemVersion: '11', shorebirdVersion: '1.2.3', - xcodeVersion: '14.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id2'), + usesShorebirdCodePushPackage: true, + xcodeVersion: '14.0', ), ), ); @@ -73,16 +78,18 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, + xcodeVersion: '15.0', ); const otherMetadata = BuildEnvironmentMetadata( flutterRevision: '853d13d954df3b6e9c2f07b72062f33c52a9a64b', operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, + xcodeVersion: '15.0', ); expect(metadata, equals(otherMetadata)); }); @@ -93,16 +100,18 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, + xcodeVersion: '15.0', ); const otherMetadata = BuildEnvironmentMetadata( flutterRevision: '853d13d954df3b6e9c2f07b72062f33c52a9a64b', operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.1', shorebirdYaml: ShorebirdYaml(appId: 'app-id2'), + usesShorebirdCodePushPackage: true, + xcodeVersion: '15.1', ); expect(metadata, isNot(equals(otherMetadata))); }); diff --git a/packages/shorebird_cli/test/src/metadata/create_patch_metadata_test.dart b/packages/shorebird_cli/test/src/metadata/create_patch_metadata_test.dart index b5b90d21..9dc1a456 100644 --- a/packages/shorebird_cli/test/src/metadata/create_patch_metadata_test.dart +++ b/packages/shorebird_cli/test/src/metadata/create_patch_metadata_test.dart @@ -19,8 +19,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ), ); expect( @@ -44,8 +45,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ), ); @@ -66,8 +68,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ), ); @@ -83,8 +86,9 @@ void main() { operatingSystem: 'windows', operatingSystemVersion: '11', shorebirdVersion: '1.2.3', - xcodeVersion: '14.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '14.0', ), ); @@ -104,8 +108,9 @@ void main() { operatingSystem: 'windows', operatingSystemVersion: '11', shorebirdVersion: '1.2.3', - xcodeVersion: '14.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '14.0', ), ), ), @@ -129,6 +134,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', xcodeVersion: '15.0', + usesShorebirdCodePushPackage: false, shorebirdYaml: ShorebirdYaml(appId: 'app-id'), ), ); @@ -145,8 +151,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ), ); expect(metadata, equals(otherMetadata)); @@ -165,8 +172,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ), ); const otherMetadata = CreatePatchMetadata( @@ -181,8 +189,9 @@ void main() { operatingSystem: 'macos', operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', - xcodeVersion: '15.0', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, + xcodeVersion: '15.0', ), ); expect(metadata, isNot(equals(otherMetadata))); diff --git a/packages/shorebird_cli/test/src/metadata/update_release_metadata_test.dart b/packages/shorebird_cli/test/src/metadata/update_release_metadata_test.dart index c50eadce..51557759 100644 --- a/packages/shorebird_cli/test/src/metadata/update_release_metadata_test.dart +++ b/packages/shorebird_cli/test/src/metadata/update_release_metadata_test.dart @@ -16,6 +16,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: '15.0', ), ); @@ -37,6 +38,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: '15.0', ), ); @@ -55,6 +57,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: '15.0', ), ); @@ -69,6 +72,7 @@ void main() { operatingSystemVersion: '11', shorebirdVersion: '1.2.3', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, xcodeVersion: '14.0', ), ); @@ -86,6 +90,7 @@ void main() { operatingSystemVersion: '11', shorebirdVersion: '1.2.3', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, xcodeVersion: '14.0', ), ), @@ -106,6 +111,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: '15.0', ), ); @@ -119,6 +125,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: false, xcodeVersion: '15.0', ), ); @@ -136,6 +143,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, xcodeVersion: '15.0', ), ); @@ -149,6 +157,7 @@ void main() { operatingSystemVersion: '1.2.3', shorebirdVersion: '4.5.6', shorebirdYaml: ShorebirdYaml(appId: 'app-id'), + usesShorebirdCodePushPackage: true, xcodeVersion: '15.0', ), ); diff --git a/packages/shorebird_cli/test/src/shorebird_env_test.dart b/packages/shorebird_cli/test/src/shorebird_env_test.dart index aee53823..c172cac7 100644 --- a/packages/shorebird_cli/test/src/shorebird_env_test.dart +++ b/packages/shorebird_cli/test/src/shorebird_env_test.dart @@ -688,6 +688,59 @@ test-revision }); }); + group('usesShorebirdCodePushPackage', () { + group('when pubspec.yaml does not contain shorebird_code_push', () { + setUp(() { + final tempDir = Directory.systemTemp.createTempSync(); + File(p.join(tempDir.path, 'pubspec.yaml')).writeAsStringSync(''' +name: test + +dependencies: + clock: ^1.1.2 + collection: ^1.19.1 + crypto: ^3.0.6 + dart_frog: ^1.2.4 +'''); + shorebirdEnv = runWithOverrides( + () => ShorebirdEnv(flutterProjectRootOverride: tempDir.path), + ); + }); + + test('returns false', () { + expect( + runWithOverrides(() => shorebirdEnv.usesShorebirdCodePushPackage), + isFalse, + ); + }); + }); + + group('when pubspec.yaml contains shorebird_code_push', () { + setUp(() { + final tempDir = Directory.systemTemp.createTempSync(); + File(p.join(tempDir.path, 'pubspec.yaml')).writeAsStringSync(''' +name: test + +dependencies: + clock: ^1.1.2 + collection: ^1.19.1 + crypto: ^3.0.6 + dart_frog: ^1.2.4 + shorebird_code_push: ^1.0.0 +'''); + shorebirdEnv = runWithOverrides( + () => ShorebirdEnv(flutterProjectRootOverride: tempDir.path), + ); + }); + + test('returns true', () { + expect( + runWithOverrides(() => shorebirdEnv.usesShorebirdCodePushPackage), + isTrue, + ); + }); + }); + }); + group('shorebirdEngineRevision', () { test('returns correct revision', () { const engineRevision = 'test-revision';