googlearchive / chromedeveditor

Chrome Dev Editor is a developer tool for building apps on the Chrome platform - Chrome Apps and Web Apps, in JavaScript or Dart. (NO LONGER IN ACTIVE DEVELOPMENT)
BSD 3-Clause "New" or "Revised" License
2.92k stars 412 forks source link

check for and run pub when executing an application #2020

Closed devoncarew closed 10 years ago

devoncarew commented 10 years ago

We should probably make this ~generic, so that people can hook into and perform preflight operation when running an application. So, given something like the resource that's run, and the type of run (local run? mobile deploy?), a participant can optionally perform some action before the run.

A straw-man:

abstract class PreFlightOperation {
  String get operationName;
  bool canParticipate(Resource resource, String launchType);
  Future performPreflight(Resource resource, String launchType);
}

Where launchType is some well-known list of types (run, deploy). So, a dart web app that's running might need to check and run pub. A dart chrome app that's deploying might need to check and run pub, then compile the app to Javascript.

ussuri commented 10 years ago

I have a serious suspicion that close to a 100% of preflight operations will map 1:1 onto explicit actions that we already have (like "Pub Upgrade"). So maybe this new concept should be somehow mixed into Action? For those operations that don't need to be surfaced in the UI (context menu), it's trivial to do using existing Action's means. So something like:

abstract class Action {
  ...
  bool isPreflightActionFor(Object object);
  ...
}
devoncarew commented 10 years ago

@keerti, I'm re-assigning this to myself. I'm doing some re-factoring of the launch code to support deploying web apps. Part of that work will overlap with this issue. I'll assign back to cover the pub pre-flight stuff.

dinhvh commented 10 years ago

Could we make "Run" just show a warning instead of making "Run" slower every time we want to run it?

devoncarew commented 10 years ago

Either way we'll need a way to hook into a pre-launch of applications. And you'll only pay a price for running pub at launch when you've modified the pubspec.yaml.

dinhvh commented 10 years ago

Oh ok. Sounds good.

keertip commented 10 years ago

2335 - checks if pub needs to be run and shows a message.