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
95cd3c03
Unverified
Commit
95cd3c03
authored
Jun 02, 2023
by
Michael Goderbauer
Committed by
GitHub
Jun 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make --flutter-repo analyze whole repo (#127990)
Fixes
https://github.com/flutter/flutter/issues/127989
.
parent
7febf62c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
15 deletions
+42
-15
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+0
-2
analyze_base.dart
packages/flutter_tools/lib/src/commands/analyze_base.dart
+3
-3
analyze_continuously.dart
.../flutter_tools/lib/src/commands/analyze_continuously.dart
+1
-6
analyze_once.dart
packages/flutter_tools/lib/src/commands/analyze_once.dart
+1
-4
analyze_test.dart
...tter_tools/test/commands.shard/hermetic/analyze_test.dart
+37
-0
No files found.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
95cd3c03
...
@@ -176,7 +176,6 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -176,7 +176,6 @@ class AnalyzeCommand extends FlutterCommand {
}
else
if
(
boolArg
(
'watch'
))
{
}
else
if
(
boolArg
(
'watch'
))
{
await
AnalyzeContinuously
(
await
AnalyzeContinuously
(
argResults
!,
argResults
!,
runner
!.
getRepoRoots
(),
runner
!.
getRepoPackages
(),
runner
!.
getRepoPackages
(),
fileSystem:
_fileSystem
,
fileSystem:
_fileSystem
,
logger:
_logger
,
logger:
_logger
,
...
@@ -189,7 +188,6 @@ class AnalyzeCommand extends FlutterCommand {
...
@@ -189,7 +188,6 @@ class AnalyzeCommand extends FlutterCommand {
}
else
{
}
else
{
await
AnalyzeOnce
(
await
AnalyzeOnce
(
argResults
!,
argResults
!,
runner
!.
getRepoRoots
(),
runner
!.
getRepoPackages
(),
runner
!.
getRepoPackages
(),
workingDirectory:
workingDirectory
,
workingDirectory:
workingDirectory
,
fileSystem:
_fileSystem
,
fileSystem:
_fileSystem
,
...
...
packages/flutter_tools/lib/src/commands/analyze_base.dart
View file @
95cd3c03
...
@@ -20,7 +20,6 @@ import '../globals.dart' as globals;
...
@@ -20,7 +20,6 @@ import '../globals.dart' as globals;
/// Common behavior for `flutter analyze` and `flutter analyze --watch`
/// Common behavior for `flutter analyze` and `flutter analyze --watch`
abstract
class
AnalyzeBase
{
abstract
class
AnalyzeBase
{
AnalyzeBase
(
this
.
argResults
,
{
AnalyzeBase
(
this
.
argResults
,
{
required
this
.
repoRoots
,
required
this
.
repoPackages
,
required
this
.
repoPackages
,
required
this
.
fileSystem
,
required
this
.
fileSystem
,
required
this
.
logger
,
required
this
.
logger
,
...
@@ -34,8 +33,6 @@ abstract class AnalyzeBase {
...
@@ -34,8 +33,6 @@ abstract class AnalyzeBase {
/// The parsed argument results for execution.
/// The parsed argument results for execution.
final
ArgResults
argResults
;
final
ArgResults
argResults
;
@protected
@protected
final
List
<
String
>
repoRoots
;
@protected
final
List
<
Directory
>
repoPackages
;
final
List
<
Directory
>
repoPackages
;
@protected
@protected
final
FileSystem
fileSystem
;
final
FileSystem
fileSystem
;
...
@@ -52,6 +49,9 @@ abstract class AnalyzeBase {
...
@@ -52,6 +49,9 @@ abstract class AnalyzeBase {
@protected
@protected
final
bool
suppressAnalytics
;
final
bool
suppressAnalytics
;
@protected
String
get
flutterRoot
=>
globals
.
fs
.
path
.
absolute
(
Cache
.
flutterRoot
!);
/// Called by [AnalyzeCommand] to start the analysis process.
/// Called by [AnalyzeCommand] to start the analysis process.
Future
<
void
>
analyze
();
Future
<
void
>
analyze
();
...
...
packages/flutter_tools/lib/src/commands/analyze_continuously.dart
View file @
95cd3c03
...
@@ -13,7 +13,6 @@ import 'analyze_base.dart';
...
@@ -13,7 +13,6 @@ import 'analyze_base.dart';
class
AnalyzeContinuously
extends
AnalyzeBase
{
class
AnalyzeContinuously
extends
AnalyzeBase
{
AnalyzeContinuously
(
AnalyzeContinuously
(
super
.
argResults
,
super
.
argResults
,
List
<
String
>
repoRoots
,
List
<
Directory
>
repoPackages
,
{
List
<
Directory
>
repoPackages
,
{
required
super
.
fileSystem
,
required
super
.
fileSystem
,
required
super
.
logger
,
required
super
.
logger
,
...
@@ -24,7 +23,6 @@ class AnalyzeContinuously extends AnalyzeBase {
...
@@ -24,7 +23,6 @@ class AnalyzeContinuously extends AnalyzeBase {
required
super
.
suppressAnalytics
,
required
super
.
suppressAnalytics
,
})
:
super
(
})
:
super
(
repoPackages:
repoPackages
,
repoPackages:
repoPackages
,
repoRoots:
repoRoots
,
);
);
String
?
analysisTarget
;
String
?
analysisTarget
;
...
@@ -43,13 +41,10 @@ class AnalyzeContinuously extends AnalyzeBase {
...
@@ -43,13 +41,10 @@ class AnalyzeContinuously extends AnalyzeBase {
final
PackageDependencyTracker
dependencies
=
PackageDependencyTracker
();
final
PackageDependencyTracker
dependencies
=
PackageDependencyTracker
();
dependencies
.
checkForConflictingDependencies
(
repoPackages
,
dependencies
);
dependencies
.
checkForConflictingDependencies
(
repoPackages
,
dependencies
);
directories
=
repoRoots
;
directories
=
<
String
>[
flutterRoot
]
;
analysisTarget
=
'Flutter repository'
;
analysisTarget
=
'Flutter repository'
;
logger
.
printTrace
(
'Analyzing Flutter repository:'
);
logger
.
printTrace
(
'Analyzing Flutter repository:'
);
for
(
final
String
projectPath
in
repoRoots
)
{
logger
.
printTrace
(
'
${fileSystem.path.relative(projectPath)}
'
);
}
}
else
{
}
else
{
directories
=
<
String
>[
fileSystem
.
currentDirectory
.
path
];
directories
=
<
String
>[
fileSystem
.
currentDirectory
.
path
];
analysisTarget
=
fileSystem
.
currentDirectory
.
path
;
analysisTarget
=
fileSystem
.
currentDirectory
.
path
;
...
...
packages/flutter_tools/lib/src/commands/analyze_once.dart
View file @
95cd3c03
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
...
@@ -14,7 +13,6 @@ import 'analyze_base.dart';
...
@@ -14,7 +13,6 @@ import 'analyze_base.dart';
class
AnalyzeOnce
extends
AnalyzeBase
{
class
AnalyzeOnce
extends
AnalyzeBase
{
AnalyzeOnce
(
AnalyzeOnce
(
super
.
argResults
,
super
.
argResults
,
List
<
String
>
repoRoots
,
List
<
Directory
>
repoPackages
,
{
List
<
Directory
>
repoPackages
,
{
required
super
.
fileSystem
,
required
super
.
fileSystem
,
required
super
.
logger
,
required
super
.
logger
,
...
@@ -25,7 +23,6 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -25,7 +23,6 @@ class AnalyzeOnce extends AnalyzeBase {
required
super
.
suppressAnalytics
,
required
super
.
suppressAnalytics
,
this
.
workingDirectory
,
this
.
workingDirectory
,
})
:
super
(
})
:
super
(
repoRoots:
repoRoots
,
repoPackages:
repoPackages
,
repoPackages:
repoPackages
,
);
);
...
@@ -42,7 +39,7 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -42,7 +39,7 @@ class AnalyzeOnce extends AnalyzeBase {
// check for conflicting dependencies
// check for conflicting dependencies
final
PackageDependencyTracker
dependencies
=
PackageDependencyTracker
();
final
PackageDependencyTracker
dependencies
=
PackageDependencyTracker
();
dependencies
.
checkForConflictingDependencies
(
repoPackages
,
dependencies
);
dependencies
.
checkForConflictingDependencies
(
repoPackages
,
dependencies
);
items
.
add
All
(
repoRoots
);
items
.
add
(
flutterRoot
);
if
(
argResults
.
wasParsed
(
'current-package'
)
&&
(
argResults
[
'current-package'
]
as
bool
))
{
if
(
argResults
.
wasParsed
(
'current-package'
)
&&
(
argResults
[
'current-package'
]
as
bool
))
{
items
.
add
(
currentDirectory
);
items
.
add
(
currentDirectory
);
}
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/analyze_test.dart
View file @
95cd3c03
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:convert'
;
import
'package:args/command_runner.dart'
;
import
'package:args/command_runner.dart'
;
import
'package:file/file.dart'
;
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
...
@@ -118,6 +121,40 @@ void main() {
...
@@ -118,6 +121,40 @@ void main() {
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
});
});
testUsingContext
(
'--flutter-repo analyzes everything in the flutterRoot'
,
()
async
{
final
StreamController
<
List
<
int
>>
streamController
=
StreamController
<
List
<
int
>>();
final
IOSink
sink
=
IOSink
(
streamController
.
sink
);
processManager
.
addCommands
(
<
FakeCommand
>[
FakeCommand
(
// artifact paths are from Artifacts.test() and stable
command:
const
<
String
>[
'Artifact.engineDartSdkPath/bin/dart'
,
'--disable-dart-dev'
,
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot'
,
'--disable-server-feature-completion'
,
'--disable-server-feature-search'
,
'--sdk'
,
'Artifact.engineDartSdkPath'
,
'--suppress-analytics'
,
],
stdin:
sink
,
stdout:
'{"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}'
,
),
],
);
await
runner
.
run
(<
String
>[
'analyze'
,
'--flutter-repo'
]);
final
Map
<
String
,
Object
?>
setAnalysisRootsCommand
=
jsonDecode
(
await
streamController
.
stream
.
transform
(
utf8
.
decoder
).
elementAt
(
2
))
as
Map
<
String
,
Object
?>;
expect
(
setAnalysisRootsCommand
[
'method'
],
'analysis.setAnalysisRoots'
);
final
Map
<
String
,
Object
?>
params
=
setAnalysisRootsCommand
[
'params'
]!
as
Map
<
String
,
Object
?>;
expect
(
params
[
'included'
],
<
String
?>[
Cache
.
flutterRoot
]);
expect
(
params
[
'excluded'
],
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
});
});
testWithoutContext
(
'analyze inRepo'
,
()
{
testWithoutContext
(
'analyze inRepo'
,
()
{
...
...
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