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
a55a745c
Commit
a55a745c
authored
Feb 17, 2017
by
Michael Goderbauer
Committed by
GitHub
Feb 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail tests with an actionable message when FLUTTER_ROOT is not set (#8236)
Also: Fix some analyzer warnings.
parent
d7b0f7db
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
51 deletions
+31
-51
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+1
-1
asset.dart
packages/flutter_tools/lib/src/asset.dart
+3
-2
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+1
-1
all.dart
packages/flutter_tools/test/all.dart
+2
-4
forbid_package_path_test.dart
packages/flutter_tools/test/forbid_package_path_test.dart
+0
-36
forbidden_imports_test.dart
packages/flutter_tools/test/forbidden_imports_test.dart
+24
-7
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
a55a745c
...
...
@@ -140,7 +140,7 @@ class AndroidSdk {
if
(
platformsDir
.
existsSync
())
{
platforms
=
platformsDir
.
listSync
()
.
map
((
FileSystemEntity
entity
)
=>
fs
.
path
.
basename
(
entity
.
path
))
.
map
<
String
>
((
FileSystemEntity
entity
)
=>
fs
.
path
.
basename
(
entity
.
path
))
.
where
((
String
name
)
=>
name
.
startsWith
(
'android-'
))
.
toList
();
}
...
...
packages/flutter_tools/lib/src/asset.dart
View file @
a55a745c
...
...
@@ -336,8 +336,9 @@ Map<_Asset, List<_Asset>> _parseAssets(
if
(
manifestDescriptor
==
null
)
return
result
;
excludeDirs
=
excludeDirs
.
map
(
(
String
exclude
)
=>
fs
.
path
.
absolute
(
exclude
)
+
fs
.
path
.
separator
).
toList
();
excludeDirs
=
excludeDirs
.
map
<
String
>(
(
String
exclude
)
=>
fs
.
path
.
absolute
(
exclude
)
+
fs
.
path
.
separator
).
toList
();
if
(
manifestDescriptor
.
containsKey
(
'assets'
))
{
for
(
String
asset
in
manifestDescriptor
[
'assets'
])
{
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
a55a745c
...
...
@@ -172,7 +172,7 @@ class TestCommand extends FlutterCommand {
testArgs
.
add
(
'--'
);
Directory
testDir
;
Iterable
<
String
>
files
=
argResults
.
rest
.
map
((
String
testPath
)
=>
fs
.
path
.
absolute
(
testPath
)).
toList
();
Iterable
<
String
>
files
=
argResults
.
rest
.
map
<
String
>
((
String
testPath
)
=>
fs
.
path
.
absolute
(
testPath
)).
toList
();
if
(
argResults
[
'start-paused'
])
{
if
(
files
.
length
!=
1
)
throwToolExit
(
'When using --start-paused, you must specify a single test file to run.'
,
exitCode:
1
);
...
...
packages/flutter_tools/test/all.dart
View file @
a55a745c
...
...
@@ -30,8 +30,7 @@ import 'device_test.dart' as device_test;
import
'devices_test.dart'
as
devices_test
;
import
'doctor_test.dart'
as
doctor_test
;
import
'drive_test.dart'
as
drive_test
;
import
'forbid_dart_io_test.dart'
as
forbid_dart_io_test
;
import
'forbid_package_path_test.dart'
as
forbid_package_path_test
;
import
'forbidden_imports_test.dart'
as
forbidden_imports_test
;
import
'format_test.dart'
as
format_test
;
import
'hot_test.dart'
as
hot_test
;
import
'install_test.dart'
as
install_test
;
...
...
@@ -70,8 +69,7 @@ void main() {
devices_test
.
main
();
doctor_test
.
main
();
drive_test
.
main
();
forbid_dart_io_test
.
main
();
forbid_package_path_test
.
main
();
forbidden_imports_test
.
main
();
format_test
.
main
();
hot_test
.
main
();
install_test
.
main
();
...
...
packages/flutter_tools/test/forbid_package_path_test.dart
deleted
100644 → 0
View file @
d7b0f7db
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
setUp
(()
{
String
flutterTools
=
fs
.
path
.
join
(
platform
.
environment
[
'FLUTTER_ROOT'
],
'packages'
,
'flutter_tools'
);
assert
(
fs
.
path
.
equals
(
fs
.
currentDirectory
.
path
,
flutterTools
));
});
test
(
'no unauthorized imports of package:path'
,
()
{
for
(
String
path
in
<
String
>[
'lib'
,
'bin'
,
'test'
])
{
fs
.
directory
(
path
)
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
map
(
_asFile
)
.
forEach
((
File
file
)
{
for
(
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
new
RegExp
(
'import.*package:path/path.dart'
)))
{
fail
(
"
${file.path}
imports 'package:path/path.dart'; use 'fs.path' instead"
);
}
}
}
);
}
});
}
bool
_isDartFile
(
FileSystemEntity
entity
)
=>
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
File
_asFile
(
FileSystemEntity
entity
)
=>
entity
;
packages/flutter_tools/test/forbid
_dart_io
_test.dart
→
packages/flutter_tools/test/forbid
den_imports
_test.dart
View file @
a55a745c
...
...
@@ -8,12 +8,16 @@ import 'package:test/test.dart';
void
main
(
)
{
setUp
(()
{
String
flutterTools
=
fs
.
path
.
join
(
platform
.
environment
[
'FLUTTER_ROOT'
],
'packages'
,
'flutter_tools'
);
String
flutterRoot
=
platform
.
environment
[
'FLUTTER_ROOT'
];
if
(
flutterRoot
==
null
)
throw
new
Exception
(
'Please set FLUTTER_ROOT env var before running tests.'
);
String
flutterTools
=
fs
.
path
.
join
(
flutterRoot
,
'packages'
,
'flutter_tools'
);
assert
(
fs
.
path
.
equals
(
fs
.
currentDirectory
.
path
,
flutterTools
));
});
test
(
'no unauthorized imports of dart:io'
,
()
{
bool
_isNotWhitelisted
(
FileSystemEntity
entity
)
=>
entity
.
path
!=
fs
.
path
.
join
(
'lib'
,
'src'
,
'base'
,
'io.dart'
);
for
(
String
path
in
<
String
>[
'lib'
,
'bin'
])
{
fs
.
directory
(
path
)
.
listSync
(
recursive:
true
)
...
...
@@ -31,12 +35,25 @@ void main() {
);
}
});
}
bool
_isDartFile
(
FileSystemEntity
entity
)
=>
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
test
(
'no unauthorized imports of package:path'
,
()
{
for
(
String
path
in
<
String
>[
'lib'
,
'bin'
,
'test'
])
{
fs
.
directory
(
path
)
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
map
(
_asFile
)
.
forEach
((
File
file
)
{
for
(
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
new
RegExp
(
'import.*package:path/path.dart'
)))
{
fail
(
"
${file.path}
imports 'package:path/path.dart'; use 'fs.path' instead"
);
}
}
}
);
}
});
}
bool
_isNotWhitelisted
(
FileSystemEntity
entity
)
=>
entity
.
path
!=
fs
.
path
.
join
(
'lib'
,
'src'
,
'base'
,
'io.dart'
);
bool
_isDartFile
(
FileSystemEntity
entity
)
=>
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
File
_asFile
(
FileSystemEntity
entity
)
=>
entity
;
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