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
cdf7ad4d
Commit
cdf7ad4d
authored
Jan 21, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1319 from devoncarew/refactor_build_command
refactor build command into two files
parents
ecb72f97
70fb49fb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
246 additions
and
224 deletions
+246
-224
apk.dart
packages/flutter_tools/lib/src/commands/apk.dart
+3
-4
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+17
-199
list.dart
packages/flutter_tools/lib/src/commands/list.dart
+2
-2
run_mojo.dart
packages/flutter_tools/lib/src/commands/run_mojo.dart
+6
-4
start.dart
packages/flutter_tools/lib/src/commands/start.dart
+16
-15
flx.dart
packages/flutter_tools/lib/src/flx.dart
+202
-0
No files found.
packages/flutter_tools/lib/src/commands/apk.dart
View file @
cdf7ad4d
...
...
@@ -13,8 +13,8 @@ import '../base/logging.dart';
import
'../base/process.dart'
;
import
'../build_configuration.dart'
;
import
'../device.dart'
;
import
'../flx.dart'
as
flx
;
import
'../runner/flutter_command.dart'
;
import
'build.dart'
;
import
'start.dart'
;
const
String
_kDefaultAndroidManifestPath
=
'apk/AndroidManifest.xml'
;
...
...
@@ -305,10 +305,9 @@ class ApkCommand extends FlutterCommand {
String
mainPath
=
StartCommandBase
.
findMainDartFile
(
argResults
[
'target'
]);
// Build the FLX.
BuildCommand
builder
=
new
BuildCommand
();
builder
.
inheritFromParent
(
this
);
int
result
;
await
builder
.
buildInTempDir
(
await
flx
.
buildInTempDir
(
toolchain
,
mainPath:
mainPath
,
onBundleAvailable:
(
String
localBundlePath
)
{
result
=
_buildApk
(
components
,
localBundlePath
);
...
...
packages/flutter_tools/lib/src/commands/build.dart
View file @
cdf7ad4d
...
...
@@ -3,134 +3,27 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'dart:typed_data'
;
import
'package:archive/archive.dart'
;
import
'package:flx/bundle.dart'
;
import
'package:flx/signing.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logging.dart'
;
import
'../flx.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../toolchain.dart'
;
const
String
_kSnapshotKey
=
'snapshot_blob.bin'
;
const
List
<
String
>
_kDensities
=
const
[
'drawable-xxhdpi'
];
const
List
<
String
>
_kThemes
=
const
[
'white'
,
'black'
];
const
List
<
int
>
_kSizes
=
const
[
18
,
24
,
36
,
48
];
class
_Asset
{
final
String
base
;
final
String
key
;
_Asset
({
this
.
base
,
this
.
key
});
}
Iterable
<
_Asset
>
_parseAssets
(
Map
manifestDescriptor
,
String
manifestPath
)
sync
*
{
if
(
manifestDescriptor
==
null
||
!
manifestDescriptor
.
containsKey
(
'assets'
))
return
;
String
basePath
=
path
.
dirname
(
path
.
absolute
(
manifestPath
));
for
(
String
asset
in
manifestDescriptor
[
'assets'
])
yield
new
_Asset
(
base:
basePath
,
key:
asset
);
}
class
_MaterialAsset
{
final
String
name
;
final
String
density
;
final
String
theme
;
final
int
size
;
_MaterialAsset
(
Map
descriptor
)
:
name
=
descriptor
[
'name'
],
density
=
descriptor
[
'density'
],
theme
=
descriptor
[
'theme'
],
size
=
descriptor
[
'size'
];
String
get
key
{
List
<
String
>
parts
=
name
.
split
(
'/'
);
String
category
=
parts
[
0
];
String
subtype
=
parts
[
1
];
return
'
$category
/
$density
/ic_
${subtype}
_
${theme}
_
${size}
dp.png'
;
}
}
List
_generateValues
(
Map
assetDescriptor
,
String
key
,
List
defaults
)
{
if
(
assetDescriptor
.
containsKey
(
key
))
return
[
assetDescriptor
[
key
]];
return
defaults
;
}
Iterable
<
_MaterialAsset
>
_generateMaterialAssets
(
Map
assetDescriptor
)
sync
*
{
Map
currentAssetDescriptor
=
new
Map
.
from
(
assetDescriptor
);
for
(
String
density
in
_generateValues
(
assetDescriptor
,
'density'
,
_kDensities
))
{
currentAssetDescriptor
[
'density'
]
=
density
;
for
(
String
theme
in
_generateValues
(
assetDescriptor
,
'theme'
,
_kThemes
))
{
currentAssetDescriptor
[
'theme'
]
=
theme
;
for
(
int
size
in
_generateValues
(
assetDescriptor
,
'size'
,
_kSizes
))
{
currentAssetDescriptor
[
'size'
]
=
size
;
yield
new
_MaterialAsset
(
currentAssetDescriptor
);
}
}
}
}
Iterable
<
_MaterialAsset
>
_parseMaterialAssets
(
Map
manifestDescriptor
)
sync
*
{
if
(
manifestDescriptor
==
null
||
!
manifestDescriptor
.
containsKey
(
'material-design-icons'
))
return
;
for
(
Map
assetDescriptor
in
manifestDescriptor
[
'material-design-icons'
])
{
for
(
_MaterialAsset
asset
in
_generateMaterialAssets
(
assetDescriptor
))
{
yield
asset
;
}
}
}
dynamic
_loadManifest
(
String
manifestPath
)
{
if
(
manifestPath
==
null
||
!
FileSystemEntity
.
isFileSync
(
manifestPath
))
return
null
;
String
manifestDescriptor
=
new
File
(
manifestPath
).
readAsStringSync
();
return
loadYaml
(
manifestDescriptor
);
}
ArchiveFile
_createFile
(
String
key
,
String
assetBase
)
{
File
file
=
new
File
(
'
$assetBase
/
$key
'
);
if
(!
file
.
existsSync
())
return
null
;
List
<
int
>
content
=
file
.
readAsBytesSync
();
return
new
ArchiveFile
.
noCompress
(
key
,
content
.
length
,
content
);
}
ArchiveFile
_createSnapshotFile
(
String
snapshotPath
)
{
File
file
=
new
File
(
snapshotPath
);
List
<
int
>
content
=
file
.
readAsBytesSync
();
return
new
ArchiveFile
(
_kSnapshotKey
,
content
.
length
,
content
);
}
const
String
_kDefaultAssetBase
=
'packages/material_design_icons/icons'
;
const
String
_kDefaultMainPath
=
'lib/main.dart'
;
const
String
_kDefaultManifestPath
=
'flutter.yaml'
;
const
String
_kDefaultOutputPath
=
'build/app.flx'
;
const
String
_kDefaultSnapshotPath
=
'build/snapshot_blob.bin'
;
const
String
_kDefaultPrivateKeyPath
=
'privatekey.der'
;
class
BuildCommand
extends
FlutterCommand
{
final
String
name
=
'build'
;
final
String
description
=
'Packages your Flutter app into an FLX.'
;
BuildCommand
()
{
argParser
.
addFlag
(
'precompiled'
,
negatable:
false
);
argParser
.
addOption
(
'asset-base'
,
defaultsTo:
_kD
efaultAssetBase
);
argParser
.
addOption
(
'asset-base'
,
defaultsTo:
d
efaultAssetBase
);
argParser
.
addOption
(
'compiler'
);
argParser
.
addOption
(
'main'
,
defaultsTo:
_kD
efaultMainPath
);
argParser
.
addOption
(
'manifest'
,
defaultsTo:
_kD
efaultManifestPath
);
argParser
.
addOption
(
'private-key'
,
defaultsTo:
_kD
efaultPrivateKeyPath
);
argParser
.
addOption
(
'output-file'
,
abbr:
'o'
,
defaultsTo:
_kDefault
OutputPath
);
argParser
.
addOption
(
'snapshot'
,
defaultsTo:
_kD
efaultSnapshotPath
);
argParser
.
addOption
(
'main'
,
defaultsTo:
d
efaultMainPath
);
argParser
.
addOption
(
'manifest'
,
defaultsTo:
d
efaultManifestPath
);
argParser
.
addOption
(
'private-key'
,
defaultsTo:
d
efaultPrivateKeyPath
);
argParser
.
addOption
(
'output-file'
,
abbr:
'o'
,
defaultsTo:
defaultFlx
OutputPath
);
argParser
.
addOption
(
'snapshot'
,
defaultsTo:
d
efaultSnapshotPath
);
}
@override
Future
<
int
>
runInProject
()
async
{
String
compilerPath
=
argResults
[
'compiler'
];
...
...
@@ -139,98 +32,23 @@ class BuildCommand extends FlutterCommand {
else
toolchain
=
new
Toolchain
(
compiler:
new
Compiler
(
compilerPath
));
String
outputPath
=
argResults
[
'output-file'
];
return
await
build
(
toolchain
,
assetBase:
argResults
[
'asset-base'
],
mainPath:
argResults
[
'main'
],
manifestPath:
argResults
[
'manifest'
],
outputPath:
argResults
[
'output-file'
]
,
outputPath:
outputPath
,
snapshotPath:
argResults
[
'snapshot'
],
privateKeyPath:
argResults
[
'private-key'
],
precompiledSnapshot:
argResults
[
'precompiled'
]
);
}
Future
<
int
>
buildInTempDir
({
String
mainPath:
_kDefaultMainPath
,
void
onBundleAvailable
(
String
bundlePath
)
})
async
{
int
result
;
Directory
tempDir
=
await
Directory
.
systemTemp
.
createTemp
(
'flutter_tools'
);
try
{
String
localBundlePath
=
path
.
join
(
tempDir
.
path
,
'app.flx'
);
String
localSnapshotPath
=
path
.
join
(
tempDir
.
path
,
'snapshot_blob.bin'
);
result
=
await
build
(
snapshotPath:
localSnapshotPath
,
outputPath:
localBundlePath
,
mainPath:
mainPath
);
).
then
((
int
result
)
{
if
(
result
==
0
)
onBundleAvailable
(
localBundlePath
);
}
finally
{
tempDir
.
deleteSync
(
recursive:
true
);
}
return
result
;
}
Future
<
int
>
build
({
String
assetBase:
_kDefaultAssetBase
,
String
mainPath:
_kDefaultMainPath
,
String
manifestPath:
_kDefaultManifestPath
,
String
outputPath:
_kDefaultOutputPath
,
String
snapshotPath:
_kDefaultSnapshotPath
,
String
privateKeyPath:
_kDefaultPrivateKeyPath
,
bool
precompiledSnapshot:
false
})
async
{
logging
.
fine
(
'Building
$outputPath
'
);
Map
manifestDescriptor
=
_loadManifest
(
manifestPath
);
Iterable
<
_Asset
>
assets
=
_parseAssets
(
manifestDescriptor
,
manifestPath
);
Iterable
<
_MaterialAsset
>
materialAssets
=
_parseMaterialAssets
(
manifestDescriptor
);
Archive
archive
=
new
Archive
();
if
(!
precompiledSnapshot
)
{
ensureDirectoryExists
(
snapshotPath
);
// In a precompiled snapshot, the instruction buffer contains script
// content equivalents
int
result
=
await
toolchain
.
compiler
.
compile
(
mainPath:
mainPath
,
snapshotPath:
snapshotPath
);
if
(
result
!=
0
)
{
logging
.
severe
(
'Failed to run the Flutter compiler. Exit code:
$result
'
);
return
result
;
}
archive
.
addFile
(
_createSnapshotFile
(
snapshotPath
));
}
for
(
_Asset
asset
in
assets
)
{
ArchiveFile
file
=
_createFile
(
asset
.
key
,
asset
.
base
);
if
(
file
==
null
)
{
stderr
.
writeln
(
'Cannot find asset "
${asset.key}
" in directory "
${path.absolute(asset.base)}
".'
);
return
1
;
}
archive
.
addFile
(
file
);
}
for
(
_MaterialAsset
asset
in
materialAssets
)
{
ArchiveFile
file
=
_createFile
(
asset
.
key
,
assetBase
);
if
(
file
!=
null
)
archive
.
addFile
(
file
);
}
await
CipherParameters
.
get
().
seedRandom
();
AsymmetricKeyPair
keyPair
=
keyPairFromPrivateKeyFileSync
(
privateKeyPath
);
Uint8List
zipBytes
=
new
Uint8List
.
fromList
(
new
ZipEncoder
().
encode
(
archive
));
ensureDirectoryExists
(
outputPath
);
Bundle
bundle
=
new
Bundle
.
fromContent
(
path:
outputPath
,
manifest:
manifestDescriptor
,
contentBytes:
zipBytes
,
keyPair:
keyPair
);
bundle
.
writeSync
();
return
0
;
print
(
'Built
$outputPath
.'
);
else
logging
.
severe
(
'Error building
$outputPath
:
$result
.'
);
return
result
;
});
}
}
packages/flutter_tools/lib/src/commands/list.dart
View file @
cdf7ad4d
...
...
@@ -49,9 +49,9 @@ class ListCommand extends FlutterCommand {
}
}
if
(
details
)
{
if
(
details
)
print
(
'iOS Simulators:'
);
}
for
(
IOSSimulator
device
in
IOSSimulator
.
getAttachedDevices
(
devices
.
iOSSimulator
))
{
if
(
details
)
{
print
(
'
${device.id}
\t
${device.name}
'
);
...
...
packages/flutter_tools/lib/src/commands/run_mojo.dart
View file @
cdf7ad4d
...
...
@@ -12,8 +12,8 @@ import '../artifacts.dart';
import
'../base/logging.dart'
;
import
'../base/process.dart'
;
import
'../build_configuration.dart'
;
import
'../flx.dart'
as
flx
;
import
'../runner/flutter_command.dart'
;
import
'build.dart'
;
import
'start.dart'
;
const
String
_kDefaultBundlePath
=
'build/app.flx'
;
...
...
@@ -156,9 +156,11 @@ class RunMojoCommand extends FlutterCommand {
String
mainPath
=
StartCommandBase
.
findMainDartFile
(
argResults
[
'target'
]);
BuildCommand
builder
=
new
BuildCommand
();
builder
.
inheritFromParent
(
this
);
int
result
=
await
builder
.
build
(
mainPath:
mainPath
,
outputPath:
bundlePath
);
int
result
=
await
flx
.
build
(
toolchain
,
mainPath:
mainPath
,
outputPath:
bundlePath
);
if
(
result
!=
0
)
return
result
;
}
...
...
packages/flutter_tools/lib/src/commands/start.dart
View file @
cdf7ad4d
...
...
@@ -11,8 +11,8 @@ import '../application_package.dart';
import
'../base/logging.dart'
;
import
'../build_configuration.dart'
;
import
'../device.dart'
;
import
'../flx.dart'
as
flx
;
import
'../runner/flutter_command.dart'
;
import
'build.dart'
;
import
'install.dart'
;
import
'stop.dart'
;
...
...
@@ -87,21 +87,22 @@ abstract class StartCommandBase extends FlutterCommand {
logging
.
fine
(
'Running build command for
$device
.'
);
if
(
device
.
platform
==
TargetPlatform
.
android
)
{
BuildCommand
builder
=
new
BuildCommand
();
builder
.
inheritFromParent
(
this
);
await
builder
.
buildInTempDir
(
mainPath:
mainPath
,
onBundleAvailable:
(
String
localBundlePath
)
{
logging
.
fine
(
'Starting bundle for
$device
.'
);
final
AndroidDevice
androidDevice
=
device
;
// https://github.com/flutter/flutter/issues/1035
if
(
androidDevice
.
startBundle
(
package
,
localBundlePath
,
poke:
poke
,
checked:
argResults
[
'checked
'
],
traceStartup:
argResults
[
'trace-startup
'
],
route:
argResults
[
'route'
],
clearLogs:
clearLogs
))
startedSomething
=
true
;
await
flx
.
buildInTempDir
(
toolchain
,
mainPath:
mainPath
,
onBundleAvailable:
(
String
localBundlePath
)
{
logging
.
fine
(
'Starting bundle for
$device
.'
);
final
AndroidDevice
androidDevice
=
device
;
// https://github.com/flutter/flutter/issues/1035
if
(
androidDevice
.
startBundle
(
package
,
localBundlePath
,
poke:
poke
,
checked:
argResults
[
'checked'
]
,
traceStartup:
argResults
[
'trace-startup
'
],
route:
argResults
[
'route
'
],
clearLogs:
clearLogs
))
{
startedSomething
=
true
;
}
}
);
}
else
{
bool
result
=
await
device
.
startApp
(
package
);
...
...
packages/flutter_tools/lib/src/flx.dart
0 → 100644
View file @
cdf7ad4d
// 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
'dart:async'
;
import
'dart:io'
;
import
'dart:typed_data'
;
import
'package:archive/archive.dart'
;
import
'package:flx/bundle.dart'
;
import
'package:flx/signing.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'base/file_system.dart'
;
import
'base/logging.dart'
;
import
'toolchain.dart'
;
const
String
defaultMainPath
=
'lib/main.dart'
;
const
String
defaultAssetBase
=
'packages/material_design_icons/icons'
;
const
String
defaultManifestPath
=
'flutter.yaml'
;
const
String
defaultFlxOutputPath
=
'build/app.flx'
;
const
String
defaultSnapshotPath
=
'build/snapshot_blob.bin'
;
const
String
defaultPrivateKeyPath
=
'privatekey.der'
;
const
String
_kSnapshotKey
=
'snapshot_blob.bin'
;
const
List
<
String
>
_kDensities
=
const
[
'drawable-xxhdpi'
];
const
List
<
String
>
_kThemes
=
const
[
'white'
,
'black'
];
const
List
<
int
>
_kSizes
=
const
[
18
,
24
,
36
,
48
];
class
_Asset
{
final
String
base
;
final
String
key
;
_Asset
({
this
.
base
,
this
.
key
});
}
Iterable
<
_Asset
>
_parseAssets
(
Map
manifestDescriptor
,
String
manifestPath
)
sync
*
{
if
(
manifestDescriptor
==
null
||
!
manifestDescriptor
.
containsKey
(
'assets'
))
return
;
String
basePath
=
path
.
dirname
(
path
.
absolute
(
manifestPath
));
for
(
String
asset
in
manifestDescriptor
[
'assets'
])
yield
new
_Asset
(
base:
basePath
,
key:
asset
);
}
class
_MaterialAsset
{
final
String
name
;
final
String
density
;
final
String
theme
;
final
int
size
;
_MaterialAsset
(
Map
descriptor
)
:
name
=
descriptor
[
'name'
],
density
=
descriptor
[
'density'
],
theme
=
descriptor
[
'theme'
],
size
=
descriptor
[
'size'
];
String
get
key
{
List
<
String
>
parts
=
name
.
split
(
'/'
);
String
category
=
parts
[
0
];
String
subtype
=
parts
[
1
];
return
'
$category
/
$density
/ic_
${subtype}
_
${theme}
_
${size}
dp.png'
;
}
}
List
_generateValues
(
Map
assetDescriptor
,
String
key
,
List
defaults
)
{
if
(
assetDescriptor
.
containsKey
(
key
))
return
[
assetDescriptor
[
key
]];
return
defaults
;
}
Iterable
<
_MaterialAsset
>
_generateMaterialAssets
(
Map
assetDescriptor
)
sync
*
{
Map
currentAssetDescriptor
=
new
Map
.
from
(
assetDescriptor
);
for
(
String
density
in
_generateValues
(
assetDescriptor
,
'density'
,
_kDensities
))
{
currentAssetDescriptor
[
'density'
]
=
density
;
for
(
String
theme
in
_generateValues
(
assetDescriptor
,
'theme'
,
_kThemes
))
{
currentAssetDescriptor
[
'theme'
]
=
theme
;
for
(
int
size
in
_generateValues
(
assetDescriptor
,
'size'
,
_kSizes
))
{
currentAssetDescriptor
[
'size'
]
=
size
;
yield
new
_MaterialAsset
(
currentAssetDescriptor
);
}
}
}
}
Iterable
<
_MaterialAsset
>
_parseMaterialAssets
(
Map
manifestDescriptor
)
sync
*
{
if
(
manifestDescriptor
==
null
||
!
manifestDescriptor
.
containsKey
(
'material-design-icons'
))
return
;
for
(
Map
assetDescriptor
in
manifestDescriptor
[
'material-design-icons'
])
{
for
(
_MaterialAsset
asset
in
_generateMaterialAssets
(
assetDescriptor
))
{
yield
asset
;
}
}
}
dynamic
_loadManifest
(
String
manifestPath
)
{
if
(
manifestPath
==
null
||
!
FileSystemEntity
.
isFileSync
(
manifestPath
))
return
null
;
String
manifestDescriptor
=
new
File
(
manifestPath
).
readAsStringSync
();
return
loadYaml
(
manifestDescriptor
);
}
ArchiveFile
_createFile
(
String
key
,
String
assetBase
)
{
File
file
=
new
File
(
'
$assetBase
/
$key
'
);
if
(!
file
.
existsSync
())
return
null
;
List
<
int
>
content
=
file
.
readAsBytesSync
();
return
new
ArchiveFile
.
noCompress
(
key
,
content
.
length
,
content
);
}
ArchiveFile
_createSnapshotFile
(
String
snapshotPath
)
{
File
file
=
new
File
(
snapshotPath
);
List
<
int
>
content
=
file
.
readAsBytesSync
();
return
new
ArchiveFile
(
_kSnapshotKey
,
content
.
length
,
content
);
}
Future
<
int
>
buildInTempDir
(
Toolchain
toolchain
,
{
String
mainPath:
defaultMainPath
,
void
onBundleAvailable
(
String
bundlePath
)
})
async
{
int
result
;
Directory
tempDir
=
await
Directory
.
systemTemp
.
createTemp
(
'flutter_tools'
);
try
{
String
localBundlePath
=
path
.
join
(
tempDir
.
path
,
'app.flx'
);
String
localSnapshotPath
=
path
.
join
(
tempDir
.
path
,
'snapshot_blob.bin'
);
result
=
await
build
(
toolchain
,
snapshotPath:
localSnapshotPath
,
outputPath:
localBundlePath
,
mainPath:
mainPath
);
if
(
result
==
0
)
onBundleAvailable
(
localBundlePath
);
}
finally
{
tempDir
.
deleteSync
(
recursive:
true
);
}
return
result
;
}
Future
<
int
>
build
(
Toolchain
toolchain
,
{
String
assetBase:
defaultAssetBase
,
String
mainPath:
defaultMainPath
,
String
manifestPath:
defaultManifestPath
,
String
outputPath:
defaultFlxOutputPath
,
String
snapshotPath:
defaultSnapshotPath
,
String
privateKeyPath:
defaultPrivateKeyPath
,
bool
precompiledSnapshot:
false
})
async
{
logging
.
fine
(
'Building
$outputPath
'
);
Map
manifestDescriptor
=
_loadManifest
(
manifestPath
);
Iterable
<
_Asset
>
assets
=
_parseAssets
(
manifestDescriptor
,
manifestPath
);
Iterable
<
_MaterialAsset
>
materialAssets
=
_parseMaterialAssets
(
manifestDescriptor
);
Archive
archive
=
new
Archive
();
if
(!
precompiledSnapshot
)
{
ensureDirectoryExists
(
snapshotPath
);
// In a precompiled snapshot, the instruction buffer contains script
// content equivalents
int
result
=
await
toolchain
.
compiler
.
compile
(
mainPath:
mainPath
,
snapshotPath:
snapshotPath
);
if
(
result
!=
0
)
{
logging
.
severe
(
'Failed to run the Flutter compiler. Exit code:
$result
'
);
return
result
;
}
archive
.
addFile
(
_createSnapshotFile
(
snapshotPath
));
}
for
(
_Asset
asset
in
assets
)
{
ArchiveFile
file
=
_createFile
(
asset
.
key
,
asset
.
base
);
if
(
file
==
null
)
{
stderr
.
writeln
(
'Cannot find asset "
${asset.key}
" in directory "
${path.absolute(asset.base)}
".'
);
return
1
;
}
archive
.
addFile
(
file
);
}
for
(
_MaterialAsset
asset
in
materialAssets
)
{
ArchiveFile
file
=
_createFile
(
asset
.
key
,
assetBase
);
if
(
file
!=
null
)
archive
.
addFile
(
file
);
}
await
CipherParameters
.
get
().
seedRandom
();
AsymmetricKeyPair
keyPair
=
keyPairFromPrivateKeyFileSync
(
privateKeyPath
);
Uint8List
zipBytes
=
new
Uint8List
.
fromList
(
new
ZipEncoder
().
encode
(
archive
));
ensureDirectoryExists
(
outputPath
);
Bundle
bundle
=
new
Bundle
.
fromContent
(
path:
outputPath
,
manifest:
manifestDescriptor
,
contentBytes:
zipBytes
,
keyPair:
keyPair
);
bundle
.
writeSync
();
return
0
;
}
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