refactor(shorebird_cli)!: use new releases endpoint (#861)
This commit is contained in:
@@ -132,12 +132,14 @@ This app may not exist or you may not have permission to view it.''',
|
||||
/// Exits if [platform] release artifacts already exist for an
|
||||
/// [existingRelease].
|
||||
Future<void> ensureReleaseHasNoArtifacts({
|
||||
required String appId,
|
||||
required Release existingRelease,
|
||||
required String platform,
|
||||
}) async {
|
||||
logger.detail('Verifying ability to release');
|
||||
|
||||
final artifacts = await codePushClient.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: existingRelease.id,
|
||||
platform: platform,
|
||||
);
|
||||
@@ -223,6 +225,7 @@ Please create a release using "shorebird release" and try again.
|
||||
}
|
||||
|
||||
Future<Map<Arch, ReleaseArtifact>> getReleaseArtifacts({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required Map<Arch, ArchMetadata> architectures,
|
||||
required String platform,
|
||||
@@ -236,6 +239,7 @@ Please create a release using "shorebird release" and try again.
|
||||
for (final entry in architectures.entries) {
|
||||
try {
|
||||
final artifacts = await codePushClient.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: entry.value.arch,
|
||||
platform: platform,
|
||||
@@ -258,6 +262,7 @@ Please create a release using "shorebird release" and try again.
|
||||
}
|
||||
|
||||
Future<ReleaseArtifact> getReleaseArtifact({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String arch,
|
||||
required String platform,
|
||||
@@ -267,6 +272,7 @@ Please create a release using "shorebird release" and try again.
|
||||
);
|
||||
try {
|
||||
final artifacts = await codePushClient.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
platform: platform,
|
||||
@@ -286,6 +292,7 @@ Please create a release using "shorebird release" and try again.
|
||||
}
|
||||
|
||||
Future<ReleaseArtifact?> maybeGetReleaseArtifact({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String arch,
|
||||
required String platform,
|
||||
@@ -295,6 +302,7 @@ Please create a release using "shorebird release" and try again.
|
||||
);
|
||||
try {
|
||||
final artifacts = await codePushClient.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
platform: platform,
|
||||
@@ -317,6 +325,7 @@ Please create a release using "shorebird release" and try again.
|
||||
}
|
||||
|
||||
Future<void> createAndroidReleaseArtifacts({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String platform,
|
||||
required String aabPath,
|
||||
@@ -343,6 +352,7 @@ Please create a release using "shorebird release" and try again.
|
||||
|
||||
try {
|
||||
await codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
artifactPath: artifact.path,
|
||||
arch: archMetadata.arch,
|
||||
@@ -365,6 +375,7 @@ ${archMetadata.arch} artifact already exists, continuing...''',
|
||||
try {
|
||||
logger.detail('Creating artifact for $aabPath');
|
||||
await codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
artifactPath: aabPath,
|
||||
arch: 'aab',
|
||||
@@ -387,6 +398,7 @@ aab artifact already exists, continuing...''',
|
||||
}
|
||||
|
||||
Future<void> createAndroidArchiveReleaseArtifacts({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String platform,
|
||||
required String aarPath,
|
||||
@@ -408,6 +420,7 @@ aab artifact already exists, continuing...''',
|
||||
|
||||
try {
|
||||
await codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
artifactPath: artifact.path,
|
||||
arch: archMetadata.arch,
|
||||
@@ -430,6 +443,7 @@ ${archMetadata.arch} artifact already exists, continuing...''',
|
||||
try {
|
||||
logger.detail('Creating artifact for $aarPath');
|
||||
await codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
artifactPath: aarPath,
|
||||
arch: 'aar',
|
||||
@@ -453,6 +467,7 @@ aar artifact already exists, continuing...''',
|
||||
|
||||
/// Uploads a release ipa to the Shorebird server.
|
||||
Future<void> createIosReleaseArtifact({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String ipaPath,
|
||||
}) async {
|
||||
@@ -460,6 +475,7 @@ aar artifact already exists, continuing...''',
|
||||
final ipaFile = File(ipaPath);
|
||||
try {
|
||||
await codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
artifactPath: ipaPath,
|
||||
arch: 'ipa',
|
||||
@@ -477,12 +493,14 @@ aar artifact already exists, continuing...''',
|
||||
/// Updates the specified release's status to [ReleaseStatus.active] for the
|
||||
/// given platform.
|
||||
Future<void> completeRelease({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String platform,
|
||||
}) async {
|
||||
final completeReleaseProgress = logger.progress('Completing release');
|
||||
try {
|
||||
await codePushClient.updateReleaseStatus(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
status: ReleaseStatus.active,
|
||||
platform: platform,
|
||||
|
||||
@@ -191,12 +191,14 @@ https://github.com/shorebirdtech/shorebird/issues/472
|
||||
}
|
||||
|
||||
final releaseArtifacts = await codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
architectures: architectures,
|
||||
platform: platformName,
|
||||
);
|
||||
|
||||
final releaseAarArtifact = await codePushClientWrapper.getReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
arch: 'aar',
|
||||
platform: platformName,
|
||||
|
||||
@@ -196,12 +196,14 @@ https://github.com/shorebirdtech/shorebird/issues/472
|
||||
}
|
||||
|
||||
final releaseArtifacts = await codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
architectures: architectures,
|
||||
platform: platformName,
|
||||
);
|
||||
|
||||
final releaseAabArtifact = await codePushClientWrapper.getReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
arch: 'aab',
|
||||
platform: platformName,
|
||||
|
||||
@@ -80,6 +80,7 @@ class PreviewCommand extends ShorebirdCommand
|
||||
);
|
||||
final releaseAabArtifact =
|
||||
await codePushClientWrapper.getReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
// TODO(felangel): add iOS support
|
||||
arch: 'aab',
|
||||
|
||||
@@ -102,6 +102,7 @@ make smaller updates to your app.
|
||||
);
|
||||
if (existingRelease != null) {
|
||||
await codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: app.appId,
|
||||
existingRelease: existingRelease,
|
||||
platform: platformName,
|
||||
);
|
||||
@@ -172,6 +173,7 @@ ${summary.join('\n')}
|
||||
extractAarProgress.complete();
|
||||
|
||||
await codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
aarPath: aarArtifactPath(
|
||||
@@ -183,6 +185,7 @@ ${summary.join('\n')}
|
||||
);
|
||||
|
||||
await codePushClientWrapper.completeRelease(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
);
|
||||
|
||||
@@ -121,6 +121,7 @@ make smaller updates to your app.
|
||||
|
||||
if (existingRelease != null) {
|
||||
await codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: app.appId,
|
||||
existingRelease: existingRelease,
|
||||
platform: platformName,
|
||||
);
|
||||
@@ -172,6 +173,7 @@ ${summary.join('\n')}
|
||||
);
|
||||
|
||||
await codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
aabPath: bundlePath,
|
||||
platform: platformName,
|
||||
@@ -180,6 +182,7 @@ ${summary.join('\n')}
|
||||
);
|
||||
|
||||
await codePushClientWrapper.completeRelease(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
);
|
||||
|
||||
@@ -119,6 +119,7 @@ make smaller updates to your app.
|
||||
);
|
||||
if (existingRelease != null) {
|
||||
await codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: app.appId,
|
||||
existingRelease: existingRelease,
|
||||
platform: platformName,
|
||||
);
|
||||
@@ -169,11 +170,13 @@ ${summary.join('\n')}
|
||||
final relativeIpaPath = p.relative(ipaPath);
|
||||
|
||||
await codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
ipaPath: ipaPath,
|
||||
);
|
||||
|
||||
await codePushClientWrapper.completeRelease(
|
||||
appId: app.appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
);
|
||||
|
||||
@@ -91,7 +91,10 @@ class DeleteReleasesCommand extends ShorebirdCommand
|
||||
progress = logger.progress('Deleting release');
|
||||
|
||||
try {
|
||||
await codePushClient.deleteRelease(releaseId: releaseToDelete.id);
|
||||
await codePushClient.deleteRelease(
|
||||
appId: appId,
|
||||
releaseId: releaseToDelete.id,
|
||||
);
|
||||
} catch (error) {
|
||||
progress.fail('$error');
|
||||
return ExitCode.software.code;
|
||||
|
||||
@@ -361,12 +361,14 @@ void main() {
|
||||
});
|
||||
|
||||
group('release', () {
|
||||
group('verifyCanRelease', () {
|
||||
group('ensureReleaseHasNoArtifacts', () {
|
||||
const appId = 'test-app-id';
|
||||
test(
|
||||
'''exits with code 70 if release artifacts exist for the given release and platform''',
|
||||
() async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -375,6 +377,7 @@ void main() {
|
||||
await expectLater(
|
||||
runWithOverrides(
|
||||
() async => codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: appId,
|
||||
existingRelease: release,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -397,6 +400,7 @@ Please bump your version number and try again.''',
|
||||
() async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -405,6 +409,7 @@ Please bump your version number and try again.''',
|
||||
await expectLater(
|
||||
runWithOverrides(
|
||||
() => codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: appId,
|
||||
existingRelease: release,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -655,6 +660,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -664,6 +670,7 @@ Please bump your version number and try again.''',
|
||||
await expectLater(
|
||||
() async => runWithOverrides(
|
||||
() => codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
architectures: archMap,
|
||||
platform: platformName,
|
||||
@@ -677,6 +684,7 @@ Please bump your version number and try again.''',
|
||||
test('exits with code 70 if release artifact does not exist', () async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -686,6 +694,7 @@ Please bump your version number and try again.''',
|
||||
await expectLater(
|
||||
() async => runWithOverrides(
|
||||
() => codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
architectures: archMap,
|
||||
platform: platformName,
|
||||
@@ -705,6 +714,7 @@ Please bump your version number and try again.''',
|
||||
() async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -713,6 +723,7 @@ Please bump your version number and try again.''',
|
||||
|
||||
final result = await runWithOverrides(
|
||||
() => codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
architectures: archMap,
|
||||
platform: platformName,
|
||||
@@ -729,6 +740,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -738,6 +750,7 @@ Please bump your version number and try again.''',
|
||||
await expectLater(
|
||||
() async => runWithOverrides(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch.name,
|
||||
platform: platformName,
|
||||
@@ -752,6 +765,7 @@ Please bump your version number and try again.''',
|
||||
test('exits with code 70 if release artifact does not exist', () async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -761,6 +775,7 @@ Please bump your version number and try again.''',
|
||||
await expectLater(
|
||||
() async => runWithOverrides(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch.name,
|
||||
platform: platformName,
|
||||
@@ -781,6 +796,7 @@ Please bump your version number and try again.''',
|
||||
() async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -789,6 +805,7 @@ Please bump your version number and try again.''',
|
||||
|
||||
final result = await runWithOverrides(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch.name,
|
||||
platform: platformName,
|
||||
@@ -806,6 +823,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -815,6 +833,7 @@ Please bump your version number and try again.''',
|
||||
await expectLater(
|
||||
() async => runWithOverrides(
|
||||
() => codePushClientWrapper.maybeGetReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch.name,
|
||||
platform: platformName,
|
||||
@@ -829,6 +848,7 @@ Please bump your version number and try again.''',
|
||||
test('returns null if release artifact does not exist', () async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -837,6 +857,7 @@ Please bump your version number and try again.''',
|
||||
|
||||
final result = await runWithOverrides(
|
||||
() => codePushClientWrapper.maybeGetReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch.name,
|
||||
platform: platformName,
|
||||
@@ -852,6 +873,7 @@ Please bump your version number and try again.''',
|
||||
() async {
|
||||
when(
|
||||
() => codePushClient.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -860,6 +882,7 @@ Please bump your version number and try again.''',
|
||||
|
||||
final result = await runWithOverrides(
|
||||
() => codePushClientWrapper.maybeGetReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch.name,
|
||||
platform: platformName,
|
||||
@@ -900,6 +923,7 @@ Please bump your version number and try again.''',
|
||||
setUp(() {
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -913,6 +937,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -926,6 +951,7 @@ Please bump your version number and try again.''',
|
||||
() async => expectLater(
|
||||
() async => runWithOverrides(
|
||||
() async => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aabPath: p.join(tempDir.path, aabPath),
|
||||
@@ -944,6 +970,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath', that: endsWith('aab')),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -957,6 +984,7 @@ Please bump your version number and try again.''',
|
||||
() async => expectLater(
|
||||
() async => runWithOverrides(
|
||||
() async => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aabPath: p.join(tempDir.path, aabPath),
|
||||
@@ -976,6 +1004,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -988,6 +1017,7 @@ Please bump your version number and try again.''',
|
||||
await runWithOverrides(
|
||||
() async => IOOverrides.runZoned(
|
||||
() async => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aabPath: p.join(tempDir.path, aabPath),
|
||||
@@ -1010,6 +1040,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath', that: endsWith('.aab')),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1022,6 +1053,7 @@ Please bump your version number and try again.''',
|
||||
await runWithOverrides(
|
||||
() async => IOOverrides.runZoned(
|
||||
() async => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aabPath: p.join(tempDir.path, aabPath),
|
||||
@@ -1042,6 +1074,7 @@ Please bump your version number and try again.''',
|
||||
test('completes successfully when all artifacts are created', () async {
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1054,6 +1087,7 @@ Please bump your version number and try again.''',
|
||||
await runWithOverrides(
|
||||
() async => IOOverrides.runZoned(
|
||||
() async => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aabPath: p.join(tempDir.path, aabPath),
|
||||
@@ -1071,6 +1105,7 @@ Please bump your version number and try again.''',
|
||||
const flavorName = 'myFlavor';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1083,6 +1118,7 @@ Please bump your version number and try again.''',
|
||||
await runWithOverrides(
|
||||
() async => IOOverrides.runZoned(
|
||||
() async => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aabPath: p.join(tempDir.path, aabPath),
|
||||
@@ -1095,8 +1131,11 @@ Please bump your version number and try again.''',
|
||||
|
||||
verify(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
artifactPath:
|
||||
any(named: 'artifactPath', that: contains(flavorName)),
|
||||
appId: app.appId,
|
||||
artifactPath: any(
|
||||
named: 'artifactPath',
|
||||
that: contains(flavorName),
|
||||
),
|
||||
releaseId: releaseId,
|
||||
arch: any(named: 'arch'),
|
||||
platform: platformName,
|
||||
@@ -1145,6 +1184,7 @@ Please bump your version number and try again.''',
|
||||
setUp(() {
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1158,6 +1198,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1172,6 +1213,7 @@ Please bump your version number and try again.''',
|
||||
() async => runWithOverrides(
|
||||
() async =>
|
||||
codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aarPath: p.join(tempDir.path, aarPath),
|
||||
@@ -1191,6 +1233,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath', that: endsWith('aar')),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1205,6 +1248,7 @@ Please bump your version number and try again.''',
|
||||
() async => runWithOverrides(
|
||||
() async =>
|
||||
codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aarPath: p.join(tempDir.path, aarPath),
|
||||
@@ -1225,6 +1269,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1238,6 +1283,7 @@ Please bump your version number and try again.''',
|
||||
() async => IOOverrides.runZoned(
|
||||
() async =>
|
||||
codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aarPath: p.join(tempDir.path, aarPath),
|
||||
@@ -1261,6 +1307,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath', that: endsWith('.aar')),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1274,6 +1321,7 @@ Please bump your version number and try again.''',
|
||||
() async => IOOverrides.runZoned(
|
||||
() async =>
|
||||
codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aarPath: p.join(tempDir.path, aarPath),
|
||||
@@ -1295,6 +1343,7 @@ Please bump your version number and try again.''',
|
||||
test('completes successfully when all artifacts are created', () async {
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1308,6 +1357,7 @@ Please bump your version number and try again.''',
|
||||
() async => IOOverrides.runZoned(
|
||||
() async =>
|
||||
codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aarPath: p.join(tempDir.path, aarPath),
|
||||
@@ -1326,6 +1376,7 @@ Please bump your version number and try again.''',
|
||||
const flavorName = 'myFlavor';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1339,6 +1390,7 @@ Please bump your version number and try again.''',
|
||||
() async => IOOverrides.runZoned(
|
||||
() async =>
|
||||
codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
aarPath: p.join(tempDir.path, aarPath),
|
||||
@@ -1351,6 +1403,7 @@ Please bump your version number and try again.''',
|
||||
|
||||
verify(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: app.appId,
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: releaseId,
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1376,6 +1429,7 @@ Please bump your version number and try again.''',
|
||||
setUp(() {
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1389,6 +1443,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1402,6 +1457,7 @@ Please bump your version number and try again.''',
|
||||
() async => expectLater(
|
||||
() async => runWithOverrides(
|
||||
() async => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
ipaPath: p.join(tempDir.path, ipaPath),
|
||||
),
|
||||
@@ -1419,6 +1475,7 @@ Please bump your version number and try again.''',
|
||||
const error = 'something went wrong';
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath', that: endsWith('.ipa')),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1432,6 +1489,7 @@ Please bump your version number and try again.''',
|
||||
() async => expectLater(
|
||||
() async => runWithOverrides(
|
||||
() async => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
ipaPath: p.join(tempDir.path, ipaPath),
|
||||
),
|
||||
@@ -1447,6 +1505,7 @@ Please bump your version number and try again.''',
|
||||
test('completes successfully when artifact is created', () async {
|
||||
when(
|
||||
() => codePushClient.createReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
artifactPath: any(named: 'artifactPath'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
@@ -1459,6 +1518,7 @@ Please bump your version number and try again.''',
|
||||
await runWithOverrides(
|
||||
() async => IOOverrides.runZoned(
|
||||
() async => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
ipaPath: p.join(tempDir.path, ipaPath),
|
||||
),
|
||||
@@ -1481,6 +1541,7 @@ Please bump your version number and try again.''',
|
||||
() async {
|
||||
when(
|
||||
() => codePushClient.updateReleaseStatus(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
status: any(named: 'status'),
|
||||
@@ -1490,6 +1551,7 @@ Please bump your version number and try again.''',
|
||||
await expectLater(
|
||||
() async => runWithOverrides(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -1502,6 +1564,7 @@ Please bump your version number and try again.''',
|
||||
test('completes when updating release status succeeds', () async {
|
||||
when(
|
||||
() => codePushClient.updateReleaseStatus(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
status: any(named: 'status'),
|
||||
@@ -1510,6 +1573,7 @@ Please bump your version number and try again.''',
|
||||
|
||||
await runWithOverrides(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: app.appId,
|
||||
releaseId: releaseId,
|
||||
platform: platformName,
|
||||
),
|
||||
|
||||
@@ -290,6 +290,7 @@ flutter:
|
||||
).thenAnswer((_) async => release);
|
||||
when(
|
||||
() => codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
architectures: any(named: 'architectures'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -303,6 +304,7 @@ flutter:
|
||||
);
|
||||
when(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: 'aar',
|
||||
platform: 'android',
|
||||
@@ -719,6 +721,7 @@ https://github.com/shorebirdtech/shorebird/issues/472
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
architectures: ShorebirdBuildMixin.allAndroidArchitectures,
|
||||
platform: platformName,
|
||||
@@ -726,6 +729,7 @@ https://github.com/shorebirdtech/shorebird/issues/472
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
arch: 'aar',
|
||||
platform: platformName,
|
||||
@@ -769,6 +773,7 @@ flavors:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
architectures: ShorebirdBuildMixin.allAndroidArchitectures,
|
||||
platform: platformName,
|
||||
@@ -776,6 +781,7 @@ flavors:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
arch: 'aar',
|
||||
platform: platformName,
|
||||
|
||||
@@ -282,6 +282,7 @@ flutter:
|
||||
).thenAnswer((_) async => release);
|
||||
when(
|
||||
() => codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
architectures: any(named: 'architectures'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -295,6 +296,7 @@ flutter:
|
||||
);
|
||||
when(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: 'aab',
|
||||
platform: 'android',
|
||||
|
||||
@@ -145,6 +145,7 @@ void main() {
|
||||
).thenAnswer((_) async => release);
|
||||
when(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -216,6 +217,7 @@ void main() {
|
||||
final exception = Exception('oops');
|
||||
when(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
arch: any(named: 'arch'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -225,6 +227,7 @@ void main() {
|
||||
expect(result, equals(ExitCode.software.code));
|
||||
verify(
|
||||
() => codePushClientWrapper.getReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: 'aab',
|
||||
platform: platform,
|
||||
|
||||
@@ -235,6 +235,7 @@ flutter:
|
||||
).thenAnswer((_) async => null);
|
||||
when(
|
||||
() => codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
existingRelease: any(named: 'existingRelease'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -248,6 +249,7 @@ flutter:
|
||||
).thenAnswer((_) async => release);
|
||||
when(
|
||||
() => codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
aarPath: any(named: 'aarPath'),
|
||||
@@ -257,6 +259,7 @@ flutter:
|
||||
).thenAnswer((_) async => {});
|
||||
when(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -421,6 +424,7 @@ flutter:
|
||||
verify(() => logger.success('\n✅ Published Release!')).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
aarPath: any(
|
||||
@@ -440,6 +444,7 @@ flutter:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -477,6 +482,7 @@ flavors:
|
||||
expect(capturedArgs, contains('--flavor=$flavor'));
|
||||
verify(
|
||||
() => codePushClientWrapper.createAndroidArchiveReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
aarPath: any(
|
||||
@@ -496,6 +502,7 @@ flavors:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -528,6 +535,7 @@ flavors:
|
||||
);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -585,6 +593,7 @@ flavors:
|
||||
verify(() => logger.err('Aborting due to validation errors.')).called(1);
|
||||
verifyNever(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
|
||||
@@ -204,6 +204,7 @@ flutter:
|
||||
).thenAnswer((_) async => null);
|
||||
when(
|
||||
() => codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
existingRelease: any(named: 'existingRelease'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -217,6 +218,7 @@ flutter:
|
||||
).thenAnswer((_) async => release);
|
||||
when(
|
||||
() => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
aabPath: any(named: 'aabPath'),
|
||||
platform: any(named: 'platform'),
|
||||
@@ -226,6 +228,7 @@ flutter:
|
||||
).thenAnswer((_) async {});
|
||||
when(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -338,6 +341,7 @@ flutter:
|
||||
verify(() => logger.info('Aborting.')).called(1);
|
||||
verifyNever(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -393,6 +397,7 @@ flutter:
|
||||
verify(() => logger.success('\n✅ Published Release!')).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
aabPath: any(named: 'aabPath'),
|
||||
@@ -401,6 +406,7 @@ flutter:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -420,6 +426,7 @@ flutter:
|
||||
verify(() => logger.success('\n✅ Published Release!')).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
aabPath: any(named: 'aabPath'),
|
||||
@@ -428,6 +435,7 @@ flutter:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -458,6 +466,7 @@ flavors:
|
||||
verify(() => logger.success('\n✅ Published Release!')).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.createAndroidReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
aabPath: any(named: 'aabPath'),
|
||||
@@ -467,6 +476,7 @@ flavors:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -550,6 +560,7 @@ flavors:
|
||||
verify(() => logger.err('Aborting due to validation errors.')).called(1);
|
||||
verifyNever(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
|
||||
@@ -203,6 +203,7 @@ flutter:
|
||||
).thenAnswer((_) async => null);
|
||||
when(
|
||||
() => codePushClientWrapper.ensureReleaseHasNoArtifacts(
|
||||
appId: any(named: 'appId'),
|
||||
existingRelease: any(named: 'existingRelease'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -216,12 +217,14 @@ flutter:
|
||||
).thenAnswer((_) async => release);
|
||||
when(
|
||||
() => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
ipaPath: any(named: 'ipaPath'),
|
||||
),
|
||||
).thenAnswer((_) async => release);
|
||||
when(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
platform: any(named: 'platform'),
|
||||
),
|
||||
@@ -402,6 +405,7 @@ error: exportArchive: No signing certificate "iOS Distribution" found
|
||||
verify(() => logger.info('Aborting.')).called(1);
|
||||
verifyNever(
|
||||
() => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
ipaPath: any(named: 'ipaPath', that: endsWith('.ipa')),
|
||||
),
|
||||
@@ -445,6 +449,7 @@ error: exportArchive: No signing certificate "iOS Distribution" found
|
||||
);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -474,12 +479,14 @@ error: exportArchive: No signing certificate "iOS Distribution" found
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
ipaPath: any(named: 'ipaPath', that: endsWith('.ipa')),
|
||||
),
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
@@ -522,6 +529,7 @@ flavors:
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
ipaPath: any(named: 'ipaPath', that: endsWith('.ipa')),
|
||||
),
|
||||
@@ -554,12 +562,14 @@ flavors:
|
||||
);
|
||||
verify(
|
||||
() => codePushClientWrapper.createIosReleaseArtifact(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
ipaPath: any(named: 'ipaPath', that: endsWith('.ipa')),
|
||||
),
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClientWrapper.completeRelease(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
platform: platformName,
|
||||
),
|
||||
|
||||
+28
-11
@@ -198,7 +198,10 @@ flutter:
|
||||
|
||||
expect(exitCode, ExitCode.success.code);
|
||||
verifyNever(
|
||||
() => codePushClient.deleteRelease(releaseId: any(named: 'releaseId')),
|
||||
() => codePushClient.deleteRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
),
|
||||
);
|
||||
verify(() => logger.info('Aborted.')).called(1);
|
||||
});
|
||||
@@ -215,13 +218,19 @@ flutter:
|
||||
expect(exitCode, ExitCode.software.code);
|
||||
verify(() => logger.err('No release found for version "asdf"')).called(1);
|
||||
verifyNever(
|
||||
() => codePushClient.deleteRelease(releaseId: any(named: 'releaseId')),
|
||||
() => codePushClient.deleteRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('returns software error when delete release fails', () async {
|
||||
when(
|
||||
() => codePushClient.deleteRelease(releaseId: any(named: 'releaseId')),
|
||||
() => codePushClient.deleteRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
),
|
||||
).thenThrow(Exception('oops'));
|
||||
|
||||
final tempDir = setUpTempDir();
|
||||
@@ -233,13 +242,16 @@ flutter:
|
||||
expect(exitCode, ExitCode.software.code);
|
||||
verify(() => progress.fail(any(that: contains('oops')))).called(1);
|
||||
verify(
|
||||
() => codePushClient.deleteRelease(releaseId: any(named: 'releaseId')),
|
||||
() => codePushClient.deleteRelease(appId: appId, releaseId: releaseId),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
test('returns success when release is deleted', () async {
|
||||
when(
|
||||
() => codePushClient.deleteRelease(releaseId: any(named: 'releaseId')),
|
||||
() => codePushClient.deleteRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
),
|
||||
).thenAnswer((_) async {});
|
||||
|
||||
final tempDir = setUpTempDir();
|
||||
@@ -249,10 +261,12 @@ flutter:
|
||||
);
|
||||
|
||||
expect(exitCode, ExitCode.success.code);
|
||||
verify(() => codePushClient.deleteRelease(releaseId: releaseId))
|
||||
.called(1);
|
||||
verify(() => progress.complete('Deleted release $versionNumber.'))
|
||||
.called(1);
|
||||
verify(
|
||||
() => codePushClient.deleteRelease(appId: appId, releaseId: releaseId),
|
||||
).called(1);
|
||||
verify(
|
||||
() => progress.complete('Deleted release $versionNumber.'),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
test('uses correct app_id when flavor is specified', () async {
|
||||
@@ -266,7 +280,10 @@ app_id: productionAppId
|
||||
flavors:
|
||||
$flavor: $appId''');
|
||||
when(
|
||||
() => codePushClient.deleteRelease(releaseId: any(named: 'releaseId')),
|
||||
() => codePushClient.deleteRelease(
|
||||
appId: any(named: 'appId'),
|
||||
releaseId: any(named: 'releaseId'),
|
||||
),
|
||||
).thenAnswer((_) async {});
|
||||
|
||||
final exitCode = await IOOverrides.runZoned(
|
||||
@@ -277,7 +294,7 @@ flavors:
|
||||
expect(exitCode, ExitCode.success.code);
|
||||
verify(() => codePushClient.getReleases(appId: appId)).called(1);
|
||||
verify(
|
||||
() => codePushClient.deleteRelease(releaseId: releaseId),
|
||||
() => codePushClient.deleteRelease(appId: appId, releaseId: releaseId),
|
||||
).called(1);
|
||||
verify(
|
||||
() => progress.complete('Deleted release $versionNumber.'),
|
||||
|
||||
@@ -30,6 +30,7 @@ Future<void> main() async {
|
||||
|
||||
// Create a release artifact.
|
||||
await client.createReleaseArtifact(
|
||||
appId: app.id,
|
||||
releaseId: release.id,
|
||||
artifactPath: '<PATH TO ARTIFACT>', // e.g. 'libapp.so'
|
||||
platform: '<PLATFORM>', // e.g. 'android'
|
||||
|
||||
@@ -192,6 +192,7 @@ class CodePushClient {
|
||||
/// Create a new artifact for a specific [releaseId].
|
||||
Future<void> createReleaseArtifact({
|
||||
required String artifactPath,
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String arch,
|
||||
required String platform,
|
||||
@@ -199,7 +200,7 @@ class CodePushClient {
|
||||
}) async {
|
||||
final request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse('$_v1/releases/$releaseId/artifacts'),
|
||||
Uri.parse('$_v1/apps/$appId/releases/$releaseId/artifacts'),
|
||||
);
|
||||
final file = await http.MultipartFile.fromPath('file', artifactPath);
|
||||
request.fields.addAll({
|
||||
@@ -286,9 +287,8 @@ class CodePushClient {
|
||||
String? displayName,
|
||||
}) async {
|
||||
final response = await _httpClient.post(
|
||||
Uri.parse('$_v1/releases'),
|
||||
Uri.parse('$_v1/apps/$appId/releases'),
|
||||
body: json.encode({
|
||||
'app_id': appId,
|
||||
'version': version,
|
||||
'flutter_revision': flutterRevision,
|
||||
if (displayName != null) 'display_name': displayName,
|
||||
@@ -304,12 +304,13 @@ class CodePushClient {
|
||||
|
||||
/// Updates the specified release's status to [status].
|
||||
Future<void> updateReleaseStatus({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required String platform,
|
||||
required ReleaseStatus status,
|
||||
}) async {
|
||||
final response = await _httpClient.patch(
|
||||
Uri.parse('$_v1/releases/$releaseId'),
|
||||
Uri.parse('$_v1/apps/$appId/releases/$releaseId'),
|
||||
body: json.encode(
|
||||
UpdateReleaseRequest(
|
||||
status: status,
|
||||
@@ -338,9 +339,12 @@ class CodePushClient {
|
||||
}
|
||||
|
||||
/// Delete the release with the provided [releaseId].
|
||||
Future<void> deleteRelease({required int releaseId}) async {
|
||||
Future<void> deleteRelease({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
}) async {
|
||||
final response = await _httpClient.delete(
|
||||
Uri.parse('$_v1/releases/$releaseId'),
|
||||
Uri.parse('$_v1/apps/$appId/releases/$releaseId'),
|
||||
);
|
||||
|
||||
if (response.statusCode != HttpStatus.noContent) {
|
||||
@@ -422,10 +426,12 @@ class CodePushClient {
|
||||
throw _parseErrorResponse(response.statusCode, response.body);
|
||||
}
|
||||
|
||||
final releases = json.decode(response.body) as List;
|
||||
return releases
|
||||
final collaborators = json.decode(response.body) as List;
|
||||
return collaborators
|
||||
.map(
|
||||
(release) => Collaborator.fromJson(release as Map<String, dynamic>),
|
||||
(collaborator) => Collaborator.fromJson(
|
||||
collaborator as Map<String, dynamic>,
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
@@ -433,9 +439,7 @@ class CodePushClient {
|
||||
/// List all release for the provided [appId].
|
||||
Future<List<Release>> getReleases({required String appId}) async {
|
||||
final response = await _httpClient.get(
|
||||
Uri.parse('$_v1/releases').replace(
|
||||
queryParameters: {'appId': appId},
|
||||
),
|
||||
Uri.parse('$_v1/apps/$appId/releases'),
|
||||
);
|
||||
|
||||
if (response.statusCode != HttpStatus.ok) {
|
||||
@@ -451,12 +455,13 @@ class CodePushClient {
|
||||
/// Get all release artifacts for a specific [releaseId]
|
||||
/// and optional [arch] and [platform].
|
||||
Future<List<ReleaseArtifact>> getReleaseArtifacts({
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
String? arch,
|
||||
String? platform,
|
||||
}) async {
|
||||
final response = await _httpClient.get(
|
||||
Uri.parse('$_v1/releases/$releaseId/artifacts').replace(
|
||||
Uri.parse('$_v1/apps/$appId/releases/$releaseId/artifacts').replace(
|
||||
queryParameters: {
|
||||
if (arch != null) 'arch': arch,
|
||||
if (platform != null) 'platform': platform,
|
||||
|
||||
@@ -483,6 +483,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('createReleaseArtifact', () {
|
||||
const appId = 'test-app-id';
|
||||
const releaseId = 0;
|
||||
const arch = 'aarch64';
|
||||
const platform = 'android';
|
||||
@@ -496,6 +497,7 @@ void main() {
|
||||
|
||||
try {
|
||||
await codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
artifactPath: fixture.path,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
@@ -508,7 +510,8 @@ void main() {
|
||||
.captured
|
||||
.single as http.BaseRequest;
|
||||
expect(request.method, equals('POST'));
|
||||
expect(request.url, equals(v1('releases/$releaseId/artifacts')));
|
||||
expect(request.url,
|
||||
equals(v1('apps/$appId/releases/$releaseId/artifacts')));
|
||||
expect(request.hasStandardHeaders, isTrue);
|
||||
});
|
||||
|
||||
@@ -526,6 +529,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
artifactPath: fixture.path,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
@@ -558,6 +562,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
artifactPath: fixture.path,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
@@ -584,6 +589,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
artifactPath: fixture.path,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
@@ -608,6 +614,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
artifactPath: fixture.path,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
@@ -662,6 +669,7 @@ void main() {
|
||||
|
||||
await expectLater(
|
||||
codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
artifactPath: fixture.path,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
@@ -724,6 +732,7 @@ void main() {
|
||||
|
||||
await expectLater(
|
||||
codePushClient.createReleaseArtifact(
|
||||
appId: appId,
|
||||
artifactPath: fixture.path,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
@@ -740,7 +749,7 @@ void main() {
|
||||
expect(
|
||||
request.url,
|
||||
codePushClient.hostedUri.replace(
|
||||
path: '/api/v1/releases/$releaseId/artifacts',
|
||||
path: '/api/v1/apps/$appId/releases/$releaseId/artifacts',
|
||||
),
|
||||
);
|
||||
});
|
||||
@@ -1027,7 +1036,7 @@ void main() {
|
||||
.captured
|
||||
.single as http.BaseRequest;
|
||||
expect(request.method, equals('POST'));
|
||||
expect(request.url, equals(v1('releases')));
|
||||
expect(request.url, equals(v1('apps/$appId/releases')));
|
||||
expect(request.hasStandardHeaders, isTrue);
|
||||
});
|
||||
|
||||
@@ -1131,18 +1140,21 @@ void main() {
|
||||
|
||||
expect(
|
||||
request.url,
|
||||
codePushClient.hostedUri.replace(path: '/api/v1/releases'),
|
||||
codePushClient.hostedUri
|
||||
.replace(path: '/api/v1/apps/$appId/releases'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('updateReleaseStatus', () {
|
||||
const appId = 'test-app-id';
|
||||
const releaseId = 42;
|
||||
const platform = 'android';
|
||||
|
||||
test('makes the correct request', () async {
|
||||
codePushClient
|
||||
.updateReleaseStatus(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
platform: platform,
|
||||
status: ReleaseStatus.active,
|
||||
@@ -1152,7 +1164,7 @@ void main() {
|
||||
.captured
|
||||
.single as http.BaseRequest;
|
||||
expect(request.method, equals('PATCH'));
|
||||
expect(request.url, equals(v1('releases/$releaseId')));
|
||||
expect(request.url, equals(v1('apps/$appId/releases/$releaseId')));
|
||||
expect(request.hasStandardHeaders, isTrue);
|
||||
});
|
||||
|
||||
@@ -1166,6 +1178,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.updateReleaseStatus(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
platform: platform,
|
||||
status: ReleaseStatus.active,
|
||||
@@ -1190,6 +1203,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.updateReleaseStatus(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
platform: platform,
|
||||
status: ReleaseStatus.active,
|
||||
@@ -1282,15 +1296,18 @@ void main() {
|
||||
});
|
||||
|
||||
group('deleteRelease', () {
|
||||
const appId = 'test-app-id';
|
||||
const releaseId = 42;
|
||||
|
||||
test('makes the correct request', () async {
|
||||
codePushClient.deleteRelease(releaseId: releaseId).ignore();
|
||||
codePushClient
|
||||
.deleteRelease(appId: appId, releaseId: releaseId)
|
||||
.ignore();
|
||||
final request = verify(() => httpClient.send(captureAny()))
|
||||
.captured
|
||||
.single as http.BaseRequest;
|
||||
expect(request.method, equals('DELETE'));
|
||||
expect(request.url, equals(v1('releases/$releaseId')));
|
||||
expect(request.url, equals(v1('apps/$appId/releases/$releaseId')));
|
||||
expect(request.hasStandardHeaders, isTrue);
|
||||
});
|
||||
|
||||
@@ -1303,7 +1320,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
codePushClient.deleteRelease(releaseId: releaseId),
|
||||
codePushClient.deleteRelease(appId: appId, releaseId: releaseId),
|
||||
throwsA(
|
||||
isA<CodePushException>().having(
|
||||
(e) => e.message,
|
||||
@@ -1323,7 +1340,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
codePushClient.deleteRelease(releaseId: releaseId),
|
||||
codePushClient.deleteRelease(appId: appId, releaseId: releaseId),
|
||||
throwsA(
|
||||
isA<CodePushException>().having(
|
||||
(e) => e.message,
|
||||
@@ -1342,7 +1359,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
await codePushClient.deleteRelease(releaseId: releaseId);
|
||||
await codePushClient.deleteRelease(appId: appId, releaseId: releaseId);
|
||||
|
||||
final request = verify(() => httpClient.send(captureAny()))
|
||||
.captured
|
||||
@@ -1351,7 +1368,7 @@ void main() {
|
||||
expect(
|
||||
request.url,
|
||||
codePushClient.hostedUri.replace(
|
||||
path: '/api/v1/releases/$releaseId',
|
||||
path: '/api/v1/apps/$appId/releases/$releaseId',
|
||||
),
|
||||
);
|
||||
});
|
||||
@@ -1747,7 +1764,7 @@ void main() {
|
||||
.captured
|
||||
.single as http.BaseRequest;
|
||||
expect(request.method, equals('GET'));
|
||||
expect(request.url, equals(v1('releases?appId=$appId')));
|
||||
expect(request.url, equals(v1('apps/$appId/releases')));
|
||||
expect(request.hasStandardHeaders, isTrue);
|
||||
});
|
||||
|
||||
@@ -1834,6 +1851,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('getReleaseArtifacts', () {
|
||||
const appId = 'test-app-id';
|
||||
const releaseId = 0;
|
||||
const arch = 'aarch64';
|
||||
const platform = 'android';
|
||||
@@ -1841,6 +1859,7 @@ void main() {
|
||||
test('makes the correct request', () async {
|
||||
codePushClient
|
||||
.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
platform: platform,
|
||||
@@ -1853,7 +1872,7 @@ void main() {
|
||||
expect(
|
||||
request.url,
|
||||
equals(
|
||||
v1('releases/$releaseId/artifacts?arch=$arch&platform=$platform'),
|
||||
v1('apps/$appId/releases/$releaseId/artifacts?arch=$arch&platform=$platform'),
|
||||
),
|
||||
);
|
||||
expect(request.hasStandardHeaders, isTrue);
|
||||
@@ -1869,6 +1888,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
platform: platform,
|
||||
@@ -1893,6 +1913,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
codePushClient.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
platform: platform,
|
||||
@@ -1932,6 +1953,7 @@ void main() {
|
||||
);
|
||||
|
||||
final actual = await codePushClient.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
releaseId: releaseId,
|
||||
arch: arch,
|
||||
platform: platform,
|
||||
|
||||
+3
-8
@@ -3,15 +3,14 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
part 'create_release_request.g.dart';
|
||||
|
||||
/// {@template create_release_request}
|
||||
/// The request body for POST /api/v1/releases
|
||||
/// The request body for POST /api/v1/apps/<appId>/releases
|
||||
/// {@endtemplate}
|
||||
@JsonSerializable()
|
||||
class CreateReleaseRequest {
|
||||
/// {@macro create_release_request}
|
||||
const CreateReleaseRequest({
|
||||
required this.appId,
|
||||
required this.version,
|
||||
this.flutterRevision,
|
||||
required this.flutterRevision,
|
||||
this.displayName,
|
||||
});
|
||||
|
||||
@@ -22,15 +21,11 @@ class CreateReleaseRequest {
|
||||
/// Converts a [CreateReleaseRequest] to a Map<String, dynamic>
|
||||
Map<String, dynamic> toJson() => _$CreateReleaseRequestToJson(this);
|
||||
|
||||
/// The ID of the app.
|
||||
final String appId;
|
||||
|
||||
/// The release version.
|
||||
final String version;
|
||||
|
||||
/// The Flutter revision used to create the release.
|
||||
// TODO(felangel): Make this non-nullable in the next major release.
|
||||
final String? flutterRevision;
|
||||
final String flutterRevision;
|
||||
|
||||
/// The display name for the release.
|
||||
final String? displayName;
|
||||
|
||||
+1
-4
@@ -15,16 +15,14 @@ CreateReleaseRequest _$CreateReleaseRequestFromJson(
|
||||
json,
|
||||
($checkedConvert) {
|
||||
final val = CreateReleaseRequest(
|
||||
appId: $checkedConvert('app_id', (v) => v as String),
|
||||
version: $checkedConvert('version', (v) => v as String),
|
||||
flutterRevision:
|
||||
$checkedConvert('flutter_revision', (v) => v as String?),
|
||||
$checkedConvert('flutter_revision', (v) => v as String),
|
||||
displayName: $checkedConvert('display_name', (v) => v as String?),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
fieldKeyMap: const {
|
||||
'appId': 'app_id',
|
||||
'flutterRevision': 'flutter_revision',
|
||||
'displayName': 'display_name'
|
||||
},
|
||||
@@ -33,7 +31,6 @@ CreateReleaseRequest _$CreateReleaseRequestFromJson(
|
||||
Map<String, dynamic> _$CreateReleaseRequestToJson(
|
||||
CreateReleaseRequest instance) =>
|
||||
<String, dynamic>{
|
||||
'app_id': instance.appId,
|
||||
'version': instance.version,
|
||||
'flutter_revision': instance.flutterRevision,
|
||||
'display_name': instance.displayName,
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
part 'create_release_response.g.dart';
|
||||
|
||||
/// {@template create_release_response}
|
||||
/// The response body for POST /api/v1/releases
|
||||
/// The response body for POST /api/v1/apps/<appId>/releases
|
||||
/// {@endtemplate}
|
||||
@JsonSerializable()
|
||||
class CreateReleaseResponse {
|
||||
|
||||
+1
-1
@@ -5,8 +5,8 @@ void main() {
|
||||
group(CreateReleaseRequest, () {
|
||||
test('can be (de)serialized', () {
|
||||
const request = CreateReleaseRequest(
|
||||
appId: 'my_app',
|
||||
version: '1.2.3',
|
||||
flutterRevision: 'abc123',
|
||||
displayName: 'display_name',
|
||||
);
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user