• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import 'context.dart';
6
7UserMessages get userMessages => context.get<UserMessages>();
8
9/// Class containing message strings that can be produced by Flutter tools.
10class UserMessages {
11  // Messages used in FlutterValidator
12  String flutterStatusInfo(String channel, String version, String os, String locale) =>
13      'Channel $channel, v$version, on $os, locale $locale';
14  String flutterVersion(String version, String flutterRoot) =>
15      'Flutter version $version at $flutterRoot';
16  String flutterRevision(String revision, String age, String date) =>
17      'Framework revision $revision ($age), $date';
18  String engineRevision(String revision) => 'Engine revision $revision';
19  String dartRevision(String revision) => 'Dart version $revision';
20  String get flutterBinariesDoNotRun =>
21      'Downloaded executables cannot execute on host.\n'
22      'See https://github.com/flutter/flutter/issues/6207 for more information';
23  String get flutterBinariesLinuxRepairCommands =>
24      'On Debian/Ubuntu/Mint: sudo apt-get install lib32stdc++6\n'
25      'On Fedora: dnf install libstdc++.i686\n'
26      'On Arch: pacman -S lib32-gcc-libs';
27
28  // Messages used in NoIdeValidator
29  String get noIdeStatusInfo => 'No supported IDEs installed';
30  String get noIdeInstallationInfo => 'IntelliJ - https://www.jetbrains.com/idea/';
31
32  // Messages used in IntellijValidator
33  String intellijStatusInfo(String version) => 'version $version';
34  String get intellijPluginInfo =>
35      'For information about installing plugins, see\n'
36      'https://flutter.dev/intellij-setup/#installing-the-plugins';
37  String intellijMinimumVersion(String minVersion) =>
38      'This install is older than the minimum recommended version of $minVersion.';
39  String intellijLocation(String installPath) => 'IntelliJ at $installPath';
40
41  // Message used in IntellijValidatorOnMac
42  String get intellijMacUnknownResult => 'Cannot determine if IntelliJ is installed';
43
44  // Messages used in DeviceValidator
45  String get devicesMissing => 'No devices available';
46  String devicesAvailable(int devices) => '$devices available';
47
48  // Messages used in AndroidValidator
49  String androidCantRunJavaBinary(String javaBinary) => 'Cannot execute $javaBinary to determine the version';
50  String get androidUnknownJavaVersion => 'Could not determine java version';
51  String androidJavaVersion(String javaVersion) => 'Java version $javaVersion';
52  String androidSdkLicenseOnly(String envKey) =>
53      'Android SDK contains licenses only.\n'
54      'Your first build of an Android application will take longer than usual, '
55      'while gradle downloads the missing components. This functionality will '
56      'only work if the licenses in the licenses folder in $envKey are valid.\n'
57      'If the Android SDK has been installed to another location, set $envKey to that location.\n'
58      'You may also want to add it to your PATH environment variable.\n\n'
59      'Certain features, such as `flutter emulators` and `flutter devices`, will '
60      'not work without the currently missing SDK components.';
61  String androidBadSdkDir(String envKey, String homeDir) =>
62      '$envKey = $homeDir\n'
63      'but Android SDK not found at this location.';
64  String androidMissingSdkInstructions(String envKey) =>
65      'Unable to locate Android SDK.\n'
66      'Install Android Studio from: https://developer.android.com/studio/index.html\n'
67      'On first launch it will assist you in installing the Android SDK components.\n'
68      '(or visit https://flutter.dev/setup/#android-setup for detailed instructions).\n'
69      'If the Android SDK has been installed to a custom location, set $envKey to that location.\n'
70      'You may also want to add it to your PATH environment variable.\n';
71  String androidSdkLocation(String directory) => 'Android SDK at $directory';
72  String androidSdkPlatformToolsVersion(String platform, String tools) =>
73      'Platform $platform, build-tools $tools';
74  String get androidSdkInstallHelp =>
75      'Try re-installing or updating your Android SDK,\n'
76      'visit https://flutter.dev/setup/#android-setup for detailed instructions.';
77  String get androidMissingNdk => 'Android NDK location not configured (optional; useful for native profiling support)';
78  String androidNdkLocation(String directory) => 'Android NDK at $directory';
79  // Also occurs in AndroidLicenseValidator
80  String androidStatusInfo(String version) => 'Android SDK version $version';
81
82  // Messages used in AndroidLicenseValidator
83  String get androidMissingJdk =>
84      'No Java Development Kit (JDK) found; You must have the environment '
85      'variable JAVA_HOME set and the java binary in your PATH. '
86      'You can download the JDK from https://www.oracle.com/technetwork/java/javase/downloads/.';
87  String androidJdkLocation(String location) => 'Java binary at: $location';
88  String get androidLicensesAll => 'All Android licenses accepted.';
89  String get androidLicensesSome => 'Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses';
90  String get androidLicensesNone => 'Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses';
91  String get androidLicensesUnknown =>
92      'Android license status unknown.\n'
93      'Try re-installing or updating your Android SDK Manager.\n'
94      'See https://developer.android.com/studio/#downloads or visit '
95      'https://flutter.dev/setup/#android-setup for detailed instructions.';
96  String androidSdkManagerOutdated(String managerPath) =>
97      'A newer version of the Android SDK is required. To update, run:\n'
98      '$managerPath --update\n';
99  String androidLicensesTimeout(String managerPath) => 'Intentionally killing $managerPath';
100  String get androidSdkShort => 'Unable to locate Android SDK.';
101  String androidMissingSdkManager(String sdkManagerPath) =>
102      'Android sdkmanager tool not found ($sdkManagerPath).\n'
103      'Try re-installing or updating your Android SDK,\n'
104      'visit https://flutter.dev/setup/#android-setup for detailed instructions.';
105  String androidCannotRunSdkManager(String sdkManagerPath, String error) =>
106      'Android sdkmanager tool was found, but failed to run ($sdkManagerPath): "$error".\n'
107      'Try re-installing or updating your Android SDK,\n'
108      'visit https://flutter.dev/setup/#android-setup for detailed instructions.';
109  String androidSdkBuildToolsOutdated(String managerPath, int sdkMinVersion, String buildToolsMinVersion) =>
110      'Flutter requires Android SDK $sdkMinVersion and the Android BuildTools $buildToolsMinVersion\n'
111      'To update using sdkmanager, run:\n'
112      '  "$managerPath" "platforms;android-$sdkMinVersion" "build-tools;$buildToolsMinVersion"\n'
113      'or visit https://flutter.dev/setup/#android-setup for detailed instructions.';
114
115  // Messages used in AndroidStudioValidator
116  String androidStudioVersion(String version) => 'version $version';
117  String androidStudioLocation(String location) => 'Android Studio at $location';
118  String get androidStudioNeedsUpdate => 'Try updating or re-installing Android Studio.';
119  String get androidStudioResetDir =>
120      'Consider removing your android-studio-dir setting by running:\n'
121      'flutter config --android-studio-dir=';
122  String get aaptNotFound =>
123      'Could not locate aapt. Please ensure you have the Android buildtools installed.';
124
125  // Messages used in NoAndroidStudioValidator
126  String androidStudioMissing(String location) =>
127      'android-studio-dir = $location\n'
128      'but Android Studio not found at this location.';
129  String get androidStudioInstallation =>
130      'Android Studio not found; download from https://developer.android.com/studio/index.html\n'
131      '(or visit https://flutter.dev/setup/#android-setup for detailed instructions).';
132
133  // Messages used in XcodeValidator
134  String xcodeLocation(String location) => 'Xcode at $location';
135  String xcodeOutdated(int versionMajor, int versionMinor) =>
136      'Flutter requires a minimum Xcode version of $versionMajor.$versionMinor.0.\n'
137      'Download the latest version or update via the Mac App Store.';
138  String get xcodeEula => 'Xcode end user license agreement not signed; open Xcode or run the command \'sudo xcodebuild -license\'.';
139  String get xcodeMissingSimct =>
140      'Xcode requires additional components to be installed in order to run.\n'
141      'Launch Xcode and install additional required components when prompted.';
142  String get xcodeMissing =>
143      'Xcode not installed; this is necessary for iOS development.\n'
144      'Download at https://developer.apple.com/xcode/download/.';
145  String get xcodeIncomplete =>
146      'Xcode installation is incomplete; a full installation is necessary for iOS development.\n'
147      'Download at: https://developer.apple.com/xcode/download/\n'
148      'Or install Xcode via the App Store.\n'
149      'Once installed, run:\n'
150      '  sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer';
151
152  // Messages used in CocoaPodsValidator
153  String cocoaPodsVersion(String version) => 'CocoaPods version $version';
154  String cocoaPodsUninitialized(String consequence) =>
155      'CocoaPods installed but not initialized.\n'
156      '$consequence\n'
157      'To initialize CocoaPods, run:\n'
158      '  pod setup\n'
159      'once to finalize CocoaPods\' installation.';
160  String cocoaPodsMissing(String consequence, String installInstructions) =>
161      'CocoaPods not installed.\n'
162      '$consequence\n'
163      'To install:\n'
164      '$installInstructions';
165  String cocoaPodsUnknownVersion(String consequence, String upgradeInstructions) =>
166      'Unknown CocoaPods version installed.\n'
167      '$consequence\n'
168      'To upgrade:\n'
169      '$upgradeInstructions';
170  String cocoaPodsOutdated(String recVersion, String consequence, String upgradeInstructions) =>
171      'CocoaPods out of date ($recVersion is recommended).\n'
172      '$consequence\n'
173      'To upgrade:\n'
174      '$upgradeInstructions';
175
176  // Messages used in VsCodeValidator
177  String vsCodeVersion(String version) => 'version $version';
178  String vsCodeLocation(String location) => 'VS Code at $location';
179  String vsCodeFlutterExtensionMissing(String url) => 'Flutter extension not installed; install from\n$url';
180
181  // Messages used in VisualStudioValidator
182  String visualStudioVersion(String name, String version) => '$name version $version';
183  String visualStudioLocation(String location) => 'Visual Studio at $location';
184  String visualStudioMissingComponents(String workload, List<String> components) =>
185      'Visual Studio is missing necessary components. Please re-run the '
186      'Visual Studio installer for the "$workload" workload, and include these components:\n'
187      '  ${components.join('\n  ')}';
188  String get visualStudioMissing =>
189      'Visual Studio not installed; this is necessary for Windows development.\n'
190      'Download at https://visualstudio.microsoft.com/downloads/.';
191
192  // Messages used in FlutterCommand
193  String flutterElapsedTime(String name, String elapsedTime) => '"flutter $name" took $elapsedTime.';
194  String get flutterNoDevelopmentDevice =>
195      "Unable to locate a development device; please run 'flutter doctor' "
196      'for information about installing additional components.';
197  String flutterNoMatchingDevice(String deviceId) => 'No devices found with name or id '
198      "matching '$deviceId'";
199  String get flutterNoDevicesFound => 'No devices found';
200  String get flutterNoSupportedDevices => 'No supported devices connected.';
201  String flutterFoundSpecifiedDevices(int count, String deviceId) =>
202      'Found $count devices with name or id matching $deviceId:';
203  String get flutterSpecifyDeviceWithAllOption =>
204      'More than one device connected; please specify a device with '
205      "the '-d <deviceId>' flag, or use '-d all' to act on all devices.";
206  String get flutterSpecifyDevice =>
207      'More than one device connected; please specify a device with '
208      "the '-d <deviceId>' flag.";
209  String get flutterNoConnectedDevices => 'No connected devices.';
210  String get flutterNoPubspec =>
211      'Error: No pubspec.yaml file found.\n'
212      'This command should be run from the root of your Flutter project.\n'
213      'Do not run this command from the root of your git clone of Flutter.';
214  String get flutterMergeYamlFiles =>
215      'Please merge your flutter.yaml into your pubspec.yaml.\n\n'
216      'We have changed from having separate flutter.yaml and pubspec.yaml\n'
217      'files to having just one pubspec.yaml file. Transitioning is simple:\n'
218      'add a line that just says "flutter:" to your pubspec.yaml file, and\n'
219      'move everything from your current flutter.yaml file into the\n'
220      'pubspec.yaml file, below that line, with everything indented by two\n'
221      'extra spaces compared to how it was in the flutter.yaml file. Then, if\n'
222      'you had a "name:" line, move that to the top of your "pubspec.yaml"\n'
223      'file (you may already have one there), so that there is only one\n'
224      '"name:" line. Finally, delete the flutter.yaml file.\n\n'
225      'For an example of what a new-style pubspec.yaml file might look like,\n'
226      'check out the Flutter Gallery pubspec.yaml:\n'
227      'https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/pubspec.yaml\n';
228  String flutterTargetFileMissing(String path) => 'Target file "$path" not found.';
229  String get flutterBasePatchFlagsExclusive => 'Error: Only one of --baseline, --patch is allowed.';
230  String get flutterBaselineRequiresTraceFile => 'Error: --baseline requires --compilation-trace-file to be specified.';
231  String get flutterPatchRequiresTraceFile => 'Error: --patch requires --compilation-trace-file to be specified.';
232
233  // Messages used in FlutterCommandRunner
234  String runnerNoRoot(String error) => 'Unable to locate flutter root: $error';
235  String runnerWrapColumnInvalid(dynamic value) =>
236      'Argument to --wrap-column must be a positive integer. You supplied $value.';
237  String runnerWrapColumnParseError(dynamic value) =>
238      'Unable to parse argument --wrap-column=$value. Must be a positive integer.';
239  String runnerBugReportFinished(String zipFileName) =>
240      'Bug report written to $zipFileName.\n'
241      'Warning: this bug report contains local paths, device identifiers, and log snippets.';
242  String get runnerNoRecordTo => 'record-to location not specified';
243  String get runnerNoReplayFrom => 'replay-from location not specified';
244  String runnerNoEngineSrcDir(String enginePackageName, String engineEnvVar) =>
245      'Unable to detect local Flutter engine src directory.\n'
246      'Either specify a dependency_override for the $enginePackageName package in your pubspec.yaml and '
247      'ensure --package-root is set if necessary, or set the \$$engineEnvVar environment variable, or '
248      'use --local-engine-src-path to specify the path to the root of your flutter/engine repository.';
249  String runnerNoEngineBuildDirInPath(String engineSourcePath) =>
250      'Unable to detect a Flutter engine build directory in $engineSourcePath.\n'
251      'Please ensure that $engineSourcePath is a Flutter engine \'src\' directory and that '
252      'you have compiled the engine in that directory, which should produce an \'out\' directory';
253  String get runnerLocalEngineRequired =>
254      'You must specify --local-engine if you are using a locally built engine.';
255  String runnerNoEngineBuild(String engineBuildPath) =>
256      'No Flutter engine build found at $engineBuildPath.';
257  String runnerWrongFlutterInstance(String flutterRoot, String currentDir) =>
258      'Warning: the \'flutter\' tool you are currently running is not the one from the current directory:\n'
259      '  running Flutter  : $flutterRoot\n'
260      '  current directory: $currentDir\n'
261      'This can happen when you have multiple copies of flutter installed. Please check your system path to verify '
262      'that you\'re running the expected version (run \'flutter --version\' to see which flutter is on your path).\n';
263  String runnerRemovedFlutterRepo(String flutterRoot, String flutterPath) =>
264      'Warning! This package referenced a Flutter repository via the .packages file that is '
265      'no longer available. The repository from which the \'flutter\' tool is currently '
266      'executing will be used instead.\n'
267      '  running Flutter tool: $flutterRoot\n'
268      '  previous reference  : $flutterPath\n'
269      'This can happen if you deleted or moved your copy of the Flutter repository, or '
270      'if it was on a volume that is no longer mounted or has been mounted at a '
271      'different location. Please check your system path to verify that you are running '
272      'the expected version (run \'flutter --version\' to see which flutter is on your path).\n';
273  String runnerChangedFlutterRepo(String flutterRoot, String flutterPath) =>
274      'Warning! The \'flutter\' tool you are currently running is from a different Flutter '
275      'repository than the one last used by this package. The repository from which the '
276      '\'flutter\' tool is currently executing will be used instead.\n'
277      '  running Flutter tool: $flutterRoot\n'
278      '  previous reference  : $flutterPath\n'
279      'This can happen when you have multiple copies of flutter installed. Please check '
280      'your system path to verify that you are running the expected version (run '
281      '\'flutter --version\' to see which flutter is on your path).\n';
282  String invalidVersionSettingHintMessage(String invalidVersion) =>
283      'Invalid version $invalidVersion found, default value will be used.\n'
284      'In pubspec.yaml, a valid version should look like: build-name+build-number.\n'
285      'In Android, build-name is used as versionName while build-number used as versionCode.\n'
286      'Read more about Android versioning at https://developer.android.com/studio/publish/versioning\n'
287      'In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.\n'
288      'Read more about iOS versioning at\n'
289      'https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html\n';
290}
291