Adopt Flutter.xcframework in tool (#71495)

This commit is contained in:
Jenn Magder
2020-12-04 13:57:11 -08:00
committed by GitHub
parent f67b94bdf6
commit d4150d3f6d
14 changed files with 275 additions and 180 deletions

View File

@@ -42,9 +42,67 @@ void main() {
});
testWithoutContext('getArtifactPath', () {
final String xcframeworkPath = artifacts.getArtifactPath(
Artifact.flutterXcframework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
);
expect(
artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release),
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'ios-release', 'Flutter.framework'),
xcframeworkPath,
fileSystem.path.join(
'root',
'bin',
'cache',
'artifacts',
'engine',
'ios-release',
'Flutter.xcframework',
),
);
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
throwsToolExit(
message:
'No xcframework found at $xcframeworkPath. Try running "flutter build ios".'),
);
fileSystem.directory(xcframeworkPath).createSync(recursive: true);
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
throwsToolExit(message: 'No iOS frameworks found in $xcframeworkPath'),
);
fileSystem
.directory(xcframeworkPath)
.childDirectory('ios-x86_64-simulator')
.childDirectory('Flutter.framework')
.createSync(recursive: true);
fileSystem
.directory(xcframeworkPath)
.childDirectory('ios-armv7_arm64')
.childDirectory('Flutter.framework')
.createSync(recursive: true);
expect(
artifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator),
fileSystem.path
.join(xcframeworkPath, 'ios-x86_64-simulator', 'Flutter.framework'),
);
expect(
artifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: BuildMode.release, environmentType: EnvironmentType.physical),
fileSystem.path.join(xcframeworkPath, 'ios-armv7_arm64', 'Flutter.framework'),
);
expect(
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),
@@ -136,13 +194,78 @@ void main() {
});
testWithoutContext('getArtifactPath', () {
expect(
artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release),
fileSystem.path.join('/out', 'android_debug_unopt', 'Flutter.framework'),
final String xcframeworkPath = artifacts.getArtifactPath(
Artifact.flutterXcframework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
);
expect(
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),
fileSystem.path.join('/out', 'android_debug_unopt', 'Flutter.xcframework'),
xcframeworkPath,
fileSystem.path
.join('/out', 'android_debug_unopt', 'Flutter.xcframework'),
);
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
throwsToolExit(
message:
'No xcframework found at /out/android_debug_unopt/Flutter.xcframework. Try running "flutter build ios".'),
);
fileSystem.directory(xcframeworkPath).createSync(recursive: true);
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
throwsToolExit(
message:
'No iOS frameworks found in /out/android_debug_unopt/Flutter.xcframework'),
);
fileSystem
.directory(xcframeworkPath)
.childDirectory('ios-x86_64-simulator')
.childDirectory('Flutter.framework')
.createSync(recursive: true);
fileSystem
.directory(xcframeworkPath)
.childDirectory('ios-armv7_arm64')
.childDirectory('Flutter.framework')
.createSync(recursive: true);
expect(
artifacts.getArtifactPath(
Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
fileSystem.path
.join(xcframeworkPath, 'ios-x86_64-simulator', 'Flutter.framework'),
);
expect(
artifacts.getArtifactPath(
Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.physical,
),
fileSystem.path
.join(xcframeworkPath, 'ios-armv7_arm64', 'Flutter.framework'),
);
expect(
artifacts.getArtifactPath(
Artifact.flutterXcframework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
),
fileSystem.path
.join('/out', 'android_debug_unopt', 'Flutter.xcframework'),
);
expect(
artifacts.getArtifactPath(Artifact.flutterTester),