mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
This reverts commit 8e6e15f915
.
This commit is contained in:
parent
8bff33e497
commit
73ea37eca9
|
@ -225,7 +225,7 @@ class AOTSnapshotter {
|
||||||
final String assemblyO = globals.fs.path.join(outputPath, 'snapshot_assembly.o');
|
final String assemblyO = globals.fs.path.join(outputPath, 'snapshot_assembly.o');
|
||||||
List<String> isysrootArgs;
|
List<String> isysrootArgs;
|
||||||
if (isIOS) {
|
if (isIOS) {
|
||||||
final String iPhoneSDKLocation = await globals.xcode.sdkLocation(SdkType.iPhone, globals.platform.environment);
|
final String iPhoneSDKLocation = await globals.xcode.sdkLocation(SdkType.iPhone);
|
||||||
if (iPhoneSDKLocation != null) {
|
if (iPhoneSDKLocation != null) {
|
||||||
isysrootArgs = <String>['-isysroot', iPhoneSDKLocation];
|
isysrootArgs = <String>['-isysroot', iPhoneSDKLocation];
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,7 +412,7 @@ Future<RunResult> createStubAppFramework(File outputFile, SdkType sdk, { bool in
|
||||||
'-Xlinker', '-rpath', '-Xlinker', '@executable_path/Frameworks',
|
'-Xlinker', '-rpath', '-Xlinker', '@executable_path/Frameworks',
|
||||||
'-Xlinker', '-rpath', '-Xlinker', '@loader_path/Frameworks',
|
'-Xlinker', '-rpath', '-Xlinker', '@loader_path/Frameworks',
|
||||||
'-install_name', '@rpath/App.framework/App',
|
'-install_name', '@rpath/App.framework/App',
|
||||||
'-isysroot', await globals.xcode.sdkLocation(sdk, globals.platform.environment),
|
'-isysroot', await globals.xcode.sdkLocation(sdk),
|
||||||
'-o', outputFile.path,
|
'-o', outputFile.path,
|
||||||
]);
|
]);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -165,17 +165,14 @@ class Xcode {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> sdkLocation(SdkType sdk, Map<String, String> environment) async {
|
Future<String> sdkLocation(SdkType sdk) async {
|
||||||
// If this is run an Xcode script build phase, the SDKROOT is already exported.
|
|
||||||
if (environment.containsKey('SDKROOT')) {
|
|
||||||
return environment['SDKROOT'];
|
|
||||||
}
|
|
||||||
assert(sdk != null);
|
assert(sdk != null);
|
||||||
final RunResult runResult = await _processUtils.run(
|
final RunResult runResult = await _processUtils.run(
|
||||||
<String>['xcrun', '--sdk', getNameForSdk(sdk), '--show-sdk-path'],
|
<String>['xcrun', '--sdk', getNameForSdk(sdk), '--show-sdk-path'],
|
||||||
|
throwOnError: true,
|
||||||
);
|
);
|
||||||
if (runResult.exitCode != 0) {
|
if (runResult.exitCode != 0) {
|
||||||
throwToolExit('Could not find SDK location: ${runResult.stderr}');
|
throwToolExit('Could not find iPhone SDK location: ${runResult.stderr}');
|
||||||
}
|
}
|
||||||
return runResult.stdout.trim();
|
return runResult.stdout.trim();
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ void main() {
|
||||||
mockAndroidSdk = MockAndroidSdk();
|
mockAndroidSdk = MockAndroidSdk();
|
||||||
mockArtifacts = MockArtifacts();
|
mockArtifacts = MockArtifacts();
|
||||||
mockXcode = MockXcode();
|
mockXcode = MockXcode();
|
||||||
when(mockXcode.sdkLocation(any, any)).thenAnswer((_) => Future<String>.value(kSDKPath));
|
when(mockXcode.sdkLocation(any)).thenAnswer((_) => Future<String>.value(kSDKPath));
|
||||||
|
|
||||||
for (final BuildMode mode in BuildMode.values) {
|
for (final BuildMode mode in BuildMode.values) {
|
||||||
when(mockArtifacts.getArtifactPath(Artifact.snapshotDart,
|
when(mockArtifacts.getArtifactPath(Artifact.snapshotDart,
|
||||||
|
|
|
@ -178,36 +178,6 @@ void main() {
|
||||||
expect(getNameForSdk(SdkType.iPhoneSimulator), 'iphonesimulator');
|
expect(getNameForSdk(SdkType.iPhoneSimulator), 'iphonesimulator');
|
||||||
expect(getNameForSdk(SdkType.macOS), 'macosx');
|
expect(getNameForSdk(SdkType.macOS), 'macosx');
|
||||||
});
|
});
|
||||||
|
|
||||||
group('SDK location', () {
|
|
||||||
const String sdkroot = 'Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk';
|
|
||||||
|
|
||||||
testWithoutContext('environment', () async {
|
|
||||||
expect(await xcode.sdkLocation(SdkType.iPhone, <String, String>{'SDKROOT': sdkroot}), sdkroot);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('--show-sdk-path iphoneos', () async {
|
|
||||||
when(processManager.run(<String>['xcrun', '--sdk', 'iphoneos', '--show-sdk-path'])).thenAnswer((_) =>
|
|
||||||
Future<ProcessResult>.value(ProcessResult(1, 0, sdkroot, '')));
|
|
||||||
|
|
||||||
expect(await xcode.sdkLocation(SdkType.iPhone, <String, String>{}), sdkroot);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('--show-sdk-path macosx', () async {
|
|
||||||
when(processManager.run(<String>['xcrun', '--sdk', 'macosx', '--show-sdk-path'])).thenAnswer((_) =>
|
|
||||||
Future<ProcessResult>.value(ProcessResult(1, 0, sdkroot, '')));
|
|
||||||
|
|
||||||
expect(await xcode.sdkLocation(SdkType.macOS, <String, String>{}), sdkroot);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('--show-sdk-path fails', () async {
|
|
||||||
when(processManager.run(<String>['xcrun', '--sdk', 'iphoneos', '--show-sdk-path'])).thenAnswer((_) =>
|
|
||||||
Future<ProcessResult>.value(ProcessResult(1, 1, '', 'xcrun: error:')));
|
|
||||||
|
|
||||||
expect(() async => await xcode.sdkLocation(SdkType.iPhone, <String, String>{}),
|
|
||||||
throwsToolExit(message: 'Could not find SDK location'));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group('xcdevice', () {
|
group('xcdevice', () {
|
||||||
|
|
Loading…
Reference in a new issue