Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
ce3b4547
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ce3b4547
编写于
3月 28, 2016
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2557 from abarth/dot_packages2
Teach SkyShell about .packages files
上级
3821dfb7
c4e18274
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
99 addition
and
58 deletion
+99
-58
sky/build/PackagerInvoke
sky/build/PackagerInvoke
+3
-3
sky/build/sdk_xcode_harness/FlutterApplication.xcodeproj/xcshareddata/xcschemes/Application.xcscheme
...ion.xcodeproj/xcshareddata/xcschemes/Application.xcscheme
+1
-1
sky/services/engine/sky_engine.mojom
sky/services/engine/sky_engine.mojom
+1
-1
sky/shell/dart/BUILD.gn
sky/shell/dart/BUILD.gn
+1
-0
sky/shell/dart/dart_library_provider_files.cc
sky/shell/dart/dart_library_provider_files.cc
+31
-10
sky/shell/dart/dart_library_provider_files.h
sky/shell/dart/dart_library_provider_files.h
+6
-2
sky/shell/platform/ios/FlutterAppDelegate.mm
sky/shell/platform/ios/FlutterAppDelegate.mm
+1
-1
sky/shell/platform/ios/FlutterDartProject.mm
sky/shell/platform/ios/FlutterDartProject.mm
+4
-4
sky/shell/platform/ios/FlutterDartSource.h
sky/shell/platform/ios/FlutterDartSource.h
+2
-2
sky/shell/platform/ios/FlutterDartSource.mm
sky/shell/platform/ios/FlutterDartSource.mm
+6
-6
sky/shell/platform/ios/public/FlutterDartProject.h
sky/shell/platform/ios/public/FlutterDartProject.h
+1
-1
sky/shell/platform/mac/platform_mac.mm
sky/shell/platform/mac/platform_mac.mm
+9
-9
sky/shell/platform/mac/sky_window.mm
sky/shell/platform/mac/sky_window.mm
+3
-3
sky/shell/switches.cc
sky/shell/switches.cc
+2
-2
sky/shell/switches.h
sky/shell/switches.h
+1
-1
sky/shell/testing/test_runner.cc
sky/shell/testing/test_runner.cc
+1
-1
sky/shell/testing/test_runner.h
sky/shell/testing/test_runner.h
+1
-1
sky/shell/testing/testing.cc
sky/shell/testing/testing.cc
+1
-1
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+20
-5
sky/shell/ui/engine.h
sky/shell/ui/engine.h
+1
-1
sky/tools/sky_snapshot/loader.cc
sky/tools/sky_snapshot/loader.cc
+3
-3
未找到文件。
sky/build/PackagerInvoke
浏览文件 @
ce3b4547
...
...
@@ -41,8 +41,8 @@ PackageProject() {
local
dart_main
=
${
project_path
}
/lib/main.dart
AssertExists
$dart_main
local
package
_root
=
${
project_path
}
/
packages
AssertExists
$package
_root
local
package
s
=
${
project_path
}
/.
packages
AssertExists
$package
s
# Remove old build artifacts
RunCommand
rm
-f
${
derived_dir
}
/app.flx
...
...
@@ -62,7 +62,7 @@ PackageProject() {
RunCommand
${
FLUTTER_ROOT
}
/bin/flutter build flx
\
--target
${
dart_main
}
\
--output-file
${
derived_dir
}
/app.flx
\
--package
-root
${
package_root
}
\
--package
s
${
packages
}
\
--compiler
${
src_dir
}
/ScriptSnapshotter
\
${
precompilation_flag
}
\
...
...
sky/build/sdk_xcode_harness/FlutterApplication.xcodeproj/xcshareddata/xcschemes/Application.xcscheme
浏览文件 @
ce3b4547
...
...
@@ -71,7 +71,7 @@
isEnabled =
"YES"
>
</CommandLineArgument>
<CommandLineArgument
argument =
"--package
-root=$(FLUTTER_APPLICATION_PATH)/
packages"
argument =
"--package
s=$(FLUTTER_APPLICATION_PATH)/.
packages"
isEnabled =
"YES"
>
</CommandLineArgument>
</CommandLineArguments>
...
...
sky/services/engine/sky_engine.mojom
浏览文件 @
ce3b4547
...
...
@@ -49,7 +49,7 @@ interface SkyEngine {
PushRoute(string route);
PopRoute();
RunFromFile(string main, string package
_root
, string bundle_path);
RunFromFile(string main, string package
s
, string bundle_path);
RunFromPrecompiledSnapshot(string bundle_path);
RunFromBundle(string script_uri, string bundle_path);
...
...
sky/shell/dart/BUILD.gn
浏览文件 @
ce3b4547
...
...
@@ -15,6 +15,7 @@ source_set("dart") {
"//mojo/data_pipe_utils",
"//mojo/public/cpp/application",
"//sky/engine/tonic",
"//sky/engine/tonic/parsers",
"//sky/engine/wtf",
]
}
sky/shell/dart/dart_library_provider_files.cc
浏览文件 @
ce3b4547
...
...
@@ -39,18 +39,28 @@ base::FilePath SimplifyPath(const base::FilePath& path) {
}
// namespace
DartLibraryProviderFiles
::
DartLibraryProviderFiles
(
const
base
::
FilePath
&
package_root
)
:
package_root_
(
package_root
)
{
if
(
package_root_
.
empty
())
package_root_
=
base
::
FilePath
(
FILE_PATH_LITERAL
(
"packages"
));
if
(
!
base
::
DirectoryExists
(
package_root_
))
package_root_
=
base
::
FilePath
();
DartLibraryProviderFiles
::
DartLibraryProviderFiles
()
{
}
DartLibraryProviderFiles
::~
DartLibraryProviderFiles
()
{
}
void
DartLibraryProviderFiles
::
LoadPackagesMap
(
const
base
::
FilePath
&
packages
)
{
packages_
=
base
::
MakeAbsoluteFilePath
(
packages
);
std
::
string
packages_source
;
if
(
!
base
::
ReadFileToString
(
packages_
,
&
packages_source
))
{
LOG
(
ERROR
)
<<
"error: Unable to load .packages file '"
<<
packages_
.
AsUTF8Unsafe
()
<<
"'."
;
exit
(
1
);
}
std
::
string
error
;
if
(
!
packages_map_
.
Parse
(
packages_source
,
&
error
))
{
LOG
(
ERROR
)
<<
"error: Unable to parse .packages file '"
<<
packages_
.
AsUTF8Unsafe
()
<<
"'.
\n
"
<<
error
;
exit
(
1
);
}
}
void
DartLibraryProviderFiles
::
GetLibraryAsStream
(
const
std
::
string
&
name
,
blink
::
DataPipeConsumerCallback
callback
)
{
...
...
@@ -67,9 +77,20 @@ void DartLibraryProviderFiles::GetLibraryAsStream(
std
::
string
DartLibraryProviderFiles
::
CanonicalizePackageURL
(
std
::
string
url
)
{
DCHECK
(
base
::
StartsWithASCII
(
url
,
"package:"
,
true
));
base
::
ReplaceFirstSubstringAfterOffset
(
&
url
,
0
,
"package:"
,
""
);
CHECK
(
!
package_root_
.
empty
())
<<
"Cannot import packages without a valid --package-root"
;
return
package_root_
.
Append
(
url
).
AsUTF8Unsafe
();
size_t
slash
=
url
.
find
(
'/'
);
if
(
slash
==
std
::
string
::
npos
)
return
std
::
string
();
std
::
string
package
=
url
.
substr
(
0
,
slash
);
std
::
string
library_path
=
url
.
substr
(
slash
+
1
);
std
::
string
package_path
=
packages_map_
.
Resolve
(
package
);
if
(
package_path
.
empty
())
return
std
::
string
();
if
(
base
::
StartsWithASCII
(
package_path
,
"file://"
,
true
))
{
base
::
ReplaceFirstSubstringAfterOffset
(
&
package_path
,
0
,
"file://"
,
""
);
return
package_path
+
library_path
;
}
auto
path
=
packages_
.
DirName
().
Append
(
package_path
).
Append
(
library_path
);
return
SimplifyPath
(
path
).
AsUTF8Unsafe
();
}
std
::
string
DartLibraryProviderFiles
::
CanonicalizeFileURL
(
std
::
string
url
)
{
...
...
sky/shell/dart/dart_library_provider_files.h
浏览文件 @
ce3b4547
...
...
@@ -7,15 +7,18 @@
#include "base/files/file_path.h"
#include "sky/engine/tonic/dart_library_provider.h"
#include "sky/engine/tonic/parsers/packages_map.h"
namespace
sky
{
namespace
shell
{
class
DartLibraryProviderFiles
:
public
blink
::
DartLibraryProvider
{
public:
explicit
DartLibraryProviderFiles
(
const
base
::
FilePath
&
package_root
);
DartLibraryProviderFiles
(
);
~
DartLibraryProviderFiles
()
override
;
void
LoadPackagesMap
(
const
base
::
FilePath
&
packages
);
protected:
// |DartLibraryProvider| implementation:
void
GetLibraryAsStream
(
const
std
::
string
&
name
,
...
...
@@ -26,7 +29,8 @@ class DartLibraryProviderFiles : public blink::DartLibraryProvider {
std
::
string
CanonicalizePackageURL
(
std
::
string
url
);
std
::
string
CanonicalizeFileURL
(
std
::
string
url
);
base
::
FilePath
package_root_
;
base
::
FilePath
packages_
;
tonic
::
PackagesMap
packages_map_
;
DISALLOW_COPY_AND_ASSIGN
(
DartLibraryProviderFiles
);
};
...
...
sky/shell/platform/ios/FlutterAppDelegate.mm
浏览文件 @
ce3b4547
...
...
@@ -32,7 +32,7 @@ NSURL* URLForSwitch(const char* name) {
FlutterDartProject
*
project
=
[[
FlutterDartProject
alloc
]
initWithFLXArchive:
URLForSwitch
(
sky
:
:
shell
:
:
switches
::
kFLX
)
dartMain:
URLForSwitch
(
sky
::
shell
::
switches
::
kMainDartFile
)
packageRoot:
URLForSwitch
(
sky
::
shell
::
switches
::
kPackageRoot
)];
packages:
URLForSwitch
(
sky
::
shell
::
switches
::
kPackages
)];
#else
NSString
*
bundlePath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"FlutterApplication"
...
...
sky/shell/platform/ios/FlutterDartProject.mm
浏览文件 @
ce3b4547
...
...
@@ -15,7 +15,7 @@
#pragma mark - Override base class designated initializers
-
(
instancetype
)
init
{
return
[
self
initWithFLXArchive
:
nil
dartMain
:
nil
package
Root
:
nil
];
return
[
self
initWithFLXArchive
:
nil
dartMain
:
nil
package
s
:
nil
];
}
#pragma mark - Designated initializers
...
...
@@ -34,12 +34,12 @@
-
(
instancetype
)
initWithFLXArchive
:(
NSURL
*
)
archiveURL
dartMain
:(
NSURL
*
)
dartMainURL
packageRoot
:(
NSURL
*
)
dartPackageURL
{
packages
:(
NSURL
*
)
dartPackages
{
self
=
[
super
init
];
if
(
self
)
{
_dartSource
=
[[
FlutterDartSource
alloc
]
initWithDartMain
:
dartMainURL
packageRoot:
dartPackageURL
packages:
dartPackages
flxArchive:
archiveURL
];
[
self
checkReadiness
];
...
...
@@ -160,7 +160,7 @@ static NSString* NSStringFromVMType(VMType type) {
}
engine
->
RunFromFile
(
_dartSource
.
dartMain
.
absoluteURL
.
path
.
UTF8String
,
_dartSource
.
package
Root
.
absoluteURL
.
path
.
UTF8String
,
_dartSource
.
package
s
.
absoluteURL
.
path
.
UTF8String
,
_dartSource
.
flxArchive
.
absoluteURL
.
path
.
UTF8String
);
result
(
YES
,
@"Success"
);
}];
...
...
sky/shell/platform/ios/FlutterDartSource.h
浏览文件 @
ce3b4547
...
...
@@ -12,11 +12,11 @@ typedef void (^ValidationResult)(BOOL result, NSString* message);
@interface
FlutterDartSource
:
NSObject
@property
(
nonatomic
,
readonly
)
NSURL
*
dartMain
;
@property
(
nonatomic
,
readonly
)
NSURL
*
package
Root
;
@property
(
nonatomic
,
readonly
)
NSURL
*
package
s
;
@property
(
nonatomic
,
readonly
)
NSURL
*
flxArchive
;
-
(
instancetype
)
initWithDartMain
:(
NSURL
*
)
dartMain
packageRoot
:(
NSURL
*
)
packageRoot
packages
:(
NSURL
*
)
packages
flxArchive
:(
NSURL
*
)
flxArchive
NS_DESIGNATED_INITIALIZER
;
-
(
void
)
validate
:(
ValidationResult
)
result
;
...
...
sky/shell/platform/ios/FlutterDartSource.mm
浏览文件 @
ce3b4547
...
...
@@ -6,22 +6,22 @@
@implementation
FlutterDartSource
{
NSURL
*
_dartMain
;
NSURL
*
_package
Root
;
NSURL
*
_package
s
;
NSURL
*
_flxArchive
;
}
-
(
instancetype
)
init
{
return
[
self
initWithDartMain
:
nil
package
Root
:
nil
flxArchive
:
nil
];
return
[
self
initWithDartMain
:
nil
package
s
:
nil
flxArchive
:
nil
];
}
-
(
instancetype
)
initWithDartMain
:(
NSURL
*
)
dartMain
packageRoot
:(
NSURL
*
)
packageRoot
packages
:(
NSURL
*
)
packages
flxArchive
:(
NSURL
*
)
flxArchive
{
self
=
[
super
init
];
if
(
self
)
{
_dartMain
=
[
dartMain
copy
];
_package
Root
=
[
packageRoot
copy
];
_package
s
=
[
packages
copy
];
_flxArchive
=
[
flxArchive
copy
];
}
...
...
@@ -57,14 +57,14 @@ static BOOL CheckDartProjectURL(NSMutableString* log,
isValid
&=
CheckDartProjectURL
(
log
,
_flxArchive
,
@"FLX archive"
);
isValid
&=
CheckDartProjectURL
(
log
,
_dartMain
,
@"Dart main"
);
isValid
&=
CheckDartProjectURL
(
log
,
_package
Root
,
@"Dart package root
"
);
isValid
&=
CheckDartProjectURL
(
log
,
_package
s
,
@"Dart packages
"
);
result
(
isValid
,
log
);
}
-
(
void
)
dealloc
{
[
_dartMain
release
];
[
_package
Root
release
];
[
_package
s
release
];
[
_flxArchive
release
];
[
super
dealloc
];
...
...
sky/shell/platform/ios/public/FlutterDartProject.h
浏览文件 @
ce3b4547
...
...
@@ -17,7 +17,7 @@ FLUTTER_EXPORT
-
(
instancetype
)
initWithFLXArchive
:(
NSURL
*
)
archiveURL
dartMain
:(
NSURL
*
)
dartMainURL
packageRoot
:(
NSURL
*
)
dartPackageURL
packages
:(
NSURL
*
)
dartPackages
NS_DESIGNATED_INITIALIZER
;
@end
...
...
sky/shell/platform/mac/platform_mac.mm
浏览文件 @
ce3b4547
...
...
@@ -103,9 +103,9 @@ void PlatformMacMain(int argc, const char* argv[], std::string icu_data_path) {
}
static
bool
FlagsValidForCommandLineLaunch
(
const
std
::
string
&
dart_main
,
const
std
::
string
&
package
_root
,
const
std
::
string
&
package
s
,
const
std
::
string
&
bundle
)
{
if
(
dart_main
.
size
()
==
0
||
package_root
.
size
()
==
0
||
bundle
.
size
()
==
0
)
{
if
(
dart_main
.
empty
()
||
packages
.
empty
()
||
bundle
.
empty
()
)
{
return
false
;
}
...
...
@@ -119,7 +119,7 @@ static bool FlagsValidForCommandLineLaunch(const std::string& dart_main,
return
false
;
}
if
(
!
[
manager
fileExistsAtPath
:
@
(
package
_root
.
c_str
())])
{
if
(
!
[
manager
fileExistsAtPath
:
@
(
package
s
.
c_str
())])
{
return
false
;
}
...
...
@@ -157,23 +157,23 @@ bool AttemptLaunchFromCommandLineSwitches(sky::SkyEnginePtr& engine) {
auto
command_line
=
*
base
::
CommandLine
::
ForCurrentProcess
();
if
(
command_line
.
HasSwitch
(
kMainDartFile
)
||
command_line
.
HasSwitch
(
kPackage
Root
)
||
command_line
.
HasSwitch
(
kFLX
))
{
command_line
.
HasSwitch
(
kPackage
s
)
||
command_line
.
HasSwitch
(
kFLX
))
{
// The main dart file, flx bundle and the package root must be specified in
// one go. We dont want to end up in a situation where we take one value
// from the command line and the others from user defaults. In case, any
// new flags are specified, forget about all the old ones.
[
defaults
removeObjectForKey
:
@
(
kMainDartFile
)];
[
defaults
removeObjectForKey
:
@
(
kPackage
Root
)];
[
defaults
removeObjectForKey
:
@
(
kPackage
s
)];
[
defaults
removeObjectForKey
:
@
(
kFLX
)];
[
defaults
synchronize
];
}
std
::
string
dart_main
=
ResolveCommandLineLaunchFlag
(
kMainDartFile
);
std
::
string
package
_root
=
ResolveCommandLineLaunchFlag
(
kPackageRoot
);
std
::
string
package
s
=
ResolveCommandLineLaunchFlag
(
kPackages
);
std
::
string
bundle
=
ResolveCommandLineLaunchFlag
(
kFLX
);
if
(
!
FlagsValidForCommandLineLaunch
(
dart_main
,
package
_root
,
bundle
))
{
if
(
!
FlagsValidForCommandLineLaunch
(
dart_main
,
package
s
,
bundle
))
{
return
false
;
}
...
...
@@ -181,13 +181,13 @@ bool AttemptLaunchFromCommandLineSwitches(sky::SkyEnginePtr& engine) {
// defaults so that the next time the user launches the application in the
// simulator without the tooling, the application boots up.
[
defaults
setObject
:
@
(
dart_main
.
c_str
())
forKey
:
@
(
kMainDartFile
)];
[
defaults
setObject
:
@
(
package
_root
.
c_str
())
forKey
:
@
(
kPackageRoot
)];
[
defaults
setObject
:
@
(
package
s
.
c_str
())
forKey
:
@
(
kPackages
)];
[
defaults
setObject
:
@
(
bundle
.
c_str
())
forKey
:
@
(
kFLX
)];
[
defaults
synchronize
];
// Finally launch with the newly resolved arguments.
engine
->
RunFromFile
(
dart_main
,
package
_root
,
bundle
);
engine
->
RunFromFile
(
dart_main
,
package
s
,
bundle
);
return
true
;
}
...
...
sky/shell/platform/mac/sky_window.mm
浏览文件 @
ce3b4547
...
...
@@ -109,9 +109,9 @@ static inline pointer::PointerType EventTypeFromNSEventPhase(
auto
args
=
command_line
.
GetArgs
();
if
(
args
.
size
()
>
0
)
{
auto
package
_root
=
command_line
.
GetSwitchValueASCII
(
sky
::
shell
::
switches
::
kPackage
Root
);
_sky_engine
->
RunFromFile
(
args
[
0
],
package
_root
,
""
);
auto
package
s
=
command_line
.
GetSwitchValueASCII
(
sky
::
shell
::
switches
::
kPackage
s
);
_sky_engine
->
RunFromFile
(
args
[
0
],
package
s
,
""
);
return
;
}
}
...
...
sky/shell/switches.cc
浏览文件 @
ce3b4547
...
...
@@ -15,7 +15,7 @@ const char kFLX[] = "flx";
const
char
kHelp
[]
=
"help"
;
const
char
kNonInteractive
[]
=
"non-interactive"
;
const
char
kMainDartFile
[]
=
"dart-main"
;
const
char
kPackage
Root
[]
=
"package-root
"
;
const
char
kPackage
s
[]
=
"packages
"
;
const
char
kStartPaused
[]
=
"start-paused"
;
const
char
kTraceStartup
[]
=
"trace-startup"
;
const
char
kDeviceObservatoryPort
[]
=
"observatory-port"
;
...
...
@@ -27,7 +27,7 @@ void PrintUsage(const std::string& executable_name) {
<<
" --"
<<
kStartPaused
<<
" --"
<<
kTraceStartup
<<
" --"
<<
kFLX
<<
"=FLX"
<<
" --"
<<
kPackage
Root
<<
"=PACKAGE_ROOT
"
<<
" --"
<<
kPackage
s
<<
"=PACKAGES
"
<<
" --"
<<
kDeviceObservatoryPort
<<
"=8181"
<<
" [ MAIN_DART ]"
<<
std
::
endl
;
}
...
...
sky/shell/switches.h
浏览文件 @
ce3b4547
...
...
@@ -16,7 +16,7 @@ extern const char kFLX[];
extern
const
char
kHelp
[];
extern
const
char
kNonInteractive
[];
extern
const
char
kMainDartFile
[];
extern
const
char
kPackage
Root
[];
extern
const
char
kPackage
s
[];
extern
const
char
kStartPaused
[];
extern
const
char
kTraceStartup
[];
extern
const
char
kDeviceObservatoryPort
[];
...
...
sky/shell/testing/test_runner.cc
浏览文件 @
ce3b4547
...
...
@@ -41,7 +41,7 @@ TestRunner& TestRunner::Shared() {
}
void
TestRunner
::
Run
(
const
TestDescriptor
&
test
)
{
sky_engine_
->
RunFromFile
(
test
.
path
,
test
.
package
_root
,
""
);
sky_engine_
->
RunFromFile
(
test
.
path
,
test
.
package
s
,
""
);
}
}
// namespace shell
...
...
sky/shell/testing/test_runner.h
浏览文件 @
ce3b4547
...
...
@@ -24,7 +24,7 @@ class TestRunner {
struct
TestDescriptor
{
std
::
string
path
;
std
::
string
package
_root
;
std
::
string
package
s
;
};
void
Run
(
const
TestDescriptor
&
test
);
...
...
sky/shell/testing/testing.cc
浏览文件 @
ce3b4547
...
...
@@ -15,7 +15,7 @@ bool InitForTesting() {
base
::
CommandLine
&
command_line
=
*
base
::
CommandLine
::
ForCurrentProcess
();
TestRunner
::
TestDescriptor
test
;
test
.
package
_root
=
command_line
.
GetSwitchValueASCII
(
switches
::
kPackageRoot
);
test
.
package
s
=
command_line
.
GetSwitchValueASCII
(
switches
::
kPackages
);
auto
args
=
command_line
.
GetArgs
();
if
(
args
.
empty
())
return
false
;
...
...
sky/shell/ui/engine.cc
浏览文件 @
ce3b4547
...
...
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
...
...
@@ -209,17 +210,31 @@ void Engine::RunFromPrecompiledSnapshot(const mojo::String& bundle_path) {
}
void
Engine
::
RunFromFile
(
const
mojo
::
String
&
main
,
const
mojo
::
String
&
package
_root
,
const
mojo
::
String
&
package
s
,
const
mojo
::
String
&
bundle
)
{
TRACE_EVENT0
(
"flutter"
,
"Engine::RunFromFile"
);
std
::
string
main_str
(
main
);
if
(
bundle
.
size
()
!=
0
)
{
// The specification of an FLX bundle is optional.
ConfigureZipAssetBundle
(
bundle
);
}
std
::
string
package_root_str
=
package_root
;
dart_library_provider_
.
reset
(
new
DartLibraryProviderFiles
(
base
::
FilePath
(
package_root_str
)));
RunFromLibrary
(
main
);
base
::
FilePath
packages_path
=
base
::
FilePath
(
std
::
string
(
packages
));
if
(
packages_path
.
empty
())
{
base
::
FilePath
main_dir
=
base
::
FilePath
(
main_str
).
DirName
();
packages_path
=
main_dir
.
Append
(
FILE_PATH_LITERAL
(
".packages"
));
if
(
!
base
::
PathExists
(
packages_path
))
{
packages_path
=
main_dir
.
Append
(
base
::
FilePath
::
kParentDirectory
)
.
Append
(
FILE_PATH_LITERAL
(
".packages"
));
if
(
!
base
::
PathExists
(
packages_path
))
packages_path
=
base
::
FilePath
();
}
}
DartLibraryProviderFiles
*
provider
=
new
DartLibraryProviderFiles
();
dart_library_provider_
.
reset
(
provider
);
if
(
!
packages_path
.
empty
())
provider
->
LoadPackagesMap
(
packages_path
);
RunFromLibrary
(
main_str
);
}
void
Engine
::
RunFromBundle
(
const
mojo
::
String
&
script_uri
,
...
...
sky/shell/ui/engine.h
浏览文件 @
ce3b4547
...
...
@@ -71,7 +71,7 @@ class Engine : public UIDelegate,
void
OnPointerPacket
(
pointer
::
PointerPacketPtr
packet
)
override
;
void
RunFromFile
(
const
mojo
::
String
&
main
,
const
mojo
::
String
&
package
_root
,
const
mojo
::
String
&
package
s
,
const
mojo
::
String
&
bundle
)
override
;
void
RunFromPrecompiledSnapshot
(
const
mojo
::
String
&
bundle_path
)
override
;
void
RunFromBundle
(
const
mojo
::
String
&
script_uri
,
...
...
sky/tools/sky_snapshot/loader.cc
浏览文件 @
ce3b4547
...
...
@@ -69,16 +69,16 @@ void Loader::LoadPackagesMap(const base::FilePath& packages) {
packages_
=
base
::
MakeAbsoluteFilePath
(
packages
);
dependencies_
.
insert
(
packages_
.
AsUTF8Unsafe
());
std
::
string
packages_source
;
if
(
!
base
::
ReadFileToString
(
packages
,
&
packages_source
))
{
if
(
!
base
::
ReadFileToString
(
packages
_
,
&
packages_source
))
{
fprintf
(
stderr
,
"error: Unable to load .packages file '%s'.
\n
"
,
packages
.
AsUTF8Unsafe
().
c_str
());
packages
_
.
AsUTF8Unsafe
().
c_str
());
exit
(
1
);
}
packages_map_
.
reset
(
new
tonic
::
PackagesMap
());
std
::
string
error
;
if
(
!
packages_map_
->
Parse
(
packages_source
,
&
error
))
{
fprintf
(
stderr
,
"error: Unable to parse .packages file '%s'.
\n
%s
\n
"
,
packages
.
AsUTF8Unsafe
().
c_str
(),
error
.
c_str
());
packages
_
.
AsUTF8Unsafe
().
c_str
(),
error
.
c_str
());
exit
(
1
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录