From bfe37ce2dc59f3b8a7840bfe46807cd586960326 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 28 Jul 2015 16:05:20 -0700 Subject: [PATCH] Teach setup_dart_analyzer about workbench --- sky/tools/setup_dart_analyzer | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sky/tools/setup_dart_analyzer b/sky/tools/setup_dart_analyzer index 0d733742600..33b32d197d0 100755 --- a/sky/tools/setup_dart_analyzer +++ b/sky/tools/setup_dart_analyzer @@ -12,9 +12,11 @@ import yaml SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) SRC_ROOT = os.path.dirname(os.path.dirname(SKY_TOOLS_DIR)) -SKY_SDK_DIR = os.path.join(SRC_ROOT, 'sky', 'sdk') -SKY_PUBSPEC = os.path.join(SKY_SDK_DIR, 'pubspec.yaml') -SKY_PUBSPEC_LOCK = os.path.join(SKY_SDK_DIR, 'pubspec.lock') +SKY_PACKAGE_DIR = os.path.join(SRC_ROOT, 'sky', 'packages', 'sky') +SKY_PUBSPEC = os.path.join(SKY_PACKAGE_DIR, 'pubspec.yaml') +SKY_PUBSPEC_LOCK = os.path.join(SKY_PACKAGE_DIR, 'pubspec.lock') + +WORKBENCH = os.path.join(SRC_ROOT, 'sky', 'packages', 'workbench') def version_for_pubspec(pubspec_path): with open(pubspec_path, 'r') as stream: @@ -25,12 +27,15 @@ def version_for_pubspec(pubspec_path): def entry_for_dependency(dart_pkg_dir, dependency): dependency_path = os.path.join(dart_pkg_dir, dependency) pubspec_path = os.path.join(dependency_path, 'pubspec.yaml') + if not os.path.exists(pubspec_path): + dependency_path = os.path.dirname(os.path.realpath(os.path.join(WORKBENCH, 'packages', dependency))) + pubspec_path = os.path.join(dependency_path, 'pubspec.yaml') if not os.path.exists(pubspec_path): return version = version_for_pubspec(pubspec_path) return { 'description': { - 'path': os.path.relpath(dependency_path, SKY_SDK_DIR), + 'path': os.path.relpath(dependency_path, SKY_PACKAGE_DIR), 'relative': True, }, 'source': 'path', @@ -47,7 +52,7 @@ def main(): if not os.path.exists(dart_pkg_dir): print 'Cannot find Dart pacakges at "%s".' % dart_pkg_dir - print 'Did you run `ninja -C %s sky` ?' % os.path.relpath(args.build_dir, os.getcwd()) + print 'Did you run `ninja -C %s` ?' % os.path.relpath(args.build_dir, os.getcwd()) return 1 packages = {}