fix(shorebird_cli): use correct ipa file name (#706)

This commit is contained in:
Bryan Oltman
2023-06-23 16:17:45 -04:00
committed by GitHub
parent 6fbe9a6f05
commit 5d46d3fe36
5 changed files with 56 additions and 9 deletions
@@ -127,14 +127,13 @@ class PatchIosCommand extends ShorebirdCommand
'Detecting release version',
);
try {
final pubspec = ShorebirdEnvironment.getPubspecYaml()!;
final ipa = _ipaReader.read(
p.join(
Directory.current.path,
'build',
'ios',
'ipa',
'${pubspec.name}.ipa',
'${getIpaName()}.ipa',
),
);
releaseVersion = ipa.versionNumber;
@@ -7,6 +7,7 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
import 'package:shorebird_cli/src/command.dart';
import 'package:shorebird_cli/src/config/config.dart';
import 'package:shorebird_cli/src/logger.dart';
import 'package:shorebird_cli/src/shorebird_artifact_mixin.dart';
import 'package:shorebird_cli/src/shorebird_build_mixin.dart';
import 'package:shorebird_cli/src/shorebird_config_mixin.dart';
import 'package:shorebird_cli/src/shorebird_environment.dart';
@@ -17,7 +18,11 @@ import 'package:shorebird_cli/src/shorebird_validation_mixin.dart';
/// Create new app releases for iOS.
/// {@endtemplate}
class ReleaseIosCommand extends ShorebirdCommand
with ShorebirdBuildMixin, ShorebirdConfigMixin, ShorebirdValidationMixin {
with
ShorebirdBuildMixin,
ShorebirdConfigMixin,
ShorebirdArtifactMixin,
ShorebirdValidationMixin {
/// {@macro release_ios_command}
ReleaseIosCommand({
super.cache,
@@ -89,13 +94,12 @@ make smaller updates to your app.
buildProgress.complete();
final releaseVersionProgress = logger.progress('Getting release version');
final pubspec = ShorebirdEnvironment.getPubspecYaml()!;
final ipaPath = p.join(
Directory.current.path,
'build',
'ios',
'ipa',
'${pubspec.name}.ipa',
'${getIpaName()}.ipa',
);
String releaseVersion;
try {
@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:path/path.dart' as p;
import 'package:propertylistserialization/propertylistserialization.dart';
import 'package:shorebird_cli/src/command.dart';
import 'package:shorebird_cli/src/logger.dart';
@@ -61,6 +62,23 @@ mixin ShorebirdArtifactMixin on ShorebirdCommand {
return extractedZipDir;
}
/// Finds CFBundleName in the app's Info.plist. The ipa generated by `flutter
/// build ipa` will have this name and an .ipa extension.
String getIpaName() {
final infoPlist = PropertyListSerialization.propertyListWithString(
File(
p.join(
Directory.current.path,
'ios',
'Runner',
'Info.plist',
),
).readAsStringSync(),
) as Map<String, Object>;
return infoPlist['CFBundleName']! as String;
}
/// Finds the most recently-edited app.dill file in the .dart_tool directory.
// TODO(bryanoltman): This is an enormous hack we don't know that this is
// the correct file.
@@ -61,6 +61,15 @@ void main() {
const appDisplayName = 'Test App';
const platformName = 'ios';
const elfAotSnapshotFileName = 'out.aot';
const infoPlistContent = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>app_bundle_name</string>
</dict>
</plist>''';
const pubspecYamlContent = '''
name: example
version: $version
@@ -117,6 +126,11 @@ flutter:
File(
p.join(tempDir.path, 'shorebird.yaml'),
).writeAsStringSync('app_id: $appId');
File(
p.join(tempDir.path, 'ios', 'Runner', 'Info.plist'),
)
..createSync(recursive: true)
..writeAsStringSync(infoPlistContent);
return tempDir;
}
@@ -63,7 +63,15 @@ void main() {
flutterRevision: flutterRevision,
displayName: '1.2.3+1',
);
const infoPlistContent = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>app_bundle_name</string>
</dict>
</plist>''';
const pubspecYamlContent = '''
name: example
version: $version
@@ -110,7 +118,11 @@ flutter:
File(
p.join(tempDir.path, 'shorebird.yaml'),
).writeAsStringSync('app_id: $appId');
File(
p.join(tempDir.path, 'ios', 'Runner', 'Info.plist'),
)
..createSync(recursive: true)
..writeAsStringSync(infoPlistContent);
return tempDir;
}
@@ -431,7 +443,7 @@ error: exportArchive: No signing certificate "iOS Distribution" found
that: stringContainsInOrder(
[
'Your next step is to upload the ipa to App Store Connect.',
'build/ios/ipa/example.ipa',
'build/ios/ipa/app_bundle_name.ipa',
],
),
),
@@ -467,7 +479,7 @@ flavors:
that: stringContainsInOrder(
[
'Your next step is to upload the ipa to App Store Connect.',
'build/ios/ipa/example.ipa',
'build/ios/ipa/app_bundle_name.ipa',
],
),
),