Skip to content

Commit 4cc10a1

Browse files
authored
Revert "Always compile with isysroot on iOS to point to SDK root (flutter#45436)" (flutter#45555)
Analyzer warning.
1 parent 6b11f18 commit 4cc10a1

File tree

2 files changed

+5
-41
lines changed

2 files changed

+5
-41
lines changed

packages/flutter_tools/lib/src/base/build.dart

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,8 @@ class AOTSnapshotter {
242242

243243
const String embedBitcodeArg = '-fembed-bitcode';
244244
final String assemblyO = fs.path.join(outputPath, 'snapshot_assembly.o');
245-
List<String> isysrootArgs;
246-
if (isIOS) {
247-
final String iPhoneSDKLocation = await xcode.iPhoneSdkLocation();
248-
if (iPhoneSDKLocation != null) {
249-
isysrootArgs = <String>['-isysroot', iPhoneSDKLocation];
250-
}
251-
}
252245
final RunResult compileResult = await xcode.cc(<String>[
253246
'-arch', targetArch,
254-
if (isysrootArgs != null) ...isysrootArgs,
255247
if (bitcode) embedBitcodeArg,
256248
'-c',
257249
assemblyPath,
@@ -273,7 +265,7 @@ class AOTSnapshotter {
273265
'-Xlinker', '-rpath', '-Xlinker', '@loader_path/Frameworks',
274266
'-install_name', '@rpath/App.framework/App',
275267
if (bitcode) embedBitcodeArg,
276-
if (isysrootArgs != null) ...isysrootArgs,
268+
if (bitcode && isIOS) ...<String>[embedBitcodeArg, '-isysroot', await xcode.iPhoneSdkLocation()],
277269
'-o', appLib,
278270
assemblyO,
279271
];

packages/flutter_tools/test/general.shard/base/build_test.dart

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ void main() {
214214

215215
group('Snapshotter - AOT', () {
216216
const String kSnapshotDart = 'snapshot.dart';
217-
const String kSDKPath = '/path/to/sdk';
218217
String skyEnginePath;
219218

220219
_FakeGenSnapshot genSnapshot;
@@ -244,8 +243,6 @@ void main() {
244243
mockAndroidSdk = MockAndroidSdk();
245244
mockArtifacts = MockArtifacts();
246245
mockXcode = MockXcode();
247-
when(mockXcode.iPhoneSdkLocation()).thenAnswer((_) => Future<String>.value(kSDKPath));
248-
249246
bufferLogger = BufferLogger();
250247
for (BuildMode mode in BuildMode.values) {
251248
when(mockArtifacts.getArtifactPath(Artifact.snapshotDart,
@@ -337,19 +334,8 @@ void main() {
337334
'main.dill',
338335
]);
339336

340-
final VerificationResult toVerifyCC = verify(xcode.cc(captureAny));
341-
expect(toVerifyCC.callCount, 1);
342-
final List<String> ccArgs = toVerifyCC.captured.first;
343-
expect(ccArgs, contains('-fembed-bitcode'));
344-
expect(ccArgs, contains('-isysroot'));
345-
expect(ccArgs, contains(kSDKPath));
346-
347-
final VerificationResult toVerifyClang = verify(xcode.clang(captureAny));
348-
expect(toVerifyClang.callCount, 1);
349-
final List<String> clangArgs = toVerifyClang.captured.first;
350-
expect(clangArgs, contains('-fembed-bitcode'));
351-
expect(clangArgs, contains('-isysroot'));
352-
expect(clangArgs, contains(kSDKPath));
337+
verify(xcode.cc(argThat(contains('-fembed-bitcode')))).called(1);
338+
verify(xcode.clang(argThat(contains('-fembed-bitcode')))).called(1);
353339

354340
final File assemblyFile = fs.file(assembly);
355341
expect(assemblyFile.existsSync(), true);
@@ -394,19 +380,8 @@ void main() {
394380
'main.dill',
395381
]);
396382

397-
final VerificationResult toVerifyCC = verify(xcode.cc(captureAny));
398-
expect(toVerifyCC.callCount, 1);
399-
final List<String> ccArgs = toVerifyCC.captured.first;
400-
expect(ccArgs, contains('-fembed-bitcode'));
401-
expect(ccArgs, contains('-isysroot'));
402-
expect(ccArgs, contains(kSDKPath));
403-
404-
final VerificationResult toVerifyClang = verify(xcode.clang(captureAny));
405-
expect(toVerifyClang.callCount, 1);
406-
final List<String> clangArgs = toVerifyClang.captured.first;
407-
expect(clangArgs, contains('-fembed-bitcode'));
408-
expect(clangArgs, contains('-isysroot'));
409-
expect(clangArgs, contains(kSDKPath));
383+
verify(xcode.cc(argThat(contains('-fembed-bitcode')))).called(1);
384+
verify(xcode.clang(argThat(contains('-fembed-bitcode')))).called(1);
410385

411386
final File assemblyFile = fs.file(assembly);
412387
final File assemblyBitcodeFile = fs.file('$assembly.stripped.S');
@@ -456,9 +431,6 @@ void main() {
456431
verifyNever(xcode.cc(argThat(contains('-fembed-bitcode'))));
457432
verifyNever(xcode.clang(argThat(contains('-fembed-bitcode'))));
458433

459-
verify(xcode.cc(argThat(contains('-isysroot')))).called(1);
460-
verify(xcode.clang(argThat(contains('-isysroot')))).called(1);
461-
462434
final File assemblyFile = fs.file(assembly);
463435
expect(assemblyFile.existsSync(), true);
464436
expect(assemblyFile.readAsStringSync().contains('.section __DWARF'), true);

0 commit comments

Comments
 (0)