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
34b8f830
Unverified
Commit
34b8f830
authored
Apr 27, 2020
by
michaellee8
Committed by
GitHub
Apr 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] add --dart-define option for fuchsia build (#55715)
parent
7eb3df4a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
22 deletions
+101
-22
AUTHORS
AUTHORS
+1
-0
build_fuchsia.dart
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
+1
-0
fuchsia_kernel_compiler.dart
...lutter_tools/lib/src/fuchsia/fuchsia_kernel_compiler.dart
+47
-22
fuchsia_kernel_compiler_test.dart
...t/general.shard/fuchsia/fuchsia_kernel_compiler_test.dart
+52
-0
No files found.
AUTHORS
View file @
34b8f830
...
...
@@ -52,3 +52,4 @@ Alek Åström <alek.astrom@gmail.com>
Efthymios Sarpmpanis <e.sarbanis@gmail.com>
Cédric Wyss <cedi.wyss@gmail.com>
Michel Feinstein <michel@feinstein.com.br>
Michael Lee <ckmichael8@gmail.com>
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
View file @
34b8f830
...
...
@@ -19,6 +19,7 @@ class BuildFuchsiaCommand extends BuildSubCommand {
BuildFuchsiaCommand
({
bool
verboseHelp
=
false
})
{
addTreeShakeIconsFlag
();
usesTargetOption
();
usesDartDefineOption
();
addBuildModeFlags
(
verboseHelp:
verboseHelp
);
argParser
.
addOption
(
'runner-source'
,
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_kernel_compiler.dart
View file @
34b8f830
...
...
@@ -56,28 +56,7 @@ class FuchsiaKernelCompiler {
'--packages'
,
'
$multiRootScheme
:///
$relativePackagesFile
'
,
'--output'
,
globals
.
fs
.
path
.
join
(
outDir
,
'
$appName
.dil'
),
'--component-name'
,
appName
,
// AOT/JIT:
if
(
buildInfo
.
usesAot
)
...<
String
>[
'--aot'
,
'--tfa'
]
else
...<
String
>[
'--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'
,
'-Ddart.developer.causal_async_stacks=
${buildInfo.isDebug}
'
,
// Use bytecode and drop the ast in JIT release mode.
if
(
buildInfo
.
isJitRelease
)
...<
String
>[
'--gen-bytecode'
,
'--drop-ast'
,
],
...
getBuildInfoFlags
(
buildInfo:
buildInfo
,
manifestPath:
manifestPath
)
];
flags
+=
<
String
>[
...
...
@@ -103,4 +82,50 @@ class FuchsiaKernelCompiler {
throwToolExit
(
'Build process failed'
);
}
}
/// Provide flags that are affected by [BuildInfo]
@visibleForTesting
static
List
<
String
>
getBuildInfoFlags
({
@required
BuildInfo
buildInfo
,
@required
String
manifestPath
,
})
{
return
<
String
>[
// AOT/JIT:
if
(
buildInfo
.
usesAot
)
...<
String
>[
'--aot'
,
'--tfa'
]
else
...<
String
>[
'--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
)
...<
String
>[
'-Ddart.vm.profile=true'
,
'-Ddart.vm.product=false'
,
],
if
(
buildInfo
.
mode
.
isRelease
)
...<
String
>[
'-Ddart.vm.profile=false'
,
'-Ddart.vm.product=true'
,
],
'-Ddart.developer.causal_async_stacks=
${buildInfo.isDebug}
'
,
// Use bytecode and drop the ast in JIT release mode.
if
(
buildInfo
.
isJitRelease
)
...<
String
>[
'--gen-bytecode'
,
'--drop-ast'
,
],
for
(
final
String
dartDefine
in
buildInfo
.
dartDefines
)
'-D
$dartDefine
'
,
];
}
}
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_kernel_compiler_test.dart
0 → 100644
View file @
34b8f830
// Copyright 2014 The Flutter 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
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/fuchsia/fuchsia_kernel_compiler.dart'
;
import
'../../src/common.dart'
;
void
main
(
)
{
group
(
'Fuchsia Kernel Compiler'
,
()
{
test
(
'provide correct flags for release mode'
,
()
{
expect
(
FuchsiaKernelCompiler
.
getBuildInfoFlags
(
buildInfo:
BuildInfo
.
release
,
manifestPath:
''
,
),
allOf
(<
Matcher
>[
contains
(
'-Ddart.vm.profile=false'
),
contains
(
'-Ddart.vm.product=true'
),
]));
});
test
(
'provide correct flags for profile mode'
,
()
{
expect
(
FuchsiaKernelCompiler
.
getBuildInfoFlags
(
buildInfo:
BuildInfo
.
profile
,
manifestPath:
''
,
),
allOf
(<
Matcher
>[
contains
(
'-Ddart.vm.profile=true'
),
contains
(
'-Ddart.vm.product=false'
),
]),
);
});
test
(
'provide correct flags for custom dart define'
,
()
{
expect
(
FuchsiaKernelCompiler
.
getBuildInfoFlags
(
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
null
,
treeShakeIcons:
true
,
dartDefines:
<
String
>[
'abc=efg'
],
),
manifestPath:
''
),
allOf
(<
Matcher
>[
contains
(
'-Dabc=efg'
),
]));
});
});
}
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