feat: remove --split-debug-symbols handling from macOS patching (#2807)
This commit is contained in:
@@ -2,7 +2,6 @@ import 'dart:io';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:shorebird_cli/src/archive_analysis/apple_archive_differ.dart';
|
||||
@@ -56,30 +55,6 @@ class MacosPatcher extends Patcher {
|
||||
|
||||
String get _appDillCopyPath => p.join(buildDirectory.path, 'app.dill');
|
||||
|
||||
/// The name of the split debug info file when the target is macOS.
|
||||
// FIXME: this is only the arm symbols, x64 symbols are at
|
||||
// app.darwin-x86_64.symbols
|
||||
static const splitDebugInfoFileName = 'app.darwin-arm64.symbols';
|
||||
|
||||
/// The additional gen_snapshot arguments to use when building the patch with
|
||||
/// `--split-debug-info`.
|
||||
static List<String> splitDebugInfoArgs(String? splitDebugInfoPath) {
|
||||
return splitDebugInfoPath != null
|
||||
? [
|
||||
'--dwarf-stack-traces',
|
||||
'--resolve-dwarf-paths',
|
||||
'''--save-debugging-info=${p.join(p.absolute(splitDebugInfoPath), splitDebugInfoFileName)}''',
|
||||
]
|
||||
: <String>[];
|
||||
}
|
||||
|
||||
/// The link percentage from the most recent patch build.
|
||||
@visibleForTesting
|
||||
double? lastBuildLinkPercentage;
|
||||
|
||||
@override
|
||||
double? get linkPercentage => lastBuildLinkPercentage;
|
||||
|
||||
@override
|
||||
ReleaseType get releaseType => ReleaseType.macos;
|
||||
|
||||
@@ -211,7 +186,6 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
|
||||
appDillPath: macosBuildResult.kernelFile.path,
|
||||
outFilePath: _arm64AotOutputPath,
|
||||
genSnapshotArtifact: ShorebirdArtifact.genSnapshotMacosArm64,
|
||||
additionalArgs: splitDebugInfoArgs(splitDebugInfoPath),
|
||||
);
|
||||
|
||||
if (!File(_arm64AotOutputPath).existsSync()) {
|
||||
@@ -222,7 +196,6 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
|
||||
appDillPath: macosBuildResult.kernelFile.path,
|
||||
outFilePath: _x64AotOutputPath,
|
||||
genSnapshotArtifact: ShorebirdArtifact.genSnapshotMacosX64,
|
||||
additionalArgs: splitDebugInfoArgs(splitDebugInfoPath),
|
||||
);
|
||||
|
||||
if (!File(_x64AotOutputPath).existsSync()) {
|
||||
@@ -363,7 +336,6 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
|
||||
CreatePatchMetadata metadata,
|
||||
) async =>
|
||||
metadata.copyWith(
|
||||
linkPercentage: lastBuildLinkPercentage,
|
||||
environment: metadata.environment.copyWith(
|
||||
xcodeVersion: await xcodeBuild.version(),
|
||||
),
|
||||
|
||||
@@ -46,7 +46,6 @@ void main() {
|
||||
group(
|
||||
MacosPatcher,
|
||||
() {
|
||||
late AotTools aotTools;
|
||||
late ArgParser argParser;
|
||||
late ArgResults argResults;
|
||||
late ArtifactBuilder artifactBuilder;
|
||||
@@ -75,7 +74,6 @@ void main() {
|
||||
return runScoped(
|
||||
body,
|
||||
values: {
|
||||
aotToolsRef.overrideWith(() => aotTools),
|
||||
artifactBuilderRef.overrideWith(() => artifactBuilder),
|
||||
artifactManagerRef.overrideWith(() => artifactManager),
|
||||
codePushClientWrapperRef.overrideWith(() => codePushClientWrapper),
|
||||
@@ -106,7 +104,6 @@ void main() {
|
||||
});
|
||||
|
||||
setUp(() {
|
||||
aotTools = MockAotTools();
|
||||
argParser = MockArgParser();
|
||||
argResults = MockArgResults();
|
||||
artifactBuilder = MockArtifactBuilder();
|
||||
@@ -154,8 +151,6 @@ void main() {
|
||||
() => shorebirdEnv.getShorebirdProjectRoot(),
|
||||
).thenReturn(projectRoot);
|
||||
|
||||
when(aotTools.isLinkDebugInfoSupported).thenAnswer((_) async => false);
|
||||
|
||||
appDirectory = Directory(
|
||||
p.join(
|
||||
projectRoot.path,
|
||||
@@ -191,26 +186,6 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
group('linkPercentage', () {
|
||||
group('when linking has not occurred', () {
|
||||
test('returns null', () {
|
||||
expect(patcher.linkPercentage, isNull);
|
||||
});
|
||||
});
|
||||
|
||||
group('when linking has occurred', () {
|
||||
const linkPercentage = 42.1337;
|
||||
|
||||
setUp(() {
|
||||
patcher.lastBuildLinkPercentage = linkPercentage;
|
||||
});
|
||||
|
||||
test('returns correct link percentage', () {
|
||||
expect(patcher.linkPercentage, equals(linkPercentage));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
group('assertPreconditions', () {
|
||||
setUp(() {
|
||||
when(
|
||||
@@ -530,7 +505,7 @@ This may indicate that the patch contains native changes, which cannot be applie
|
||||
).thenAnswer((_) async => flutterVersionAndRevision);
|
||||
when(
|
||||
() => shorebirdFlutter.getVersion(),
|
||||
).thenAnswer((_) async => Version(3, 27, 0));
|
||||
).thenAnswer((_) async => Version(3, 27, 3));
|
||||
});
|
||||
|
||||
group('when specified flutter version is less than minimum', () {
|
||||
@@ -804,44 +779,6 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
|
||||
});
|
||||
});
|
||||
|
||||
group('when --split-debug-info is provided', () {
|
||||
final tempDir = Directory.systemTemp.createTempSync();
|
||||
final splitDebugInfoPath = p.join(tempDir.path, 'symbols');
|
||||
final splitDebugInfoFile = File(
|
||||
p.join(splitDebugInfoPath, 'app.darwin-arm64.symbols'),
|
||||
);
|
||||
setUp(() {
|
||||
when(
|
||||
() => argResults.wasParsed(
|
||||
CommonArguments.splitDebugInfoArg.name,
|
||||
),
|
||||
).thenReturn(true);
|
||||
when(
|
||||
() => argResults[CommonArguments.splitDebugInfoArg.name],
|
||||
).thenReturn(splitDebugInfoPath);
|
||||
});
|
||||
|
||||
test('forwards --split-debug-info to builder', () async {
|
||||
try {
|
||||
await runWithOverrides(patcher.buildPatchArtifact);
|
||||
} on Exception {
|
||||
// ignore
|
||||
}
|
||||
verify(
|
||||
() => artifactBuilder.buildElfAotSnapshot(
|
||||
appDillPath: any(named: 'appDillPath'),
|
||||
outFilePath: any(named: 'outFilePath'),
|
||||
genSnapshotArtifact: any(named: 'genSnapshotArtifact'),
|
||||
additionalArgs: [
|
||||
'--dwarf-stack-traces',
|
||||
'--resolve-dwarf-paths',
|
||||
'--save-debugging-info=${splitDebugInfoFile.path}',
|
||||
],
|
||||
),
|
||||
).called(2);
|
||||
});
|
||||
});
|
||||
|
||||
group('when releaseVersion is provided', () {
|
||||
test('forwards --build-name and --build-number to builder',
|
||||
() async {
|
||||
@@ -1198,12 +1135,6 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
|
||||
).thenAnswer((_) async => xcodeVersion);
|
||||
});
|
||||
|
||||
const linkPercentage = 100.0;
|
||||
|
||||
setUp(() {
|
||||
patcher.lastBuildLinkPercentage = linkPercentage;
|
||||
});
|
||||
|
||||
test('returns correct metadata', () async {
|
||||
const metadata = CreatePatchMetadata(
|
||||
releasePlatform: ReleasePlatform.macos,
|
||||
@@ -1231,7 +1162,6 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
|
||||
hasAssetChanges: true,
|
||||
usedIgnoreNativeChangesFlag: allowNativeDiffs,
|
||||
hasNativeChanges: false,
|
||||
linkPercentage: linkPercentage,
|
||||
environment: BuildEnvironmentMetadata(
|
||||
flutterRevision: flutterRevision,
|
||||
operatingSystem: operatingSystem,
|
||||
|
||||
Reference in New Issue
Block a user