Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shorebird_cli): include shorebird.yaml in release and patch metadata #2443

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ NOTE: this is ${styleBold.wrap('not')} recommended. Asset changes cannot be incl
operatingSystem: platform.operatingSystem,
operatingSystemVersion: platform.operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: shorebirdEnv.getShorebirdYaml()!,
),
);
final updateMetadata = await patcher.updatedCreatePatchMetadata(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ ${summary.join('\n')}
operatingSystem: platform.operatingSystem,
operatingSystemVersion: platform.operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: shorebirdEnv.getShorebirdYaml()!,
),
);
final updatedMetadata = await releaser.updatedReleaseMetadata(baseMetadata);
Expand Down
3 changes: 3 additions & 0 deletions packages/shorebird_cli/lib/src/config/shorebird_yaml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class ShorebirdYaml {
factory ShorebirdYaml.fromJson(Map<dynamic, dynamic> json) =>
_$ShorebirdYamlFromJson(json);

/// Converts this [ShorebirdYaml] to a JSON map.
Map<String, dynamic> toJson() => _$ShorebirdYamlToJson(this);

/// The base app id.
///
/// Example:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:shorebird_cli/src/config/config.dart';

part 'build_environment_metadata.g.dart';

Expand All @@ -21,6 +22,7 @@ class BuildEnvironmentMetadata extends Equatable {
required this.shorebirdVersion,
required this.operatingSystem,
required this.operatingSystemVersion,
required this.shorebirdYaml,
this.xcodeVersion,
});

Expand All @@ -32,13 +34,15 @@ class BuildEnvironmentMetadata extends Equatable {
String shorebirdVersion = '4.5.6',
String operatingSystem = 'macos',
String operatingSystemVersion = '1.2.3',
ShorebirdYaml shorebirdYaml = const ShorebirdYaml(appId: '123'),
String? xcodeVersion = '15.0',
}) =>
BuildEnvironmentMetadata(
flutterRevision: flutterRevision,
shorebirdVersion: shorebirdVersion,
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdYaml: shorebirdYaml,
xcodeVersion: xcodeVersion,
);
// coverage:ignore-end
Expand All @@ -57,6 +61,7 @@ class BuildEnvironmentMetadata extends Equatable {
String? shorebirdVersion,
String? operatingSystem,
String? operatingSystemVersion,
ShorebirdYaml? shorebirdYaml,
String? xcodeVersion,
}) =>
BuildEnvironmentMetadata(
Expand All @@ -65,6 +70,7 @@ class BuildEnvironmentMetadata extends Equatable {
operatingSystem: operatingSystem ?? this.operatingSystem,
operatingSystemVersion:
operatingSystemVersion ?? this.operatingSystemVersion,
shorebirdYaml: shorebirdYaml ?? this.shorebirdYaml,
xcodeVersion: xcodeVersion ?? this.xcodeVersion,
);

Expand Down Expand Up @@ -92,6 +98,9 @@ class BuildEnvironmentMetadata extends Equatable {
/// Reason: issues may occur on some OS versions and not others.
final String operatingSystemVersion;

/// The shorebird.yaml file for this project.
final ShorebirdYaml shorebirdYaml;

/// The version of Xcode used to build the patch. Only provided for iOS
/// patches.
///
Expand All @@ -105,6 +114,7 @@ class BuildEnvironmentMetadata extends Equatable {
shorebirdVersion,
operatingSystem,
operatingSystemVersion,
shorebirdYaml,
xcodeVersion,
];
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:shorebird_cli/src/artifact_builder.dart';
import 'package:shorebird_cli/src/artifact_manager.dart';
import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/commands/patch/patch.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/engine_config.dart';
import 'package:shorebird_cli/src/logger.dart';
import 'package:shorebird_cli/src/metadata/metadata.dart';
Expand Down Expand Up @@ -528,6 +529,7 @@ void main() {
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/code_signer.dart';
import 'package:shorebird_cli/src/commands/patch/patch.dart';
import 'package:shorebird_cli/src/common_arguments.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/doctor.dart';
import 'package:shorebird_cli/src/engine_config.dart';
import 'package:shorebird_cli/src/logger.dart';
Expand Down Expand Up @@ -645,6 +646,7 @@ Looked in:
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:shorebird_cli/src/artifact_manager.dart';
import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/commands/patch/patch.dart';
import 'package:shorebird_cli/src/common_arguments.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/doctor.dart';
import 'package:shorebird_cli/src/engine_config.dart';
import 'package:shorebird_cli/src/executables/aot_tools.dart';
Expand Down Expand Up @@ -843,6 +844,7 @@ void main() {
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand All @@ -862,6 +864,7 @@ void main() {
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
xcodeVersion: xcodeVersion,
),
),
Expand Down Expand Up @@ -889,6 +892,7 @@ void main() {
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand All @@ -909,6 +913,7 @@ void main() {
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
xcodeVersion: xcodeVersion,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/code_signer.dart';
import 'package:shorebird_cli/src/commands/patch/patch.dart';
import 'package:shorebird_cli/src/common_arguments.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/doctor.dart';
import 'package:shorebird_cli/src/engine_config.dart';
import 'package:shorebird_cli/src/executables/aot_tools.dart';
Expand Down Expand Up @@ -1608,6 +1609,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand All @@ -1627,6 +1629,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
xcodeVersion: xcodeVersion,
),
),
Expand Down Expand Up @@ -1654,6 +1657,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand All @@ -1675,6 +1679,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
xcodeVersion: xcodeVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/code_signer.dart';
import 'package:shorebird_cli/src/commands/release/android_releaser.dart';
import 'package:shorebird_cli/src/common_arguments.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/doctor.dart';
import 'package:shorebird_cli/src/engine_config.dart';
import 'package:shorebird_cli/src/logger.dart';
Expand Down Expand Up @@ -655,6 +656,7 @@ To change the version of this release, change your app's version in your pubspec
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand All @@ -678,6 +680,7 @@ To change the version of this release, change your app's version in your pubspec
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
),
),
Expand Down Expand Up @@ -705,6 +708,7 @@ To change the version of this release, change your app's version in your pubspec
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:shorebird_cli/src/artifact_builder.dart';
import 'package:shorebird_cli/src/artifact_manager.dart';
import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/commands/release/ios_framework_releaser.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/doctor.dart';
import 'package:shorebird_cli/src/executables/executables.dart';
import 'package:shorebird_cli/src/logger.dart';
Expand Down Expand Up @@ -398,6 +399,7 @@ void main() {
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand All @@ -421,6 +423,7 @@ void main() {
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
xcodeVersion: xcodeVersion,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/code_signer.dart';
import 'package:shorebird_cli/src/commands/release/ios_releaser.dart';
import 'package:shorebird_cli/src/common_arguments.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/doctor.dart';
import 'package:shorebird_cli/src/executables/xcodebuild.dart';
import 'package:shorebird_cli/src/logger.dart';
Expand Down Expand Up @@ -768,6 +769,7 @@ To change the version of this release, change your app's version in your pubspec
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
),
);

Expand All @@ -791,6 +793,7 @@ To change the version of this release, change your app's version in your pubspec
operatingSystem: operatingSystem,
operatingSystemVersion: operatingSystemVersion,
shorebirdVersion: packageVersion,
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
xcodeVersion: xcodeVersion,
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/metadata/metadata.dart';
import 'package:test/test.dart';

Expand All @@ -10,6 +11,7 @@ void main() {
operatingSystemVersion: '1.2.3',
shorebirdVersion: '4.5.6',
xcodeVersion: '15.0',
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
);
expect(
BuildEnvironmentMetadata.fromJson(metadata.toJson()).toJson(),
Expand All @@ -25,6 +27,7 @@ void main() {
operatingSystemVersion: '1.2.3',
shorebirdVersion: '4.5.6',
xcodeVersion: '15.0',
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
);

expect(metadata.copyWith(), equals(metadata));
Expand All @@ -37,13 +40,15 @@ void main() {
operatingSystemVersion: '1.2.3',
shorebirdVersion: '4.5.6',
xcodeVersion: '15.0',
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
);
final newMetadata = metadata.copyWith(
flutterRevision: 'asdf',
operatingSystem: 'windows',
operatingSystemVersion: '11',
shorebirdVersion: '1.2.3',
xcodeVersion: '14.0',
shorebirdYaml: const ShorebirdYaml(appId: 'app-id2'),
);
expect(
newMetadata,
Expand All @@ -54,6 +59,7 @@ void main() {
operatingSystemVersion: '11',
shorebirdVersion: '1.2.3',
xcodeVersion: '14.0',
shorebirdYaml: ShorebirdYaml(appId: 'app-id2'),
),
),
);
Expand All @@ -68,13 +74,15 @@ void main() {
operatingSystemVersion: '1.2.3',
shorebirdVersion: '4.5.6',
xcodeVersion: '15.0',
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
);
const otherMetadata = BuildEnvironmentMetadata(
flutterRevision: '853d13d954df3b6e9c2f07b72062f33c52a9a64b',
operatingSystem: 'macos',
operatingSystemVersion: '1.2.3',
shorebirdVersion: '4.5.6',
xcodeVersion: '15.0',
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
);
expect(metadata, equals(otherMetadata));
});
Expand All @@ -86,13 +94,15 @@ void main() {
operatingSystemVersion: '1.2.3',
shorebirdVersion: '4.5.6',
xcodeVersion: '15.0',
shorebirdYaml: ShorebirdYaml(appId: 'app-id'),
);
const otherMetadata = BuildEnvironmentMetadata(
flutterRevision: '853d13d954df3b6e9c2f07b72062f33c52a9a64b',
operatingSystem: 'macos',
operatingSystemVersion: '1.2.3',
shorebirdVersion: '4.5.6',
xcodeVersion: '15.1',
shorebirdYaml: ShorebirdYaml(appId: 'app-id2'),
);
expect(metadata, isNot(equals(otherMetadata)));
});
Expand Down
Loading
Loading