From db39cbfe5962c770ddbe566a8c70d68fbed1b4cc Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Wed, 17 Apr 2024 15:13:04 -0500 Subject: [PATCH 1/2] feat(shorebird_cli): `shorebird patch` includes Flutter version when building --- .../lib/src/commands/patch/patch_aar_command.dart | 6 +++++- .../lib/src/commands/patch/patch_android_command.dart | 7 ++++++- .../lib/src/commands/patch/patch_ios_command.dart | 6 +++++- .../src/commands/patch/patch_ios_framework_command.dart | 6 +++++- .../test/src/commands/patch/patch_aar_command_test.dart | 4 ++++ .../src/commands/patch/patch_android_command_test.dart | 4 ++++ .../test/src/commands/patch/patch_ios_command_test.dart | 4 ++++ .../commands/patch/patch_ios_framework_command_test.dart | 4 ++++ 8 files changed, 37 insertions(+), 4 deletions(-) diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart index 1e83448bf..809710e98 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart @@ -177,7 +177,11 @@ Please re-run the release command for this version or create a new release.'''); return await runScoped( () async { final buildNumber = results['build-number'] as String; - final buildProgress = logger.progress('Building patch'); + final flutterVersionString = + await shorebirdFlutter.getVersionAndRevision(); + final buildProgress = logger.progress( + 'Building patch with Flutter $flutterVersionString', + ); try { await buildAar(buildNumber: buildNumber); buildProgress.complete(); diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart index 15ca81e01..91bfa861e 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart @@ -139,7 +139,12 @@ If this option is not provided, the version number will be determined from the p releaseVersion = argReleaseVersion; } else { logger.detail('No release version provided. Determining from bundle.'); - final buildProgress = logger.progress('Building patch'); + final flutterVersionString = + await shorebirdFlutter.getVersionAndRevision(); + + final buildProgress = logger.progress( + 'Building patch with Flutter $flutterVersionString', + ); try { await buildAppBundle(flavor: flavor, target: target); buildProgress.complete(); diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart index b7620ca14..eafe8ed2d 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart @@ -479,7 +479,11 @@ ${summary.join('\n')} required String? target, }) async { final shouldCodesign = results['codesign'] == true; - final buildProgress = logger.progress('Building patch'); + final flutterVersionString = await shorebirdFlutter.getVersionAndRevision(); + + final buildProgress = logger.progress( + 'Building patch with Flutter $flutterVersionString', + ); try { // If buildIpa is called with a different codesign value than the release // was, we will erroneously report native diffs. diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_framework_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_framework_command.dart index af26847fa..7b22a99a5 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_framework_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_framework_command.dart @@ -148,7 +148,11 @@ Please re-run the release command for this version or create a new release.'''); return await runScoped( () async { - final buildProgress = logger.progress('Building patch'); + final flutterVersionString = + await shorebirdFlutter.getVersionAndRevision(); + final buildProgress = logger.progress( + 'Building patch with Flutter $flutterVersionString', + ); try { await buildIosFramework(); buildProgress.complete(); diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart index afba8835a..d2ca605af 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart @@ -36,6 +36,7 @@ import '../../mocks.dart'; void main() { group(PatchAarCommand, () { const flutterRevision = '83305b5088e6fe327fb3334a73ff190828d85713'; + const flutterVersionAndRevision = '3.10.6 (83305b5088)'; const appId = 'test-app-id'; const shorebirdYaml = ShorebirdYaml(appId: appId); const buildNumber = '1.0'; @@ -321,6 +322,9 @@ void main() { when( () => cache.getArtifactDirectory(any()), ).thenReturn(Directory.systemTemp.createTempSync()); + when( + () => shorebirdFlutter.getVersionAndRevision(), + ).thenAnswer((_) async => flutterVersionAndRevision); when( () => shorebirdFlutter.installRevision( revision: any(named: 'revision'), diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart index 118e2f4d1..ad5fa3c2d 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart @@ -39,6 +39,7 @@ import '../../mocks.dart'; void main() { group(PatchAndroidCommand, () { const flutterRevision = '83305b5088e6fe327fb3334a73ff190828d85713'; + const flutterVersionAndRevision = '3.10.6 (83305b5088)'; const appId = 'test-app-id'; const shorebirdYaml = ShorebirdYaml(appId: appId); const versionName = '1.2.3'; @@ -236,6 +237,9 @@ flutter: }); when(() => shorebirdEnv.flutterDirectory).thenReturn(flutterDirectory); when(() => shorebirdEnv.flutterRevision).thenReturn(flutterRevision); + when( + () => shorebirdFlutter.getVersionAndRevision(), + ).thenAnswer((_) async => flutterVersionAndRevision); when( () => shorebirdFlutter.installRevision( revision: any(named: 'revision'), diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart index ee0e4a0df..dfb37abec 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart @@ -41,6 +41,7 @@ import '../../mocks.dart'; void main() { const preLinkerFlutterRevision = '83305b5088e6fe327fb3334a73ff190828d85713'; const postLinkerFlutterRevision = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'; + const flutterVersionAndRevision = '3.10.6 (83305b5088)'; const appId = 'test-app-id'; const shorebirdYaml = ShorebirdYaml(appId: appId); const versionName = '1.2.3'; @@ -462,6 +463,9 @@ flutter: when(() => shorebirdEnv.flutterRevision) .thenReturn(preLinkerFlutterRevision); when(() => shorebirdEnv.canAcceptUserInput).thenReturn(true); + when( + () => shorebirdFlutter.getVersionAndRevision(), + ).thenAnswer((_) async => flutterVersionAndRevision); when( () => shorebirdFlutter.installRevision( revision: any(named: 'revision'), diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_ios_framework_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_ios_framework_command_test.dart index 8cc785a46..05da4e906 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_ios_framework_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_ios_framework_command_test.dart @@ -53,6 +53,7 @@ void main() { 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'; const preLinkerFlutterRevision = '83305b5088e6fe327fb3334a73ff190828d85713'; + const flutterVersionAndRevision = '3.10.6 (83305b5088)'; const pubspecYamlContent = ''' name: example version: $version @@ -340,6 +341,9 @@ flutter: artifact: ShorebirdArtifact.analyzeSnapshot, ), ).thenReturn(analyzeSnapshotFile.path); + when( + () => shorebirdFlutter.getVersionAndRevision(), + ).thenAnswer((_) async => flutterVersionAndRevision); when( () => shorebirdFlutter.installRevision( revision: any(named: 'revision'), From 70a45f111fb73560960d46be8dbe407787b9c08f Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Wed, 17 Apr 2024 15:14:27 -0500 Subject: [PATCH 2/2] format --- .../lib/src/commands/patch/patch_android_command.dart | 1 - .../shorebird_cli/lib/src/commands/patch/patch_ios_command.dart | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart index 91bfa861e..15f6d5267 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart @@ -141,7 +141,6 @@ If this option is not provided, the version number will be determined from the p logger.detail('No release version provided. Determining from bundle.'); final flutterVersionString = await shorebirdFlutter.getVersionAndRevision(); - final buildProgress = logger.progress( 'Building patch with Flutter $flutterVersionString', ); diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart index eafe8ed2d..e92bdeb79 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart @@ -480,7 +480,6 @@ ${summary.join('\n')} }) async { final shouldCodesign = results['codesign'] == true; final flutterVersionString = await shorebirdFlutter.getVersionAndRevision(); - final buildProgress = logger.progress( 'Building patch with Flutter $flutterVersionString', );