feat: support codesigning for macos apps (#2771)
This commit is contained in:
@@ -61,8 +61,6 @@ class AndroidReleaser extends Releaser {
|
||||
|
||||
@override
|
||||
Future<void> assertArgsAreValid() async {
|
||||
argResults.assertAbsentOrValidPublicKey();
|
||||
|
||||
if (argResults.wasParsed('release-version')) {
|
||||
logger.err(
|
||||
'''
|
||||
|
||||
@@ -42,8 +42,6 @@ class IosReleaser extends Releaser {
|
||||
|
||||
@override
|
||||
Future<void> assertArgsAreValid() async {
|
||||
argResults.assertAbsentOrValidPublicKey();
|
||||
|
||||
if (argResults.wasParsed('release-version')) {
|
||||
logger.err(
|
||||
'''
|
||||
|
||||
@@ -248,6 +248,7 @@ of the iOS app that is using this module. (aar and ios-framework only)''',
|
||||
@visibleForTesting
|
||||
Future<void> createRelease(Releaser releaser) async {
|
||||
await releaser.assertPreconditions();
|
||||
await assertArgsAreValid();
|
||||
await releaser.assertArgsAreValid();
|
||||
|
||||
await shorebirdValidator.validateFlavors(flavorArg: flavor);
|
||||
@@ -327,6 +328,11 @@ of the iOS app that is using this module. (aar and ios-framework only)''',
|
||||
);
|
||||
}
|
||||
|
||||
/// Validates arguments that are common to all release types.
|
||||
Future<void> assertArgsAreValid() async {
|
||||
results.assertAbsentOrValidPublicKey();
|
||||
}
|
||||
|
||||
/// Determines which Flutter version to use for the release. This will be
|
||||
/// either the version specified by the user or the version provided by
|
||||
/// [shorebirdEnv]. Will exit with [ExitCode.software] if the version
|
||||
|
||||
@@ -37,8 +37,6 @@ class WindowsReleaser extends Releaser {
|
||||
|
||||
@override
|
||||
Future<void> assertArgsAreValid() async {
|
||||
argResults.assertAbsentOrValidPublicKey();
|
||||
|
||||
if (argResults.wasParsed('release-version')) {
|
||||
logger.err(
|
||||
'''
|
||||
|
||||
@@ -235,45 +235,6 @@ To change the version of this release, change your app's version in your pubspec
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('when a public key is provided and it exists', () {
|
||||
setUp(() {
|
||||
when(() => argResults['artifact']).thenReturn('apk');
|
||||
final publicKeyFile = File(
|
||||
p.join(
|
||||
Directory.systemTemp.createTempSync().path,
|
||||
'public-key.pem',
|
||||
),
|
||||
)..writeAsStringSync('public key');
|
||||
when(() => argResults[CommonArguments.publicKeyArg.name])
|
||||
.thenReturn(publicKeyFile.path);
|
||||
});
|
||||
|
||||
test('returns normally', () async {
|
||||
expect(
|
||||
() => runWithOverrides(androidReleaser.assertArgsAreValid),
|
||||
returnsNormally,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('when a public key is provided but does not exist', () {
|
||||
setUp(() {
|
||||
when(() => argResults['artifact']).thenReturn('apk');
|
||||
when(() => argResults[CommonArguments.publicKeyArg.name])
|
||||
.thenReturn('non-existing-key.pem');
|
||||
});
|
||||
|
||||
test('logs and exits with usage err', () async {
|
||||
await expectLater(
|
||||
() => runWithOverrides(androidReleaser.assertArgsAreValid),
|
||||
exitsWithCode(ExitCode.usage),
|
||||
);
|
||||
|
||||
verify(() => logger.err('No file found at non-existing-key.pem'))
|
||||
.called(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
group('buildReleaseArtifacts', () {
|
||||
|
||||
@@ -278,43 +278,6 @@ To change the version of this release, change your app's version in your pubspec
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('when a public key is provided and it exists', () {
|
||||
setUp(() {
|
||||
final publicKeyFile = File(
|
||||
p.join(
|
||||
Directory.systemTemp.createTempSync().path,
|
||||
'public-key.pem',
|
||||
),
|
||||
)..writeAsStringSync('public key');
|
||||
when(() => argResults[CommonArguments.publicKeyArg.name])
|
||||
.thenReturn(publicKeyFile.path);
|
||||
});
|
||||
|
||||
test('returns normally', () async {
|
||||
expect(
|
||||
() => runWithOverrides(iosReleaser.assertArgsAreValid),
|
||||
returnsNormally,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('when the provided public key is a nonexistent file', () {
|
||||
setUp(() {
|
||||
when(() => argResults[CommonArguments.publicKeyArg.name])
|
||||
.thenReturn('non-existing-key.pem');
|
||||
});
|
||||
|
||||
test('logs and exits with usage err', () async {
|
||||
await expectLater(
|
||||
() => runWithOverrides(iosReleaser.assertArgsAreValid),
|
||||
exitsWithCode(ExitCode.usage),
|
||||
);
|
||||
|
||||
verify(() => logger.err('No file found at non-existing-key.pem'))
|
||||
.called(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
group('buildReleaseArtifacts', () {
|
||||
|
||||
@@ -252,6 +252,24 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('when public key path is provided but no key exists', () {
|
||||
setUp(() {
|
||||
when(() => argResults[CommonArguments.publicKeyArg.name])
|
||||
.thenReturn('/path/to/nonexistent/file');
|
||||
});
|
||||
|
||||
test('exits with usage code', () async {
|
||||
await expectLater(
|
||||
runWithOverrides(command.run),
|
||||
exitsWithCode(ExitCode.usage),
|
||||
);
|
||||
|
||||
verifyNever(
|
||||
() => codePushClientWrapper.getApp(appId: any(named: 'appId')),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test('executes commands in order, completes successfully', () async {
|
||||
final exitCode = await runWithOverrides(command.run);
|
||||
expect(exitCode, equals(ExitCode.success.code));
|
||||
|
||||
@@ -151,22 +151,6 @@ To change the version of this release, change your app's version in your pubspec
|
||||
).called(1);
|
||||
});
|
||||
});
|
||||
|
||||
group('when public key is provided but file does not exist', () {
|
||||
setUp(() {
|
||||
when(() => argResults.wasParsed(CommonArguments.publicKeyArg.name))
|
||||
.thenReturn(true);
|
||||
when(() => argResults[CommonArguments.publicKeyArg.name])
|
||||
.thenReturn('nonexistent');
|
||||
});
|
||||
|
||||
test('fails progress, exits', () async {
|
||||
await expectLater(
|
||||
() => runWithOverrides(releaser.assertArgsAreValid),
|
||||
exitsWithCode(ExitCode.usage),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
group('assertPreconditions', () {
|
||||
|
||||
Reference in New Issue
Block a user