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
02169536
Unverified
Commit
02169536
authored
Nov 21, 2019
by
Zachary Anderson
Committed by
GitHub
Nov 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[flutter_tool] Fuchsia AOT builds (#45187)" (#45349)
This reverts commit
a57dddd2
.
parent
1f3ff5ca
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
130 additions
and
264 deletions
+130
-264
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+19
-22
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+2
-11
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+1
-1
build_fuchsia.dart
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
+0
-6
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+12
-1
build_linux.dart
packages/flutter_tools/lib/src/commands/build_linux.dart
+12
-1
build_windows.dart
packages/flutter_tools/lib/src/commands/build_windows.dart
+12
-1
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-1
fuchsia_build.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_build.dart
+5
-87
fuchsia_dev_finder.dart
...ges/flutter_tools/lib/src/fuchsia/fuchsia_dev_finder.dart
+4
-6
fuchsia_device.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+17
-40
fuchsia_kernel_compiler.dart
...lutter_tools/lib/src/fuchsia/fuchsia_kernel_compiler.dart
+37
-22
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+2
-17
fuchsia_device_test.dart
...tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+6
-48
No files found.
packages/flutter_tools/lib/src/artifacts.dart
View file @
02169536
...
...
@@ -61,7 +61,7 @@ enum Artifact {
// Fuchsia artifacts from the engine prebuilts.
fuchsiaKernelCompiler
,
fuchsiaFlutterRunner
,
fuchsiaFlutter
Jit
Runner
,
}
String
_artifactToFileName
(
Artifact
artifact
,
[
TargetPlatform
platform
,
BuildMode
mode
])
{
...
...
@@ -136,10 +136,11 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
return
'flutter_ddc_sdk.dill'
;
case
Artifact
.
fuchsiaKernelCompiler
:
return
'kernel_compiler.snapshot'
;
case
Artifact
.
fuchsiaFlutterRunner
:
final
String
jitOrAot
=
mode
.
isJit
?
'_jit'
:
'_aot'
;
final
String
productOrNo
=
mode
.
isRelease
?
'_product'
:
''
;
return
'flutter
$jitOrAot${productOrNo}
_runner-0.far'
;
case
Artifact
.
fuchsiaFlutterJitRunner
:
if
(
mode
==
BuildMode
.
debug
||
mode
==
BuildMode
.
profile
)
{
return
'flutter_jit_runner-0.far'
;
}
return
'flutter_jit_product_runner-0.far'
;
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
...
...
@@ -277,25 +278,21 @@ class CachedArtifacts extends Artifacts {
cache
.
getArtifactDirectory
(
'flutter_runner'
).
path
,
'flutter'
,
fuchsiaArchForTargetPlatform
(
platform
),
mode
.
isRelease
?
'release'
:
mode
.
toString
(
),
getNameForBuildMode
(
mode
),
);
final
String
runtime
=
mode
.
isJit
?
'jit'
:
'aot'
;
switch
(
artifact
)
{
case
Artifact
.
genSnapshot
:
final
String
genSnapshot
=
mode
.
isRelease
?
'gen_snapshot_product'
:
'gen_snapshot'
;
return
fs
.
path
.
join
(
root
,
runtime
,
'dart_binaries'
,
genSnapshot
);
case
Artifact
.
flutterPatchedSdkPath
:
const
String
artifactFileName
=
'flutter_runner_patched_sdk'
;
return
fs
.
path
.
join
(
root
,
runtime
,
artifactFileName
);
return
fs
.
path
.
join
(
root
,
'jit'
,
artifactFileName
);
case
Artifact
.
platformKernelDill
:
final
String
artifactFileName
=
_artifactToFileName
(
artifact
,
platform
,
mode
);
return
fs
.
path
.
join
(
root
,
runtime
,
'flutter_runner_patched_sdk'
,
artifactFileName
);
return
fs
.
path
.
join
(
root
,
'jit'
,
'flutter_runner_patched_sdk'
,
artifactFileName
);
case
Artifact
.
fuchsiaKernelCompiler
:
final
String
artifactFileName
=
_artifactToFileName
(
artifact
,
platform
,
mode
);
return
fs
.
path
.
join
(
root
,
runtime
,
'dart_binaries'
,
artifactFileName
);
case
Artifact
.
fuchsiaFlutterRunner
:
return
fs
.
path
.
join
(
root
,
'jit'
,
'dart_binaries'
,
artifactFileName
);
case
Artifact
.
fuchsiaFlutter
Jit
Runner
:
final
String
artifactFileName
=
_artifactToFileName
(
artifact
,
platform
,
mode
);
return
fs
.
path
.
join
(
root
,
runtime
,
artifactFileName
);
return
fs
.
path
.
join
(
root
,
'jit'
,
artifactFileName
);
default
:
return
_getHostArtifactPath
(
artifact
,
platform
,
mode
);
}
...
...
@@ -416,7 +413,7 @@ class LocalEngineArtifacts extends Artifacts {
@override
String
getArtifactPath
(
Artifact
artifact
,
{
TargetPlatform
platform
,
BuildMode
mode
})
{
platform
??=
_currentHostPlatform
;
final
String
artifactFileName
=
_artifactToFileName
(
artifact
,
platform
,
mode
);
final
String
artifactFileName
=
_artifactToFileName
(
artifact
,
platform
);
switch
(
artifact
)
{
case
Artifact
.
snapshotDart
:
return
fs
.
path
.
join
(
_engineSrcPath
,
'flutter'
,
'lib'
,
'snapshot'
,
artifactFileName
);
...
...
@@ -485,13 +482,13 @@ class LocalEngineArtifacts extends Artifacts {
return
fs
.
path
.
join
(
_getFlutterWebSdkPath
(),
'kernel'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
fuchsiaKernelCompiler
:
final
String
hostPlatform
=
getNameForHostPlatform
(
getCurrentHostPlatform
());
final
String
modeName
=
mode
.
isRelease
?
'release'
:
mode
.
toString
();
final
String
dartBinaries
=
'dart_binaries-
$modeName
-
$hostPlatform
'
;
final
String
dartBinaries
=
'dart_binaries-
$mode
-
$hostPlatform
'
;
return
fs
.
path
.
join
(
engineOutPath
,
'host_bundle'
,
dartBinaries
,
'kernel_compiler.dart.snapshot'
);
case
Artifact
.
fuchsiaFlutterRunner
:
final
String
jitOrAot
=
mode
.
isJit
?
'_jit'
:
'_aot'
;
final
String
productOrNo
=
mode
.
isRelease
?
'_product'
:
''
;
return
fs
.
path
.
join
(
engineOutPath
,
'flutter
$jitOrAot${productOrNo}
_runner-0.far'
);
case
Artifact
.
fuchsiaFlutterJitRunner
:
if
(
mode
==
BuildMode
.
debug
||
mode
==
BuildMode
.
profile
)
{
return
fs
.
path
.
join
(
engineOutPath
,
'flutter_jit_runner-0.far'
);
}
return
fs
.
path
.
join
(
engineOutPath
,
'flutter_jit_product_runner-0.far'
);
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
...
...
packages/flutter_tools/lib/src/build_info.dart
View file @
02169536
...
...
@@ -59,7 +59,6 @@ class BuildInfo {
static
const
BuildInfo
debug
=
BuildInfo
(
BuildMode
.
debug
,
null
);
static
const
BuildInfo
profile
=
BuildInfo
(
BuildMode
.
profile
,
null
);
static
const
BuildInfo
jitRelease
=
BuildInfo
(
BuildMode
.
jitRelease
,
null
);
static
const
BuildInfo
release
=
BuildInfo
(
BuildMode
.
release
,
null
);
/// Returns whether a debug build is requested.
...
...
@@ -69,22 +68,14 @@ class BuildInfo {
/// Returns whether a profile build is requested.
///
/// Exactly one of [isDebug], [isProfile], [isJitRelease],
/// or [isRelease] is true.
/// Exactly one of [isDebug], [isProfile], or [isRelease] is true.
bool
get
isProfile
=>
mode
==
BuildMode
.
profile
;
/// Returns whether a release build is requested.
///
/// Exactly one of [isDebug], [isProfile], [isJitRelease],
/// or [isRelease] is true.
/// Exactly one of [isDebug], [isProfile], or [isRelease] is true.
bool
get
isRelease
=>
mode
==
BuildMode
.
release
;
/// Returns whether a JIT release build is requested.
///
/// Exactly one of [isDebug], [isProfile], [isJitRelease],
/// or [isRelease] is true.
bool
get
isJitRelease
=>
mode
==
BuildMode
.
jitRelease
;
bool
get
usesAot
=>
isAotBuildMode
(
mode
);
bool
get
supportsEmulator
=>
isEmulatorBuildMode
(
mode
);
bool
get
supportsSimulator
=>
isEmulatorBuildMode
(
mode
);
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
02169536
...
...
@@ -214,7 +214,7 @@ class AttachCommand extends FlutterCommand {
if
(
module
==
null
)
{
throwToolExit
(
'
\'
--module
\'
is required for attaching to a Fuchsia device'
);
}
usesIpv6
=
await
device
.
ipv6
;
usesIpv6
=
device
.
ipv6
;
FuchsiaIsolateDiscoveryProtocol
isolateDiscoveryProtocol
;
try
{
isolateDiscoveryProtocol
=
device
.
getIsolateDiscoveryProtocol
(
module
);
...
...
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
View file @
02169536
...
...
@@ -31,11 +31,6 @@ class BuildFuchsiaCommand extends BuildSubCommand {
],
defaultsTo:
FuchsiaPackageServer
.
toolHost
,
);
argParser
.
addOption
(
'target-platform'
,
defaultsTo:
'fuchsia-x64'
,
allowed:
<
String
>[
'fuchsia-arm64'
,
'fuchsia-x64'
],
help:
'The target platform for which the app is compiled.'
,
);
}
@override
...
...
@@ -74,7 +69,6 @@ class BuildFuchsiaCommand extends BuildSubCommand {
await
buildFuchsia
(
fuchsiaProject:
flutterProject
.
fuchsia
,
target:
targetFile
,
targetPlatform:
getTargetPlatformForName
(
argResults
[
'target-platform'
]),
buildInfo:
buildInfo
,
runnerPackageSource:
stringArg
(
'runner-source'
),
);
...
...
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
02169536
...
...
@@ -19,13 +19,24 @@ import 'build.dart';
/// .ipas, see https://flutter.dev/docs/deployment/ios.
class
BuildIOSCommand
extends
BuildSubCommand
{
BuildIOSCommand
()
{
addBuildModeFlags
(
defaultToRelease:
false
);
usesTargetOption
();
usesFlavorOption
();
usesPubOption
();
usesBuildNumberOption
();
usesBuildNameOption
();
argParser
..
addFlag
(
'debug'
,
negatable:
false
,
help:
'Build a debug version of your app (default mode for iOS simulator builds).'
,
)
..
addFlag
(
'profile'
,
negatable:
false
,
help:
'Build a version of your app specialized for performance profiling.'
,
)
..
addFlag
(
'release'
,
negatable:
false
,
help:
'Build a release version of your app (default mode for device builds).'
,
)
..
addFlag
(
'simulator'
,
help:
'Build for the iOS simulator instead of the device.'
,
)
...
...
packages/flutter_tools/lib/src/commands/build_linux.dart
View file @
02169536
...
...
@@ -17,8 +17,19 @@ import 'build.dart';
/// A command to build a linux desktop target through a build shell script.
class
BuildLinuxCommand
extends
BuildSubCommand
{
BuildLinuxCommand
()
{
addBuildModeFlags
(
defaultToRelease:
false
);
usesTargetOption
();
argParser
.
addFlag
(
'debug'
,
negatable:
false
,
help:
'Build a debug version of your app.'
,
);
argParser
.
addFlag
(
'profile'
,
negatable:
false
,
help:
'Build a version of your app specialized for performance profiling.'
,
);
argParser
.
addFlag
(
'release'
,
negatable:
false
,
help:
'Build a version of your app specialized for performance profiling.'
,
);
}
@override
...
...
packages/flutter_tools/lib/src/commands/build_windows.dart
View file @
02169536
...
...
@@ -17,8 +17,19 @@ import 'build.dart';
/// A command to build a windows desktop target through a build shell script.
class
BuildWindowsCommand
extends
BuildSubCommand
{
BuildWindowsCommand
()
{
addBuildModeFlags
(
defaultToRelease:
false
);
usesTargetOption
();
argParser
.
addFlag
(
'debug'
,
negatable:
false
,
help:
'Build a debug version of your app.'
,
);
argParser
.
addFlag
(
'profile'
,
negatable:
false
,
help:
'Build a version of your app specialized for performance profiling.'
,
);
argParser
.
addFlag
(
'release'
,
negatable:
false
,
help:
'Build a version of your app specialized for performance profiling.'
,
);
}
@override
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
02169536
...
...
@@ -295,7 +295,7 @@ class RunCommand extends RunCommandBase {
DebuggingOptions
_createDebuggingOptions
()
{
final
BuildInfo
buildInfo
=
getBuildInfo
();
if
(
buildInfo
.
mode
.
isRelease
)
{
if
(
buildInfo
.
isRelease
)
{
return
DebuggingOptions
.
disabled
(
buildInfo
,
initializePlatform:
boolArg
(
'web-initialize-platform'
),
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_build.dart
View file @
02169536
...
...
@@ -6,13 +6,10 @@ import 'dart:async';
import
'package:meta/meta.dart'
;
import
'../artifacts.dart'
;
import
'../asset.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../bundle.dart'
;
...
...
@@ -40,7 +37,6 @@ Future<void> _timedBuildStep(String name, Future<void> Function() action) async
// Fuchsia package.
Future
<
void
>
buildFuchsia
({
@required
FuchsiaProject
fuchsiaProject
,
@required
TargetPlatform
targetPlatform
,
@required
String
target
,
// E.g., lib/main.dart
BuildInfo
buildInfo
=
BuildInfo
.
debug
,
String
runnerPackageSource
=
FuchsiaPackageServer
.
toolHost
,
...
...
@@ -53,66 +49,12 @@ Future<void> buildFuchsia({
await
_timedBuildStep
(
'fuchsia-kernel-compile'
,
()
=>
fuchsiaSdk
.
fuchsiaKernelCompiler
.
build
(
fuchsiaProject:
fuchsiaProject
,
target:
target
,
buildInfo:
buildInfo
));
if
(
buildInfo
.
usesAot
)
{
await
_timedBuildStep
(
'fuchsia-gen-snapshot'
,
()
=>
_genSnapshot
(
fuchsiaProject
,
target
,
buildInfo
,
targetPlatform
));
}
await
_timedBuildStep
(
'fuchsia-build-assets'
,
()
=>
_buildAssets
(
fuchsiaProject
,
target
,
buildInfo
));
await
_timedBuildStep
(
'fuchsia-build-package'
,
()
=>
_buildPackage
(
fuchsiaProject
,
target
,
buildInfo
,
runnerPackageSource
));
}
Future
<
void
>
_genSnapshot
(
FuchsiaProject
fuchsiaProject
,
String
target
,
// lib/main.dart
BuildInfo
buildInfo
,
TargetPlatform
targetPlatform
,
)
async
{
final
String
outDir
=
getFuchsiaBuildDirectory
();
final
String
appName
=
fuchsiaProject
.
project
.
manifest
.
appName
;
final
String
dilPath
=
fs
.
path
.
join
(
outDir
,
'
$appName
.dil'
);
final
String
vmSnapshotData
=
fs
.
path
.
join
(
outDir
,
'vm_data.aotsnapshot'
);
final
String
vmSnapshotInstructions
=
fs
.
path
.
join
(
outDir
,
'vm_instructions.aotsnapshot'
);
final
String
snapshotData
=
fs
.
path
.
join
(
outDir
,
'data.aotsnapshot'
);
final
String
snapshotInstructions
=
fs
.
path
.
join
(
outDir
,
'instructions.aotsnapshot'
);
final
String
genSnapshot
=
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
,
platform:
targetPlatform
,
mode:
buildInfo
.
mode
,
);
final
List
<
String
>
command
=
<
String
>[
genSnapshot
,
'--no_causal_async_stacks'
,
'--deterministic'
,
'--snapshot_kind=app-aot-blobs'
,
'--vm_snapshot_data=
$vmSnapshotData
'
,
'--vm_snapshot_instructions=
$vmSnapshotInstructions
'
,
'--isolate_snapshot_data=
$snapshotData
'
,
'--isolate_snapshot_instructions=
$snapshotInstructions
'
,
if
(
buildInfo
.
isDebug
)
'--enable-asserts'
,
dilPath
,
];
int
result
;
final
Status
status
=
logger
.
startProgress
(
'Compiling Fuchsia application to native code...'
,
timeout:
null
,
);
try
{
result
=
await
processUtils
.
stream
(
command
,
trace:
true
);
}
finally
{
status
.
cancel
();
}
if
(
result
!=
0
)
{
throwToolExit
(
'Build process failed'
);
}
}
Future
<
void
>
_buildAssets
(
FuchsiaProject
fuchsiaProject
,
String
target
,
// lib/main.dart
...
...
@@ -156,16 +98,11 @@ void _rewriteCmx(BuildMode mode, String runnerPackageSource, File src, File dst)
String
runner
;
switch
(
mode
)
{
case
BuildMode
.
debug
:
runner
=
'flutter_jit_runner'
;
break
;
case
BuildMode
.
profile
:
runner
=
'flutter_aot_runner'
;
break
;
case
BuildMode
.
jitRelease
:
runner
=
'flutter_jit_product_runner'
;
runner
=
'flutter_jit_runner'
;
break
;
case
BuildMode
.
release
:
runner
=
'flutter_
ao
t_product_runner'
;
runner
=
'flutter_
ji
t_product_runner'
;
break
;
default
:
throwToolExit
(
'Fuchsia does not support build mode "
$mode
"'
);
...
...
@@ -185,6 +122,7 @@ Future<void> _buildPackage(
final
String
outDir
=
getFuchsiaBuildDirectory
();
final
String
pkgDir
=
fs
.
path
.
join
(
outDir
,
'pkg'
);
final
String
appName
=
fuchsiaProject
.
project
.
manifest
.
appName
;
final
String
dilpmanifest
=
fs
.
path
.
join
(
outDir
,
'
$appName
.dilpmanifest'
);
final
String
pkgassets
=
fs
.
path
.
join
(
outDir
,
'
${appName}
_pkgassets'
);
final
String
packageManifest
=
fs
.
path
.
join
(
pkgDir
,
'package_manifest'
);
final
String
devKeyPath
=
fs
.
path
.
join
(
pkgDir
,
'development.key'
);
...
...
@@ -199,29 +137,9 @@ Future<void> _buildPackage(
final
File
dstCmx
=
fs
.
file
(
fs
.
path
.
join
(
outDir
,
'
$appName
.cmx'
));
_rewriteCmx
(
buildInfo
.
mode
,
runnerPackageSource
,
srcCmx
,
dstCmx
);
// Concatenate dilpmanifest and pkgassets into package_manifest.
final
File
manifestFile
=
fs
.
file
(
packageManifest
);
if
(
buildInfo
.
usesAot
)
{
final
String
vmSnapshotData
=
fs
.
path
.
join
(
outDir
,
'vm_data.aotsnapshot'
);
final
String
vmSnapshotInstructions
=
fs
.
path
.
join
(
outDir
,
'vm_instructions.aotsnapshot'
);
final
String
snapshotData
=
fs
.
path
.
join
(
outDir
,
'data.aotsnapshot'
);
final
String
snapshotInstructions
=
fs
.
path
.
join
(
outDir
,
'instructions.aotsnapshot'
);
manifestFile
.
writeAsStringSync
(
'data/
$appName
/vm_snapshot_data.bin=
$vmSnapshotData
\n
'
);
manifestFile
.
writeAsStringSync
(
'data/
$appName
/vm_snapshot_instructions.bin=
$vmSnapshotInstructions
\n
'
,
mode:
FileMode
.
append
);
manifestFile
.
writeAsStringSync
(
'data/
$appName
/isolate_snapshot_data.bin=
$snapshotData
\n
'
,
mode:
FileMode
.
append
);
manifestFile
.
writeAsStringSync
(
'data/
$appName
/isolate_snapshot_instructions.bin=
$snapshotInstructions
\n
'
,
mode:
FileMode
.
append
);
}
else
{
final
String
dilpmanifest
=
fs
.
path
.
join
(
outDir
,
'
$appName
.dilpmanifest'
);
manifestFile
.
writeAsStringSync
(
fs
.
file
(
dilpmanifest
).
readAsStringSync
());
}
manifestFile
.
writeAsStringSync
(
fs
.
file
(
dilpmanifest
).
readAsStringSync
());
manifestFile
.
writeAsStringSync
(
fs
.
file
(
pkgassets
).
readAsStringSync
(),
mode:
FileMode
.
append
);
manifestFile
.
writeAsStringSync
(
'meta/
$appName
.cmx=
${dstCmx.path}
\n
'
,
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_dev_finder.dart
View file @
02169536
...
...
@@ -40,14 +40,12 @@ class FuchsiaDevFinder {
return
result
.
stdout
.
split
(
'
\n
'
);
}
/// Returns the address of the named device.
///
/// If local is true, then gives the address by which the device reaches the
/// host.
/// Returns the host address by which the device [deviceName] should use for
/// the host.
///
/// The string [deviceName] should be the name of the device from the
/// 'list' command, e.g. 'scare-cable-skip-joy'.
Future
<
String
>
resolve
(
String
deviceName
,
{
bool
local
=
false
}
)
async
{
Future
<
String
>
resolve
(
String
deviceName
)
async
{
if
(
fuchsiaArtifacts
.
devFinder
==
null
||
!
fuchsiaArtifacts
.
devFinder
.
existsSync
())
{
throwToolExit
(
'Fuchsia dev_finder tool not found.'
);
...
...
@@ -55,7 +53,7 @@ class FuchsiaDevFinder {
final
List
<
String
>
command
=
<
String
>[
fuchsiaArtifacts
.
devFinder
.
path
,
'resolve'
,
if
(
local
)
'-local'
,
'-local'
,
'-device-limit'
,
'1'
,
deviceName
,
];
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
02169536
...
...
@@ -230,17 +230,13 @@ class FuchsiaDevice extends Device {
})
async
{
if
(!
prebuiltApplication
)
{
await
buildFuchsia
(
fuchsiaProject:
FlutterProject
.
current
().
fuchsia
,
targetPlatform:
await
targetPlatform
,
target:
mainPath
,
buildInfo:
debuggingOptions
.
buildInfo
);
}
// Stop the app if it's currently running.
await
stopApp
(
package
);
// Find out who the device thinks we are.
final
String
host
=
await
fuchsiaSdk
.
fuchsiaDevFinder
.
resolve
(
name
,
local:
true
,
);
final
String
host
=
await
fuchsiaSdk
.
fuchsiaDevFinder
.
resolve
(
name
);
if
(
host
==
null
)
{
printError
(
'Failed to resolve host for Fuchsia device'
);
return
LaunchResult
.
failed
();
...
...
@@ -305,7 +301,7 @@ class FuchsiaDevice extends Device {
// Serve the flutter_runner.
final
File
flutterRunnerArchive
=
fs
.
file
(
artifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
Artifact
.
fuchsiaFlutter
Jit
Runner
,
platform:
await
targetPlatform
,
mode:
debuggingOptions
.
buildInfo
.
mode
,
));
...
...
@@ -322,19 +318,10 @@ class FuchsiaDevice extends Device {
serverRegistered
=
true
;
// Tell the package controller to prefetch the flutter_runner.
String
flutterRunnerName
;
if
(
debuggingOptions
.
buildInfo
.
usesAot
)
{
if
(
debuggingOptions
.
buildInfo
.
mode
.
isRelease
)
{
flutterRunnerName
=
'flutter_aot_product_runner'
;
}
else
{
flutterRunnerName
=
'flutter_aot_runner'
;
}
}
else
{
if
(
debuggingOptions
.
buildInfo
.
mode
.
isRelease
)
{
flutterRunnerName
=
'flutter_jit_product_runner'
;
}
else
{
flutterRunnerName
=
'flutter_jit_runner'
;
}
String
flutterRunnerName
=
'flutter_jit_runner'
;
if
(!
debuggingOptions
.
buildInfo
.
isDebug
&&
!
debuggingOptions
.
buildInfo
.
isProfile
)
{
flutterRunnerName
=
'flutter_jit_product_runner'
;
}
if
(!
await
fuchsiaDeviceTools
.
amberCtl
.
pkgCtlResolve
(
this
,
fuchsiaPackageServer
,
flutterRunnerName
))
{
...
...
@@ -380,15 +367,14 @@ class FuchsiaDevice extends Device {
status
.
cancel
();
}
if
(
debuggingOptions
.
buildInfo
.
mode
.
isRelease
)
{
printTrace
(
'App succesfully started in a release mode.'
);
if
(
!
debuggingOptions
.
buildInfo
.
isDebug
&&
!
debuggingOptions
.
buildInfo
.
isProfile
)
{
return
LaunchResult
.
succeeded
();
}
printTrace
(
'App started in a non-release mode. Setting up vmservice connection.'
);
// In a debug or profile build, try to find the observatory uri.
final
FuchsiaIsolateDiscoveryProtocol
discovery
=
getIsolateDiscoveryProtocol
(
appName
);
getIsolateDiscoveryProtocol
(
appName
);
try
{
final
Uri
observatoryUri
=
await
discovery
.
uri
;
return
LaunchResult
.
succeeded
(
observatoryUri:
observatoryUri
);
...
...
@@ -466,9 +452,9 @@ class FuchsiaDevice extends Device {
@override
bool
get
supportsScreenshot
=>
false
;
Future
<
bool
>
get
ipv6
async
{
bool
get
ipv6
{
// Workaround for https://github.com/dart-lang/sdk/issues/29456
final
String
fragment
=
(
await
_resolvedIp
)
.
split
(
'%'
).
first
;
final
String
fragment
=
id
.
split
(
'%'
).
first
;
try
{
Uri
.
parseIPv6Address
(
fragment
);
return
true
;
...
...
@@ -482,7 +468,7 @@ class FuchsiaDevice extends Device {
const
String
findCommand
=
'find /hub -name vmservice-port'
;
final
RunResult
findResult
=
await
shell
(
findCommand
);
if
(
findResult
.
exitCode
!=
0
)
{
throwToolExit
(
"'
$findCommand
' on device
$
name
failed. stderr: '
${findResult.stderr}
'"
);
throwToolExit
(
"'
$findCommand
' on device
$
id
failed. stderr: '
${findResult.stderr}
'"
);
return
null
;
}
final
String
findOutput
=
findResult
.
stdout
;
...
...
@@ -499,7 +485,7 @@ class FuchsiaDevice extends Device {
final
String
lsCommand
=
'ls
$path
'
;
final
RunResult
lsResult
=
await
shell
(
lsCommand
);
if
(
lsResult
.
exitCode
!=
0
)
{
throwToolExit
(
"'
$lsCommand
' on device
$
name
failed"
);
throwToolExit
(
"'
$lsCommand
' on device
$
id
failed"
);
return
null
;
}
final
String
lsOutput
=
lsResult
.
stdout
;
...
...
@@ -516,15 +502,6 @@ class FuchsiaDevice extends Device {
return
ports
;
}
String
_cachedResolvedIp
;
Future
<
String
>
get
_resolvedIp
async
{
return
_cachedResolvedIp
??=
await
fuchsiaSdk
.
fuchsiaDevFinder
.
resolve
(
name
,
local:
false
,
);
}
/// Run `command` on the Fuchsia device shell.
Future
<
RunResult
>
shell
(
String
command
)
async
{
if
(
fuchsiaArtifacts
.
sshConfig
==
null
)
{
...
...
@@ -535,7 +512,7 @@ class FuchsiaDevice extends Device {
'ssh'
,
'-F'
,
fuchsiaArtifacts
.
sshConfig
.
absolute
.
path
,
await
_resolvedIp
,
id
,
command
,
]);
}
...
...
@@ -656,7 +633,7 @@ class FuchsiaIsolateDiscoveryProtocol {
}
final
Uri
address
=
flutterView
.
owner
.
vmService
.
httpAddress
;
if
(
flutterView
.
uiIsolate
.
name
.
contains
(
_isolateName
))
{
_foundUri
.
complete
(
await
_device
.
ipv6
_foundUri
.
complete
(
_device
.
ipv6
?
Uri
.
parse
(
'http://[
$_ipv6Loopback
]:
${address.port}
/'
)
:
Uri
.
parse
(
'http://
$_ipv4Loopback
:
${address.port}
/'
));
_status
.
stop
();
...
...
@@ -697,7 +674,7 @@ class _FuchsiaPortForwarder extends DevicePortForwarder {
'-f'
,
'-L'
,
'
$hostPort
:
$_ipv4Loopback
:
$devicePort
'
,
await
device
.
_resolvedIp
,
device
.
id
,
'true'
,
];
final
Process
process
=
await
processManager
.
start
(
command
);
...
...
@@ -729,7 +706,7 @@ class _FuchsiaPortForwarder extends DevicePortForwarder {
'-vvv'
,
'-L'
,
'
${forwardedPort.hostPort}
:
$_ipv4Loopback
:
${forwardedPort.devicePort}
'
,
await
device
.
_resolvedIp
,
device
.
id
,
];
final
ProcessResult
result
=
await
processManager
.
run
(
command
);
if
(
result
.
exitCode
!=
0
)
{
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_kernel_compiler.dart
View file @
02169536
...
...
@@ -7,9 +7,11 @@ import 'package:meta/meta.dart';
import
'../artifacts.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../build_info.dart'
;
import
'../convert.dart'
;
import
'../globals.dart'
;
import
'../project.dart'
;
...
...
@@ -56,31 +58,35 @@ class FuchsiaKernelCompiler {
'--filesystem-root'
,
fsRoot
,
'--packages'
,
'
$multiRootScheme
:///
$relativePackagesFile
'
,
'--output'
,
fs
.
path
.
join
(
outDir
,
'
$appName
.dil'
),
// TODO(zra): Add back when this is supported again.
// See: https://github.com/flutter/flutter/issues/44925
// '--no-link-platform',
'--split-output-by-packages'
,
'--manifest'
,
manifestPath
,
'--component-name'
,
appName
,
];
// AOT/JIT:
if
(
buildInfo
.
usesAot
)
...<
String
>[
'--aot'
,
'--tfa'
]
else
...<
String
>[
// TODO(zra): Add back when this is supported again.
// See: https://github.com/flutter/flutter/issues/44925
// '--no-link-platform',
'--split-output-by-packages'
,
'--manifest'
,
manifestPath
],
// debug, profile, jit release, release:
if
(
buildInfo
.
isDebug
)
'--embed-sources'
else
'--no-embed-sources'
,
if
(
buildInfo
.
isProfile
)
'-Ddart.vm.profile=true'
,
if
(
buildInfo
.
mode
.
isRelease
)
'-Ddart.vm.release=true'
,
// Use bytecode and drop the ast in JIT release mode.
if
(
buildInfo
.
isJitRelease
)
...<
String
>[
if
(
buildInfo
.
isDebug
)
{
flags
+=
<
String
>[
'--embed-sources'
,
];
}
else
if
(
buildInfo
.
isProfile
)
{
flags
+=
<
String
>[
'--no-embed-sources'
,
'-Ddart.vm.profile=true'
,
'--gen-bytecode'
,
'--drop-ast'
,
],
];
];
}
else
if
(
buildInfo
.
isRelease
)
{
flags
+=
<
String
>[
'--no-embed-sources'
,
'-Ddart.vm.release=true'
,
'--gen-bytecode'
,
'--drop-ast'
,
];
}
else
{
throwToolExit
(
'Expected build type to be debug, profile, or release'
);
}
flags
+=
<
String
>[
'
$multiRootScheme
:///
$target
'
,
...
...
@@ -91,13 +97,22 @@ class FuchsiaKernelCompiler {
kernelCompiler
,
...
flags
,
];
final
Process
process
=
await
processUtils
.
start
(
command
);
final
Status
status
=
logger
.
startProgress
(
'Building Fuchsia application...'
,
timeout:
null
,
);
int
result
;
try
{
result
=
await
processUtils
.
stream
(
command
,
trace:
true
);
process
.
stderr
.
transform
(
utf8
.
decoder
)
.
transform
(
const
LineSplitter
())
.
listen
(
printError
);
process
.
stdout
.
transform
(
utf8
.
decoder
)
.
transform
(
const
LineSplitter
())
.
listen
(
printTrace
);
result
=
await
process
.
exitCode
;
}
finally
{
status
.
cancel
();
}
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
02169536
...
...
@@ -337,10 +337,6 @@ abstract class FlutterCommand extends Command<void> {
argParser
.
addFlag
(
'release'
,
negatable:
false
,
help:
'Build a release version of your app
${defaultToRelease ? ' (default mode)' : ''}
.'
);
argParser
.
addFlag
(
'jit-release'
,
negatable:
false
,
hide:
!
verboseHelp
,
help:
'Build a JIT release version of your app
${defaultToRelease ? ' (default mode)' : ''}
.'
);
}
void
addShrinkingFlag
()
{
...
...
@@ -378,18 +374,10 @@ abstract class FlutterCommand extends Command<void> {
}
BuildMode
getBuildMode
()
{
// No debug when _excludeDebug is true.
// If debug is not excluded, then take the command line flag.
final
bool
debugResult
=
!
_excludeDebug
&&
boolArg
(
'debug'
);
final
List
<
bool
>
modeFlags
=
<
bool
>[
debugResult
,
boolArg
(
'jit-release'
),
boolArg
(
'profile'
),
boolArg
(
'release'
),
];
final
List
<
bool
>
modeFlags
=
<
bool
>[
debugResult
,
boolArg
(
'profile'
),
boolArg
(
'release'
)];
if
(
modeFlags
.
where
((
bool
flag
)
=>
flag
).
length
>
1
)
{
throw
UsageException
(
'Only one of --debug, --profile, --jit-release, '
'or --release can be specified.'
,
null
);
throw
UsageException
(
'Only one of --debug, --profile, or --release can be specified.'
,
null
);
}
if
(
debugResult
)
{
return
BuildMode
.
debug
;
...
...
@@ -400,9 +388,6 @@ abstract class FlutterCommand extends Command<void> {
if
(
boolArg
(
'release'
))
{
return
BuildMode
.
release
;
}
if
(
boolArg
(
'jit-release'
))
{
return
BuildMode
.
jitRelease
;
}
return
_defaultBuildMode
;
}
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
02169536
...
...
@@ -25,7 +25,6 @@ import 'package:flutter_tools/src/fuchsia/fuchsia_kernel_compiler.dart';
import
'package:flutter_tools/src/fuchsia/fuchsia_pm.dart'
;
import
'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart'
;
import
'package:flutter_tools/src/fuchsia/tiles_ctl.dart'
;
import
'package:flutter_tools/src/globals.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
import
'package:meta/meta.dart'
;
...
...
@@ -112,7 +111,6 @@ void main() {
expect
(
await
device
.
targetPlatform
,
TargetPlatform
.
fuchsia_arm64
);
},
overrides:
<
Type
,
Generator
>{
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
sshConfig
),
FuchsiaSdk:
()
=>
MockFuchsiaSdk
(),
ProcessUtils:
()
=>
mockProcessUtils
,
});
...
...
@@ -124,7 +122,6 @@ void main() {
expect
(
await
device
.
targetPlatform
,
TargetPlatform
.
fuchsia_x64
);
},
overrides:
<
Type
,
Generator
>{
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
sshConfig
),
FuchsiaSdk:
()
=>
MockFuchsiaSdk
(),
ProcessUtils:
()
=>
mockProcessUtils
,
});
});
...
...
@@ -183,7 +180,6 @@ void main() {
sshConfig:
mockFile
,
devFinder:
mockFile
,
),
FuchsiaSdk:
()
=>
MockFuchsiaSdk
(),
});
group
(
'device logs'
,
()
{
...
...
@@ -382,38 +378,7 @@ void main() {
});
});
testUsingContext
(
'Correct flutter runner'
,
()
async
{
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
platform:
TargetPlatform
.
fuchsia_x64
,
mode:
BuildMode
.
debug
,
),
contains
(
'flutter_jit_runner'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
platform:
TargetPlatform
.
fuchsia_x64
,
mode:
BuildMode
.
profile
,
),
contains
(
'flutter_aot_runner'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
platform:
TargetPlatform
.
fuchsia_x64
,
mode:
BuildMode
.
release
,
),
contains
(
'flutter_aot_product_runner'
),
);
expect
(
artifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
platform:
TargetPlatform
.
fuchsia_x64
,
mode:
BuildMode
.
jitRelease
,
),
contains
(
'flutter_jit_product_runner'
),
);
});
group
(
'Fuchsia app start and stop: '
,
()
{
group
(
'fuchsia app start and stop: '
,
()
{
MemoryFileSystem
memoryFileSystem
;
FakeOperatingSystemUtils
osUtils
;
FakeFuchsiaDeviceTools
fuchsiaDeviceTools
;
...
...
@@ -455,7 +420,7 @@ void main() {
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
patchedSdk
.
path
);
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
fuchsiaFlutterRunner
,
Artifact
.
fuchsiaFlutter
Jit
Runner
,
platform:
anyNamed
(
'platform'
),
mode:
anyNamed
(
'mode'
),
)).
thenReturn
(
runner
.
path
);
...
...
@@ -685,7 +650,6 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockSuccessProcessManager
,
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
sshConfig
),
FuchsiaSdk:
()
=>
MockFuchsiaSdk
(),
});
testUsingContext
(
'returns "Fuchsia" when device command fails'
,
()
async
{
...
...
@@ -694,7 +658,6 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockFailureProcessManager
,
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
sshConfig
),
FuchsiaSdk:
()
=>
MockFuchsiaSdk
(),
});
testUsingContext
(
'returns "Fuchsia" when device gives an empty result'
,
()
async
{
...
...
@@ -703,7 +666,6 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
emptyStdoutProcessManager
,
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
(
sshConfig:
sshConfig
),
FuchsiaSdk:
()
=>
MockFuchsiaSdk
(),
});
});
}
...
...
@@ -760,16 +722,12 @@ Process _createMockProcess({
}
class
MockFuchsiaDevice
extends
Mock
implements
FuchsiaDevice
{
MockFuchsiaDevice
(
this
.
id
,
this
.
portForwarder
,
this
.
_ipv6
);
final
bool
_ipv6
;
MockFuchsiaDevice
(
this
.
id
,
this
.
portForwarder
,
this
.
ipv6
);
@override
Future
<
bool
>
get
ipv6
async
=>
_ipv6
;
final
bool
ipv6
;
@override
final
String
id
;
@override
final
DevicePortForwarder
portForwarder
;
...
...
@@ -1115,7 +1073,7 @@ class FakeFuchsiaDevFinder implements FuchsiaDevFinder {
}
@override
Future
<
String
>
resolve
(
String
deviceName
,
{
bool
local
=
false
}
)
async
{
Future
<
String
>
resolve
(
String
deviceName
)
async
{
return
'192.168.42.10'
;
}
}
...
...
@@ -1127,7 +1085,7 @@ class FailingDevFinder implements FuchsiaDevFinder {
}
@override
Future
<
String
>
resolve
(
String
deviceName
,
{
bool
local
=
false
}
)
async
{
Future
<
String
>
resolve
(
String
deviceName
)
async
{
return
null
;
}
}
...
...
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