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
23404dfa
Unverified
Commit
23404dfa
authored
Apr 12, 2021
by
Jenn Magder
Committed by
GitHub
Apr 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove flutter_command dependency from reporting library (#80159)
parent
f79ad055
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
48 additions
and
51 deletions
+48
-51
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+9
-8
gradle_errors.dart
packages/flutter_tools/lib/src/android/gradle_errors.dart
+4
-0
gradle_utils.dart
packages/flutter_tools/lib/src/android/gradle_utils.dart
+1
-1
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+2
-0
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+1
-0
events.dart
packages/flutter_tools/lib/src/reporting/events.dart
+4
-5
reporting.dart
packages/flutter_tools/lib/src/reporting/reporting.dart
+0
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
build_apk_test.dart
...r_tools/test/commands.shard/permeable/build_apk_test.dart
+3
-3
build_appbundle_test.dart
...s/test/commands.shard/permeable/build_appbundle_test.dart
+2
-2
android_gradle_builder_test.dart
...st/general.shard/android/android_gradle_builder_test.dart
+5
-5
gradle_errors_test.dart
..._tools/test/general.shard/android/gradle_errors_test.dart
+4
-4
gradle_find_bundle_test.dart
...s/test/general.shard/android/gradle_find_bundle_test.dart
+2
-4
mac_test.dart
packages/flutter_tools/test/general.shard/ios/mac_test.dart
+10
-17
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
23404dfa
...
...
@@ -292,9 +292,9 @@ class AndroidGradleBuilder implements AndroidBuilder {
final
bool
usesAndroidX
=
isAppUsingAndroidX
(
project
.
android
.
hostAppGradleRoot
);
if
(
usesAndroidX
)
{
BuildEvent
(
'app-using-android-x'
,
flutterUsage:
_usage
).
send
();
BuildEvent
(
'app-using-android-x'
,
type:
'gradle'
,
flutterUsage:
_usage
).
send
();
}
else
if
(!
usesAndroidX
)
{
BuildEvent
(
'app-not-using-android-x'
,
flutterUsage:
_usage
).
send
();
BuildEvent
(
'app-not-using-android-x'
,
type:
'gradle'
,
flutterUsage:
_usage
).
send
();
_logger
.
printStatus
(
"
${_logger.terminal.warningMark}
Your app isn't using AndroidX."
,
emphasis:
true
);
_logger
.
printStatus
(
'To avoid potential build failures, you can quickly migrate your app '
...
...
@@ -460,7 +460,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
if
(
exitCode
!=
0
)
{
if
(
detectedGradleError
==
null
)
{
BuildEvent
(
'gradle-unknown-failure'
,
flutterUsage:
_usage
).
send
();
BuildEvent
(
'gradle-unknown-failure'
,
type:
'gradle'
,
flutterUsage:
_usage
).
send
();
throwToolExit
(
'Gradle task
$assembleTask
failed with exit code
$exitCode
'
,
exitCode:
exitCode
,
...
...
@@ -486,7 +486,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
shouldBuildPluginAsAar:
shouldBuildPluginAsAar
,
retries:
retries
-
1
,
);
BuildEvent
(
successEventLabel
,
flutterUsage:
_usage
).
send
();
BuildEvent
(
successEventLabel
,
type:
'gradle'
,
flutterUsage:
_usage
).
send
();
return
;
case
GradleBuildStatus
.
retryWithAarPlugins
:
await
buildGradleApp
(
...
...
@@ -498,13 +498,13 @@ class AndroidGradleBuilder implements AndroidBuilder {
shouldBuildPluginAsAar:
true
,
retries:
retries
-
1
,
);
BuildEvent
(
successEventLabel
,
flutterUsage:
_usage
).
send
();
BuildEvent
(
successEventLabel
,
type:
'gradle'
,
flutterUsage:
_usage
).
send
();
return
;
case
GradleBuildStatus
.
exit
:
// noop.
}
}
BuildEvent
(
'gradle-
${detectedGradleError.eventLabel}
-failure'
,
flutterUsage:
_usage
).
send
();
BuildEvent
(
'gradle-
${detectedGradleError.eventLabel}
-failure'
,
type:
'gradle'
,
flutterUsage:
_usage
).
send
();
throwToolExit
(
'Gradle task
$assembleTask
failed with exit code
$exitCode
'
,
exitCode:
exitCode
,
...
...
@@ -798,7 +798,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
}
on
ToolExit
{
// Log the entire plugin entry in `.flutter-plugins` since it
// includes the plugin name and the version.
BuildEvent
(
'gradle-plugin-aar-failure'
,
eventError:
plugin
,
flutterUsage:
_usage
).
send
();
BuildEvent
(
'gradle-plugin-aar-failure'
,
type:
'gradle'
,
eventError:
plugin
,
flutterUsage:
_usage
).
send
();
throwToolExit
(
'The plugin
$pluginName
could not be built due to the issue above.'
);
}
}
...
...
@@ -879,7 +879,7 @@ String _calculateSha(File file) {
}
void
_exitWithUnsupportedProjectMessage
(
Usage
usage
,
Terminal
terminal
)
{
BuildEvent
(
'unsupported-project'
,
eventError:
'gradle-plugin'
,
flutterUsage:
usage
).
send
();
BuildEvent
(
'unsupported-project'
,
type:
'gradle'
,
eventError:
'gradle-plugin'
,
flutterUsage:
usage
).
send
();
throwToolExit
(
'
${terminal.warningMark}
Your app is using an unsupported Gradle project. '
'To fix this problem, create a new project by running `flutter create -t app <app-directory>` '
...
...
@@ -1030,6 +1030,7 @@ void _exitWithExpectedFileNotFound({
final
String
androidGradlePluginVersion
=
getGradleVersionForAndroidPlugin
(
project
.
android
.
hostAppGradleRoot
,
logger
);
BuildEvent
(
'gradle-expected-file-not-found'
,
type:
'gradle'
,
settings:
'androidGradlePluginVersion:
$androidGradlePluginVersion
, '
'fileExtension:
$fileExtension
'
,
...
...
packages/flutter_tools/lib/src/android/gradle_errors.dart
View file @
23404dfa
...
...
@@ -199,6 +199,7 @@ final GradleHandledError androidXFailureHandler = GradleHandledError(
// the incompatibility is coming from.
BuildEvent
(
'gradle-android-x-failure'
,
type:
'gradle'
,
eventError:
'app-not-using-plugins'
,
flutterUsage:
globals
.
flutterUsage
,
).
send
();
...
...
@@ -212,6 +213,7 @@ final GradleHandledError androidXFailureHandler = GradleHandledError(
);
BuildEvent
(
'gradle-android-x-failure'
,
type:
'gradle'
,
eventError:
'app-not-using-androidx'
,
flutterUsage:
globals
.
flutterUsage
,
).
send
();
...
...
@@ -222,6 +224,7 @@ final GradleHandledError androidXFailureHandler = GradleHandledError(
// AARs, Jetifier translated Support libraries for AndroidX equivalents.
BuildEvent
(
'gradle-android-x-failure'
,
type:
'gradle'
,
eventError:
'using-jetifier'
,
flutterUsage:
globals
.
flutterUsage
,
).
send
();
...
...
@@ -233,6 +236,7 @@ final GradleHandledError androidXFailureHandler = GradleHandledError(
);
BuildEvent
(
'gradle-android-x-failure'
,
type:
'gradle'
,
eventError:
'not-using-jetifier'
,
flutterUsage:
globals
.
flutterUsage
,
).
send
();
...
...
packages/flutter_tools/lib/src/android/gradle_utils.dart
View file @
23404dfa
...
...
@@ -255,7 +255,7 @@ void writeLocalProperties(File properties) {
}
void
exitWithNoSdkMessage
(
)
{
BuildEvent
(
'unsupported-project'
,
eventError:
'android-sdk-not-found'
,
flutterUsage:
globals
.
flutterUsage
).
send
();
BuildEvent
(
'unsupported-project'
,
type:
'gradle'
,
eventError:
'android-sdk-not-found'
,
flutterUsage:
globals
.
flutterUsage
).
send
();
throwToolExit
(
'
${globals.logger.terminal.warningMark}
No Android SDK found. '
'Try setting the ANDROID_SDK_ROOT environment variable.'
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
23404dfa
...
...
@@ -383,6 +383,7 @@ Future<XcodeBuildResult> buildXcodeProject({
}
on
ProcessException
catch
(
e
)
{
if
(
e
.
toString
().
contains
(
'timed out'
))
{
BuildEvent
(
'xcode-show-build-settings-timeout'
,
type:
'ios'
,
command:
showBuildSettingsCommand
.
join
(
' '
),
flutterUsage:
globals
.
flutterUsage
,
).
send
();
...
...
@@ -535,6 +536,7 @@ Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result, Usage flutterUsa
result
.
xcodeBuildExecution
.
buildForPhysicalDevice
&&
result
.
stdout
?.
toUpperCase
()?.
contains
(
'BITCODE'
)
==
true
)
{
BuildEvent
(
'xcode-bitcode-failure'
,
type:
'ios'
,
command:
result
.
xcodeBuildExecution
.
buildCommands
.
toString
(),
settings:
result
.
xcodeBuildExecution
.
buildSettings
.
toString
(),
flutterUsage:
flutterUsage
,
...
...
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
23404dfa
...
...
@@ -436,6 +436,7 @@ class XcodeProjectInterpreter {
}
on
Exception
catch
(
error
)
{
if
(
error
is
ProcessException
&&
error
.
toString
().
contains
(
'timed out'
))
{
BuildEvent
(
'xcode-show-build-settings-timeout'
,
type:
'ios'
,
command:
showBuildSettingsCommand
.
join
(
' '
),
flutterUsage:
_usage
,
).
send
();
...
...
packages/flutter_tools/lib/src/reporting/events.dart
View file @
23404dfa
...
...
@@ -152,6 +152,7 @@ class BuildEvent extends UsageEvent {
String
settings
,
String
eventError
,
@required
Usage
flutterUsage
,
@required
String
type
,
})
:
_command
=
command
,
_settings
=
settings
,
_eventError
=
eventError
,
...
...
@@ -159,9 +160,7 @@ class BuildEvent extends UsageEvent {
// category
'build'
,
// parameter
FlutterCommand
.
current
==
null
?
'unspecified'
:
FlutterCommand
.
current
.
name
,
type
,
label:
label
,
flutterUsage:
flutterUsage
,
);
...
...
@@ -191,10 +190,10 @@ class BuildEvent extends UsageEvent {
/// An event that reports the result of a top-level command.
class
CommandResultEvent
extends
UsageEvent
{
CommandResultEvent
(
String
commandPath
,
FlutterCommandResult
result
)
CommandResultEvent
(
String
commandPath
,
String
result
)
:
assert
(
commandPath
!=
null
),
assert
(
result
!=
null
),
super
(
commandPath
,
result
.
toString
()
,
flutterUsage:
globals
.
flutterUsage
);
super
(
commandPath
,
result
,
flutterUsage:
globals
.
flutterUsage
);
@override
void
send
()
{
...
...
packages/flutter_tools/lib/src/reporting/reporting.dart
View file @
23404dfa
...
...
@@ -21,7 +21,6 @@ import '../dart/language_version.dart';
import
'../doctor_validator.dart'
;
import
'../features.dart'
;
import
'../globals.dart'
as
globals
;
import
'../runner/flutter_command.dart'
;
import
'../version.dart'
;
import
'first_run.dart'
;
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
23404dfa
...
...
@@ -1105,7 +1105,7 @@ abstract class FlutterCommand extends Command<void> {
}
assert
(
commandResult
!=
null
);
// Send command result.
CommandResultEvent
(
commandPath
,
commandResult
).
send
();
CommandResultEvent
(
commandPath
,
commandResult
.
toString
()
).
send
();
// Send timing.
final
List
<
String
>
labels
=
<
String
>[
...
...
packages/flutter_tools/test/commands.shard/permeable/build_apk_test.dart
View file @
23404dfa
...
...
@@ -376,7 +376,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
apk
'
,
'
gradle
'
,
label:
'gradle-r8-failure'
,
parameters:
<
String
,
String
>{},
),
...
...
@@ -442,7 +442,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
apk
'
,
'
gradle
'
,
label:
'app-not-using-android-x'
,
parameters:
<
String
,
String
>{},
),
...
...
@@ -499,7 +499,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
apk
'
,
'
gradle
'
,
label:
'app-using-android-x'
,
parameters:
<
String
,
String
>{},
),
...
...
packages/flutter_tools/test/commands.shard/permeable/build_appbundle_test.dart
View file @
23404dfa
...
...
@@ -161,7 +161,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
appbun
dle'
,
'
gra
dle'
,
label:
'app-not-using-android-x'
,
parameters:
<
String
,
String
>{},
),
...
...
@@ -201,7 +201,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
appbun
dle'
,
'
gra
dle'
,
label:
'app-using-android-x'
,
parameters:
<
String
,
String
>{},
),
...
...
packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
View file @
23404dfa
...
...
@@ -120,7 +120,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-random-event-label-failure'
,
parameters:
<
String
,
String
>{},
),
...
...
@@ -222,7 +222,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-random-event-label-failure'
,
parameters:
<
String
,
String
>{},
),
...
...
@@ -309,7 +309,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-random-event-label-failure'
,
parameters:
<
String
,
String
>{},
),
...
...
@@ -466,7 +466,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-random-event-label-success'
,
parameters:
<
String
,
String
>{},
),
...
...
@@ -674,7 +674,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-random-event-label-failure'
,
parameters:
<
String
,
String
>{},
),
...
...
packages/flutter_tools/test/general.shard/android/gradle_errors_test.dart
View file @
23404dfa
...
...
@@ -355,7 +355,7 @@ Command: /home/android/gradlew assembleRelease
expect(testUsage.events, contains(
const TestUsageEvent(
'
build
',
'
unspecified
',
'
gradle
',
label: '
gradle
-
android
-
x
-
failure
',
parameters: <String, String>{
'
cd43
': '
app
-
not
-
using
-
plugins
',
...
...
@@ -390,7 +390,7 @@ Command: /home/android/gradlew assembleRelease
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-android-x-failure'
,
parameters:
<
String
,
String
>{
'cd43'
:
'app-not-using-androidx'
,
...
...
@@ -418,7 +418,7 @@ Command: /home/android/gradlew assembleRelease
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-android-x-failure'
,
parameters:
<
String
,
String
>{
'cd43'
:
'using-jetifier'
,
...
...
@@ -453,7 +453,7 @@ Command: /home/android/gradlew assembleRelease
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-android-x-failure'
,
parameters:
<
String
,
String
>{
'cd43'
:
'not-using-jetifier'
,
...
...
packages/flutter_tools/test/general.shard/android/gradle_find_bundle_test.dart
View file @
23404dfa
...
...
@@ -14,7 +14,6 @@ import 'package:flutter_tools/src/reporting/reporting.dart';
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
void
main
(
)
{
FileSystem
fileSystem
;
...
...
@@ -309,8 +308,7 @@ void main() {
expect
(
bundle
.
path
,
fileSystem
.
path
.
join
(
'irrelevant'
,
'app'
,
'outputs'
,
'bundle'
,
'foo_barDebug'
,
'app-foo_bar-debug.aab'
));
});
// Context is required due to build failure analytics event grabbing FlutterCommand.current.
testUsingContext
(
'AAB not found'
,
()
{
testWithoutContext
(
'AAB not found'
,
()
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
TestUsage
testUsage
=
TestUsage
();
expect
(
...
...
@@ -331,7 +329,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
const
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
gradle
'
,
label:
'gradle-expected-file-not-found'
,
parameters:
<
String
,
String
>
{
'cd37'
:
'androidGradlePluginVersion: 6.7, fileExtension: .aab'
,
...
...
packages/flutter_tools/test/general.shard/ios/mac_test.dart
View file @
23404dfa
...
...
@@ -9,7 +9,6 @@ import 'package:file/memory.dart';
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/ios/devices.dart'
;
...
...
@@ -19,15 +18,9 @@ import 'package:flutter_tools/src/reporting/reporting.dart';
import
'package:mockito/mockito.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
import
'../../src/fakes.dart'
;
FakePlatform
_kNoColorTerminalPlatform
(
)
=>
FakePlatform
(
stdoutSupportsAnsi:
false
);
final
Map
<
Type
,
Generator
>
noColorTerminalOverride
=
<
Type
,
Generator
>{
Platform:
_kNoColorTerminalPlatform
,
};
class
MockIosProject
extends
Mock
implements
IosProject
{}
void
main
(
)
{
...
...
@@ -149,7 +142,7 @@ void main() {
testUsage
=
TestUsage
();
});
test
Using
Context
(
'Sends analytics when bitcode fails'
,
()
async
{
test
Without
Context
(
'Sends analytics when bitcode fails'
,
()
async
{
const
List
<
String
>
buildCommands
=
<
String
>[
'xcrun'
,
'cc'
,
'blah'
];
final
XcodeBuildResult
buildResult
=
XcodeBuildResult
(
success:
false
,
...
...
@@ -166,7 +159,7 @@ void main() {
expect
(
testUsage
.
events
,
contains
(
TestUsageEvent
(
'build'
,
'
unspecified
'
,
'
ios
'
,
label:
'xcode-bitcode-failure'
,
parameters:
<
String
,
String
>{
cdKey
(
CustomDimensions
.
buildEventCommand
):
buildCommands
.
toString
(),
...
...
@@ -176,7 +169,7 @@ void main() {
));
});
test
Using
Context
(
'No provisioning profile shows message'
,
()
async
{
test
Without
Context
(
'No provisioning profile shows message'
,
()
async
{
final
XcodeBuildResult
buildResult
=
XcodeBuildResult
(
success:
false
,
stdout:
'''
...
...
@@ -247,9 +240,9 @@ Error launching application on iPhone.''',
logger.errorText,
contains("No Provisioning Profile was found for your project'
s
Bundle
Identifier
or
your
\
ndevice
.
"),
);
}
, overrides: noColorTerminalOverride
);
});
test
Using
Context('No development team shows message', () async {
test
Without
Context('No development team shows message', () async {
final XcodeBuildResult buildResult = XcodeBuildResult(
success: false,
stdout: '''
...
...
@@ -328,9 +321,9 @@ Could not build the precompiled application for the device.''',
logger.errorText,
contains('Building a deployable iOS app requires a selected Development Team with a
\n
Provisioning Profile.'),
);
}
, overrides: noColorTerminalOverride
);
});
test
Using
Context('embedded and linked framework iOS mismatch shows message', () async {
test
Without
Context('embedded and linked framework iOS mismatch shows message', () async {
final XcodeBuildResult buildResult = XcodeBuildResult(
success: false,
stdout: '''
...
...
@@ -365,9 +358,9 @@ Exited (sigterm)''',
logger.errorText,
contains('Your Xcode project requires migration.'),
);
}
, overrides: noColorTerminalOverride
);
});
test
Using
Context('embedded and linked framework iOS simulator mismatch shows message', () async {
test
Without
Context('embedded and linked framework iOS simulator mismatch shows message', () async {
final XcodeBuildResult buildResult = XcodeBuildResult(
success: false,
stdout: '''
...
...
@@ -402,7 +395,7 @@ Exited (sigterm)''',
logger.errorText,
contains('Your Xcode project requires migration.'),
);
}
, overrides: noColorTerminalOverride
);
});
});
group('Upgrades project.pbxproj for old asset usage', () {
...
...
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