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
fb808b40
Unverified
Commit
fb808b40
authored
Feb 12, 2021
by
Jonah Williams
Committed by
GitHub
Feb 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] add package:http to forbidden imports test (#75925)
parent
486ba893
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
runner.dart
packages/flutter_tools/lib/runner.dart
+0
-2
crash_reporting.dart
...ages/flutter_tools/lib/src/reporting/crash_reporting.dart
+2
-2
forbidden_imports_test.dart
..._tools/test/integration.shard/forbidden_imports_test.dart
+25
-0
No files found.
packages/flutter_tools/lib/runner.dart
View file @
fb808b40
...
...
@@ -7,7 +7,6 @@
import
'dart:async'
;
import
'package:args/command_runner.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:intl/intl.dart'
as
intl
;
import
'package:intl/intl_standalone.dart'
as
intl_standalone
;
...
...
@@ -136,7 +135,6 @@ Future<int> _handleToolError(
globals
.
flutterUsage
.
sendException
(
error
);
await
asyncGuard
(()
async
{
final
CrashReportSender
crashReportSender
=
CrashReportSender
(
client:
http
.
Client
(),
usage:
globals
.
flutterUsage
,
platform:
globals
.
platform
,
logger:
globals
.
logger
,
...
...
packages/flutter_tools/lib/src/reporting/crash_reporting.dart
View file @
fb808b40
...
...
@@ -97,12 +97,12 @@ class CrashReporter {
/// wish to use your own server for collecting crash reports from Flutter Tools.
class
CrashReportSender
{
CrashReportSender
({
@required
http
.
Client
client
,
http
.
Client
client
,
@required
Usage
usage
,
@required
Platform
platform
,
@required
Logger
logger
,
@required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_client
=
client
,
})
:
_client
=
client
??
http
.
Client
()
,
_usage
=
usage
,
_platform
=
platform
,
_logger
=
logger
,
...
...
packages/flutter_tools/test/integration.shard/forbidden_imports_test.dart
View file @
fb808b40
...
...
@@ -86,6 +86,31 @@ void main() {
}
});
test
(
'no unauthorized imports of package:http'
,
()
{
final
List
<
String
>
allowedPaths
=
<
String
>[
// Used only for multi-part file uploads, which are non-trivial to reimplement.
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'reporting'
,
'reporting.dart'
),
];
bool
_isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
path
!=
entity
.
path
);
for
(
final
String
dirName
in
<
String
>[
'lib'
,
'bin'
])
{
final
Iterable
<
File
>
files
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
flutterTools
,
dirName
))
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
where
(
_isNotAllowed
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
RegExp
(
r'import.*package:http/'
))
&&
!
line
.
contains
(
'ignore: package_http_import'
))
{
final
String
relativePath
=
fileSystem
.
path
.
relative
(
file
.
path
,
from:
flutterTools
);
fail
(
"
$relativePath
imports 'package:http'; import 'lib/src/base/io.dart' instead"
);
}
}
}
}
});
test
(
'no unauthorized imports of test_api'
,
()
{
final
List
<
String
>
allowedPaths
=
<
String
>[
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'test'
,
'flutter_platform.dart'
),
...
...
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