Merge pull request #245 from abarth/sky_engine_package
Add a sky_engine package to contain the dart:sky SDK extensions
This commit is contained in:
@@ -23,6 +23,7 @@ group("sky_dev") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
"//sky/packages",
|
||||
"//sky/sdk",
|
||||
"//sky/sdk/example/demo_launcher",
|
||||
"//sky/shell",
|
||||
|
||||
11
engine/src/flutter/sky/packages/BUILD.gn
Normal file
11
engine/src/flutter/sky/packages/BUILD.gn
Normal file
@@ -0,0 +1,11 @@
|
||||
# Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
group("packages") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
"//sky/packages/sky_engine",
|
||||
]
|
||||
}
|
||||
27
engine/src/flutter/sky/packages/sky_engine/BUILD.gn
Normal file
27
engine/src/flutter/sky/packages/sky_engine/BUILD.gn
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//mojo/public/dart/rules.gni")
|
||||
|
||||
dart_pkg("sky_engine") {
|
||||
sources = [
|
||||
"README.md",
|
||||
"pubspec.yaml",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//sky/engine/bindings",
|
||||
]
|
||||
|
||||
sdk_ext_directory = "$root_gen_dir/sky/bindings"
|
||||
sdk_ext_files = [
|
||||
"//sky/engine/bindings/sky_internals.dart",
|
||||
"//sky/engine/bindings/builtin_natives.dart",
|
||||
]
|
||||
sdk_ext_mappings = [
|
||||
"dart:sky,dart_sky.dart",
|
||||
"dart:sky.internals,sky_internals.dart",
|
||||
"dart:sky_builtin_natives,builtin_natives.dart",
|
||||
]
|
||||
}
|
||||
7
engine/src/flutter/sky/packages/sky_engine/README.md
Normal file
7
engine/src/flutter/sky/packages/sky_engine/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Sky Engine
|
||||
==========
|
||||
|
||||
This packages describes the dart:sky library, which is the interface between
|
||||
Dart and the Sky Engine. This package also contains a number of Sky shell
|
||||
binaries that let you run code that uses the dart:sky library on various
|
||||
platforms.
|
||||
5
engine/src/flutter/sky/packages/sky_engine/pubspec.yaml
Normal file
5
engine/src/flutter/sky/packages/sky_engine/pubspec.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
name: sky_engine
|
||||
version: 0.0.1
|
||||
author: Chromium Authors <sky-dev@googlegroups.com>
|
||||
description: Dart SDK extensions for dart:sky
|
||||
homepage: https://github.com/domokit/sky_engine
|
||||
@@ -10,6 +10,7 @@ import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
PUBSPECS = [
|
||||
'sky/packages/sky_engine/pubspec.yaml',
|
||||
'sky/sdk/pubspec.yaml',
|
||||
]
|
||||
|
||||
|
||||
@@ -15,13 +15,6 @@ 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')
|
||||
SDK_EXT = os.path.join(SKY_SDK_DIR, 'lib', '_sdkext')
|
||||
|
||||
SDK_EXT_TEMPLATE = '''{
|
||||
"dart:sky": "%(build_dir)s/gen/dart-pkg/sky/sdk_ext/dart_sky.dart",
|
||||
"dart:sky.internals": "%(build_dir)s/gen/dart-pkg/sky/sdk_ext/sky_internals.dart",
|
||||
"dart:sky_builtin_natives": "%(build_dir)s/gen/dart-pkg/sky/sdk_ext/builtin_natives.dart"
|
||||
}'''
|
||||
|
||||
def version_for_pubspec(pubspec_path):
|
||||
with open(pubspec_path, 'r') as stream:
|
||||
@@ -31,7 +24,10 @@ def version_for_pubspec(pubspec_path):
|
||||
|
||||
def entry_for_dependency(dart_pkg_dir, dependency):
|
||||
dependency_path = os.path.join(dart_pkg_dir, dependency)
|
||||
version = version_for_pubspec(os.path.join(dependency_path, 'pubspec.yaml'))
|
||||
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),
|
||||
@@ -59,16 +55,15 @@ def main():
|
||||
with open(SKY_PUBSPEC, 'r') as stream:
|
||||
spec = yaml.load(stream)
|
||||
for dependency in spec['dependencies'].keys():
|
||||
packages[dependency] = entry_for_dependency(dart_pkg_dir, dependency)
|
||||
entry = entry_for_dependency(dart_pkg_dir, dependency)
|
||||
if not entry:
|
||||
continue
|
||||
packages[dependency] = entry
|
||||
|
||||
lock = { 'packages': packages }
|
||||
with open(SKY_PUBSPEC_LOCK, 'w') as stream:
|
||||
yaml.dump(lock, stream=stream, default_flow_style=False)
|
||||
|
||||
with open(SDK_EXT, 'w') as stream:
|
||||
rebased_build_dir = os.path.relpath(args.build_dir, os.path.dirname(SDK_EXT))
|
||||
stream.write(SDK_EXT_TEMPLATE % { 'build_dir': rebased_build_dir })
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
||||
Reference in New Issue
Block a user