fix(shorebird_cli): improve iOS flavors error (#942)
This commit is contained in:
@@ -301,10 +301,10 @@ packages:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: mocktail
|
||||
sha256: "80a996cd9a69284b3dc521ce185ffe9150cde69767c2d3a0720147d93c0cef53"
|
||||
sha256: "3b5b76b6b81177220f29993bf16b2cd8c9ab03659422f20c190df3be897d5807"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
version: "1.0.0-dev.0"
|
||||
node_preamble:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -301,10 +301,10 @@ packages:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: mocktail
|
||||
sha256: "80a996cd9a69284b3dc521ce185ffe9150cde69767c2d3a0720147d93c0cef53"
|
||||
sha256: "3b5b76b6b81177220f29993bf16b2cd8c9ab03659422f20c190df3be897d5807"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
version: "1.0.0-dev.0"
|
||||
node_preamble:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -119,7 +119,7 @@ To proxy an option to the flutter command, use the -- --<option> syntax.
|
||||
|
||||
Example:
|
||||
|
||||
${lightCyan.wrap('shorebird run -- --no-pub lib/main.dart')}''',
|
||||
${lightCyan.wrap('shorebird release android -- --no-pub lib/main.dart')}''',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ class ReleaseIosCommand extends ShorebirdCommand
|
||||
..addOption(
|
||||
'flavor',
|
||||
help: 'The product flavor to use when building the app.',
|
||||
// TODO(felangel): unhide when we support flavors
|
||||
hide: true,
|
||||
)
|
||||
..addFlag(
|
||||
'force',
|
||||
@@ -77,6 +79,16 @@ make smaller updates to your app.
|
||||
|
||||
const releasePlatform = ReleasePlatform.ios;
|
||||
final flavor = results['flavor'] as String?;
|
||||
|
||||
if (flavor != null) {
|
||||
logger.err(
|
||||
'''
|
||||
iOS flavors are not yet supported.
|
||||
Watch the following issue for updates: https://github.com/shorebirdtech/shorebird/issues/910''',
|
||||
);
|
||||
return ExitCode.unavailable.code;
|
||||
}
|
||||
|
||||
final shorebirdYaml = ShorebirdEnvironment.getShorebirdYaml()!;
|
||||
final appId = shorebirdYaml.getAppId(flavor: flavor);
|
||||
final app = await codePushClientWrapper.getApp(appId: appId);
|
||||
@@ -136,7 +148,8 @@ make smaller updates to your app.
|
||||
|
||||
final summary = [
|
||||
'''📱 App: ${lightCyan.wrap(app.displayName)} ${lightCyan.wrap('($appId)')}''',
|
||||
if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}',
|
||||
// TODO(felangel): uncomment once flavor support is added.
|
||||
// if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}',
|
||||
'📦 Release Version: ${lightCyan.wrap(releaseVersion)}',
|
||||
'''🕹️ Platform: ${lightCyan.wrap(releasePlatform.name)}''',
|
||||
];
|
||||
|
||||
@@ -106,7 +106,7 @@ To proxy an option to the flutter command, use the -- --<option> syntax.
|
||||
|
||||
Example:
|
||||
|
||||
${lightCyan.wrap('shorebird run -- --no-pub lib/main.dart')}''',
|
||||
${lightCyan.wrap('shorebird release android -- --no-pub lib/main.dart')}''',
|
||||
),
|
||||
).called(1);
|
||||
verify(() => logger.info('exception usage')).called(1);
|
||||
|
||||
@@ -516,13 +516,9 @@ error: exportArchive: No signing certificate "iOS Distribution" found
|
||||
expect(exitCode, ExitCode.success.code);
|
||||
});
|
||||
|
||||
test(
|
||||
'succeeds when release is successful '
|
||||
'with flavors and target', () async {
|
||||
test('logs error when a flavor is supplied', () async {
|
||||
const flavor = 'development';
|
||||
final target = p.join('lib', 'main_development.dart');
|
||||
when(() => argResults['flavor']).thenReturn(flavor);
|
||||
when(() => argResults['target']).thenReturn(target);
|
||||
final tempDir = setUpTempDir();
|
||||
File(
|
||||
p.join(tempDir.path, 'shorebird.yaml'),
|
||||
@@ -536,30 +532,71 @@ flavors:
|
||||
getCurrentDirectory: () => tempDir,
|
||||
);
|
||||
|
||||
verify(() => logger.success('\n✅ Published Release!')).called(1);
|
||||
expect(exitCode, ExitCode.unavailable.code);
|
||||
|
||||
verify(
|
||||
() => logger.info(
|
||||
any(
|
||||
that: stringContainsInOrder(
|
||||
[
|
||||
'Your next step is to upload the ipa to App Store Connect.',
|
||||
'build/ios/ipa/app_bundle_name.ipa',
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
() => logger.err('''
|
||||
iOS flavors are not yet supported.
|
||||
Watch the following issue for updates: https://github.com/shorebirdtech/shorebird/issues/910'''),
|
||||
).called(1);
|
||||
verify(
|
||||
verifyNever(
|
||||
() => codePushClientWrapper.createIosReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
ipaPath: any(named: 'ipaPath', that: endsWith('.ipa')),
|
||||
runnerPath: any(named: 'runnerPath', that: endsWith('Runner.app')),
|
||||
),
|
||||
).called(1);
|
||||
expect(exitCode, ExitCode.success.code);
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'succeeds when release is successful '
|
||||
'with flavors and target',
|
||||
() async {
|
||||
const flavor = 'development';
|
||||
final target = p.join('lib', 'main_development.dart');
|
||||
when(() => argResults['flavor']).thenReturn(flavor);
|
||||
when(() => argResults['target']).thenReturn(target);
|
||||
final tempDir = setUpTempDir();
|
||||
File(
|
||||
p.join(tempDir.path, 'shorebird.yaml'),
|
||||
).writeAsStringSync('''
|
||||
app_id: productionAppId
|
||||
flavors:
|
||||
development: $appId''');
|
||||
|
||||
final exitCode = await IOOverrides.runZoned(
|
||||
() => runWithOverrides(command.run),
|
||||
getCurrentDirectory: () => tempDir,
|
||||
);
|
||||
|
||||
verify(() => logger.success('\n✅ Published Release!')).called(1);
|
||||
verify(
|
||||
() => logger.info(
|
||||
any(
|
||||
that: stringContainsInOrder(
|
||||
[
|
||||
'Your next step is to upload the ipa to App Store Connect.',
|
||||
'build/ios/ipa/app_bundle_name.ipa',
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.createIosReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
ipaPath: any(named: 'ipaPath', that: endsWith('.ipa')),
|
||||
runnerPath: any(named: 'runnerPath', that: endsWith('Runner.app')),
|
||||
),
|
||||
).called(1);
|
||||
expect(exitCode, ExitCode.success.code);
|
||||
},
|
||||
// TODO(felangel): revert when we support flavors for iOS
|
||||
skip: true,
|
||||
);
|
||||
|
||||
test('does not create new release if existing release is present',
|
||||
() async {
|
||||
when(
|
||||
|
||||
Reference in New Issue
Block a user