refactor(shorebird_cli): copy ShorebirdArtifactMixin methods for ios-framework to ArtifactManager (#2012)

This commit is contained in:
Bryan Oltman
2024-05-07 14:37:33 -04:00
committed by GitHub
parent e31959270d
commit b37c5b1b8a
2 changed files with 60 additions and 0 deletions
@@ -260,4 +260,29 @@ Failed to create diff (exit code ${result.exitCode}).
return ipaFiles.single;
}
static const String appXcframeworkName = 'App.xcframework';
/// Returns the path to the App.xcframework generated by
/// `shorebird release ios-framework` or
/// `shorebird patch ios-framework`.
String getAppXcframeworkPath() {
return p.join(getAppXcframeworkDirectory().path, appXcframeworkName);
}
/// Returns the [Directory] containing the App.xcframework generated by
/// `shorebird release ios-framework` or
/// `shorebird patch ios-framework`.
Directory getAppXcframeworkDirectory() {
final projectRoot = shorebirdEnv.getShorebirdProjectRoot()!;
return Directory(
p.join(
projectRoot.path,
'build',
'ios',
'framework',
'Release',
),
);
}
}
@@ -559,5 +559,40 @@ void main() {
});
});
});
group('getAppXcframeworkPath', () {
test('returns path to App.xcframework', () {
expect(
runWithOverrides(artifactManager.getAppXcframeworkPath),
equals(
p.join(
projectRoot.path,
'build',
'ios',
'framework',
'Release',
ArtifactManager.appXcframeworkName,
),
),
);
});
});
group('getAppXcframeworkDirectory', () {
test('returns directory containing App.xcframework', () {
expect(
runWithOverrides(artifactManager.getAppXcframeworkDirectory).path,
equals(
p.join(
projectRoot.path,
'build',
'ios',
'framework',
'Release',
),
),
);
});
});
});
}