mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Currently an invocation of flutter/dart will always attempt to acquire a lock. This can pose problems for tools that attempt to run multiple dart/flutter instances. Instead update the lock logic (on Linux/macOS) so that we only attempt to acquire it if an update/snapshot needs to be performed. To avoid repeatedly performing downloads/snapshots if multiple flutter/dart invocations are fired off concurrently when an update needs to be performed, do a second check of the download/snapshot condition after the lock is released. Additionally, moves all of the building/debug output to stderr on both the bash and batch scripts. This allows machine mode consumption of the tool to ignore needing to parse/handle the rebuild messages.
35 lines
1.2 KiB
Dart
35 lines
1.2 KiB
Dart
// 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.
|
|
|
|
import 'dart:io';
|
|
|
|
import 'common.dart';
|
|
|
|
void main() {
|
|
test('analyze-sample-code', () {
|
|
final ProcessResult process = Process.runSync(
|
|
'../../bin/cache/dart-sdk/bin/dart',
|
|
<String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-input'],
|
|
);
|
|
final List<String> stdoutLines = process.stdout.toString().split('\n');
|
|
final List<String> stderrLines = process.stderr.toString().split('\n')
|
|
..removeWhere((String line) => line.startsWith('Analyzer output:') || line.startsWith('Building flutter tool...'));
|
|
expect(process.exitCode, isNot(equals(0)));
|
|
expect(stderrLines, <String>[
|
|
'known_broken_documentation.dart:30:9: new Opacity(',
|
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
|
'known_broken_documentation.dart:62:9: new Opacity(',
|
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
|
'',
|
|
'Found 1 sample code errors.',
|
|
'',
|
|
]);
|
|
expect(stdoutLines, <String>[
|
|
'Found 7 sample code sections.',
|
|
'Starting analysis of code samples.',
|
|
'',
|
|
]);
|
|
}, skip: Platform.isWindows);
|
|
}
|