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
d52f315c
Unverified
Commit
d52f315c
authored
Nov 02, 2018
by
Jonah Williams
Committed by
GitHub
Nov 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new benchmark to track cost of dependencies to a User (#23856)
parent
36b99832
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
technical_debt__cost.dart
dev/devicelab/bin/tasks/technical_debt__cost.dart
+14
-0
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+26
-0
No files found.
dev/devicelab/bin/tasks/technical_debt__cost.dart
View file @
d52f315c
...
...
@@ -73,8 +73,20 @@ Future<int> countDependencies() async {
return
count
;
}
Future
<
int
>
countConsumerDependencies
()
async
{
final
List
<
String
>
lines
=
(
await
evalFlutter
(
'update-packages'
,
options:
<
String
>[
'--transitive-closure'
,
'--consumer-only'
],
)).
split
(
'
\n
'
);
final
int
count
=
lines
.
where
((
String
line
)
=>
line
.
contains
(
'->'
)).
length
;
if
(
count
<
2
)
// we'll always have flutter and flutter_test, at least...
throw
Exception
(
'"flutter update-packages --transitive-closure" returned bogus output:
\n
${lines.join("\n")}
'
);
return
count
;
}
const
String
_kCostBenchmarkKey
=
'technical_debt_in_dollars'
;
const
String
_kNumberOfDependenciesKey
=
'dependencies_count'
;
const
String
_kNumberOfConsumerDependenciesKey
=
'consumer_dependencies_count'
;
Future
<
void
>
main
()
async
{
await
task
(()
async
{
...
...
@@ -82,10 +94,12 @@ Future<void> main() async {
<
String
,
dynamic
>{
_kCostBenchmarkKey:
await
findCostsForRepo
(),
_kNumberOfDependenciesKey:
await
countDependencies
(),
_kNumberOfConsumerDependenciesKey:
await
countConsumerDependencies
(),
},
benchmarkScoreKeys:
<
String
>[
_kCostBenchmarkKey
,
_kNumberOfDependenciesKey
,
_kNumberOfConsumerDependenciesKey
,
],
);
});
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
d52f315c
...
...
@@ -65,6 +65,14 @@ class UpdatePackagesCommand extends FlutterCommand {
defaultsTo:
false
,
negatable:
false
,
)
..
addFlag
(
'consumer-only'
,
help:
'Only prints the dependency graph that is the transitive closure'
'that a consumer of the Flutter SDK will observe (When combined '
'with transitive-closure)'
,
defaultsTo:
false
,
negatable:
false
,
)
..
addFlag
(
'verify-only'
,
help:
'verifies the package checksum without changing or updating deps'
,
...
...
@@ -107,6 +115,24 @@ class UpdatePackagesCommand extends FlutterCommand {
final
bool
isPrintPaths
=
argResults
[
'paths'
];
final
bool
isPrintTransitiveClosure
=
argResults
[
'transitive-closure'
];
final
bool
isVerifyOnly
=
argResults
[
'verify-only'
];
final
bool
isConsumerOnly
=
argResults
[
'consumer-only'
];
// "consumer" packages are those that constitute our public API (e.g. flutter, flutter_test, flutter_driver, flutter_localizations).
if
(
isConsumerOnly
)
{
if
(!
isPrintTransitiveClosure
)
{
throwToolExit
(
'--consumer-only can only be used with the --transitive-closure flag'
);
}
// Only retain flutter, flutter_test, flutter_driver, and flutter_localizations.
const
List
<
String
>
consumerPackages
=
<
String
>[
'flutter'
,
'flutter_test'
,
'flutter_driver'
,
'flutter_localizations'
];
// ensure we only get flutter/packages
packages
.
retainWhere
((
Directory
directory
)
{
return
consumerPackages
.
any
((
String
package
)
{
return
directory
.
path
.
endsWith
(
'packages
${fs.path.separator}$package
'
);
});
});
}
// The dev/integration_tests/android_views integration test depends on an assets
// package that is in the goldens repository. We need to make sure that the goldens
...
...
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