blob: 8bac5c0bb14ef561f332ce9ba08ab5cb0793a1c9 [file] [log] [blame]
Hannes Winklere8ad0302021-04-01 03:09:02 +02001{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "$id": "https://raw.githubusercontent.com/flutter/flutter/stable/packages/flutter_tools/static/custom-devices.schema.json",
4 "title": "Flutter Custom Devices",
5 "description": "The schema for the flutter custom devices config file.",
6 "type": "object",
7 "properties": {
8 "custom-devices": {
9 "description": "The actual list of custom devices.",
10 "type": "array",
11 "items": {
12 "description": "A single custom device to be configured.",
13 "type": "object",
14 "properties": {
15 "id": {
16 "description": "A unique, short identification string for this device. Used for example as an argument to the flutter run command.",
17 "type": "string"
18 },
19 "label": {
20 "description": "A more descriptive, user-friendly label for the device.",
Hannes Winklera1e9f202021-07-07 18:16:04 +020021 "type": "string",
22 "default": "",
23 "required": false
Hannes Winklere8ad0302021-04-01 03:09:02 +020024 },
25 "sdkNameAndVersion": {
26 "description": "Additional information about the device. For other devices, this is the SDK (for example Android SDK, Windows SDK) name and version.",
Hannes Winklera1e9f202021-07-07 18:16:04 +020027 "type": "string",
28 "default": "",
29 "required": false
Hannes Winklere8ad0302021-04-01 03:09:02 +020030 },
Hannes Winklera1e9f202021-07-07 18:16:04 +020031 "enabled": {
32 "description": "If false, this device will be ignored completely by the flutter SDK and none of the commands configured will be called. You can use this as a way to comment out device configs you're still working on, for example.",
33 "type": "boolean",
34 "default": true,
35 "required": false
36 },
37 "platform": {
38 "description": "The platform of the target device.",
39 "enum": ["linux-arm64", "linux-x64"],
40 "default": "linux-arm64",
41 "required": false
Hannes Winklere8ad0302021-04-01 03:09:02 +020042 },
43 "ping": {
44 "description": "The command to be invoked to ping the device. Used to find out whether its available or not. Every exit code unequal 0 will be treated as \"unavailable\". On Windows, consider providing a \"pingSuccessRegex\" since Windows' ping will also return 0 on failure. Make sure the command times out internally since it's not guaranteed the flutter SDK will enforce a timeout itself.",
45 "type": "array",
46 "items": {
47 "type": "string"
48 },
49 "minItems": 1,
50 "default": [
51 "ping", "-w", "500", "-n", "1", "raspberrypi"
52 ]
53 },
54 "pingSuccessRegex": {
55 "description": "When the output of the ping command matches this regex (and the ping command finished with exit code 0), the ping will be considered successful and the pinged device reachable. If this regex is not provided the ping command will be considered successful when it returned with exit code 0. The regex syntax is the standard dart syntax.",
56 "type": ["string", "null"],
57 "format": "regex",
Hannes Winklera1e9f202021-07-07 18:16:04 +020058 "default": "[<=]\\d+ms",
Hannes Winklere8ad0302021-04-01 03:09:02 +020059 "required": false
60 },
61 "postBuild": {
62 "description": "The command to be invoked after the build process is done, to do any additional packaging for example.",
63 "type": ["array", "null"],
64 "items": {
65 "type": "string"
66 },
67 "minItems": 1,
68 "default": null,
69 "required": false
70 },
71 "install": {
72 "description": "The command to be invoked to install the app on the device. The path to the directory / file to be installed (copied over) to the device is available via the ${localPath} string interpolation and the name of the app to be installed via the ${appName} string interpolation.",
73 "type": "array",
74 "items": {
75 "type": "string"
76 },
77 "minItems": 1,
78 "default": [
79 "scp", "-r", "${localPath}", "pi@raspberrypi:/tmp/${appName}"
80 ]
81 },
82 "uninstall": {
83 "description": "The command to be invoked to remove the app from the device. Invoked before every invocation of the app install command. The name of the app to be removed is available via the ${appName} string interpolation.",
84 "type": "array",
85 "items": {
86 "type": "string"
87 },
88 "minItems": 1,
89 "default": [
90 "ssh", "pi@raspberrypi", "rm -rf \"/tmp/${appName}\""
91 ]
92 },
93 "runDebug": {
Kevin Chisholm09f4a692023-02-16 18:27:08 -060094 "description": "The command to be invoked to run the app in debug mode. The name of the app to be started is available via the ${appName} string interpolation. Make sure the flutter cmdline output is available via this commands stdout/stderr since the SDK needs the \"Observatory is now listening on ...\" message to function. If the forwardPort command is not specified, the observatory URL will be connected to as-is, without any port forwarding. In that case you need to make sure it is reachable from your host device, possibly via the \"--observatory-host=<ip>\" engine flag.",
Hannes Winklere8ad0302021-04-01 03:09:02 +020095 "type": "array",
96 "items": {
97 "type": "string"
98 },
99 "minItems": 1,
100 "default": [
Kevin Chisholm09f4a692023-02-16 18:27:08 -0600101 "ssh", "pi@raspberrypi", "flutter-pi /tmp/${appName} --observatory-host=192.168.178.123"
Hannes Winklere8ad0302021-04-01 03:09:02 +0200102 ]
103 },
104 "forwardPort": {
Anis Alibegića753d092021-09-07 23:56:04 +0200105 "description": "The command to be invoked to forward a specific device port to a port on the host device. The host port is available via ${hostPort} and the device port via ${devicePort}. On success, the command should stay running for the duration of the forwarding. The command will be terminated using SIGTERM when the forwarding should be stopped. When using ssh, make sure ssh quits when the forwarding fails since that's not the default behaviour.",
Hannes Winklere8ad0302021-04-01 03:09:02 +0200106 "type": ["array", "null"],
107 "items": {
108 "type": "string"
109 },
110 "minItems": 1,
111 "default": [
112 "ssh", "-o", "ExitOnForwardFailure=yes", "-L", "127.0.0.1:${hostPort}:127.0.0.1:${devicePort}", "pi@raspberrypi"
113 ],
114 "required": false
115 },
116 "forwardPortSuccessRegex": {
117 "description": "A regular expression to be used to classify a successful port forwarding. As soon as any line of stdout or stderr of the forward port command matches this regex, the port forwarding is considered successful. The regex syntax is the standard dart syntax. This value needs to be present & non-null when \"forwardPort\" specified.",
118 "type": ["string", "null"],
119 "format": "regex",
120 "default": "Linux",
121 "required": false
Hannes Winkler82830fa2021-04-30 07:39:03 +0200122 },
123 "screenshot": {
124 "description": "Take a screenshot of the app as a png image. This command should take the screenshot, convert it to png, then base64 encode it and echo to stdout. Any stderr output will be ignored. If this command is not given, screenshotting will be disabled for this device.",
125 "type": ["array", "null"],
126 "items": {
127 "type": "string"
128 },
129 "minItems": 1,
130 "default": [
131 "ssh", "pi@raspberrypi", "fbgrab /tmp/screenshot.png && cat /tmp/screenshot.png | base64 | tr -d ' \\n\\t'"
132 ],
133 "required": false
Hannes Winklere8ad0302021-04-01 03:09:02 +0200134 }
135 }
136 }
137 }
138 }
139}