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
24bfc46d
Unverified
Commit
24bfc46d
authored
May 20, 2021
by
Jonah Williams
Committed by
GitHub
May 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] allow passing properties directly to gradle (#82941)
parent
c94f0bea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+7
-0
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+13
-0
build_info_test.dart
...ges/flutter_tools/test/general.shard/build_info_test.dart
+6
-1
No files found.
packages/flutter_tools/lib/src/build_info.dart
View file @
24bfc46d
...
...
@@ -25,6 +25,7 @@ class BuildInfo {
List
<
String
>?
extraFrontEndOptions
,
List
<
String
>?
extraGenSnapshotOptions
,
List
<
String
>?
fileSystemRoots
,
this
.
androidProjectArgs
=
const
<
String
>[],
this
.
fileSystemScheme
,
this
.
buildNumber
,
this
.
buildName
,
...
...
@@ -142,6 +143,10 @@ class BuildInfo {
/// The Gradle daemon may also be disabled in the Android application's properties file.
final
bool
androidGradleDaemon
;
/// Additional key value pairs that are passed directly to the gradle project via the `-P`
/// flag.
final
List
<
String
>
androidProjectArgs
;
/// The package configuration for the loaded application.
///
/// This is captured once during startup, but the actual package configuration
...
...
@@ -276,6 +281,8 @@ class BuildInfo {
'-Pbundle-sksl-path=
$bundleSkSLPath
'
,
if
(
codeSizeDirectory
!=
null
)
'-Pcode-size-directory=
$codeSizeDirectory
'
,
for
(
String
projectArg
in
androidProjectArgs
)
'-P
$projectArg
'
,
];
}
}
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
24bfc46d
...
...
@@ -118,6 +118,7 @@ class FlutterOptions {
static
const
String
kNullAssertions
=
'null-assertions'
;
static
const
String
kAndroidGradleDaemon
=
'android-gradle-daemon'
;
static
const
String
kDeferredComponents
=
'deferred-components'
;
static
const
String
kAndroidProjectArgs
=
'android-project-arg'
;
}
abstract
class
FlutterCommand
extends
Command
<
void
>
{
...
...
@@ -768,6 +769,13 @@ abstract class FlutterCommand extends Command<void> {
defaultsTo:
true
,
hide:
hide
,
);
argParser
.
addMultiOption
(
FlutterOptions
.
kAndroidProjectArgs
,
help:
'Additional arguments specified as key=value that are passed directly to the gradle '
'project via the -P flag. These can be accesed in build.gradle via the "project.property" API.'
,
splitCommas:
false
,
abbr:
'P'
,
);
}
void
addNativeNullAssertions
({
bool
hide
=
false
})
{
...
...
@@ -971,6 +979,10 @@ abstract class FlutterCommand extends Command<void> {
final
bool
androidGradleDaemon
=
!
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAndroidGradleDaemon
)
||
boolArg
(
FlutterOptions
.
kAndroidGradleDaemon
);
final
List
<
String
>
androidProjectArgs
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAndroidProjectArgs
)
?
stringsArg
(
FlutterOptions
.
kAndroidProjectArgs
)
:
<
String
>[];
if
(
dartObfuscation
&&
(
splitDebugInfoPath
==
null
||
splitDebugInfoPath
.
isEmpty
))
{
throwToolExit
(
'"--
${FlutterOptions.kDartObfuscationOption}
" can only be used in '
...
...
@@ -1042,6 +1054,7 @@ abstract class FlutterCommand extends Command<void> {
codeSizeDirectory:
codeSizeDirectory
,
androidGradleDaemon:
androidGradleDaemon
,
packageConfig:
packageConfig
,
androidProjectArgs:
androidProjectArgs
,
);
}
...
...
packages/flutter_tools/test/general.shard/build_info_test.dart
View file @
24bfc46d
...
...
@@ -139,6 +139,8 @@ void main() {
bundleSkSLPath:
'foo/bar/baz.sksl.json'
,
packagesPath:
'foo/.packages'
,
codeSizeDirectory:
'foo/code-size'
,
// These values are ignored by toEnvironmentConfig
androidProjectArgs:
<
String
>[
'foo=bar'
,
'fizz=bazz'
]
);
expect
(
buildInfo
.
toEnvironmentConfig
(),
<
String
,
String
>{
...
...
@@ -167,6 +169,7 @@ void main() {
bundleSkSLPath:
'foo/bar/baz.sksl.json'
,
packagesPath:
'foo/.packages'
,
codeSizeDirectory:
'foo/code-size'
,
androidProjectArgs:
<
String
>[
'foo=bar'
,
'fizz=bazz'
]
);
expect
(
buildInfo
.
toGradleConfig
(),
<
String
>[
...
...
@@ -178,7 +181,9 @@ void main() {
'-Ptrack-widget-creation=true'
,
'-Ptree-shake-icons=true'
,
'-Pbundle-sksl-path=foo/bar/baz.sksl.json'
,
'-Pcode-size-directory=foo/code-size'
'-Pcode-size-directory=foo/code-size'
,
'-Pfoo=bar'
,
'-Pfizz=bazz'
]);
});
...
...
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