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
83a88058
Unverified
Commit
83a88058
authored
Feb 25, 2022
by
Jonah Williams
Committed by
GitHub
Feb 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use dart pub deps to analyze consumer dependencies (#99079)
parent
281f1421
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
45 deletions
+46
-45
allowlist.dart
dev/bots/allowlist.dart
+4
-29
analyze.dart
dev/bots/analyze.dart
+42
-16
No files found.
dev/bots/allowlist.dart
View file @
83a88058
...
...
@@ -17,18 +17,13 @@
/// unless the additions are cleared as described above.
const
Set
<
String
>
kCorePackageAllowList
=
<
String
>{
// Please keep this list in alphabetical order.
'_fe_analyzer_shared'
,
'analyzer'
,
'archive'
,
'args'
,
'async'
,
'boolean_selector'
,
'characters'
,
'charcode'
,
'clock'
,
'collection'
,
'convert'
,
'coverage'
,
'crypto'
,
'fake_async'
,
'file'
,
...
...
@@ -36,45 +31,25 @@ const Set<String> kCorePackageAllowList = <String>{
'flutter_driver'
,
'flutter_localizations'
,
'flutter_test'
,
'frontend_server_client'
,
'glob'
,
'http_multi_server'
,
'http_parser'
,
'fuchsia_remote_debug_protocol'
,
'integration_test'
,
'intl'
,
'io'
,
'js'
,
'logging'
,
'matcher'
,
'material_color_utilities'
,
'meta'
,
'mime'
,
'node_preamble'
,
'package_config'
,
'path'
,
'pool'
,
'pub_semver'
,
'shelf'
,
'shelf_packages_handler'
,
'shelf_static'
,
'shelf_web_socket'
,
'source_map_stack_trace'
,
'source_maps'
,
'platform'
,
'process'
,
'sky_engine'
,
'source_span'
,
'stack_trace'
,
'stream_channel'
,
'string_scanner'
,
'sync_http'
,
'term_glyph'
,
'test'
,
'test_api'
,
'test_core'
,
'typed_data'
,
'vector_math'
,
'vm_service'
,
'watcher'
,
'web_socket_channel'
,
'webdriver'
,
'webkit_inspection_protocol'
,
'yaml'
,
};
dev/bots/analyze.dart
View file @
83a88058
...
...
@@ -1565,24 +1565,50 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
}
Future
<
void
>
_checkConsumerDependencies
()
async
{
final
ProcessResult
result
=
await
Process
.
run
(
flutter
,
<
String
>[
'update-packages'
,
'--transitive-closure'
,
'--consumer-only'
,
]);
if
(
result
.
exitCode
!=
0
)
{
print
(
result
.
stdout
as
Object
);
print
(
result
.
stderr
as
Object
);
exit
(
result
.
exitCode
);
}
const
List
<
String
>
kCorePackages
=
<
String
>[
'flutter'
,
'flutter_test'
,
'flutter_driver'
,
'flutter_localizations'
,
'integration_test'
,
'fuchsia_remote_debug_protocol'
,
];
final
Set
<
String
>
dependencies
=
<
String
>{};
for
(
final
String
line
in
result
.
stdout
.
toString
().
split
(
'
\n
'
))
{
if
(!
line
.
contains
(
'->'
))
{
continue
;
// Parse the output of pub deps --json to determine all of the
// current packages used by the core set of flutter packages.
for
(
final
String
package
in
kCorePackages
)
{
final
ProcessResult
result
=
await
Process
.
run
(
dart
,
<
String
>[
'pub'
,
'deps'
,
'--json'
,
'--directory=
${path.join(flutterRoot, 'packages', package)}
'
]);
if
(
result
.
exitCode
!=
0
)
{
print
(
result
.
stdout
as
Object
);
print
(
result
.
stderr
as
Object
);
exit
(
result
.
exitCode
);
}
final
Map
<
String
,
Object
?>
rawJson
=
json
.
decode
(
result
.
stdout
as
String
)
as
Map
<
String
,
Object
?>;
final
Map
<
String
,
Map
<
String
,
Object
?>>
dependencyTree
=
<
String
,
Map
<
String
,
Object
?>>{
for
(
final
Map
<
String
,
Object
?>
package
in
(
rawJson
[
'packages'
]!
as
List
<
Object
?>).
cast
<
Map
<
String
,
Object
?>>())
package
[
'name'
]!
as
String
:
package
,
};
final
List
<
Map
<
String
,
Object
?>>
workset
=
<
Map
<
String
,
Object
?>>[];
workset
.
add
(
dependencyTree
[
package
]!);
while
(
workset
.
isNotEmpty
)
{
final
Map
<
String
,
Object
?>
currentPackage
=
workset
.
removeLast
();
if
(
currentPackage
[
'kind'
]
==
'dev'
)
{
continue
;
}
dependencies
.
add
(
currentPackage
[
'name'
]!
as
String
);
final
List
<
String
>
currentDependencies
=
(
currentPackage
[
'dependencies'
]!
as
List
<
Object
?>).
cast
<
String
>();
for
(
final
String
dependency
in
currentDependencies
)
{
workset
.
add
(
dependencyTree
[
dependency
]!);
}
}
final
List
<
String
>
parts
=
line
.
split
(
'->'
);
final
String
name
=
parts
[
0
].
trim
();
dependencies
.
add
(
name
);
}
final
Set
<
String
>
removed
=
kCorePackageAllowList
.
difference
(
dependencies
);
...
...
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