forked from firka/flutter
Add FlutterMacOS.xcframework artifact (#143244)
Replace `FlutterMacOS.framework` cached artifact with `FlutterMacOS.xcframework`. Also, update usage of `FlutterMacOS.framework` to use `FlutterMacOS.xcframework`. Part of https://github.com/flutter/flutter/issues/126016.
This commit is contained in:
committed by
GitHub
parent
b2a3075fa5
commit
42252cd4c6
@@ -93,12 +93,6 @@ void main() {
|
||||
.childDirectory('Flutter.framework')
|
||||
.createSync(recursive: true);
|
||||
|
||||
// TODO(jmagman): Remove ios-arm64_armv7 checks when armv7 engine artifacts are removed.
|
||||
fileSystem
|
||||
.directory(xcframeworkPath)
|
||||
.childDirectory('ios-arm64_armv7')
|
||||
.childDirectory('Flutter.framework')
|
||||
.createSync(recursive: true);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.flutterFramework,
|
||||
platform: TargetPlatform.ios,
|
||||
@@ -118,16 +112,9 @@ void main() {
|
||||
'ios-arm64',
|
||||
'Flutter.framework',
|
||||
);
|
||||
final String expectedArmv7ReleaseFrameworkArtifact = fileSystem.path.join(
|
||||
xcframeworkPath,
|
||||
'ios-arm64_armv7',
|
||||
'Flutter.framework',
|
||||
);
|
||||
|
||||
// TODO(jmagman): Replace with expect(actualReleaseFrameworkArtifact, expectedArm64ReleaseFrameworkArtifact) when armv7 engine artifacts are removed.
|
||||
expect(
|
||||
actualReleaseFrameworkArtifact,
|
||||
anyOf(expectedArm64ReleaseFrameworkArtifact, expectedArmv7ReleaseFrameworkArtifact),
|
||||
expectedArm64ReleaseFrameworkArtifact,
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),
|
||||
@@ -148,6 +135,87 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('getArtifactPath for FlutterMacOS.framework and FlutterMacOS.xcframework', () {
|
||||
final String xcframeworkPath = fileSystem.path.join(
|
||||
'root',
|
||||
'bin',
|
||||
'cache',
|
||||
'artifacts',
|
||||
'engine',
|
||||
'darwin-x64-release',
|
||||
'FlutterMacOS.xcframework',
|
||||
);
|
||||
final String xcframeworkPathWithUnsetPlatform = fileSystem.path.join(
|
||||
'root',
|
||||
'bin',
|
||||
'cache',
|
||||
'artifacts',
|
||||
'engine',
|
||||
'linux-x64-release',
|
||||
'FlutterMacOS.xcframework',
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSXcframework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
xcframeworkPath,
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSXcframework,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
xcframeworkPathWithUnsetPlatform,
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'No xcframework found at $xcframeworkPath.'),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'No xcframework found at $xcframeworkPathWithUnsetPlatform.'),
|
||||
);
|
||||
fileSystem.directory(xcframeworkPath).createSync(recursive: true);
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
throwsToolExit(message: 'No macOS frameworks found in $xcframeworkPath'),
|
||||
);
|
||||
fileSystem
|
||||
.directory(xcframeworkPath)
|
||||
.childDirectory('macos-arm64_x86_64')
|
||||
.childDirectory('FlutterMacOS.framework')
|
||||
.createSync(recursive: true);
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
fileSystem.path.join(
|
||||
xcframeworkPath,
|
||||
'macos-arm64_x86_64',
|
||||
'FlutterMacOS.framework',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Precompiled web AMD module system artifact paths are correct', () {
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.webPrecompiledAmdSdk).path,
|
||||
@@ -269,6 +337,92 @@ void main() {
|
||||
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||
});
|
||||
|
||||
testWithoutContext('getArtifactPath for FlutterMacOS.framework and FlutterMacOS.xcframework', () {
|
||||
final String xcframeworkPath = fileSystem.path.join(
|
||||
'/out',
|
||||
'android_debug_unopt',
|
||||
'FlutterMacOS.xcframework',
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSXcframework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
xcframeworkPath,
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSXcframework,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
xcframeworkPath,
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'No xcframework found at /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'No xcframework found at /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
||||
);
|
||||
fileSystem.directory(xcframeworkPath).createSync(recursive: true);
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'No macOS frameworks found in /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'No macOS frameworks found in /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
||||
);
|
||||
|
||||
fileSystem
|
||||
.directory(xcframeworkPath)
|
||||
.childDirectory('macos-arm64_x86_64')
|
||||
.childDirectory('FlutterMacOS.framework')
|
||||
.createSync(recursive: true);
|
||||
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
platform: TargetPlatform.darwin,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
fileSystem.path
|
||||
.join(xcframeworkPath, 'macos-arm64_x86_64', 'FlutterMacOS.framework'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.flutterMacOSFramework,
|
||||
mode: BuildMode.release,
|
||||
),
|
||||
fileSystem.path
|
||||
.join(xcframeworkPath, 'macos-arm64_x86_64', 'FlutterMacOS.framework'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('getArtifactPath', () {
|
||||
final String xcframeworkPath = artifacts.getArtifactPath(
|
||||
Artifact.flutterXcframework,
|
||||
@@ -311,7 +465,7 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.directory(xcframeworkPath)
|
||||
.childDirectory('ios-arm64_armv7')
|
||||
.childDirectory('ios-arm64')
|
||||
.childDirectory('Flutter.framework')
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
@@ -339,7 +493,7 @@ void main() {
|
||||
environmentType: EnvironmentType.physical,
|
||||
),
|
||||
fileSystem.path
|
||||
.join(xcframeworkPath, 'ios-arm64_armv7', 'Flutter.framework'),
|
||||
.join(xcframeworkPath, 'ios-arm64', 'Flutter.framework'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(
|
||||
|
||||
@@ -393,33 +393,6 @@ void main() {
|
||||
expect(operatingSystemUtils.chmods, <List<String>>[<String>['/.tmp_rand0/flutter_cache_test_artifact.rand0/bin_dir', 'a+r,a+x']]);
|
||||
});
|
||||
|
||||
testWithoutContext('EngineCachedArtifact removes unzipped FlutterMacOS.framework before replacing', () async {
|
||||
final OperatingSystemUtils operatingSystemUtils = FakeOperatingSystemUtils();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final Directory artifactDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_artifact.');
|
||||
final Directory downloadDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_download.');
|
||||
final FakeSecondaryCache cache = FakeSecondaryCache()
|
||||
..artifactDirectory = artifactDir
|
||||
..downloadDir = downloadDir;
|
||||
|
||||
final Directory binDir = artifactDir.childDirectory('bin_dir')..createSync();
|
||||
binDir.childFile('FlutterMacOS.framework.zip').createSync();
|
||||
final Directory unzippedFramework = binDir.childDirectory('FlutterMacOS.framework');
|
||||
final File staleFile = unzippedFramework.childFile('stale_file')..createSync(recursive: true);
|
||||
artifactDir.childFile('unused_url_path').createSync();
|
||||
|
||||
final FakeCachedArtifact artifact = FakeCachedArtifact(
|
||||
cache: cache,
|
||||
binaryDirs: <List<String>>[
|
||||
<String>['bin_dir', 'unused_url_path'],
|
||||
],
|
||||
requiredArtifacts: DevelopmentArtifact.universal,
|
||||
);
|
||||
await artifact.updateInner(FakeArtifactUpdater(), fileSystem, operatingSystemUtils);
|
||||
expect(unzippedFramework, exists);
|
||||
expect(staleFile, isNot(exists));
|
||||
});
|
||||
|
||||
testWithoutContext('Try to remove without a parent', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final Directory parent = fileSystem.directory('dir');
|
||||
|
||||
@@ -24,6 +24,38 @@ void main() {
|
||||
]);
|
||||
});
|
||||
|
||||
test('verify FlutterMacOS.xcframework artifact', () {
|
||||
final String flutterRoot = getFlutterRoot();
|
||||
|
||||
final Directory xcframeworkArtifact = fileSystem.directory(
|
||||
fileSystem.path.join(
|
||||
flutterRoot,
|
||||
'bin',
|
||||
'cache',
|
||||
'artifacts',
|
||||
'engine',
|
||||
'darwin-x64',
|
||||
'FlutterMacOS.xcframework',
|
||||
),
|
||||
);
|
||||
|
||||
final Directory tempDir = createResolvedTempDirectorySync('macos_content_validation.');
|
||||
|
||||
// Pre-cache iOS engine Flutter.xcframework artifacts.
|
||||
final ProcessResult result = processManager.runSync(
|
||||
<String>[
|
||||
flutterBin,
|
||||
...getLocalEngineArguments(),
|
||||
'precache',
|
||||
'--macos',
|
||||
],
|
||||
workingDirectory: tempDir.path,
|
||||
);
|
||||
|
||||
expect(result, const ProcessResultMatcher());
|
||||
expect(xcframeworkArtifact.existsSync(), isTrue);
|
||||
});
|
||||
|
||||
for (final String buildMode in <String>['Debug', 'Release']) {
|
||||
final String buildModeLower = buildMode.toLowerCase();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user