Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanoltman committed Dec 10, 2024
1 parent ed1adb4 commit ddfd5e3
Show file tree
Hide file tree
Showing 5 changed files with 1,385 additions and 24 deletions.
7 changes: 1 addition & 6 deletions packages/shorebird_cli/lib/src/artifact_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class ArtifactManager {
return archsDirectory.existsSync() ? archsDirectory : null;
}

/// The directory containing the compiled macOS .app file, if it exists.
Directory? getMacOSAppDirectory() {
final projectRoot = shorebirdEnv.getShorebirdProjectRoot()!;

Expand Down Expand Up @@ -346,12 +347,6 @@ class ArtifactManager {
.firstWhereOrNull((directory) => directory.path.endsWith('.app'));
}

Directory? getMacosAppDirectory({required Directory parentDirectory}) {
return parentDirectory.listSync().whereType<Directory>().firstWhereOrNull(
(directory) => directory.path.endsWith('.app'),
);
}

/// Returns the path to the .ipa file generated by `flutter build ipa`.
///
/// Returns null if:
Expand Down
10 changes: 5 additions & 5 deletions packages/shorebird_cli/lib/src/commands/patch/macos_patcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ class MacosPatcher extends Patcher {
).wait;

if ((flutterVersion ?? minimumSupportedMacosFlutterVersion) <
minimumSupportedIosFlutterVersion) {
minimumSupportedMacosFlutterVersion) {
logger.err(
'''
macos patches are not supported with Flutter versions older than $minimumSupportedIosFlutterVersion.
macOS patches are not supported with Flutter versions older than $minimumSupportedMacosFlutterVersion.
For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
);
throw ProcessExit(ExitCode.software.code);
Expand All @@ -128,7 +128,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
buildProgress.fail('Failed to build: ${error.message}');
rethrow;
} on ArtifactBuildException catch (error) {
buildProgress.fail('Failed to build macos app');
buildProgress.fail('Failed to build macOS app');
logger.err(error.message);
rethrow;
}
Expand Down Expand Up @@ -282,7 +282,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
if (useLinker && await aotTools.isGeneratePatchDiffBaseSupported()) {
final patchBaseProgress = logger.progress('Generating patch diff base');
final analyzeSnapshotPath = shorebirdArtifacts.getArtifactPath(
artifact: ShorebirdArtifact.analyzeSnapshotMacos,
artifact: ShorebirdArtifact.analyzeSnapshotMacOS,
);

final File patchBaseFile;
Expand Down Expand Up @@ -369,7 +369,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',

final analyzeSnapshot = File(
shorebirdArtifacts.getArtifactPath(
artifact: ShorebirdArtifact.analyzeSnapshotMacos,
artifact: ShorebirdArtifact.analyzeSnapshotMacOS,
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
// This is to ensure that we don't accidentally upload stale artifacts
// when building with older versions of Flutter.
final shorebirdSupplementDir =
artifactManager.getIosReleaseSupplementDirectory();
artifactManager.getMacosReleaseSupplementDirectory();
if (shorebirdSupplementDir?.existsSync() ?? false) {
shorebirdSupplementDir!.deleteSync(recursive: true);
}
Expand Down
42 changes: 33 additions & 9 deletions packages/shorebird_cli/lib/src/shorebird_artifacts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum ShorebirdArtifact {
analyzeSnapshotIos,

/// The macOS analyze_snapshot executable.
analyzeSnapshotMacos,
analyzeSnapshotMacOS,

/// The aot_tools executable or kernel file.
aotTools,
Expand Down Expand Up @@ -56,7 +56,7 @@ class ShorebirdCachedArtifacts implements ShorebirdArtifacts {
switch (artifact) {
case ShorebirdArtifact.analyzeSnapshotIos:
return _analyzeSnapshotIosFile.path;
case ShorebirdArtifact.analyzeSnapshotMacos:
case ShorebirdArtifact.analyzeSnapshotMacOS:
return _analyzeSnapshotMacosFile.path;
case ShorebirdArtifact.aotTools:
return _aotToolsFile.path;
Expand Down Expand Up @@ -159,24 +159,37 @@ class ShorebirdLocalEngineArtifacts implements ShorebirdArtifacts {
String getArtifactPath({required ShorebirdArtifact artifact}) {
switch (artifact) {
case ShorebirdArtifact.analyzeSnapshotIos:
case ShorebirdArtifact.analyzeSnapshotMacos:
return _analyzeSnapshotFile.path;
return _analyzeSnapshotIosFile.path;
case ShorebirdArtifact.analyzeSnapshotMacOS:
return _analyzeSnapshotMacosFile.path;
case ShorebirdArtifact.aotTools:
return _aotToolsFile.path;
case ShorebirdArtifact.genSnapshotIos:
return _genSnapshotIosFile.path;
case ShorebirdArtifact.genSnapshotMacOS:
return _genSnapshotFile.path;
return _genSnapshotMacosFile.path;
}
}

File get _analyzeSnapshotFile {
File get _analyzeSnapshotIosFile {
return File(
p.join(
engineConfig.localEngineSrcPath!,
'out',
engineConfig.localEngine,
'clang_x64',
'analyze_snapshot_arm64',
),
);
}

File get _analyzeSnapshotMacosFile {
return File(
p.join(
engineConfig.localEngineSrcPath!,
'out',
engineConfig.localEngine,
'clang_x64',
// 'analyze_snapshot_arm64',
'analyze_snapshot',
),
);
Expand All @@ -197,14 +210,25 @@ class ShorebirdLocalEngineArtifacts implements ShorebirdArtifacts {
);
}

File get _genSnapshotFile {
File get _genSnapshotIosFile {
return File(
p.join(
engineConfig.localEngineSrcPath!,
'out',
engineConfig.localEngine,
'clang_x64',
'gen_snapshot_arm64',
),
);
}

File get _genSnapshotMacosFile {
return File(
p.join(
engineConfig.localEngineSrcPath!,
'out',
engineConfig.localEngine,
'clang_x64',
// 'gen_snapshot_arm64',
'gen_snapshot',
),
);
Expand Down
Loading

0 comments on commit ddfd5e3

Please sign in to comment.