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
d356b2d7
Commit
d356b2d7
authored
Mar 23, 2017
by
P.Y. Laligand
Committed by
GitHub
Mar 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate a depfile for assets of a flutter_app. (#8961)
parent
38e4e48d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
7 deletions
+47
-7
fuchsia_builder.dart
packages/flutter_tools/bin/fuchsia_builder.dart
+33
-5
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+6
-0
flx.dart
packages/flutter_tools/lib/src/flx.dart
+8
-2
No files found.
packages/flutter_tools/bin/fuchsia_builder.dart
View file @
d356b2d7
...
...
@@ -25,13 +25,17 @@ const String _kOptionOutput = 'output-file';
const
String
_kOptionHeader
=
'header'
;
const
String
_kOptionSnapshot
=
'snapshot'
;
const
String
_kOptionWorking
=
'working-dir'
;
const
String
_kOptionsManifest
=
'manifest'
;
const
String
_kOptionManifest
=
'manifest'
;
const
String
_kOptionDepFile
=
'depfile'
;
const
String
_kOptionBuildRoot
=
'build-root'
;
const
List
<
String
>
_kRequiredOptions
=
const
<
String
>[
_kOptionPackages
,
_kOptionOutput
,
_kOptionHeader
,
_kOptionSnapshot
,
_kOptionWorking
,
_kOptionDepFile
,
_kOptionBuildRoot
,
];
Future
<
Null
>
main
(
List
<
String
>
args
)
async
{
...
...
@@ -59,23 +63,36 @@ Future<Null> run(List<String> args) async {
..
addOption
(
_kOptionSnapshot
,
help:
'The generated snapshot file'
)
..
addOption
(
_kOptionWorking
,
help:
'The directory where to put temporary files'
)
..
addOption
(
_kOptionsManifest
,
help:
'The manifest file'
);
..
addOption
(
_kOptionManifest
,
help:
'The manifest file'
)
..
addOption
(
_kOptionDepFile
,
help:
'The generated depfile'
)
..
addOption
(
_kOptionBuildRoot
,
help:
'The build
\'
s root directory'
);
final
ArgResults
argResults
=
parser
.
parse
(
args
);
if
(
_kRequiredOptions
.
any
((
String
option
)
=>
!
argResults
.
options
.
contains
(
option
)))
{
if
(
_kRequiredOptions
.
any
((
String
option
)
=>
!
argResults
.
options
.
contains
(
option
)))
{
printError
(
'Missing option! All options must be specified.'
);
exit
(
1
);
}
Cache
.
flutterRoot
=
platform
.
environment
[
'FLUTTER_ROOT'
];
final
String
outputPath
=
argResults
[
_kOptionOutput
];
try
{
await
assemble
(
final
List
<
String
>
dependencies
=
await
assemble
(
outputPath:
outputPath
,
snapshotFile:
fs
.
file
(
argResults
[
_kOptionSnapshot
]),
workingDirPath:
argResults
[
_kOptionWorking
],
packagesPath:
argResults
[
_kOptionPackages
],
manifestPath:
argResults
[
_kOption
s
Manifest
]
??
defaultManifestPath
,
manifestPath:
argResults
[
_kOptionManifest
]
??
defaultManifestPath
,
includeDefaultFonts:
false
,
);
final
String
depFilePath
=
argResults
[
_kOptionDepFile
];
final
int
depFileResult
=
_createDepfile
(
depFilePath
,
fs
.
path
.
relative
(
argResults
[
_kOptionOutput
],
from:
argResults
[
_kOptionBuildRoot
]),
dependencies
);
if
(
depFileResult
!=
0
)
{
printError
(
'Error creating depfile
$depFilePath
:
$depFileResult
.'
);
exit
(
depFileResult
);
}
}
on
ToolExit
catch
(
e
)
{
printError
(
e
.
message
);
exit
(
e
.
exitCode
);
...
...
@@ -87,6 +104,17 @@ Future<Null> run(List<String> args) async {
exit
(
headerResult
);
}
int
_createDepfile
(
String
depFilePath
,
String
target
,
List
<
String
>
dependencies
)
{
try
{
final
File
depFile
=
fs
.
file
(
depFilePath
);
depFile
.
writeAsStringSync
(
'
$target
:
${dependencies.join(' ')}
\n
'
);
return
0
;
}
catch
(
_
)
{
return
1
;
}
}
int
_addHeader
(
String
outputPath
,
String
header
)
{
try
{
final
File
outputFile
=
fs
.
file
(
outputPath
);
...
...
packages/flutter_tools/lib/src/devfs.dart
View file @
d356b2d7
...
...
@@ -42,6 +42,9 @@ abstract class DevFSContent {
Stream
<
List
<
int
>>
contentsAsCompressedStream
()
{
return
contentsAsStream
().
transform
(
GZIP
.
encoder
);
}
/// Return the list of files this content depends on.
List
<
String
>
get
fileDependencies
=>
<
String
>[];
}
// File content to be copied to the device.
...
...
@@ -82,6 +85,9 @@ class DevFSFileContent extends DevFSContent {
}
}
@override
List
<
String
>
get
fileDependencies
=>
<
String
>[
_getFile
().
path
];
@override
bool
get
isModified
{
final
FileStat
_oldFileStat
=
_fileStat
;
...
...
packages/flutter_tools/lib/src/flx.dart
View file @
d356b2d7
...
...
@@ -107,10 +107,10 @@ Future<Null> build({
packagesPath:
packagesPath
,
includeRobotoFonts:
includeRobotoFonts
,
reportLicensedPackages:
reportLicensedPackages
);
)
.
then
((
_
)
=>
null
)
;
}
Future
<
Null
>
assemble
({
Future
<
List
<
String
>
>
assemble
({
String
manifestPath
,
DevFSContent
kernelContent
,
File
snapshotFile
,
...
...
@@ -145,6 +145,10 @@ Future<Null> assemble({
// Add all entries from the asset bundle.
zipBuilder
.
entries
.
addAll
(
assetBundle
.
entries
);
final
List
<
String
>
fileDependencies
=
assetBundle
.
entries
.
values
.
expand
((
DevFSContent
content
)
=>
content
.
fileDependencies
)
.
toList
();
if
(
kernelContent
!=
null
)
zipBuilder
.
entries
[
_kKernelKey
]
=
kernelContent
;
if
(
snapshotFile
!=
null
)
...
...
@@ -156,4 +160,6 @@ Future<Null> assemble({
await
zipBuilder
.
createZip
(
fs
.
file
(
outputPath
),
fs
.
directory
(
workingDirPath
));
printTrace
(
'Built
$outputPath
.'
);
return
fileDependencies
;
}
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