Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
7f8319fd
Commit
7f8319fd
authored
Sep 19, 2015
by
James Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #30 from jamesr/download_sky_snapshot
Download sky_snapshot from the cloud
parents
670f14e0
cbc35dfa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
8 deletions
+44
-8
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+41
-4
build.dart
packages/flutter_tools/lib/src/build.dart
+3
-4
No files found.
packages/flutter_tools/lib/src/artifacts.dart
View file @
7f8319fd
...
...
@@ -8,15 +8,52 @@ import 'dart:async';
import
'dart:io'
;
enum
Artifact
{
FlutterCompiler
FlutterCompiler
,
}
class
_ArtifactStore
{
_ArtifactStore
.
_
();
Future
<
File
>
getPath
(
Artifact
artifact
)
async
{
// TODO(abarth): Download artifacts from cloud storage.
return
new
File
(
''
);
Future
_downloadFile
(
String
url
,
File
file
)
async
{
HttpClient
httpClient
=
new
HttpClient
();
HttpClientRequest
request
=
await
httpClient
.
getUrl
(
Uri
.
parse
(
url
));
HttpClientResponse
response
=
await
request
.
close
();
if
(
response
.
statusCode
!=
200
)
throw
new
Exception
(
response
.
reasonPhrase
);
IOSink
sink
=
file
.
openWrite
();
await
sink
.
addStream
(
response
);
await
sink
.
close
();
}
Future
<
String
>
_getEngineRevision
(
String
packageRoot
)
{
return
new
File
(
packageRoot
+
'/sky_engine/REVISION'
).
readAsString
();
}
Future
<
Directory
>
_cacheDir
(
String
engineRevision
,
String
packageRoot
)
async
{
String
cacheDirPath
=
'
${packageRoot}
/sky_tools/cache/sky_engine/
${engineRevision}
/'
;
Directory
cacheDir
=
new
Directory
(
cacheDirPath
);
if
(!
await
cacheDir
.
exists
())
{
await
cacheDir
.
create
(
recursive:
true
);
}
return
cacheDir
;
}
Future
<
String
>
getPath
(
Artifact
artifact
,
String
packageRoot
)
async
{
String
engineRevision
=
await
_getEngineRevision
(
packageRoot
);
Directory
cacheDir
=
await
_cacheDir
(
engineRevision
,
packageRoot
);
if
(
artifact
==
Artifact
.
FlutterCompiler
)
{
File
skySnapshotFile
=
new
File
(
cacheDir
.
path
+
'sky_snapshot'
);
if
(!
await
skySnapshotFile
.
exists
())
{
print
(
'Downloading sky_snapshot from the cloud, one moment please...'
);
String
googleStorageUrl
=
'https://storage.googleapis.com/mojo/sky/shell/linux-x64/
${engineRevision}
/sky_snapshot'
;
await
_downloadFile
(
googleStorageUrl
,
skySnapshotFile
);
ProcessResult
result
=
await
Process
.
run
(
'chmod'
,
[
'u+x'
,
skySnapshotFile
.
path
]);
if
(
result
.
exitCode
!=
0
)
throw
new
Exception
(
result
.
stderr
);
}
return
skySnapshotFile
.
path
;
}
return
''
;
}
}
...
...
packages/flutter_tools/lib/src/build.dart
View file @
7f8319fd
...
...
@@ -105,10 +105,9 @@ Future _compileSnapshot({
String
packageRoot
,
String
snapshotPath
})
async
{
File
compiler
=
compilerPath
==
null
?
await
artifactStore
.
getPath
(
Artifact
.
FlutterCompiler
)
:
new
File
(
compilerPath
);
ProcessResult
result
=
await
Process
.
run
(
compiler
.
path
,
[
if
(
compilerPath
==
null
)
compilerPath
=
await
artifactStore
.
getPath
(
Artifact
.
FlutterCompiler
,
packageRoot
);
ProcessResult
result
=
await
Process
.
run
(
compilerPath
,
[
mainPath
,
'--package-root=
$packageRoot
'
,
'--snapshot=
$snapshotPath
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment