diff --git a/packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_test.dart b/packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_test.dart new file mode 100644 index 0000000000..b75a00e5bc --- /dev/null +++ b/packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_test.dart @@ -0,0 +1,76 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// @dart = 2.8 + +import 'package:file/file.dart'; +import 'package:flutter_tools/src/base/io.dart'; + +import '../src/common.dart'; +import 'test_utils.dart'; + +void main() { + Directory tempDir; + Directory projectRoot; + String flutterBin; + final List targetPlatforms = [ + 'apk', + 'web', + if (platform.isWindows) + 'windows', + if (platform.isMacOS) + ...['macos', 'ios'], + ]; + + setUpAll(() { + tempDir = createResolvedTempDirectorySync('build_compilation_error_test.'); + flutterBin = fileSystem.path.join( + getFlutterRoot(), + 'bin', + 'flutter', + ); + processManager.runSync([flutterBin, 'config', + '--enable-macos-desktop', + '--enable-windows-desktop', + '--enable-web', + ]); + + processManager.runSync([ + flutterBin, + ...getLocalEngineArguments(), + 'create', + 'hello', + ], workingDirectory: tempDir.path); + + projectRoot = tempDir.childDirectory('hello'); + writeFile(fileSystem.path.join(projectRoot.path, 'lib', 'main.dart'), ''' +int x = 'String'; +'''); + }); + + tearDownAll(() { + tryToDelete(tempDir); + }); + + for (final String targetPlatform in targetPlatforms) { + testWithoutContext('flutter build $targetPlatform shows dart compilation error in non-verbose', () { + final ProcessResult result = processManager.runSync([ + flutterBin, + ...getLocalEngineArguments(), + 'build', + targetPlatform, + '--no-pub', + if (targetPlatform == 'ios') + '--no-codesign', + ], workingDirectory: projectRoot.path); + + expect( + // iOS shows this as stdout. + targetPlatform == 'ios' ? result.stdout : result.stderr, + contains("A value of type 'String' can't be assigned to a variable of type 'int'."), + ); + expect(result.exitCode, 1); + }, timeout: const Timeout(Duration(minutes: 3))); + } +} diff --git a/packages/flutter_tools/test/integration.shard/ios_content_validation_test.dart b/packages/flutter_tools/test/integration.shard/ios_content_validation_test.dart index c5aefdede3..0572145c79 100644 --- a/packages/flutter_tools/test/integration.shard/ios_content_validation_test.dart +++ b/packages/flutter_tools/test/integration.shard/ios_content_validation_test.dart @@ -57,26 +57,6 @@ void main() { File outputAppFrameworkBinary; setUpAll(() { - flutterRoot = getFlutterRoot(); - tempDir = createResolvedTempDirectorySync('ios_content_validation.'); - flutterBin = fileSystem.path.join( - flutterRoot, - 'bin', - 'flutter', - ); - - processManager.runSync([ - flutterBin, - ...getLocalEngineArguments(), - 'create', - '--platforms=ios', - '-i', - 'objc', - 'hello', - ], workingDirectory: tempDir.path); - - projectRoot = tempDir.childDirectory('hello').path; - processManager.runSync([ flutterBin, ...getLocalEngineArguments(), diff --git a/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart b/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart index f93bf8d3df..943340dd71 100644 --- a/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart +++ b/packages/flutter_tools/test/integration.shard/macos_content_validation_test.dart @@ -107,7 +107,7 @@ void main() { expect(outputFlutterFramework.childDirectory('Modules'), isNot(exists)); // Archiving should contain a bitcode blob, but not building. - // This mimics Xcode behavior and present a developer from having to install a + // This mimics Xcode behavior and prevents a developer from having to install a // 300+MB app. final File outputFlutterFrameworkBinary = outputFlutterFramework .childDirectory('Versions')