OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 * The file containing the VM executable. | 96 * The file containing the VM executable. |
97 */ | 97 */ |
98 private File vmExecutable; | 98 private File vmExecutable; |
99 | 99 |
100 /** | 100 /** |
101 * A mapping from Dart library URI's to the library represented by that URI. | 101 * A mapping from Dart library URI's to the library represented by that URI. |
102 */ | 102 */ |
103 private LibraryMap libraryMap; | 103 private LibraryMap libraryMap; |
104 | 104 |
105 /** | 105 /** |
| 106 * The default SDK, or {@code null} if the default SDK either has not yet been
created or cannot |
| 107 * be created for some reason. |
| 108 */ |
| 109 private static DirectoryBasedDartSdk DEFAULT_SDK; |
| 110 |
| 111 /** |
106 * The name of the directory within the SDK directory that contains executable
s. | 112 * The name of the directory within the SDK directory that contains executable
s. |
107 */ | 113 */ |
108 private static final String BIN_DIRECTORY_NAME = "bin"; //$NON-NLS-1$ | 114 private static final String BIN_DIRECTORY_NAME = "bin"; //$NON-NLS-1$ |
109 | 115 |
110 /** | 116 /** |
111 * The name of the directory on non-Mac that contains dartium. | 117 * The name of the directory on non-Mac that contains dartium. |
112 */ | 118 */ |
113 private static final String DARTIUM_DIRECTORY_NAME = "chromium"; //$NON-NLS-1$ | 119 private static final String DARTIUM_DIRECTORY_NAME = "chromium"; //$NON-NLS-1$ |
114 | 120 |
115 /** | 121 /** |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 */ | 211 */ |
206 private static final String VM_EXECUTABLE_NAME = "dart"; //$NON-NLS-1$ | 212 private static final String VM_EXECUTABLE_NAME = "dart"; //$NON-NLS-1$ |
207 | 213 |
208 /** | 214 /** |
209 * Return the default Dart SDK, or {@code null} if the directory containing th
e default SDK cannot | 215 * Return the default Dart SDK, or {@code null} if the directory containing th
e default SDK cannot |
210 * be determined (or does not exist). | 216 * be determined (or does not exist). |
211 * | 217 * |
212 * @return the default Dart SDK | 218 * @return the default Dart SDK |
213 */ | 219 */ |
214 public static DirectoryBasedDartSdk getDefaultSdk() { | 220 public static DirectoryBasedDartSdk getDefaultSdk() { |
215 File sdkDirectory = getDefaultSdkDirectory(); | 221 if (DEFAULT_SDK == null) { |
216 if (sdkDirectory == null) { | 222 File sdkDirectory = getDefaultSdkDirectory(); |
217 return null; | 223 if (sdkDirectory == null) { |
| 224 return null; |
| 225 } |
| 226 DEFAULT_SDK = new DirectoryBasedDartSdk(sdkDirectory); |
218 } | 227 } |
219 return new DirectoryBasedDartSdk(sdkDirectory); | 228 return DEFAULT_SDK; |
220 } | 229 } |
221 | 230 |
222 /** | 231 /** |
223 * Return the default directory for the Dart SDK, or {@code null} if the direc
tory cannot be | 232 * Return the default directory for the Dart SDK, or {@code null} if the direc
tory cannot be |
224 * determined (or does not exist). The default directory is provided by a {@li
nk System} property | 233 * determined (or does not exist). The default directory is provided by a {@li
nk System} property |
225 * named {@code com.google.dart.sdk}. | 234 * named {@code com.google.dart.sdk}. |
226 * | 235 * |
227 * @return the default directory for the Dart SDK | 236 * @return the default directory for the Dart SDK |
228 */ | 237 */ |
229 public static File getDefaultSdkDirectory() { | 238 public static File getDefaultSdkDirectory() { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 * Verify that the given executable file exists and is executable. | 629 * Verify that the given executable file exists and is executable. |
621 * | 630 * |
622 * @param file the binary file | 631 * @param file the binary file |
623 * @return the file if it exists and is executable, else {@code null} | 632 * @return the file if it exists and is executable, else {@code null} |
624 */ | 633 */ |
625 @DartExpressionBody("file.isExecutable() ? file : null") | 634 @DartExpressionBody("file.isExecutable() ? file : null") |
626 private File verifyExecutable(File file) { | 635 private File verifyExecutable(File file) { |
627 return FileUtilities.ensureExecutable(file) ? file : null; | 636 return FileUtilities.ensureExecutable(file) ? file : null; |
628 } | 637 } |
629 } | 638 } |
OLD | NEW |