Unverified Commit a5ee7f7c authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Add XCFramework artifacts (#71113)

parent e2447247
...@@ -18,6 +18,7 @@ enum Artifact { ...@@ -18,6 +18,7 @@ enum Artifact {
/// The flutter tester binary. /// The flutter tester binary.
flutterTester, flutterTester,
flutterFramework, flutterFramework,
flutterXcframework,
/// The framework directory of the macOS desktop. /// The framework directory of the macOS desktop.
flutterMacOSFramework, flutterMacOSFramework,
vmSnapshotData, vmSnapshotData,
...@@ -94,6 +95,8 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo ...@@ -94,6 +95,8 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
return 'flutter_tester$exe'; return 'flutter_tester$exe';
case Artifact.flutterFramework: case Artifact.flutterFramework:
return 'Flutter.framework'; return 'Flutter.framework';
case Artifact.flutterXcframework:
return 'Flutter.xcframework';
case Artifact.flutterMacOSFramework: case Artifact.flutterMacOSFramework:
return 'FlutterMacOS.framework'; return 'FlutterMacOS.framework';
case Artifact.vmSnapshotData: case Artifact.vmSnapshotData:
...@@ -208,8 +211,13 @@ abstract class Artifacts { ...@@ -208,8 +211,13 @@ abstract class Artifacts {
); );
} }
// Returns the requested [artifact] for the [platform] and [mode] combination. /// Returns the requested [artifact] for the [platform], [mode], and [environmentType] combination.
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }); String getArtifactPath(
Artifact artifact, {
TargetPlatform platform,
BuildMode mode,
EnvironmentType environmentType,
});
// Returns which set of engine artifacts is currently used for the [platform] // Returns which set of engine artifacts is currently used for the [platform]
// and [mode] combination. // and [mode] combination.
...@@ -235,7 +243,12 @@ class CachedArtifacts implements Artifacts { ...@@ -235,7 +243,12 @@ class CachedArtifacts implements Artifacts {
final Cache _cache; final Cache _cache;
@override @override
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) { String getArtifactPath(
Artifact artifact, {
TargetPlatform platform,
BuildMode mode,
EnvironmentType environmentType,
}) {
switch (platform) { switch (platform) {
case TargetPlatform.android_arm: case TargetPlatform.android_arm:
case TargetPlatform.android_arm64: case TargetPlatform.android_arm64:
...@@ -243,7 +256,7 @@ class CachedArtifacts implements Artifacts { ...@@ -243,7 +256,7 @@ class CachedArtifacts implements Artifacts {
case TargetPlatform.android_x86: case TargetPlatform.android_x86:
return _getAndroidArtifactPath(artifact, platform, mode); return _getAndroidArtifactPath(artifact, platform, mode);
case TargetPlatform.ios: case TargetPlatform.ios:
return _getIosArtifactPath(artifact, platform, mode); return _getIosArtifactPath(artifact, platform, mode, environmentType);
case TargetPlatform.darwin_x64: case TargetPlatform.darwin_x64:
case TargetPlatform.linux_x64: case TargetPlatform.linux_x64:
case TargetPlatform.windows_x64: case TargetPlatform.windows_x64:
...@@ -288,10 +301,12 @@ class CachedArtifacts implements Artifacts { ...@@ -288,10 +301,12 @@ class CachedArtifacts implements Artifacts {
} }
} }
String _getIosArtifactPath(Artifact artifact, TargetPlatform platform, BuildMode mode) { String _getIosArtifactPath(Artifact artifact, TargetPlatform platform,
BuildMode mode, EnvironmentType environmentType) {
switch (artifact) { switch (artifact) {
case Artifact.genSnapshot: case Artifact.genSnapshot:
case Artifact.flutterFramework: case Artifact.flutterFramework:
case Artifact.flutterXcframework:
case Artifact.frontendServerSnapshotForEngineDartSdk: case Artifact.frontendServerSnapshotForEngineDartSdk:
final String artifactFileName = _artifactToFileName(artifact); final String artifactFileName = _artifactToFileName(artifact);
final String engineDir = _getEngineArtifactsPath(platform, mode); final String engineDir = _getEngineArtifactsPath(platform, mode);
...@@ -534,7 +549,12 @@ class LocalEngineArtifacts implements Artifacts { ...@@ -534,7 +549,12 @@ class LocalEngineArtifacts implements Artifacts {
final Platform _platform; final Platform _platform;
@override @override
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) { String getArtifactPath(
Artifact artifact, {
TargetPlatform platform,
BuildMode mode,
EnvironmentType environmentType,
}) {
platform ??= _currentHostPlatform(_platform); platform ??= _currentHostPlatform(_platform);
final bool isDirectoryArtifact = artifact == Artifact.flutterWebSdk || artifact == Artifact.flutterPatchedSdkPath; final bool isDirectoryArtifact = artifact == Artifact.flutterWebSdk || artifact == Artifact.flutterPatchedSdkPath;
final String artifactFileName = isDirectoryArtifact ? null : _artifactToFileName(artifact, platform, mode); final String artifactFileName = isDirectoryArtifact ? null : _artifactToFileName(artifact, platform, mode);
...@@ -547,6 +567,8 @@ class LocalEngineArtifacts implements Artifacts { ...@@ -547,6 +567,8 @@ class LocalEngineArtifacts implements Artifacts {
case Artifact.vmSnapshotData: case Artifact.vmSnapshotData:
return _fileSystem.path.join(engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName); return _fileSystem.path.join(engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName);
case Artifact.icuData: case Artifact.icuData:
case Artifact.flutterXcframework:
case Artifact.flutterMacOSFramework:
return _fileSystem.path.join(engineOutPath, artifactFileName); return _fileSystem.path.join(engineOutPath, artifactFileName);
case Artifact.platformKernelDill: case Artifact.platformKernelDill:
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) { if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
...@@ -557,8 +579,6 @@ class LocalEngineArtifacts implements Artifacts { ...@@ -557,8 +579,6 @@ class LocalEngineArtifacts implements Artifacts {
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), 'lib', artifactFileName); return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), 'lib', artifactFileName);
case Artifact.flutterFramework: case Artifact.flutterFramework:
return _fileSystem.path.join(engineOutPath, artifactFileName); return _fileSystem.path.join(engineOutPath, artifactFileName);
case Artifact.flutterMacOSFramework:
return _fileSystem.path.join(engineOutPath, artifactFileName);
case Artifact.flutterPatchedSdkPath: case Artifact.flutterPatchedSdkPath:
// When using local engine always use [BuildMode.debug] regardless of // When using local engine always use [BuildMode.debug] regardless of
// what was specified in [mode] argument because local engine will // what was specified in [mode] argument because local engine will
...@@ -712,7 +732,12 @@ class OverrideArtifacts implements Artifacts { ...@@ -712,7 +732,12 @@ class OverrideArtifacts implements Artifacts {
final File flutterPatchedSdk; final File flutterPatchedSdk;
@override @override
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) { String getArtifactPath(
Artifact artifact, {
TargetPlatform platform,
BuildMode mode,
EnvironmentType environmentType,
}) {
if (artifact == Artifact.frontendServerSnapshotForEngineDartSdk && frontendServer != null) { if (artifact == Artifact.frontendServerSnapshotForEngineDartSdk && frontendServer != null) {
return frontendServer.path; return frontendServer.path;
} }
...@@ -725,7 +750,12 @@ class OverrideArtifacts implements Artifacts { ...@@ -725,7 +750,12 @@ class OverrideArtifacts implements Artifacts {
if (artifact == Artifact.flutterPatchedSdkPath && flutterPatchedSdk != null) { if (artifact == Artifact.flutterPatchedSdkPath && flutterPatchedSdk != null) {
return flutterPatchedSdk.path; return flutterPatchedSdk.path;
} }
return parent.getArtifactPath(artifact, platform: platform, mode: mode); return parent.getArtifactPath(
artifact,
platform: platform,
mode: mode,
environmentType: environmentType,
);
} }
@override @override
...@@ -742,7 +772,12 @@ String _dartSdkPath(FileSystem fileSystem) { ...@@ -742,7 +772,12 @@ String _dartSdkPath(FileSystem fileSystem) {
class _TestArtifacts implements Artifacts { class _TestArtifacts implements Artifacts {
@override @override
String getArtifactPath(Artifact artifact, {TargetPlatform platform, BuildMode mode}) { String getArtifactPath(
Artifact artifact, {
TargetPlatform platform,
BuildMode mode,
EnvironmentType environmentType,
}) {
final StringBuffer buffer = StringBuffer(); final StringBuffer buffer = StringBuffer();
buffer.write(artifact); buffer.write(artifact);
if (platform != null) { if (platform != null) {
...@@ -751,6 +786,9 @@ class _TestArtifacts implements Artifacts { ...@@ -751,6 +786,9 @@ class _TestArtifacts implements Artifacts {
if (mode != null) { if (mode != null) {
buffer.write('.$mode'); buffer.write('.$mode');
} }
if (environmentType != null) {
buffer.write('.$environmentType');
}
return buffer.toString(); return buffer.toString();
} }
......
...@@ -12,6 +12,7 @@ import '../../base/io.dart'; ...@@ -12,6 +12,7 @@ import '../../base/io.dart';
import '../../base/process.dart'; import '../../base/process.dart';
import '../../build_info.dart'; import '../../build_info.dart';
import '../../globals.dart' as globals hide fs, logger, processManager, artifacts; import '../../globals.dart' as globals hide fs, logger, processManager, artifacts;
import '../../macos/xcode.dart';
import '../../project.dart'; import '../../project.dart';
import '../build_system.dart'; import '../build_system.dart';
import '../depfile.dart'; import '../depfile.dart';
...@@ -267,10 +268,16 @@ abstract class UnpackIOS extends Target { ...@@ -267,10 +268,16 @@ abstract class UnpackIOS extends Target {
@override @override
Future<void> build(Environment environment) async { Future<void> build(Environment environment) async {
if (environment.defines[kSdkRoot] == null) {
throw MissingDefineException(kSdkRoot, name);
}
final Directory sdkRoot = environment.fileSystem.directory(environment.defines[kSdkRoot]);
final EnvironmentType environmentType = environmentTypeFromSdkroot(sdkRoot);
final String basePath = environment.artifacts.getArtifactPath( final String basePath = environment.artifacts.getArtifactPath(
Artifact.flutterFramework, Artifact.flutterFramework,
platform: TargetPlatform.ios, platform: TargetPlatform.ios,
mode: buildMode, mode: buildMode,
environmentType: environmentType,
); );
final ProcessResult result = environment.processManager.runSync(<String>[ final ProcessResult result = environment.processManager.runSync(<String>[
......
...@@ -459,7 +459,7 @@ end ...@@ -459,7 +459,7 @@ end
// copy the corresponding engine. // copy the corresponding engine.
// A plugin framework built with bitcode must link against the bitcode version // A plugin framework built with bitcode must link against the bitcode version
// of Flutter.framework (Release). // of Flutter.framework (Release).
_project.ios.copyEngineArtifactToProject(mode); _project.ios.copyEngineArtifactToProject(mode, EnvironmentType.physical);
final String bitcodeGenerationMode = mode == BuildMode.release ? final String bitcodeGenerationMode = mode == BuildMode.release ?
'bitcode' : 'marker'; // In release, force bitcode embedding without archiving. 'bitcode' : 'marker'; // In release, force bitcode embedding without archiving.
......
...@@ -648,11 +648,11 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject { ...@@ -648,11 +648,11 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
ephemeralDirectory, ephemeralDirectory,
); );
} }
copyEngineArtifactToProject(BuildMode.debug); copyEngineArtifactToProject(BuildMode.debug, EnvironmentType.physical);
} }
} }
void copyEngineArtifactToProject(BuildMode mode) { void copyEngineArtifactToProject(BuildMode mode, EnvironmentType environmentType) {
// Copy framework from engine cache. The actual build mode // Copy framework from engine cache. The actual build mode
// doesn't actually matter as it will be overwritten by xcode_backend.sh. // doesn't actually matter as it will be overwritten by xcode_backend.sh.
// However, cocoapods will run before that script and requires something // However, cocoapods will run before that script and requires something
...@@ -662,6 +662,7 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject { ...@@ -662,6 +662,7 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
Artifact.flutterFramework, Artifact.flutterFramework,
platform: TargetPlatform.ios, platform: TargetPlatform.ios,
mode: mode, mode: mode,
environmentType: environmentType,
) )
); );
if (framework.existsSync()) { if (framework.existsSync()) {
......
...@@ -544,8 +544,12 @@ include ':app' ...@@ -544,8 +544,12 @@ include ':app'
String expectedBuildName, String expectedBuildName,
String expectedBuildNumber, String expectedBuildNumber,
}) async { }) async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: TargetPlatform.android_arm, mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: TargetPlatform.android_arm,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(globals.fs.path.join('out', 'android_arm')); when(mockArtifacts.engineOutPath).thenReturn(globals.fs.path.join('out', 'android_arm'));
final File manifestFile = globals.fs.file('path/to/project/pubspec.yaml'); final File manifestFile = globals.fs.file('path/to/project/pubspec.yaml');
...@@ -1686,8 +1690,12 @@ plugin1=${plugin1.path} ...@@ -1686,8 +1690,12 @@ plugin1=${plugin1.path}
}); });
testUsingContext('build apk uses selected local engine,the engine abi is arm', () async { testUsingContext('build apk uses selected local engine,the engine abi is arm', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: TargetPlatform.android_arm, mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: TargetPlatform.android_arm,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm'));
fileSystem.file('out/android_arm/flutter_embedding_release.pom') fileSystem.file('out/android_arm/flutter_embedding_release.pom')
...@@ -1779,8 +1787,12 @@ plugin1=${plugin1.path} ...@@ -1779,8 +1787,12 @@ plugin1=${plugin1.path}
testUsingContext( testUsingContext(
'build apk uses selected local engine,the engine abi is arm64', () async { 'build apk uses selected local engine,the engine abi is arm64', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: anyNamed('platform'), mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: anyNamed('platform'),
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm64')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm64'));
fileSystem.file('out/android_arm64/flutter_embedding_release.pom') fileSystem.file('out/android_arm64/flutter_embedding_release.pom')
...@@ -1872,8 +1884,12 @@ plugin1=${plugin1.path} ...@@ -1872,8 +1884,12 @@ plugin1=${plugin1.path}
testUsingContext( testUsingContext(
'build apk uses selected local engine,the engine abi is x86', () async { 'build apk uses selected local engine,the engine abi is x86', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: anyNamed('platform'), mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: anyNamed('platform'),
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x86')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x86'));
fileSystem.file('out/android_x86/flutter_embedding_release.pom') fileSystem.file('out/android_x86/flutter_embedding_release.pom')
...@@ -1965,8 +1981,12 @@ plugin1=${plugin1.path} ...@@ -1965,8 +1981,12 @@ plugin1=${plugin1.path}
testUsingContext( testUsingContext(
'build apk uses selected local engine,the engine abi is x64', () async { 'build apk uses selected local engine,the engine abi is x64', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: anyNamed('platform'), mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: anyNamed('platform'),
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x64')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x64'));
fileSystem.file('out/android_x64/flutter_embedding_release.pom') fileSystem.file('out/android_x64/flutter_embedding_release.pom')
...@@ -2110,8 +2130,12 @@ plugin1=${plugin1.path} ...@@ -2110,8 +2130,12 @@ plugin1=${plugin1.path}
}); });
testUsingContext('build aar uses selected local engine,the engine abi is arm', () async { testUsingContext('build aar uses selected local engine,the engine abi is arm', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: TargetPlatform.android_arm, mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: TargetPlatform.android_arm,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm'));
fileSystem.file('out/android_arm/flutter_embedding_release.pom') fileSystem.file('out/android_arm/flutter_embedding_release.pom')
...@@ -2207,8 +2231,12 @@ plugin1=${plugin1.path} ...@@ -2207,8 +2231,12 @@ plugin1=${plugin1.path}
testUsingContext( testUsingContext(
'build aar uses selected local engine,the engine abi is arm64', () async { 'build aar uses selected local engine,the engine abi is arm64', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: anyNamed('platform'), mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: anyNamed('platform'),
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm64')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_arm64'));
fileSystem.file('out/android_arm64/flutter_embedding_release.pom') fileSystem.file('out/android_arm64/flutter_embedding_release.pom')
...@@ -2305,8 +2333,12 @@ plugin1=${plugin1.path} ...@@ -2305,8 +2333,12 @@ plugin1=${plugin1.path}
testUsingContext( testUsingContext(
'build aar uses selected local engine,the engine abi is x86', () async { 'build aar uses selected local engine,the engine abi is x86', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: anyNamed('platform'), mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: anyNamed('platform'),
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x86')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x86'));
fileSystem.file('out/android_x86/flutter_embedding_release.pom') fileSystem.file('out/android_x86/flutter_embedding_release.pom')
...@@ -2403,8 +2435,12 @@ plugin1=${plugin1.path} ...@@ -2403,8 +2435,12 @@ plugin1=${plugin1.path}
testUsingContext( testUsingContext(
'build aar uses selected local engine,the engine abi is x64', () async { 'build aar uses selected local engine,the engine abi is x64', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(
platform: anyNamed('platform'), mode: anyNamed('mode'))).thenReturn('engine'); Artifact.flutterFramework,
platform: anyNamed('platform'),
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType'),
)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x64')); when(mockArtifacts.engineOutPath).thenReturn(fileSystem.path.join('out', 'android_x64'));
fileSystem.file('out/android_x64/flutter_embedding_release.pom') fileSystem.file('out/android_x64/flutter_embedding_release.pom')
......
...@@ -46,6 +46,10 @@ void main() { ...@@ -46,6 +46,10 @@ void main() {
artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release), artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release),
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'ios-release', 'Flutter.framework'), fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'ios-release', 'Flutter.framework'),
); );
expect(
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'ios-release', 'Flutter.xcframework'),
);
expect( expect(
artifacts.getArtifactPath(Artifact.flutterTester), artifacts.getArtifactPath(Artifact.flutterTester),
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'linux-x64', 'flutter_tester'), fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'linux-x64', 'flutter_tester'),
...@@ -136,6 +140,10 @@ void main() { ...@@ -136,6 +140,10 @@ void main() {
artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release), artifacts.getArtifactPath(Artifact.flutterFramework, platform: TargetPlatform.ios, mode: BuildMode.release),
fileSystem.path.join('/out', 'android_debug_unopt', 'Flutter.framework'), fileSystem.path.join('/out', 'android_debug_unopt', 'Flutter.framework'),
); );
expect(
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),
fileSystem.path.join('/out', 'android_debug_unopt', 'Flutter.xcframework'),
);
expect( expect(
artifacts.getArtifactPath(Artifact.flutterTester), artifacts.getArtifactPath(Artifact.flutterTester),
fileSystem.path.join('/out', 'android_debug_unopt', 'flutter_tester'), fileSystem.path.join('/out', 'android_debug_unopt', 'flutter_tester'),
......
...@@ -238,30 +238,65 @@ void main() { ...@@ -238,30 +238,65 @@ void main() {
Platform: () => macPlatform, Platform: () => macPlatform,
}); });
testWithoutContext('Unpack copies Flutter.framework', () async { group('copy engine Flutter.framework', () {
final FileSystem fileSystem = MemoryFileSystem.test(); testWithoutContext('iphonesimulator', () async {
final Directory outputDir = fileSystem.directory('output'); final FileSystem fileSystem = MemoryFileSystem.test();
final Environment environment = Environment.test( final Directory outputDir = fileSystem.directory('output');
fileSystem.currentDirectory, final Environment environment = Environment.test(
processManager: processManager, fileSystem.currentDirectory,
artifacts: artifacts, processManager: processManager,
logger: logger, artifacts: artifacts,
fileSystem: fileSystem, logger: logger,
outputDir: outputDir, fileSystem: fileSystem,
); outputDir: outputDir,
defines: <String, String>{
kSdkRoot: 'path/to/iPhoneSimulator.sdk',
},
);
processManager.addCommand( processManager.addCommand(
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'rsync', 'rsync',
'-av', '-av',
'--delete', '--delete',
'--filter', '--filter',
'- .DS_Store/', '- .DS_Store/',
'Artifact.flutterFramework.TargetPlatform.ios.debug', 'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.simulator',
outputDir.path, outputDir.path,
]), ]),
); );
await const DebugUnpackIOS().build(environment);
});
testWithoutContext('iphoneos', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory outputDir = fileSystem.directory('output');
final Environment environment = Environment.test(
fileSystem.currentDirectory,
processManager: processManager,
artifacts: artifacts,
logger: logger,
fileSystem: fileSystem,
outputDir: outputDir,
defines: <String, String>{
kSdkRoot: 'path/to/iPhoneOS.sdk',
},
);
processManager.addCommand(
FakeCommand(command: <String>[
'rsync',
'-av',
'--delete',
'--filter',
'- .DS_Store/',
'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.physical',
outputDir.path,
]),
);
await const DebugUnpackIOS().build(environment); await const DebugUnpackIOS().build(environment);
});
}); });
} }
...@@ -638,7 +638,10 @@ Information about project "Runner": ...@@ -638,7 +638,10 @@ Information about project "Runner":
testUsingOsxContext('sets OTHER_LDFLAGS for iOS', () async { testUsingOsxContext('sets OTHER_LDFLAGS for iOS', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn(fs.path.join('engine', 'Flutter.framework')); platform: TargetPlatform.ios,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType')))
.thenReturn(fs.path.join('engine', 'Flutter.framework'));
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false);
...@@ -663,7 +666,10 @@ Information about project "Runner": ...@@ -663,7 +666,10 @@ Information about project "Runner":
testUsingOsxContext('do not set OTHER_LDFLAGS for macOS', () async { testUsingOsxContext('do not set OTHER_LDFLAGS for macOS', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterMacOSFramework, when(mockArtifacts.getArtifactPath(Artifact.flutterMacOSFramework,
platform: TargetPlatform.darwin_x64, mode: anyNamed('mode'))).thenReturn(fs.path.join('engine', 'FlutterMacOS.framework')); platform: TargetPlatform.darwin_x64,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType')))
.thenReturn(fs.path.join('engine', 'FlutterMacOS.framework'));
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false);
...@@ -689,7 +695,10 @@ Information about project "Runner": ...@@ -689,7 +695,10 @@ Information about project "Runner":
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async { testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); platform: TargetPlatform.ios,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType')))
.thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false);
...@@ -714,7 +723,10 @@ Information about project "Runner": ...@@ -714,7 +723,10 @@ Information about project "Runner":
testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async { testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); platform: TargetPlatform.ios,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType')))
.thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, treeShakeIcons: false);
final FlutterProject project = FlutterProject.fromPath('path/to/project'); final FlutterProject project = FlutterProject.fromPath('path/to/project');
...@@ -738,7 +750,10 @@ Information about project "Runner": ...@@ -738,7 +750,10 @@ Information about project "Runner":
testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async { testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); platform: TargetPlatform.ios,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType')))
.thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false);
final FlutterProject project = FlutterProject.fromPath('path/to/project'); final FlutterProject project = FlutterProject.fromPath('path/to/project');
...@@ -762,7 +777,10 @@ Information about project "Runner": ...@@ -762,7 +777,10 @@ Information about project "Runner":
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async { testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); platform: TargetPlatform.ios,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType')))
.thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, treeShakeIcons: false);
...@@ -795,7 +813,10 @@ Information about project "Runner": ...@@ -795,7 +813,10 @@ Information about project "Runner":
String expectedBuildNumber, String expectedBuildNumber,
}) async { }) async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, when(mockArtifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: anyNamed('mode'))).thenReturn('engine'); platform: TargetPlatform.ios,
mode: anyNamed('mode'),
environmentType: anyNamed('environmentType')))
.thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios'));
final File manifestFile = fs.file('path/to/project/pubspec.yaml'); final File manifestFile = fs.file('path/to/project/pubspec.yaml');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment