// 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 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/custom_devices/custom_device_config.dart'; void writeCustomDevicesConfigFile( Directory dir, { List? configs, dynamic json }) { dir.createSync(recursive: true); final File file = dir.childFile('.flutter_custom_devices.json'); file.writeAsStringSync(jsonEncode( { 'custom-devices': configs != null ? configs.map((CustomDeviceConfig c) => c.toJson()).toList() : json, }, )); } final CustomDeviceConfig testConfig = CustomDeviceConfig( id: 'testid', label: 'testlabel', sdkNameAndVersion: 'testsdknameandversion', enabled: true, pingCommand: const ['testping'], pingSuccessRegex: RegExp('testpingsuccess'), postBuildCommand: const ['testpostbuild'], installCommand: const ['testinstall'], uninstallCommand: const ['testuninstall'], runDebugCommand: const ['testrundebug'], forwardPortCommand: const ['testforwardport'], forwardPortSuccessRegex: RegExp('testforwardportsuccess') ); const Map testConfigJson = { 'id': 'testid', 'label': 'testlabel', 'sdkNameAndVersion': 'testsdknameandversion', 'enabled': true, 'ping': ['testping'], 'pingSuccessRegex': 'testpingsuccess', 'postBuild': ['testpostbuild'], 'install': ['testinstall'], 'uninstall': ['testuninstall'], 'runDebug': ['testrundebug'], 'forwardPort': ['testforwardport'], 'forwardPortSuccessRegex': 'testforwardportsuccess', };