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
ac770423
Unverified
Commit
ac770423
authored
Apr 08, 2021
by
Jonah Williams
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Allow flutter build aar to know the null safety mode ahead of time (#80000)
parent
a3e66b39
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
build_aar.dart
packages/flutter_tools/lib/src/commands/build_aar.dart
+11
-4
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+3
-3
build_aar_test.dart
...r_tools/test/commands.shard/permeable/build_aar_test.dart
+1
-0
No files found.
packages/flutter_tools/lib/src/commands/build_aar.dart
View file @
ac770423
...
@@ -3,12 +3,13 @@
...
@@ -3,12 +3,13 @@
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
// @dart = 2.8
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'../android/android_builder.dart'
;
import
'../android/android_builder.dart'
;
import
'../android/gradle_utils.dart'
;
import
'../android/gradle_utils.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/os.dart'
;
import
'../base/os.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
...
@@ -96,7 +97,9 @@ class BuildAarCommand extends BuildSubCommand {
...
@@ -96,7 +97,9 @@ class BuildAarCommand extends BuildSubCommand {
'By default, AARs are built for `release`, `debug` and `profile`.
\n
'
'By default, AARs are built for `release`, `debug` and `profile`.
\n
'
'The POM file is used to include the dependencies that the AAR was compiled against.
\n
'
'The POM file is used to include the dependencies that the AAR was compiled against.
\n
'
'To learn more about how to use these artifacts, see '
'To learn more about how to use these artifacts, see '
'https://flutter.dev/go/build-aar'
;
'https://flutter.dev/go/build-aar
\n
'
'Note: this command builds applications assuming that the entrypoint is lib/main.dart. '
'This cannot currently be configured.'
;
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
...
@@ -114,11 +117,15 @@ class BuildAarCommand extends BuildSubCommand {
...
@@ -114,11 +117,15 @@ class BuildAarCommand extends BuildSubCommand {
?
stringArg
(
'build-number'
)
?
stringArg
(
'build-number'
)
:
'1.0'
;
:
'1.0'
;
final
File
targetFile
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
));
for
(
final
String
buildMode
in
const
<
String
>[
'debug'
,
'profile'
,
'release'
])
{
for
(
final
String
buildMode
in
const
<
String
>[
'debug'
,
'profile'
,
'release'
])
{
if
(
boolArg
(
buildMode
))
{
if
(
boolArg
(
buildMode
))
{
androidBuildInfo
.
add
(
androidBuildInfo
.
add
(
AndroidBuildInfo
(
AndroidBuildInfo
(
await
getBuildInfo
(
forcedBuildMode:
BuildMode
.
fromName
(
buildMode
)),
await
getBuildInfo
(
forcedBuildMode:
BuildMode
.
fromName
(
buildMode
),
forcedTargetFile:
targetFile
,
),
targetArchs:
targetArchitectures
,
targetArchs:
targetArchitectures
,
)
)
);
);
...
@@ -131,7 +138,7 @@ class BuildAarCommand extends BuildSubCommand {
...
@@ -131,7 +138,7 @@ class BuildAarCommand extends BuildSubCommand {
displayNullSafetyMode
(
androidBuildInfo
.
first
.
buildInfo
);
displayNullSafetyMode
(
androidBuildInfo
.
first
.
buildInfo
);
await
androidBuilder
.
buildAar
(
await
androidBuilder
.
buildAar
(
project:
_getProject
(),
project:
_getProject
(),
target:
''
,
// Not needed because this command only builds Android's code.
target:
targetFile
.
path
,
androidBuildInfo:
androidBuildInfo
,
androidBuildInfo:
androidBuildInfo
,
outputDirectoryPath:
stringArg
(
'output-dir'
),
outputDirectoryPath:
stringArg
(
'output-dir'
),
buildNumber:
buildNumber
,
buildNumber:
buildNumber
,
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
ac770423
...
@@ -841,7 +841,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -841,7 +841,7 @@ abstract class FlutterCommand extends Command<void> {
///
///
/// Throws a [ToolExit] if the current set of options is not compatible with
/// Throws a [ToolExit] if the current set of options is not compatible with
/// each other.
/// each other.
Future
<
BuildInfo
>
getBuildInfo
({
BuildMode
forcedBuildMode
})
async
{
Future
<
BuildInfo
>
getBuildInfo
({
BuildMode
forcedBuildMode
,
File
forcedTargetFile
})
async
{
final
bool
trackWidgetCreation
=
argParser
.
options
.
containsKey
(
'track-widget-creation'
)
&&
final
bool
trackWidgetCreation
=
argParser
.
options
.
containsKey
(
'track-widget-creation'
)
&&
boolArg
(
'track-widget-creation'
);
boolArg
(
'track-widget-creation'
);
...
@@ -891,8 +891,8 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -891,8 +891,8 @@ abstract class FlutterCommand extends Command<void> {
// passing a flag. Examine the entrypoint file to determine if it
// passing a flag. Examine the entrypoint file to determine if it
// is opted in or out.
// is opted in or out.
final
bool
wasNullSafetyFlagParsed
=
argResults
.
wasParsed
(
FlutterOptions
.
kNullSafety
);
final
bool
wasNullSafetyFlagParsed
=
argResults
.
wasParsed
(
FlutterOptions
.
kNullSafety
);
if
(!
wasNullSafetyFlagParsed
&&
argParser
.
options
.
containsKey
(
'target'
))
{
if
(!
wasNullSafetyFlagParsed
&&
(
argParser
.
options
.
containsKey
(
'target'
)
||
forcedTargetFile
!=
null
))
{
final
File
entrypointFile
=
globals
.
fs
.
file
(
targetFile
);
final
File
entrypointFile
=
forcedTargetFile
??
globals
.
fs
.
file
(
targetFile
);
final
LanguageVersion
languageVersion
=
determineLanguageVersion
(
final
LanguageVersion
languageVersion
=
determineLanguageVersion
(
entrypointFile
,
entrypointFile
,
packageConfig
.
packageOf
(
entrypointFile
.
absolute
.
uri
),
packageConfig
.
packageOf
(
entrypointFile
.
absolute
.
uri
),
...
...
packages/flutter_tools/test/commands.shard/permeable/build_aar_test.dart
View file @
ac770423
...
@@ -185,6 +185,7 @@ void main() {
...
@@ -185,6 +185,7 @@ void main() {
expect
(
buildInfo
.
splitDebugInfoPath
,
'/project-name/v1.2.3/'
);
expect
(
buildInfo
.
splitDebugInfoPath
,
'/project-name/v1.2.3/'
);
expect
(
buildInfo
.
dartObfuscation
,
isTrue
);
expect
(
buildInfo
.
dartObfuscation
,
isTrue
);
expect
(
buildInfo
.
dartDefines
.
contains
(
'foo=bar'
),
isTrue
);
expect
(
buildInfo
.
dartDefines
.
contains
(
'foo=bar'
),
isTrue
);
expect
(
buildInfo
.
nullSafetyMode
,
NullSafetyMode
.
sound
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
AndroidBuilder:
()
=>
fakeAndroidBuilder
,
AndroidBuilder:
()
=>
fakeAndroidBuilder
,
});
});
...
...
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