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 |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.tools.core.pub; | 14 package com.google.dart.tools.core.pub; |
15 | 15 |
16 import com.google.common.annotations.VisibleForTesting; | 16 import com.google.common.annotations.VisibleForTesting; |
17 import com.google.dart.tools.core.DartCore; | 17 import com.google.dart.tools.core.DartCore; |
| 18 import com.google.dart.tools.core.DartCoreDebug; |
18 import com.google.dart.tools.core.MessageConsole; | 19 import com.google.dart.tools.core.MessageConsole; |
19 import com.google.dart.tools.core.analysis.model.PubFolder; | 20 import com.google.dart.tools.core.analysis.model.PubFolder; |
20 import com.google.dart.tools.core.builder.BuildEvent; | 21 import com.google.dart.tools.core.builder.BuildEvent; |
21 import com.google.dart.tools.core.builder.BuildParticipant; | 22 import com.google.dart.tools.core.builder.BuildParticipant; |
22 import com.google.dart.tools.core.builder.BuildVisitor; | 23 import com.google.dart.tools.core.builder.BuildVisitor; |
23 import com.google.dart.tools.core.builder.CleanEvent; | 24 import com.google.dart.tools.core.builder.CleanEvent; |
24 import com.google.dart.tools.core.internal.builder.DartBuilder; | 25 import com.google.dart.tools.core.internal.builder.DartBuilder; |
25 import com.google.dart.tools.core.utilities.yaml.PubYamlUtils; | 26 import com.google.dart.tools.core.utilities.yaml.PubYamlUtils; |
26 | 27 |
27 import org.eclipse.core.resources.IContainer; | 28 import org.eclipse.core.resources.IContainer; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return; | 222 return; |
222 } | 223 } |
223 } | 224 } |
224 | 225 |
225 try { | 226 try { |
226 // Only run pub automatically if it is not already up to date | 227 // Only run pub automatically if it is not already up to date |
227 File dir = container.getLocation().toFile(); | 228 File dir = container.getLocation().toFile(); |
228 File pubFile = new File(dir, DartCore.PUBSPEC_FILE_NAME); | 229 File pubFile = new File(dir, DartCore.PUBSPEC_FILE_NAME); |
229 File lockFile = new File(dir, DartCore.PUBSPEC_LOCK_FILE_NAME); | 230 File lockFile = new File(dir, DartCore.PUBSPEC_LOCK_FILE_NAME); |
230 File packagesDir = new File(dir, DartCore.PACKAGES_DIRECTORY_NAME); | 231 File packagesDir = new File(dir, DartCore.PACKAGES_DIRECTORY_NAME); |
231 if (packagesDir.exists() && lockFile.exists() | 232 if ((DartCoreDebug.NO_PUB_PACKAGES || packagesDir.exists()) && lockFile.ex
ists() |
232 && lockFile.lastModified() >= pubFile.lastModified()) { | 233 && lockFile.lastModified() >= pubFile.lastModified()) { |
233 return; | 234 return; |
234 } | 235 } |
235 | 236 |
236 // Run pub or notify the user that it needs to be run | 237 // Run pub or notify the user that it needs to be run |
237 if (DartCore.getPlugin().isAutoRunPubEnabled()) { | 238 if (DartCore.getPlugin().isAutoRunPubEnabled()) { |
238 new RunPubJob(container, RunPubJob.INSTALL_COMMAND, true).run(monitor); | 239 new RunPubJob(container, RunPubJob.INSTALL_COMMAND, true).run(monitor); |
239 } else { | 240 } else { |
240 MessageConsole console = DartCore.getConsole(); | 241 MessageConsole console = DartCore.getConsole(); |
241 console.printSeparator(""); | 242 console.printSeparator(""); |
242 console.println("Run Tools > Pub Get to install packages"); | 243 console.println("Run Tools > Pub Get to install packages"); |
243 } | 244 } |
244 | 245 |
245 } finally { | 246 } finally { |
246 // Ensure that currentContainers is updated | 247 // Ensure that currentContainers is updated |
247 synchronized (currentContainers) { | 248 synchronized (currentContainers) { |
248 currentContainers.remove(container); | 249 currentContainers.remove(container); |
249 currentContainers.notifyAll(); | 250 currentContainers.notifyAll(); |
250 } | 251 } |
251 } | 252 } |
252 } | 253 } |
253 } | 254 } |
OLD | NEW |