Initialize Flutter Beta (flutter-3.32-candidate.0) (#166783)
Closes https://github.com/flutter/flutter/issues/166811. ```sh $ dev/conductor/bin/conductor start \ --candidate-branch=flutter-3.32-candidate.0 \ --release-channel=beta \ --github-username=matanlurey \ --dart-revision=0d6811928830b87e36a0f49eb7fe554c308d3699 ```
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/os.dart';
|
||||
@@ -48,8 +47,6 @@ void main() {
|
||||
platform: platform,
|
||||
processManager: processManager,
|
||||
),
|
||||
processManager: FakeProcessManager.any(),
|
||||
artifacts: Artifacts.test(fileSystem: fileSystem),
|
||||
);
|
||||
rootProject = FakeFlutterProject(
|
||||
projectRoot: 'some_project',
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'dart:io' as io show IOOverrides;
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/bot_detector.dart';
|
||||
import 'package:flutter_tools/src/base/common.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
@@ -81,8 +80,6 @@ void main() {
|
||||
logger: logger,
|
||||
platform: platform,
|
||||
),
|
||||
artifacts: Artifacts.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
),
|
||||
);
|
||||
await runner.run(<String>['widget-preview', ...arguments]);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
@@ -356,6 +358,17 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('a pub error is treated as no data available instead of terminal', () async {
|
||||
final ProcessManager processes = _dartPubDepsCrashes(project: project);
|
||||
final Set<String> dependencies = await computeExclusiveDevDependencies(
|
||||
pub(processes),
|
||||
project: project,
|
||||
logger: logger,
|
||||
);
|
||||
|
||||
expect(dependencies, isEmpty, reason: 'pub deps crashed, but was not terminal');
|
||||
});
|
||||
|
||||
test('throws and logs on invalid JSON', () async {
|
||||
final ProcessManager processes = _dartPubDepsReturns('''
|
||||
{
|
||||
@@ -420,3 +433,18 @@ ProcessManager _dartPubDepsReturns(String dartPubDepsOutput, {required FlutterPr
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
ProcessManager _dartPubDepsCrashes({required FlutterProject project}) {
|
||||
return FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: const <String>[_dartBin, 'pub', '--suppress-analytics', 'deps', '--json'],
|
||||
workingDirectory: project.directory.path,
|
||||
exception: const io.ProcessException('pub', <String>[
|
||||
'pub',
|
||||
'--suppress-analytics',
|
||||
'deps',
|
||||
'--json',
|
||||
]),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'dart:async';
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
@@ -530,6 +531,100 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'custom device command string interpolation end-to-end test',
|
||||
() async {
|
||||
final Completer<void> runDebugCompleter = Completer<void>();
|
||||
|
||||
final CustomDeviceConfig config = testConfig.copyWith(
|
||||
platform: TargetPlatform.linux_arm64,
|
||||
postBuildCommand: const <String>[
|
||||
'testpostbuild',
|
||||
r'--buildMode=${buildMode}',
|
||||
r'--icuDataPath=${icuDataPath}',
|
||||
r'--engineRevision=${engineRevision}',
|
||||
],
|
||||
runDebugCommand: const <String>[
|
||||
'testrundebug',
|
||||
r'--buildMode=${buildMode}',
|
||||
r'--icuDataPath=${icuDataPath}',
|
||||
r'--engineRevision=${engineRevision}',
|
||||
],
|
||||
);
|
||||
|
||||
final List<Pattern> commandArgumentsPattern = <Pattern>[
|
||||
RegExp(r'--buildMode=.*'),
|
||||
RegExp(r'--icuDataPath=.*'),
|
||||
RegExp(r'--engineRevision=.*'),
|
||||
];
|
||||
|
||||
final String expectedIcuDataPath = globals.artifacts!.getArtifactPath(
|
||||
Artifact.icuData,
|
||||
platform: config.platform,
|
||||
);
|
||||
final String expectedEngineRevision = globals.flutterVersion.engineRevision;
|
||||
|
||||
final List<String> expectedCommandArguments = <String>[
|
||||
'--buildMode=debug',
|
||||
'--icuDataPath=$expectedIcuDataPath',
|
||||
'--engineRevision=$expectedEngineRevision',
|
||||
];
|
||||
|
||||
final List<String> expectedRunDebugCommand = <String>[
|
||||
'testrundebug',
|
||||
...expectedCommandArguments,
|
||||
];
|
||||
final List<String> expectedPostBuildCommand = <String>[
|
||||
'testpostbuild',
|
||||
...expectedCommandArguments,
|
||||
];
|
||||
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <Pattern>['testpostbuild', ...commandArgumentsPattern],
|
||||
onRun: (List<String> command) => expect(command, expectedPostBuildCommand),
|
||||
),
|
||||
FakeCommand(command: config.uninstallCommand),
|
||||
FakeCommand(command: config.installCommand),
|
||||
FakeCommand(
|
||||
command: <Pattern>['testrundebug', ...commandArgumentsPattern],
|
||||
completer: runDebugCompleter,
|
||||
onRun: (List<String> command) => expect(command, expectedRunDebugCommand),
|
||||
stdout: 'The Dart VM service is listening on http://127.0.0.1:12345/abcd/\n',
|
||||
),
|
||||
FakeCommand(
|
||||
command: config.forwardPortCommand!,
|
||||
stdout: testConfigForwardPortSuccessOutput,
|
||||
),
|
||||
]);
|
||||
|
||||
// CustomDevice.startApp doesn't care whether we pass a prebuilt app or
|
||||
// buildable app as long as we pass prebuiltApplication as false
|
||||
final PrebuiltLinuxApp app = PrebuiltLinuxApp(executable: 'testexecutable');
|
||||
|
||||
// finally start actually testing things
|
||||
final CustomDevice device = CustomDevice(
|
||||
config: config,
|
||||
logger: BufferLogger.test(),
|
||||
processManager: processManager,
|
||||
);
|
||||
|
||||
await device.startApp(
|
||||
app,
|
||||
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
||||
bundleBuilder: FakeBundleBuilder(),
|
||||
);
|
||||
expect(runDebugCompleter.isCompleted, false);
|
||||
|
||||
expect(await device.stopApp(app), true);
|
||||
expect(runDebugCompleter.isCompleted, true);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
},
|
||||
);
|
||||
|
||||
testWithoutContext('CustomDevice screenshotting', () async {
|
||||
bool screenshotCommandWasExecuted = false;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('fails on non-zero exit code', () async {
|
||||
testWithoutContext('returns null on non-zero exit code', () async {
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||
final ProcessManager processManager = _dartPubDepsFails(
|
||||
@@ -62,14 +62,8 @@ void main() {
|
||||
);
|
||||
|
||||
await expectLater(
|
||||
() => pub.deps(FlutterProject.fromDirectoryTest(fileSystem.currentDirectory)),
|
||||
throwsA(
|
||||
isA<StateError>().having(
|
||||
(StateError e) => e.message,
|
||||
'message',
|
||||
contains('dart pub --suppress-analytics deps --json failed'),
|
||||
),
|
||||
),
|
||||
pub.deps(FlutterProject.fromDirectoryTest(fileSystem.currentDirectory)),
|
||||
completion(isNull),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -5,18 +5,12 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dtd/dtd.dart';
|
||||
import 'package:file/file.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/commands/widget_preview.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
||||
import 'package:flutter_tools/src/widget_preview/dtd_services.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
import 'test_data/basic_project.dart';
|
||||
import 'test_utils.dart';
|
||||
|
||||
@@ -49,13 +43,10 @@ const List<String> subsequentLaunchMessagesWeb = <String>[
|
||||
void main() {
|
||||
late Directory tempDir;
|
||||
Process? process;
|
||||
Logger? logger;
|
||||
DtdLauncher? dtdLauncher;
|
||||
final BasicProject project = BasicProject();
|
||||
const ProcessManager processManager = LocalProcessManager();
|
||||
|
||||
setUp(() async {
|
||||
logger = BufferLogger.test();
|
||||
tempDir = createResolvedTempDirectorySync('widget_preview_test.');
|
||||
await project.setUpIn(tempDir);
|
||||
});
|
||||
@@ -63,15 +54,12 @@ void main() {
|
||||
tearDown(() async {
|
||||
process?.kill();
|
||||
process = null;
|
||||
await dtdLauncher?.dispose();
|
||||
dtdLauncher = null;
|
||||
tryToDelete(tempDir);
|
||||
});
|
||||
|
||||
Future<void> runWidgetPreview({
|
||||
required List<String> expectedMessages,
|
||||
bool useWeb = false,
|
||||
Uri? dtdUri,
|
||||
}) async {
|
||||
expect(expectedMessages, isNotEmpty);
|
||||
int i = 0;
|
||||
@@ -84,7 +72,6 @@ void main() {
|
||||
'--${WidgetPreviewStartCommand.kHeadlessWeb}'
|
||||
else
|
||||
'--${WidgetPreviewStartCommand.kUseFlutterDesktop}',
|
||||
if (dtdUri != null) '--${FlutterGlobalOptions.kDtdUrl}=$dtdUri',
|
||||
], workingDirectory: tempDir.path);
|
||||
|
||||
final Completer<void> completer = Completer<void>();
|
||||
@@ -116,6 +103,8 @@ void main() {
|
||||
}),
|
||||
);
|
||||
await completer.future;
|
||||
process!.kill();
|
||||
process = null;
|
||||
}
|
||||
|
||||
group('flutter widget-preview start', () {
|
||||
@@ -143,38 +132,5 @@ void main() {
|
||||
// We shouldn't regenerate the scaffold after the initial run.
|
||||
await runWidgetPreview(expectedMessages: subsequentLaunchMessagesWeb, useWeb: true);
|
||||
});
|
||||
|
||||
testUsingContext('can connect to an existing DTD instance', () async {
|
||||
dtdLauncher = DtdLauncher(
|
||||
logger: logger!,
|
||||
artifacts: globals.artifacts!,
|
||||
processManager: globals.processManager,
|
||||
);
|
||||
|
||||
// Start a DTD instance.
|
||||
final Uri dtdUri = await dtdLauncher!.launch();
|
||||
|
||||
// Connect to it and listen to the WidgetPreviewScaffold stream.
|
||||
//
|
||||
// The preview scaffold will send a 'Connected' event on this stream once it has initialized
|
||||
// and is ready.
|
||||
final DartToolingDaemon dtdConnection = await DartToolingDaemon.connect(dtdUri);
|
||||
const String kWidgetPreviewScaffoldStream = 'WidgetPreviewScaffold';
|
||||
final Completer<void> completer = Completer<void>();
|
||||
dtdConnection.onEvent(kWidgetPreviewScaffoldStream).listen((DTDEvent event) {
|
||||
expect(event.stream, kWidgetPreviewScaffoldStream);
|
||||
expect(event.kind, 'Connected');
|
||||
completer.complete();
|
||||
});
|
||||
await dtdConnection.streamListen(kWidgetPreviewScaffoldStream);
|
||||
|
||||
// Start the widget preview and wait for the 'Connected' event.
|
||||
await runWidgetPreview(
|
||||
expectedMessages: firstLaunchMessagesWeb,
|
||||
useWeb: true,
|
||||
dtdUri: dtdUri,
|
||||
);
|
||||
await completer.future;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
// 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:async';
|
||||
|
||||
import 'package:dtd/dtd.dart';
|
||||
|
||||
/// Provides services, streams, and RPC invocations to interact with Flutter developer tooling.
|
||||
class WidgetPreviewScaffoldDtdServices {
|
||||
/// Environment variable for the DTD URI.
|
||||
static const String kWidgetPreviewDtdUriEnvVar = 'WIDGET_PREVIEW_DTD_URI';
|
||||
|
||||
/// Connects to the Dart Tooling Daemon (DTD) specified by the Flutter tool.
|
||||
///
|
||||
/// If the connection is successful, the Widget Preview Scaffold will register services and
|
||||
/// subscribe to various streams to interact directly with other tooling (e.g., IDEs).
|
||||
Future<void> connect() async {
|
||||
final Uri dtdWsUri = Uri.parse(
|
||||
const String.fromEnvironment(kWidgetPreviewDtdUriEnvVar),
|
||||
);
|
||||
_dtd = await DartToolingDaemon.connect(dtdWsUri);
|
||||
unawaited(
|
||||
_dtd.postEvent(
|
||||
'WidgetPreviewScaffold',
|
||||
'Connected',
|
||||
const <String, Object?>{},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
late final DartToolingDaemon _dtd;
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:stack_trace/stack_trace.dart';
|
||||
|
||||
import 'controls.dart';
|
||||
import 'dtd_services.dart';
|
||||
import 'generated_preview.dart';
|
||||
import 'utils.dart';
|
||||
import 'widget_preview.dart';
|
||||
@@ -411,8 +410,6 @@ class PreviewAssetBundle extends PlatformAssetBundle {
|
||||
/// the preview scaffold project which prevents us from being able to use hot
|
||||
/// restart to iterate on this file.
|
||||
Future<void> mainImpl() async {
|
||||
// TODO(bkonyi): store somewhere.
|
||||
await WidgetPreviewScaffoldDtdServices().connect();
|
||||
runApp(_WidgetPreviewScaffold());
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
# These will be replaced with proper constraints after the template is hydrated.
|
||||
dtd: 2.5.0
|
||||
flutter_lints: 5.0.0
|
||||
stack_trace: 1.12.1
|
||||
|
||||
@@ -21,13 +20,7 @@ dependencies:
|
||||
characters: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
clock: 1.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
collection: 1.19.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
convert: 3.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
crypto: 3.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
fake_async: 1.3.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
file: 7.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
http: 1.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
http_parser: 4.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
json_rpc_2: 3.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
leak_tracker: 10.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
leak_tracker_flutter_testing: 3.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
leak_tracker_testing: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
@@ -41,15 +34,10 @@ dependencies:
|
||||
string_scanner: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
term_glyph: 1.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
test_api: 0.7.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
typed_data: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
unified_analytics: 7.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
vm_service: 15.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
web: 1.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
web_socket: 0.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
web_socket_channel: 3.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
# PUBSPEC CHECKSUM: 4b12
|
||||
# PUBSPEC CHECKSUM: 367e
|
||||
|
||||
Reference in New Issue
Block a user