OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Dart project authors. | 2 * Copyright 2011 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 */ | 45 */ |
46 public Collection<String> getAllLibrarySpecs() { | 46 public Collection<String> getAllLibrarySpecs() { |
47 Collection<String> result = new ArrayList<String>(libraries.size()); | 47 Collection<String> result = new ArrayList<String>(libraries.size()); |
48 for (SystemLibrary lib : libraries) { | 48 for (SystemLibrary lib : libraries) { |
49 result.add("dart:" + lib.getShortName()); | 49 result.add("dart:" + lib.getShortName()); |
50 } | 50 } |
51 return result; | 51 return result; |
52 } | 52 } |
53 | 53 |
54 /** | 54 /** |
| 55 * Answer the directory containing the library folders. Typically this would b
e the "dart-sdk/lib" |
| 56 * directory. |
| 57 * |
| 58 * <pre> |
| 59 * install-directory/ |
| 60 * dart-sdk/ |
| 61 * lib/ |
| 62 * core/ |
| 63 * core_runtime.dart |
| 64 * core_frog.dart |
| 65 * ... other core files ... |
| 66 * coreimpl/ |
| 67 * coreimpl_runtime.dart |
| 68 * ... other coreimpl files ... |
| 69 * dom/ |
| 70 * dom.dart |
| 71 * ... other dom files ... |
| 72 * ... other library directories ... |
| 73 * </pre> |
| 74 */ |
| 75 public abstract File getLibrariesDir(); |
| 76 |
| 77 /** |
55 * Answer the original "dart:<libname>" URI for the specified resolved URI or
<code>null</code> if | 78 * Answer the original "dart:<libname>" URI for the specified resolved URI or
<code>null</code> if |
56 * it does not map to a short URI. | 79 * it does not map to a short URI. |
57 */ | 80 */ |
58 public URI getShortUri(URI uri) { | 81 public URI getShortUri(URI uri) { |
59 return longToShortUriMap.get(uri); | 82 return longToShortUriMap.get(uri); |
60 } | 83 } |
61 | 84 |
62 /** | 85 /** |
63 * Scan the directory returned by {@link #getLibrariesDir()} looking for libra
ries of the form | 86 * Scan the directory returned by {@link #getLibrariesDir()} looking for libra
ries of the form |
64 * libraries/<name>/<name>_<platform>.dart and libraries/<name>/<name>.dart wh
ere <platform> is | 87 * libraries/<name>/<name>_<platform>.dart and libraries/<name>/<name>.dart wh
ere <platform> is |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 129 } |
107 | 130 |
108 DartCore.logInformation("Expected " + platformLibFileName + " or " + com
monLibFileName | 131 DartCore.logInformation("Expected " + platformLibFileName + " or " + com
monLibFileName |
109 + " in " + dir); | 132 + " in " + dir); |
110 } | 133 } |
111 } | 134 } |
112 return libraries.toArray(new SystemLibrary[libraries.size()]); | 135 return libraries.toArray(new SystemLibrary[libraries.size()]); |
113 } | 136 } |
114 | 137 |
115 /** | 138 /** |
116 * Answer the directory containing the library folders. Typically this would b
e the "dart-sdk/lib" | |
117 * directory. | |
118 * | |
119 * <pre> | |
120 * install-directory/ | |
121 * dart-sdk/ | |
122 * lib/ | |
123 * core/ | |
124 * core_runtime.dart | |
125 * core_frog.dart | |
126 * ... other core files ... | |
127 * coreimpl/ | |
128 * coreimpl_runtime.dart | |
129 * ... other coreimpl files ... | |
130 * dom/ | |
131 * dom.dart | |
132 * ... other dom files ... | |
133 * ... other library directories ... | |
134 * </pre> | |
135 */ | |
136 abstract File getLibrariesDir(); | |
137 | |
138 /** | |
139 * Answer the platform name (DartC = "compiler", VM = "runtime") used when loc
ating platform | 139 * Answer the platform name (DartC = "compiler", VM = "runtime") used when loc
ating platform |
140 * specific library files (e.g. "core_runtime.dart" vs "core.dart"). | 140 * specific library files (e.g. "core_runtime.dart" vs "core.dart"). |
141 */ | 141 */ |
142 abstract String getPlatformName(); | 142 abstract String getPlatformName(); |
143 | 143 |
144 private boolean addLib(String host, String name, File dir, String libFileName) | 144 private boolean addLib(String host, String name, File dir, String libFileName) |
145 throws AssertionError { | 145 throws AssertionError { |
146 File libFile = new File(dir, libFileName); | 146 File libFile = new File(dir, libFileName); |
147 if (!libFile.isFile()) { | 147 if (!libFile.isFile()) { |
148 return false; | 148 return false; |
(...skipping 11 matching lines...) Expand all Loading... |
160 expandedUri = new URI("dart://" + host + "/" + libFileName); | 160 expandedUri = new URI("dart://" + host + "/" + libFileName); |
161 } catch (URISyntaxException e) { | 161 } catch (URISyntaxException e) { |
162 throw new AssertionError(e); | 162 throw new AssertionError(e); |
163 } | 163 } |
164 URI resolvedUri = lib.translateUri(expandedUri); | 164 URI resolvedUri = lib.translateUri(expandedUri); |
165 longToShortUriMap.put(resolvedUri, libUri); | 165 longToShortUriMap.put(resolvedUri, libUri); |
166 longToShortUriMap.put(expandedUri, libUri); | 166 longToShortUriMap.put(expandedUri, libUri); |
167 return true; | 167 return true; |
168 } | 168 } |
169 } | 169 } |
OLD | NEW |