From b1aff28593217598a120abbe7675aba4f87f847c Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 29 Oct 2019 16:05:54 -0700 Subject: [PATCH] pass --no-gen-bytecode to aot kernel compiler invocations (#43753) --- packages/flutter_tools/lib/src/compile.dart | 2 ++ .../general.shard/compile_batch_test.dart | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index 34767b1b3a..b74fcc37d3 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -324,6 +324,8 @@ class KernelCompiler { if (aot) ...[ '--aot', '--tfa', + // TODO(jonahwilliams): remove when https://github.com/flutter/flutter/issues/43751 is resolved. + '--no-gen-bytecode', ], if (packagesPath != null) ...[ '--packages', diff --git a/packages/flutter_tools/test/general.shard/compile_batch_test.dart b/packages/flutter_tools/test/general.shard/compile_batch_test.dart index 7f7564654f..fabc29f797 100644 --- a/packages/flutter_tools/test/general.shard/compile_batch_test.dart +++ b/packages/flutter_tools/test/general.shard/compile_batch_test.dart @@ -66,6 +66,30 @@ void main() { Platform: kNoColorTerminalPlatform, }); + testUsingContext('passes no-gen-bytecode to kernel compiler in aot/release mode', () async { + when(mockFrontendServer.stdout) + .thenAnswer((Invocation invocation) => Stream>.fromFuture( + Future>.value(utf8.encode( + 'result abc\nline1\nline2\nabc\nabc /path/to/main.dart.dill 0' + )) + )); + final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(null); + await kernelCompiler.compile(sdkRoot: '/path/to/sdkroot', + mainPath: '/path/to/main.dart', + buildMode: BuildMode.release, + trackWidgetCreation: false, + aot: true, + ); + + expect(mockFrontendServerStdIn.getAndClear(), isEmpty); + final VerificationResult argVerification = verify(mockProcessManager.start(captureAny)); + expect(argVerification.captured.single, contains('--no-gen-bytecode')); + }, overrides: { + ProcessManager: () => mockProcessManager, + OutputPreferences: () => OutputPreferences(showColor: false), + Platform: kNoColorTerminalPlatform, + }); + testUsingContext('batch compile single dart failed compilation', () async { final BufferLogger bufferLogger = logger; when(mockFrontendServer.stdout)