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
9e0f0fe9
Unverified
Commit
9e0f0fe9
authored
Apr 12, 2022
by
Emmanuel Garcia
Committed by
GitHub
Apr 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Gradle stacktrace and debug log level to verbose builds (#101734)
parent
712667fb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
3 deletions
+131
-3
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+4
-0
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+9
-3
android_gradle_builder_test.dart
...st/general.shard/android/android_gradle_builder_test.dart
+118
-0
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
9e0f0fe9
...
...
@@ -268,6 +268,8 @@ class AndroidGradleBuilder implements AndroidBuilder {
_gradleUtils
.
getExecutable
(
project
),
];
if
(
_logger
.
isVerbose
)
{
command
.
add
(
'--full-stacktrace'
);
command
.
add
(
'--debug'
);
command
.
add
(
'-Pverbose=true'
);
}
else
{
command
.
add
(
'-q'
);
...
...
@@ -590,6 +592,8 @@ class AndroidGradleBuilder implements AndroidBuilder {
'-PbuildNumber=
$buildNumber
'
];
if
(
_logger
.
isVerbose
)
{
command
.
add
(
'--full-stacktrace'
);
command
.
add
(
'--debug'
);
command
.
add
(
'-Pverbose=true'
);
}
else
{
command
.
add
(
'-q'
);
...
...
packages/flutter_tools/lib/src/base/logger.dart
View file @
9e0f0fe9
...
...
@@ -732,16 +732,20 @@ class BufferLogger extends Logger {
required
this
.
terminal
,
required
OutputPreferences
outputPreferences
,
StopwatchFactory
stopwatchFactory
=
const
StopwatchFactory
(),
bool
verbose
=
false
,
})
:
_outputPreferences
=
outputPreferences
,
_stopwatchFactory
=
stopwatchFactory
;
_stopwatchFactory
=
stopwatchFactory
,
_verbose
=
verbose
;
/// Create a [BufferLogger] with test preferences.
BufferLogger
.
test
({
Terminal
?
terminal
,
OutputPreferences
?
outputPreferences
,
bool
verbose
=
false
,
})
:
terminal
=
terminal
??
Terminal
.
test
(),
_outputPreferences
=
outputPreferences
??
OutputPreferences
.
test
(),
_stopwatchFactory
=
const
StopwatchFactory
();
_stopwatchFactory
=
const
StopwatchFactory
(),
_verbose
=
verbose
;
@override
final
OutputPreferences
_outputPreferences
;
...
...
@@ -751,8 +755,10 @@ class BufferLogger extends Logger {
final
StopwatchFactory
_stopwatchFactory
;
final
bool
_verbose
;
@override
bool
get
isVerbose
=>
fal
se
;
bool
get
isVerbose
=>
_verbo
se
;
@override
bool
get
supportsColor
=>
terminal
.
supportsColor
;
...
...
packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
View file @
9e0f0fe9
...
...
@@ -128,6 +128,69 @@ void main() {
));
});
testUsingContext
(
'Verbose mode for APKs includes Gradle stacktrace and sets debug log level'
,
()
async
{
final
AndroidGradleBuilder
builder
=
AndroidGradleBuilder
(
logger:
BufferLogger
.
test
(
verbose:
true
),
processManager:
processManager
,
fileSystem:
fileSystem
,
artifacts:
Artifacts
.
test
(),
usage:
testUsage
,
gradleUtils:
FakeGradleUtils
(),
platform:
FakePlatform
(),
);
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'gradlew'
,
'--full-stacktrace'
,
'--debug'
,
'-Pverbose=true'
,
'-Ptarget-platform=android-arm,android-arm64,android-x64'
,
'-Ptarget=lib/main.dart'
,
'-Pbase-application-name=io.flutter.app.FlutterApplication'
,
'-Pdart-obfuscation=false'
,
'-Ptrack-widget-creation=false'
,
'-Ptree-shake-icons=false'
,
'assembleRelease'
],
));
fileSystem
.
directory
(
'android'
)
.
childFile
(
'build.gradle'
)
.
createSync
(
recursive:
true
);
fileSystem
.
directory
(
'android'
)
.
childFile
(
'gradle.properties'
)
.
createSync
(
recursive:
true
);
fileSystem
.
directory
(
'android'
)
.
childDirectory
(
'app'
)
.
childFile
(
'build.gradle'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'apply from: irrelevant/flutter.gradle'
);
fileSystem
.
directory
(
'build'
)
.
childDirectory
(
'app'
)
.
childDirectory
(
'outputs'
)
.
childDirectory
(
'flutter-apk'
)
.
childFile
(
'app-release.apk'
)
.
createSync
(
recursive:
true
);
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
,
),
),
target:
'lib/main.dart'
,
isBuildingBundle:
false
,
localGradleErrors:
<
GradleHandledError
>[],
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'Can retry build on recognized exit code/stderr'
,
()
async
{
final
AndroidGradleBuilder
builder
=
AndroidGradleBuilder
(
logger:
logger
,
...
...
@@ -700,6 +763,61 @@ void main() {
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'Verbose mode for AARs includes Gradle stacktrace and sets debug log level'
,
()
async
{
final
AndroidGradleBuilder
builder
=
AndroidGradleBuilder
(
logger:
BufferLogger
.
test
(
verbose:
true
),
processManager:
processManager
,
fileSystem:
fileSystem
,
artifacts:
Artifacts
.
test
(),
usage:
testUsage
,
gradleUtils:
FakeGradleUtils
(),
platform:
FakePlatform
(),
);
processManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'gradlew'
,
'-I=/packages/flutter_tools/gradle/aar_init_script.gradle'
,
'-Pflutter-root=/'
,
'-Poutput-dir=build/'
,
'-Pis-plugin=false'
,
'-PbuildNumber=1.0'
,
'--full-stacktrace'
,
'--debug'
,
'-Pverbose=true'
,
'-Pdart-obfuscation=false'
,
'-Ptrack-widget-creation=false'
,
'-Ptree-shake-icons=false'
,
'-Ptarget-platform=android-arm,android-arm64,android-x64'
,
'assembleAarRelease'
],
));
final
File
manifestFile
=
fileSystem
.
file
(
'pubspec.yaml'
);
manifestFile
.
createSync
(
recursive:
true
);
manifestFile
.
writeAsStringSync
(
'''
flutter:
module:
androidPackage: com.example.test
'''
);
fileSystem
.
file
(
'.android/gradlew'
).
createSync
(
recursive:
true
);
fileSystem
.
file
(
'.android/gradle.properties'
)
.
writeAsStringSync
(
'irrelevant'
);
fileSystem
.
file
(
'.android/build.gradle'
)
.
createSync
(
recursive:
true
);
fileSystem
.
directory
(
'build/outputs/repo'
).
createSync
(
recursive:
true
);
await
builder
.
buildGradleAar
(
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
)),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
outputDirectory:
fileSystem
.
directory
(
'build/'
),
target:
''
,
buildNumber:
'1.0'
,
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
testUsingContext
(
'gradle exit code and stderr is forwarded to tool exit'
,
()
async
{
final
AndroidGradleBuilder
builder
=
AndroidGradleBuilder
(
logger:
logger
,
...
...
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