feat(shorebird_cli): introduce createPatchMetadata to Patcher (#2044)
This commit is contained in:
@@ -10,6 +10,8 @@ import 'package:shorebird_cli/src/artifact_manager.dart';
|
||||
import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
|
||||
import 'package:shorebird_cli/src/commands/patch_new/patch_new.dart';
|
||||
import 'package:shorebird_cli/src/logger.dart';
|
||||
import 'package:shorebird_cli/src/patch_diff_checker.dart';
|
||||
import 'package:shorebird_cli/src/platform.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_android_artifacts.dart';
|
||||
@@ -17,6 +19,8 @@ import 'package:shorebird_cli/src/shorebird_env.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_flutter.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_validator.dart';
|
||||
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
|
||||
import 'package:shorebird_cli/src/version.dart';
|
||||
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
|
||||
/// {@template aar_patcher}
|
||||
/// Functions to patch an AAR release.
|
||||
@@ -159,4 +163,22 @@ class AarPatcher extends Patcher {
|
||||
'Release version must be specified using --release-version.',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CreatePatchMetadata> createPatchMetadata(DiffStatus diffStatus) async {
|
||||
return CreatePatchMetadata(
|
||||
releasePlatform: releaseType.releasePlatform,
|
||||
usedIgnoreAssetChangesFlag: allowAssetDiffs,
|
||||
hasAssetChanges: diffStatus.hasAssetChanges,
|
||||
usedIgnoreNativeChangesFlag: allowNativeDiffs,
|
||||
hasNativeChanges: diffStatus.hasNativeChanges,
|
||||
linkPercentage: null,
|
||||
environment: BuildEnvironmentMetadata(
|
||||
operatingSystem: platform.operatingSystem,
|
||||
operatingSystemVersion: platform.operatingSystemVersion,
|
||||
shorebirdVersion: packageVersion,
|
||||
xcodeVersion: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,16 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
|
||||
import 'package:shorebird_cli/src/commands/patch_new/patcher.dart';
|
||||
import 'package:shorebird_cli/src/doctor.dart';
|
||||
import 'package:shorebird_cli/src/logger.dart';
|
||||
import 'package:shorebird_cli/src/patch_diff_checker.dart';
|
||||
import 'package:shorebird_cli/src/platform.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_android_artifacts.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_flutter.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_validator.dart';
|
||||
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
|
||||
import 'package:shorebird_cli/src/version.dart';
|
||||
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
|
||||
/// {@template android_patcher}
|
||||
/// Functions to create an Android patch.
|
||||
@@ -166,4 +170,22 @@ Looked in:
|
||||
artifact.path,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CreatePatchMetadata> createPatchMetadata(DiffStatus diffStatus) async {
|
||||
return CreatePatchMetadata(
|
||||
releasePlatform: releaseType.releasePlatform,
|
||||
usedIgnoreAssetChangesFlag: allowAssetDiffs,
|
||||
hasAssetChanges: diffStatus.hasAssetChanges,
|
||||
usedIgnoreNativeChangesFlag: allowNativeDiffs,
|
||||
hasNativeChanges: diffStatus.hasNativeChanges,
|
||||
linkPercentage: null,
|
||||
environment: BuildEnvironmentMetadata(
|
||||
operatingSystem: platform.operatingSystem,
|
||||
operatingSystemVersion: platform.operatingSystemVersion,
|
||||
shorebirdVersion: packageVersion,
|
||||
xcodeVersion: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,10 @@ import 'package:shorebird_cli/src/extensions/arg_results.dart';
|
||||
import 'package:shorebird_cli/src/formatters/formatters.dart';
|
||||
import 'package:shorebird_cli/src/logger.dart';
|
||||
import 'package:shorebird_cli/src/patch_diff_checker.dart';
|
||||
import 'package:shorebird_cli/src/platform.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_env.dart';
|
||||
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
|
||||
import 'package:shorebird_cli/src/version.dart';
|
||||
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
|
||||
typedef ResolvePatcher = Patcher Function(ReleaseType releaseType);
|
||||
@@ -220,20 +218,7 @@ NOTE: this is ${styleBold.wrap('not')} recommended. Asset changes cannot be incl
|
||||
await codePushClientWrapper.publishPatch(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
metadata: CreatePatchMetadata(
|
||||
releasePlatform: patcher.releaseType.releasePlatform,
|
||||
usedIgnoreAssetChangesFlag: allowAssetDiffs,
|
||||
hasAssetChanges: diffStatus.hasAssetChanges,
|
||||
usedIgnoreNativeChangesFlag: allowNativeDiffs,
|
||||
hasNativeChanges: diffStatus.hasNativeChanges,
|
||||
linkPercentage: null,
|
||||
environment: BuildEnvironmentMetadata(
|
||||
operatingSystem: platform.operatingSystem,
|
||||
operatingSystemVersion: platform.operatingSystemVersion,
|
||||
shorebirdVersion: packageVersion,
|
||||
xcodeVersion: null,
|
||||
),
|
||||
),
|
||||
metadata: await patcher.createPatchMetadata(diffStatus),
|
||||
platform: patcher.releaseType.releasePlatform,
|
||||
track:
|
||||
isStaging ? DeploymentTrack.staging : DeploymentTrack.production,
|
||||
|
||||
@@ -3,9 +3,11 @@ import 'dart:io';
|
||||
import 'package:args/args.dart';
|
||||
import 'package:shorebird_cli/src/archive_analysis/archive_differ.dart';
|
||||
import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
|
||||
import 'package:shorebird_cli/src/patch_diff_checker.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_env.dart';
|
||||
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
|
||||
/// {@template patcher}
|
||||
/// Platform-specific functionality to create a patch.
|
||||
@@ -59,4 +61,14 @@ abstract class Patcher {
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
});
|
||||
|
||||
/// Metadata to attach to the patch when creating it, used for debugging
|
||||
/// and support.
|
||||
Future<CreatePatchMetadata> createPatchMetadata(DiffStatus diffStatus);
|
||||
|
||||
/// Whether to allow changes in assets (--allow-asset-diffs).
|
||||
bool get allowAssetDiffs => argResults['allow-asset-diffs'] == true;
|
||||
|
||||
/// Whether to allow changes in native code (--allow-native-diffs).
|
||||
bool get allowNativeDiffs => argResults['allow-native-diffs'] == true;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:shorebird_cli/src/artifact_builder.dart';
|
||||
import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/commands/release_new/releaser.dart';
|
||||
import 'package:shorebird_cli/src/commands/release_new/release_new.dart';
|
||||
import 'package:shorebird_cli/src/doctor.dart';
|
||||
import 'package:shorebird_cli/src/logger.dart';
|
||||
import 'package:shorebird_cli/src/platform.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_android_artifacts.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_flutter.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_validator.dart';
|
||||
|
||||
@@ -6,11 +6,11 @@ import 'package:scoped/scoped.dart';
|
||||
import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
|
||||
import 'package:shorebird_cli/src/command.dart';
|
||||
import 'package:shorebird_cli/src/commands/release_new/release_new.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/config/config.dart';
|
||||
import 'package:shorebird_cli/src/extensions/arg_results.dart';
|
||||
import 'package:shorebird_cli/src/logger.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_env.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_flutter.dart';
|
||||
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
|
||||
|
||||
@@ -428,10 +428,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: meta
|
||||
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
|
||||
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.14.0"
|
||||
version: "1.15.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -492,10 +492,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointycastle
|
||||
sha256: "79fbafed02cfdbe85ef3fd06c7f4bc2cbcba0177e61b765264853d4253b21744"
|
||||
sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.9.0"
|
||||
version: "3.9.1"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:args/args.dart';
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:scoped/scoped.dart';
|
||||
import 'package:shorebird_cli/src/archive_analysis/archive_analysis.dart';
|
||||
import 'package:shorebird_cli/src/artifact_builder.dart';
|
||||
@@ -10,6 +11,8 @@ import 'package:shorebird_cli/src/code_push_client_wrapper.dart';
|
||||
import 'package:shorebird_cli/src/commands/patch_new/patch_new.dart';
|
||||
import 'package:shorebird_cli/src/engine_config.dart';
|
||||
import 'package:shorebird_cli/src/logger.dart';
|
||||
import 'package:shorebird_cli/src/patch_diff_checker.dart';
|
||||
import 'package:shorebird_cli/src/platform.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/release_type.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_android_artifacts.dart';
|
||||
@@ -17,6 +20,7 @@ import 'package:shorebird_cli/src/shorebird_env.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_flutter.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_validator.dart';
|
||||
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
|
||||
import 'package:shorebird_cli/src/version.dart';
|
||||
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
@@ -34,6 +38,7 @@ void main() {
|
||||
late CodePushClientWrapper codePushClientWrapper;
|
||||
late Directory projectRoot;
|
||||
late Logger logger;
|
||||
late Platform platform;
|
||||
late Progress progress;
|
||||
late ShorebirdEnv shorebirdEnv;
|
||||
late ShorebirdFlutter shorebirdFlutter;
|
||||
@@ -51,11 +56,13 @@ void main() {
|
||||
codePushClientWrapperRef.overrideWith(() => codePushClientWrapper),
|
||||
engineConfigRef.overrideWith(() => const EngineConfig.empty()),
|
||||
loggerRef.overrideWith(() => logger),
|
||||
platformRef.overrideWith(() => platform),
|
||||
shorebirdEnvRef.overrideWith(() => shorebirdEnv),
|
||||
shorebirdFlutterRef.overrideWith(() => shorebirdFlutter),
|
||||
shorebirdValidatorRef.overrideWith(() => shorebirdValidator),
|
||||
shorebirdAndroidArtifactsRef
|
||||
.overrideWith(() => shorebirdAndroidArtifacts),
|
||||
shorebirdAndroidArtifactsRef.overrideWith(
|
||||
() => shorebirdAndroidArtifacts,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -86,7 +93,7 @@ void main() {
|
||||
artifactBuilder = MockArtifactBuilder();
|
||||
artifactManager = MockArtifactManager();
|
||||
codePushClientWrapper = MockCodePushClientWrapper();
|
||||
// platform = MockPlatform();
|
||||
platform = MockPlatform();
|
||||
progress = MockProgress();
|
||||
projectRoot = Directory.systemTemp.createTempSync();
|
||||
logger = MockLogger();
|
||||
@@ -416,5 +423,54 @@ void main() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('createPatchMetadata', () {
|
||||
const allowAssetDiffs = false;
|
||||
const allowNativeDiffs = true;
|
||||
const operatingSystem = 'Mac OS X';
|
||||
const operatingSystemVersion = '10.15.7';
|
||||
|
||||
setUp(() {
|
||||
when(() => argResults['allow-asset-diffs']).thenReturn(allowAssetDiffs);
|
||||
when(
|
||||
() => argResults['allow-native-diffs'],
|
||||
).thenReturn(allowNativeDiffs);
|
||||
when(() => platform.operatingSystem).thenReturn(operatingSystem);
|
||||
when(
|
||||
() => platform.operatingSystemVersion,
|
||||
).thenReturn(operatingSystemVersion);
|
||||
});
|
||||
|
||||
test('returns correct metadata', () async {
|
||||
final diffStatus = DiffStatus(
|
||||
hasAssetChanges: false,
|
||||
hasNativeChanges: false,
|
||||
);
|
||||
|
||||
final metadata = await runWithOverrides(
|
||||
() => patcher.createPatchMetadata(diffStatus),
|
||||
);
|
||||
|
||||
expect(
|
||||
metadata,
|
||||
equals(
|
||||
CreatePatchMetadata(
|
||||
releasePlatform: ReleasePlatform.android,
|
||||
usedIgnoreAssetChangesFlag: allowAssetDiffs,
|
||||
hasAssetChanges: diffStatus.hasAssetChanges,
|
||||
usedIgnoreNativeChangesFlag: allowNativeDiffs,
|
||||
hasNativeChanges: diffStatus.hasNativeChanges,
|
||||
linkPercentage: null,
|
||||
environment: const BuildEnvironmentMetadata(
|
||||
operatingSystem: operatingSystem,
|
||||
operatingSystemVersion: operatingSystemVersion,
|
||||
shorebirdVersion: packageVersion,
|
||||
xcodeVersion: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:shorebird_cli/src/commands/patch_new/patch_new.dart';
|
||||
import 'package:shorebird_cli/src/doctor.dart';
|
||||
import 'package:shorebird_cli/src/engine_config.dart';
|
||||
import 'package:shorebird_cli/src/logger.dart';
|
||||
import 'package:shorebird_cli/src/patch_diff_checker.dart';
|
||||
import 'package:shorebird_cli/src/platform.dart';
|
||||
import 'package:shorebird_cli/src/platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_android_artifacts.dart';
|
||||
@@ -21,6 +22,7 @@ import 'package:shorebird_cli/src/shorebird_process.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_validator.dart';
|
||||
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';
|
||||
import 'package:shorebird_cli/src/validators/validators.dart';
|
||||
import 'package:shorebird_cli/src/version.dart';
|
||||
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
@@ -447,5 +449,54 @@ Looked in:
|
||||
).thenReturn(aabFile);
|
||||
});
|
||||
});
|
||||
|
||||
group('createPatchMetadata', () {
|
||||
const allowAssetDiffs = false;
|
||||
const allowNativeDiffs = true;
|
||||
const operatingSystem = 'Mac OS X';
|
||||
const operatingSystemVersion = '10.15.7';
|
||||
|
||||
setUp(() {
|
||||
when(() => argResults['allow-asset-diffs']).thenReturn(allowAssetDiffs);
|
||||
when(
|
||||
() => argResults['allow-native-diffs'],
|
||||
).thenReturn(allowNativeDiffs);
|
||||
when(() => platform.operatingSystem).thenReturn(operatingSystem);
|
||||
when(
|
||||
() => platform.operatingSystemVersion,
|
||||
).thenReturn(operatingSystemVersion);
|
||||
});
|
||||
|
||||
test('returns correct metadata', () async {
|
||||
final diffStatus = DiffStatus(
|
||||
hasAssetChanges: false,
|
||||
hasNativeChanges: false,
|
||||
);
|
||||
|
||||
final metadata = await runWithOverrides(
|
||||
() => patcher.createPatchMetadata(diffStatus),
|
||||
);
|
||||
|
||||
expect(
|
||||
metadata,
|
||||
equals(
|
||||
CreatePatchMetadata(
|
||||
releasePlatform: ReleasePlatform.android,
|
||||
usedIgnoreAssetChangesFlag: allowAssetDiffs,
|
||||
hasAssetChanges: diffStatus.hasAssetChanges,
|
||||
usedIgnoreNativeChangesFlag: allowNativeDiffs,
|
||||
hasNativeChanges: diffStatus.hasNativeChanges,
|
||||
linkPercentage: null,
|
||||
environment: const BuildEnvironmentMetadata(
|
||||
operatingSystem: operatingSystem,
|
||||
operatingSystemVersion: operatingSystemVersion,
|
||||
shorebirdVersion: packageVersion,
|
||||
xcodeVersion: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../fakes.dart';
|
||||
import '../../matchers.dart';
|
||||
import '../../mocks.dart';
|
||||
|
||||
@@ -33,6 +34,7 @@ void main() {
|
||||
const releasePlatform = ReleasePlatform.android;
|
||||
const releaseVersion = '1.2.3+1';
|
||||
const shorebirdYaml = ShorebirdYaml(appId: appId);
|
||||
final patchMetadata = CreatePatchMetadata.forTest();
|
||||
|
||||
final appMetadata = AppMetadata(
|
||||
appId: appId,
|
||||
@@ -101,6 +103,7 @@ void main() {
|
||||
setUpAll(() {
|
||||
registerFallbackValue(CreatePatchMetadata.forTest());
|
||||
registerFallbackValue(DeploymentTrack.production);
|
||||
registerFallbackValue(FakeDiffStatus());
|
||||
registerFallbackValue(Directory(''));
|
||||
registerFallbackValue(File(''));
|
||||
registerFallbackValue(FileSetDiff.empty());
|
||||
@@ -129,8 +132,9 @@ void main() {
|
||||
when(() => argResults['release-version']).thenReturn(releaseVersion);
|
||||
when(() => argResults.wasParsed(any())).thenReturn(true);
|
||||
|
||||
when(() => artifactManager.downloadFile(any()))
|
||||
.thenAnswer((_) async => File(''));
|
||||
when(
|
||||
() => artifactManager.downloadFile(any()),
|
||||
).thenAnswer((_) async => File(''));
|
||||
|
||||
when(() => codePushClientWrapper.getApp(appId: any(named: 'appId')))
|
||||
.thenAnswer((_) async => appMetadata);
|
||||
@@ -195,10 +199,12 @@ void main() {
|
||||
when(() => patcher.archiveDiffer).thenReturn(archiveDiffer);
|
||||
when(() => patcher.assertArgsAreValid()).thenAnswer((_) async {});
|
||||
when(() => patcher.assertPreconditions()).thenAnswer((_) async {});
|
||||
when(() => patcher.extractReleaseVersionFromArtifact(any()))
|
||||
.thenAnswer((_) async => releaseVersion);
|
||||
when(() => patcher.buildPatchArtifact())
|
||||
.thenAnswer((_) async => File(''));
|
||||
when(
|
||||
() => patcher.extractReleaseVersionFromArtifact(any()),
|
||||
).thenAnswer((_) async => releaseVersion);
|
||||
when(
|
||||
() => patcher.buildPatchArtifact(),
|
||||
).thenAnswer((_) async => File(''));
|
||||
when(() => patcher.releaseType).thenReturn(ReleaseType.android);
|
||||
when(() => patcher.primaryReleaseArtifactArch).thenReturn('aab');
|
||||
when(
|
||||
@@ -216,6 +222,9 @@ void main() {
|
||||
),
|
||||
},
|
||||
);
|
||||
when(
|
||||
() => patcher.createPatchMetadata(any()),
|
||||
).thenAnswer((_) async => patchMetadata);
|
||||
|
||||
when(() => shorebirdEnv.getShorebirdYaml()).thenReturn(shorebirdYaml);
|
||||
when(() => shorebirdEnv.flutterRevision).thenReturn(flutterRevision);
|
||||
@@ -311,10 +320,11 @@ void main() {
|
||||
releaseId: release.id,
|
||||
),
|
||||
() => logger.confirm('Would you like to continue?'),
|
||||
() => patcher.createPatchMetadata(any()),
|
||||
() => codePushClientWrapper.publishPatch(
|
||||
appId: appId,
|
||||
releaseId: release.id,
|
||||
metadata: any(named: 'metadata'),
|
||||
metadata: patchMetadata,
|
||||
platform: releasePlatform,
|
||||
patchArtifactBundles: any(named: 'patchArtifactBundles'),
|
||||
track: DeploymentTrack.production,
|
||||
|
||||
+25
-17
@@ -137,8 +137,9 @@ void main() {
|
||||
|
||||
group('when arguments are valid', () {
|
||||
setUp(() {
|
||||
when(() => argResults.wasParsed('release-version'))
|
||||
.thenReturn(true);
|
||||
when(
|
||||
() => argResults.wasParsed('release-version'),
|
||||
).thenReturn(true);
|
||||
});
|
||||
|
||||
test('returns normally', () {
|
||||
@@ -152,8 +153,9 @@ void main() {
|
||||
|
||||
group('assertPreconditions', () {
|
||||
setUp(() {
|
||||
when(() => doctor.iosCommandValidators)
|
||||
.thenReturn([flutterValidator]);
|
||||
when(
|
||||
() => doctor.iosCommandValidators,
|
||||
).thenReturn([flutterValidator]);
|
||||
when(flutterValidator.validate).thenAnswer((_) async => []);
|
||||
});
|
||||
|
||||
@@ -161,13 +163,16 @@ void main() {
|
||||
setUp(() {
|
||||
when(
|
||||
() => shorebirdValidator.validatePreconditions(
|
||||
checkUserIsAuthenticated:
|
||||
any(named: 'checkUserIsAuthenticated'),
|
||||
checkShorebirdInitialized:
|
||||
any(named: 'checkShorebirdInitialized'),
|
||||
checkUserIsAuthenticated: any(
|
||||
named: 'checkUserIsAuthenticated',
|
||||
),
|
||||
checkShorebirdInitialized: any(
|
||||
named: 'checkShorebirdInitialized',
|
||||
),
|
||||
validators: any(named: 'validators'),
|
||||
supportedOperatingSystems:
|
||||
any(named: 'supportedOperatingSystems'),
|
||||
supportedOperatingSystems: any(
|
||||
named: 'supportedOperatingSystems',
|
||||
),
|
||||
),
|
||||
).thenAnswer((_) async {});
|
||||
});
|
||||
@@ -186,13 +191,16 @@ void main() {
|
||||
setUp(() {
|
||||
when(
|
||||
() => shorebirdValidator.validatePreconditions(
|
||||
checkUserIsAuthenticated:
|
||||
any(named: 'checkUserIsAuthenticated'),
|
||||
checkShorebirdInitialized:
|
||||
any(named: 'checkShorebirdInitialized'),
|
||||
checkUserIsAuthenticated: any(
|
||||
named: 'checkUserIsAuthenticated',
|
||||
),
|
||||
checkShorebirdInitialized: any(
|
||||
named: 'checkShorebirdInitialized',
|
||||
),
|
||||
validators: any(named: 'validators'),
|
||||
supportedOperatingSystems:
|
||||
any(named: 'supportedOperatingSystems'),
|
||||
supportedOperatingSystems: any(
|
||||
named: 'supportedOperatingSystems',
|
||||
),
|
||||
),
|
||||
).thenThrow(exception);
|
||||
});
|
||||
@@ -260,7 +268,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('when build succeeds', () {
|
||||
test('produces aar in release directory', () async {
|
||||
test('produces xcframework in release directory', () async {
|
||||
final xcframework = await runWithOverrides(
|
||||
iosFrameworkReleaser.buildReleaseArtifacts,
|
||||
);
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:shorebird_cli/src/patch_diff_checker.dart';
|
||||
import 'package:shorebird_cli/src/shorebird_process.dart';
|
||||
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
|
||||
|
||||
class FakeBaseRequest extends Fake implements http.BaseRequest {}
|
||||
|
||||
class FakeDiffStatus extends Fake implements DiffStatus {}
|
||||
|
||||
class FakeRelease extends Fake implements Release {}
|
||||
|
||||
class FakeShorebirdProcess extends Fake implements ShorebirdProcess {}
|
||||
|
||||
Reference in New Issue
Block a user