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
b5e7fb07
Unverified
Commit
b5e7fb07
authored
Apr 27, 2022
by
Phil Quitslund
Committed by
GitHub
Apr 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] rename local functions with `_`s (#102688)
parent
a03f59cd
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
341 additions
and
341 deletions
+341
-341
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+12
-12
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+3
-3
bitcode.dart
packages/flutter_tools/lib/src/ios/bitcode.dart
+4
-4
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+3
-3
devfs_web.dart
packages/flutter_tools/lib/src/isolated/devfs_web.dart
+2
-2
gen_l10n_types.dart
...s/flutter_tools/lib/src/localizations/gen_l10n_types.dart
+3
-3
analyze_continuously_test.dart
...st/commands.shard/hermetic/analyze_continuously_test.dart
+3
-3
build_ios_test.dart
...er_tools/test/commands.shard/hermetic/build_ios_test.dart
+95
-95
build_ipa_test.dart
...er_tools/test/commands.shard/hermetic/build_ipa_test.dart
+50
-50
ide_config_test.dart
...r_tools/test/commands.shard/hermetic/ide_config_test.dart
+46
-46
user_messages_test.dart
...ter_tools/test/general.shard/base/user_messages_test.dart
+7
-7
icon_tree_shaker_test.dart
...ral.shard/build_system/targets/icon_tree_shaker_test.dart
+31
-31
xcresult_test.dart
...s/flutter_tools/test/general.shard/ios/xcresult_test.dart
+16
-16
plugins_test.dart
packages/flutter_tools/test/general.shard/plugins_test.dart
+2
-2
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+29
-29
version_test.dart
packages/flutter_tools/test/general.shard/version_test.dart
+4
-4
visual_studio_validator_test.dart
...t/general.shard/windows/visual_studio_validator_test.dart
+12
-12
analyze_once_test.dart
...utter_tools/test/integration.shard/analyze_once_test.dart
+2
-2
flutter_build_android_app_project_builddir_test.dart
...hard/flutter_build_android_app_project_builddir_test.dart
+3
-3
forbidden_imports_test.dart
..._tools/test/integration.shard/forbidden_imports_test.dart
+14
-14
No files found.
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
b5e7fb07
...
...
@@ -249,7 +249,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
static
List
<
AndroidStudio
>
_allMacOS
()
{
final
List
<
FileSystemEntity
>
candidatePaths
=
<
FileSystemEntity
>[];
void
_
checkForStudio
(
String
path
)
{
void
checkForStudio
(
String
path
)
{
if
(!
globals
.
fs
.
isDirectorySync
(
path
))
{
return
;
}
...
...
@@ -264,7 +264,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
if
(
name
.
startsWith
(
'Android Studio'
)
&&
name
.
endsWith
(
'.app'
))
{
candidatePaths
.
add
(
directory
);
}
else
if
(!
directory
.
path
.
endsWith
(
'.app'
))
{
_
checkForStudio
(
directory
.
path
);
checkForStudio
(
directory
.
path
);
}
}
}
on
Exception
catch
(
e
)
{
...
...
@@ -272,10 +272,10 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}
}
_
checkForStudio
(
'/Applications'
);
checkForStudio
(
'/Applications'
);
final
String
?
homeDirPath
=
globals
.
fsUtils
.
homeDirPath
;
if
(
homeDirPath
!=
null
)
{
_
checkForStudio
(
globals
.
fs
.
path
.
join
(
checkForStudio
(
globals
.
fs
.
path
.
join
(
homeDirPath
,
'Applications'
,
));
...
...
@@ -321,7 +321,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
static
List
<
AndroidStudio
>
_allLinuxOrWindows
()
{
final
List
<
AndroidStudio
>
studios
=
<
AndroidStudio
>[];
bool
_
hasStudioAt
(
String
path
,
{
Version
?
newerThan
})
{
bool
hasStudioAt
(
String
path
,
{
Version
?
newerThan
})
{
return
studios
.
any
((
AndroidStudio
studio
)
{
if
(
studio
.
directory
!=
path
)
{
return
false
;
...
...
@@ -363,7 +363,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
for
(
final
Directory
entity
in
entities
)
{
final
AndroidStudio
?
studio
=
AndroidStudio
.
fromHomeDot
(
entity
);
if
(
studio
!=
null
&&
!
_
hasStudioAt
(
studio
.
directory
,
newerThan:
studio
.
version
))
{
if
(
studio
!=
null
&&
!
hasStudioAt
(
studio
.
directory
,
newerThan:
studio
.
version
))
{
studios
.
removeWhere
((
AndroidStudio
other
)
=>
other
.
directory
==
studio
.
directory
);
studios
.
add
(
studio
);
}
...
...
@@ -394,7 +394,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
version:
Version
.
parse
(
version
),
studioAppName:
title
,
);
if
(
studio
!=
null
&&
!
_
hasStudioAt
(
studio
.
directory
,
newerThan:
studio
.
version
))
{
if
(
studio
!=
null
&&
!
hasStudioAt
(
studio
.
directory
,
newerThan:
studio
.
version
))
{
studios
.
removeWhere
((
AndroidStudio
other
)
=>
other
.
directory
==
studio
.
directory
);
studios
.
add
(
studio
);
}
...
...
@@ -405,21 +405,21 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}
final
String
?
configuredStudioDir
=
globals
.
config
.
getValue
(
'android-studio-dir'
)
as
String
?;
if
(
configuredStudioDir
!=
null
&&
!
_
hasStudioAt
(
configuredStudioDir
))
{
if
(
configuredStudioDir
!=
null
&&
!
hasStudioAt
(
configuredStudioDir
))
{
studios
.
add
(
AndroidStudio
(
configuredStudioDir
,
configured:
configuredStudioDir
));
}
if
(
globals
.
platform
.
isLinux
)
{
void
_
checkWellKnownPath
(
String
path
)
{
if
(
globals
.
fs
.
isDirectorySync
(
path
)
&&
!
_
hasStudioAt
(
path
))
{
void
checkWellKnownPath
(
String
path
)
{
if
(
globals
.
fs
.
isDirectorySync
(
path
)
&&
!
hasStudioAt
(
path
))
{
studios
.
add
(
AndroidStudio
(
path
));
}
}
// Add /opt/android-studio and $HOME/android-studio, if they exist.
_
checkWellKnownPath
(
'/opt/android-studio'
);
_
checkWellKnownPath
(
'
${globals.fsUtils.homeDirPath}
/android-studio'
);
checkWellKnownPath
(
'/opt/android-studio'
);
checkWellKnownPath
(
'
${globals.fsUtils.homeDirPath}
/android-studio'
);
}
return
studios
;
}
...
...
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
b5e7fb07
...
...
@@ -366,7 +366,7 @@ class AndroidLicenseValidator extends DoctorValidator {
Future
<
LicensesAccepted
>
get
licensesAccepted
async
{
LicensesAccepted
?
status
;
void
_
handleLine
(
String
line
)
{
void
handleLine
(
String
line
)
{
if
(
licenseCounts
.
hasMatch
(
line
))
{
final
Match
?
match
=
licenseCounts
.
firstMatch
(
line
);
if
(
match
?.
group
(
1
)
!=
match
?.
group
(
2
))
{
...
...
@@ -399,12 +399,12 @@ class AndroidLicenseValidator extends DoctorValidator {
final
Future
<
void
>
output
=
process
.
stdout
.
transform
<
String
>(
const
Utf8Decoder
(
reportErrors:
false
))
.
transform
<
String
>(
const
LineSplitter
())
.
listen
(
_
handleLine
)
.
listen
(
handleLine
)
.
asFuture
<
void
>(
null
);
final
Future
<
void
>
errors
=
process
.
stderr
.
transform
<
String
>(
const
Utf8Decoder
(
reportErrors:
false
))
.
transform
<
String
>(
const
LineSplitter
())
.
listen
(
_
handleLine
)
.
listen
(
handleLine
)
.
asFuture
<
void
>(
null
);
await
Future
.
wait
<
void
>(<
Future
<
void
>>[
output
,
errors
]);
return
status
??
LicensesAccepted
.
unknown
;
...
...
packages/flutter_tools/lib/src/ios/bitcode.dart
View file @
b5e7fb07
...
...
@@ -46,21 +46,21 @@ Future<void> validateBitcode(BuildMode buildMode, TargetPlatform targetPlatform,
Version
_parseVersionFromClang
(
String
?
clangVersion
)
{
final
RegExp
pattern
=
RegExp
(
r'Apple (LLVM|clang) version (\d+\.\d+\.\d+) '
);
Never
_
invalid
()
{
Never
invalid
()
{
throwToolExit
(
'Unable to parse Clang version from "
$clangVersion
". '
'Expected a string like "Apple (LLVM|clang) #.#.# (clang-####.#.##.#)".'
);
}
if
(
clangVersion
==
null
||
clangVersion
.
isEmpty
)
{
_
invalid
();
invalid
();
}
final
RegExpMatch
?
match
=
pattern
.
firstMatch
(
clangVersion
);
if
(
match
==
null
||
match
.
groupCount
!=
2
)
{
_
invalid
();
invalid
();
}
final
Version
?
version
=
Version
.
parse
(
match
.
group
(
2
));
if
(
version
==
null
)
{
_
invalid
();
invalid
();
}
return
version
;
}
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
b5e7fb07
...
...
@@ -301,7 +301,7 @@ class XcodeProjectInterpreter {
const
int
missingProjectExitCode
=
66
;
// The exit code returned by 'xcodebuild -list' when the project is corrupted.
const
int
corruptedProjectExitCode
=
74
;
bool
_
allowedFailures
(
int
c
)
=>
c
==
missingProjectExitCode
||
c
==
corruptedProjectExitCode
;
bool
allowedFailures
(
int
c
)
=>
c
==
missingProjectExitCode
||
c
==
corruptedProjectExitCode
;
final
RunResult
result
=
await
_processUtils
.
run
(
<
String
>[
...
xcrunCommand
(),
...
...
@@ -310,10 +310,10 @@ class XcodeProjectInterpreter {
if
(
projectFilename
!=
null
)
...<
String
>[
'-project'
,
projectFilename
],
],
throwOnError:
true
,
allowedFailures:
_
allowedFailures
,
allowedFailures:
allowedFailures
,
workingDirectory:
projectPath
,
);
if
(
_
allowedFailures
(
result
.
exitCode
))
{
if
(
allowedFailures
(
result
.
exitCode
))
{
// User configuration error, tool exit instead of crashing.
throwToolExit
(
'Unable to get Xcode project information:
\n
${result.stderr}
'
);
}
...
...
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
b5e7fb07
...
...
@@ -254,7 +254,7 @@ class WebAssetServer implements AssetReader {
// Return a version string for all active modules. This is populated
// along with the `moduleProvider` update logic.
Future
<
Map
<
String
,
String
>>
_
digestProvider
()
async
=>
digests
;
Future
<
Map
<
String
,
String
>>
digestProvider
()
async
=>
digests
;
// Ensure dwds is present and provide middleware to avoid trying to
// load the through the isolate APIs.
...
...
@@ -295,7 +295,7 @@ class WebAssetServer implements AssetReader {
loadStrategy:
FrontendServerRequireStrategyProvider
(
ReloadConfiguration
.
none
,
server
,
_
digestProvider
,
digestProvider
,
).
strategy
,
expressionCompiler:
expressionCompiler
,
spawnDds:
enableDds
,
...
...
packages/flutter_tools/lib/src/localizations/gen_l10n_types.dart
View file @
b5e7fb07
...
...
@@ -358,7 +358,7 @@ class Message {
if
(
attributes
==
null
)
{
void
_
throwEmptyAttributes
(
final
RegExp
regExp
,
final
String
type
)
{
void
throwEmptyAttributes
(
final
RegExp
regExp
,
final
String
type
)
{
final
RegExpMatch
?
match
=
regExp
.
firstMatch
(
_value
(
bundle
,
resourceId
));
final
bool
isMatch
=
match
!=
null
&&
match
.
groupCount
==
1
;
if
(
isMatch
)
{
...
...
@@ -369,8 +369,8 @@ class Message {
}
}
_
throwEmptyAttributes
(
_pluralRE
,
'plural'
);
_
throwEmptyAttributes
(
_selectRE
,
'select'
);
throwEmptyAttributes
(
_pluralRE
,
'plural'
);
throwEmptyAttributes
(
_selectRE
,
'select'
);
}
return
attributes
as
Map
<
String
,
Object
?>?;
...
...
packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
View file @
b5e7fb07
...
...
@@ -55,7 +55,7 @@ void main() {
});
void
_
createSampleProject
(
Directory
directory
,
{
bool
brokenCode
=
false
})
{
void
createSampleProject
(
Directory
directory
,
{
bool
brokenCode
=
false
})
{
final
File
pubspecFile
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
directory
.
path
,
'pubspec.yaml'
));
pubspecFile
.
writeAsStringSync
(
'''
name: foo_project
...
...
@@ -75,7 +75,7 @@ void main() {
group
(
'analyze --watch'
,
()
{
testUsingContext
(
'AnalysisServer success'
,
()
async
{
_
createSampleProject
(
tempDir
);
createSampleProject
(
tempDir
);
final
Pub
pub
=
Pub
(
fileSystem:
fileSystem
,
...
...
@@ -113,7 +113,7 @@ void main() {
});
testUsingContext
(
'AnalysisServer errors'
,
()
async
{
_
createSampleProject
(
tempDir
,
brokenCode:
true
);
createSampleProject
(
tempDir
,
brokenCode:
true
);
final
Pub
pub
=
Pub
(
fileSystem:
fileSystem
,
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart
View file @
b5e7fb07
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart
View file @
b5e7fb07
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/ide_config_test.dart
View file @
b5e7fb07
...
...
@@ -22,7 +22,7 @@ void main() {
Directory
intellijDir
;
Directory
toolsDir
;
Map
<
String
,
String
>
_
getFilesystemContents
([
Directory
root
])
{
Map
<
String
,
String
>
getFilesystemContents
([
Directory
root
])
{
final
String
tempPath
=
tempDir
.
absolute
.
path
;
final
List
<
String
>
paths
=
(
root
??
tempDir
).
listSync
(
recursive:
true
).
map
((
FileSystemEntity
entity
)
{
...
...
@@ -41,7 +41,7 @@ void main() {
return
contents
;
}
Map
<
String
,
String
>
_
getManifest
(
Directory
base
,
String
marker
,
{
bool
isTemplate
=
false
})
{
Map
<
String
,
String
>
getManifest
(
Directory
base
,
String
marker
,
{
bool
isTemplate
=
false
})
{
final
String
basePath
=
globals
.
fs
.
path
.
relative
(
base
.
path
,
from:
tempDir
.
absolute
.
path
);
final
String
suffix
=
isTemplate
?
Template
.
copyTemplateExtension
:
''
;
return
<
String
,
String
>{
...
...
@@ -57,7 +57,7 @@ void main() {
};
}
void
_
populateDir
(
Map
<
String
,
String
>
manifest
)
{
void
populateDir
(
Map
<
String
,
String
>
manifest
)
{
for
(
final
String
key
in
manifest
.
keys
)
{
if
(
manifest
[
key
]
==
'dir'
)
{
tempDir
.
childDirectory
(
key
).
createSync
(
recursive:
true
);
...
...
@@ -72,12 +72,12 @@ void main() {
}
}
bool
_
fileOrDirectoryExists
(
String
path
)
{
bool
fileOrDirectoryExists
(
String
path
)
{
final
String
absPath
=
globals
.
fs
.
path
.
join
(
tempDir
.
absolute
.
path
,
path
);
return
globals
.
fs
.
file
(
absPath
).
existsSync
()
||
globals
.
fs
.
directory
(
absPath
).
existsSync
();
}
Future
<
void
>
_
updateIdeConfig
({
Future
<
void
>
updateIdeConfig
({
Directory
dir
,
List
<
String
>
args
=
const
<
String
>[],
Map
<
String
,
String
>
expectedContents
=
const
<
String
,
String
>{},
...
...
@@ -94,7 +94,7 @@ void main() {
for
(
final
String
path
in
expectedContents
.
keys
)
{
final
String
absPath
=
globals
.
fs
.
path
.
join
(
tempDir
.
absolute
.
path
,
path
);
expect
(
_
fileOrDirectoryExists
(
globals
.
fs
.
path
.
join
(
dir
.
path
,
path
)),
true
,
expect
(
fileOrDirectoryExists
(
globals
.
fs
.
path
.
join
(
dir
.
path
,
path
)),
true
,
reason:
"
$path
doesn't exist"
);
if
(
globals
.
fs
.
file
(
absPath
).
existsSync
())
{
expect
(
globals
.
fs
.
file
(
absPath
).
readAsStringSync
(),
equals
(
expectedContents
[
path
]),
...
...
@@ -102,7 +102,7 @@ void main() {
}
}
for
(
final
String
path
in
unexpectedPaths
)
{
expect
(
_
fileOrDirectoryExists
(
globals
.
fs
.
path
.
join
(
dir
.
path
,
path
)),
false
,
reason:
'
$path
exists'
);
expect
(
fileOrDirectoryExists
(
globals
.
fs
.
path
.
join
(
dir
.
path
,
path
)),
false
,
reason:
'
$path
exists'
);
}
}
...
...
@@ -123,56 +123,56 @@ void main() {
});
testUsingContext
(
"doesn't touch existing files without --overwrite"
,
()
async
{
final
Map
<
String
,
String
>
templateManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
templateManifest
=
getManifest
(
intellijDir
,
'template'
,
isTemplate:
true
,
);
final
Map
<
String
,
String
>
flutterManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
flutterManifest
=
getManifest
(
tempDir
,
'existing'
,
);
_
populateDir
(
templateManifest
);
_
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
expectedContents
=
_
getFilesystemContents
();
return
_
updateIdeConfig
(
populateDir
(
templateManifest
);
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
expectedContents
=
getFilesystemContents
();
return
updateIdeConfig
(
expectedContents:
expectedContents
,
);
});
testUsingContext
(
'creates non-existent files'
,
()
async
{
final
Map
<
String
,
String
>
templateManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
templateManifest
=
getManifest
(
intellijDir
,
'template'
,
isTemplate:
true
,
);
final
Map
<
String
,
String
>
flutterManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
flutterManifest
=
getManifest
(
tempDir
,
'template'
,
);
_
populateDir
(
templateManifest
);
populateDir
(
templateManifest
);
final
Map
<
String
,
String
>
expectedContents
=
<
String
,
String
>{
...
templateManifest
,
...
flutterManifest
,
};
return
_
updateIdeConfig
(
return
updateIdeConfig
(
expectedContents:
expectedContents
,
);
});
testUsingContext
(
'overwrites existing files with --overwrite'
,
()
async
{
final
Map
<
String
,
String
>
templateManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
templateManifest
=
getManifest
(
intellijDir
,
'template'
,
isTemplate:
true
,
);
final
Map
<
String
,
String
>
flutterManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
flutterManifest
=
getManifest
(
tempDir
,
'existing'
,
);
_
populateDir
(
templateManifest
);
_
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
overwrittenManifest
=
_
getManifest
(
populateDir
(
templateManifest
);
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
overwrittenManifest
=
getManifest
(
tempDir
,
'template'
,
);
...
...
@@ -180,14 +180,14 @@ void main() {
...
templateManifest
,
...
overwrittenManifest
,
};
return
_
updateIdeConfig
(
return
updateIdeConfig
(
args:
<
String
>[
'--overwrite'
],
expectedContents:
expectedContents
,
);
});
testUsingContext
(
'only adds new templates without --overwrite'
,
()
async
{
final
Map
<
String
,
String
>
templateManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
templateManifest
=
getManifest
(
intellijDir
,
'template'
,
isTemplate:
true
,
...
...
@@ -200,36 +200,36 @@ void main() {
'flutter.iml
${Template.copyTemplateExtension}
'
,
);
templateManifest
.
remove
(
flutterIml
);
_
populateDir
(
templateManifest
);
populateDir
(
templateManifest
);
templateManifest
[
flutterIml
]
=
'flutter existing'
;
final
Map
<
String
,
String
>
flutterManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
flutterManifest
=
getManifest
(
tempDir
,
'existing'
,
);
_
populateDir
(
flutterManifest
);
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
expectedContents
=
<
String
,
String
>{
...
flutterManifest
,
...
templateManifest
,
};
return
_
updateIdeConfig
(
return
updateIdeConfig
(
args:
<
String
>[
'--update-templates'
],
expectedContents:
expectedContents
,
);
});
testUsingContext
(
'update all templates with --overwrite'
,
()
async
{
final
Map
<
String
,
String
>
templateManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
templateManifest
=
getManifest
(
intellijDir
,
'template'
,
isTemplate:
true
,
);
_
populateDir
(
templateManifest
);
final
Map
<
String
,
String
>
flutterManifest
=
_
getManifest
(
populateDir
(
templateManifest
);
final
Map
<
String
,
String
>
flutterManifest
=
getManifest
(
tempDir
,
'existing'
,
);
_
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
updatedTemplates
=
_
getManifest
(
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
updatedTemplates
=
getManifest
(
intellijDir
,
'existing'
,
isTemplate:
true
,
...
...
@@ -238,26 +238,26 @@ void main() {
...
flutterManifest
,
...
updatedTemplates
,
};
return
_
updateIdeConfig
(
return
updateIdeConfig
(
args:
<
String
>[
'--update-templates'
,
'--overwrite'
],
expectedContents:
expectedContents
,
);
});
testUsingContext
(
'removes deleted imls with --overwrite'
,
()
async
{
final
Map
<
String
,
String
>
templateManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
templateManifest
=
getManifest
(
intellijDir
,
'template'
,
isTemplate:
true
,
);
_
populateDir
(
templateManifest
);
final
Map
<
String
,
String
>
flutterManifest
=
_
getManifest
(
populateDir
(
templateManifest
);
final
Map
<
String
,
String
>
flutterManifest
=
getManifest
(
tempDir
,
'existing'
,
);
flutterManifest
.
remove
(
'flutter.iml'
);
_
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
updatedTemplates
=
_
getManifest
(
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
updatedTemplates
=
getManifest
(
intellijDir
,
'existing'
,
isTemplate:
true
,
...
...
@@ -274,26 +274,26 @@ void main() {
...
flutterManifest
,
...
updatedTemplates
,
};
return
_
updateIdeConfig
(
return
updateIdeConfig
(
args:
<
String
>[
'--update-templates'
,
'--overwrite'
],
expectedContents:
expectedContents
,
);
});
testUsingContext
(
'removes deleted imls with --overwrite, including empty parent dirs'
,
()
async
{
final
Map
<
String
,
String
>
templateManifest
=
_
getManifest
(
final
Map
<
String
,
String
>
templateManifest
=
getManifest
(
intellijDir
,
'template'
,
isTemplate:
true
,
);
_
populateDir
(
templateManifest
);
final
Map
<
String
,
String
>
flutterManifest
=
_
getManifest
(
populateDir
(
templateManifest
);
final
Map
<
String
,
String
>
flutterManifest
=
getManifest
(
tempDir
,
'existing'
,
);
flutterManifest
.
remove
(
globals
.
fs
.
path
.
join
(
'packages'
,
'new'
,
'deep.iml'
));
_
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
updatedTemplates
=
_
getManifest
(
populateDir
(
flutterManifest
);
final
Map
<
String
,
String
>
updatedTemplates
=
getManifest
(
intellijDir
,
'existing'
,
isTemplate:
true
,
...
...
@@ -315,7 +315,7 @@ void main() {
...
flutterManifest
,
...
updatedTemplates
,
};
return
_
updateIdeConfig
(
return
updateIdeConfig
(
args:
<
String
>[
'--update-templates'
,
'--overwrite'
],
expectedContents:
expectedContents
,
);
...
...
packages/flutter_tools/test/general.shard/base/user_messages_test.dart
View file @
b5e7fb07
...
...
@@ -14,7 +14,7 @@ void main() {
final
FakePlatform
linuxPlatform
=
FakePlatform
();
final
FakePlatform
windowsPlatform
=
FakePlatform
(
operatingSystem:
'windows'
);
void
_
checkInstallationURL
(
_InstallationMessage
message
)
{
void
checkInstallationURL
(
_InstallationMessage
message
)
{
expect
(
message
(
macPlatform
),
contains
(
'https://flutter.dev/docs/get-started/install/macos#android-setup'
));
expect
(
message
(
linuxPlatform
),
contains
(
'https://flutter.dev/docs/get-started/install/linux#android-setup'
));
expect
(
message
(
windowsPlatform
),
contains
(
'https://flutter.dev/docs/get-started/install/windows#android-setup'
));
...
...
@@ -23,11 +23,11 @@ void main() {
testWithoutContext
(
'Android installation instructions'
,
()
{
final
UserMessages
userMessages
=
UserMessages
();
_
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidMissingSdkInstructions
(
platform
));
_
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidSdkInstallHelp
(
platform
));
_
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidMissingSdkManager
(
'/'
,
platform
));
_
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidCannotRunSdkManager
(
'/'
,
''
,
platform
));
_
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidSdkBuildToolsOutdated
(
0
,
''
,
platform
));
_
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidStudioInstallation
(
platform
));
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidMissingSdkInstructions
(
platform
));
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidSdkInstallHelp
(
platform
));
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidMissingSdkManager
(
'/'
,
platform
));
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidCannotRunSdkManager
(
'/'
,
''
,
platform
));
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidSdkBuildToolsOutdated
(
0
,
''
,
platform
));
checkInstallationURL
((
Platform
platform
)
=>
userMessages
.
androidStudioInstallation
(
platform
));
});
}
packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
View file @
b5e7fb07
...
...
@@ -35,7 +35,7 @@ void main() {
late
String
fontSubsetPath
;
late
List
<
String
>
fontSubsetArgs
;
List
<
String
>
_
getConstFinderArgs
(
String
appDillPath
)
=>
<
String
>[
List
<
String
>
getConstFinderArgs
(
String
appDillPath
)
=>
<
String
>[
dartPath
,
'--disable-dart-dev'
,
constFinderPath
,
...
...
@@ -44,21 +44,21 @@ void main() {
'--class-name'
,
'IconData'
,
];
void
_
addConstFinderInvocation
(
void
addConstFinderInvocation
(
String
appDillPath
,
{
int
exitCode
=
0
,
String
stdout
=
''
,
String
stderr
=
''
,
})
{
processManager
.
addCommand
(
FakeCommand
(
command:
_
getConstFinderArgs
(
appDillPath
),
command:
getConstFinderArgs
(
appDillPath
),
exitCode:
exitCode
,
stdout:
stdout
,
stderr:
stderr
,
));
}
void
_
resetFontSubsetInvocation
({
void
resetFontSubsetInvocation
({
int
exitCode
=
0
,
String
stdout
=
''
,
String
stderr
=
''
,
...
...
@@ -99,7 +99,7 @@ void main() {
..
writeAsBytesSync
(
_kTtfHeaderBytes
);
});
Environment
_
createEnvironment
(
Map
<
String
,
String
>
defines
)
{
Environment
createEnvironment
(
Map
<
String
,
String
>
defines
)
{
return
Environment
.
test
(
fileSystem
.
directory
(
'/icon_test'
)..
createSync
(
recursive:
true
),
defines:
defines
,
...
...
@@ -111,7 +111,7 @@ void main() {
}
testWithoutContext
(
'Prints error in debug mode environment'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'debug'
,
});
...
...
@@ -142,7 +142,7 @@ void main() {
});
testWithoutContext
(
'Does not get enabled without font manifest'
,
()
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -165,7 +165,7 @@ void main() {
});
testWithoutContext
(
'Gets enabled'
,
()
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -188,7 +188,7 @@ void main() {
});
test
(
'No app.dill throws exception'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -214,7 +214,7 @@ void main() {
});
testWithoutContext
(
'Can subset a font'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -231,8 +231,8 @@ void main() {
);
final
CompleterIOSink
stdinSink
=
CompleterIOSink
();
_
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
_
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
bool
subsetted
=
await
iconTreeShaker
.
subsetFont
(
input:
fileSystem
.
file
(
inputPath
),
...
...
@@ -240,7 +240,7 @@ void main() {
relativePath:
relativePath
,
);
expect
(
stdinSink
.
getAndClear
(),
'59470
\n
'
);
_
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
expect
(
subsetted
,
true
);
subsetted
=
await
iconTreeShaker
.
subsetFont
(
...
...
@@ -254,7 +254,7 @@ void main() {
});
testWithoutContext
(
'Does not subset a non-supported font'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -271,8 +271,8 @@ void main() {
);
final
CompleterIOSink
stdinSink
=
CompleterIOSink
();
_
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
_
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
final
File
notAFont
=
fileSystem
.
file
(
'input/foo/bar.txt'
)
..
createSync
(
recursive:
true
)
...
...
@@ -286,7 +286,7 @@ void main() {
});
testWithoutContext
(
'Does not subset an invalid ttf font'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -303,8 +303,8 @@ void main() {
);
final
CompleterIOSink
stdinSink
=
CompleterIOSink
();
_
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
_
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
resetFontSubsetInvocation
(
stdinSink:
stdinSink
);
final
File
notAFont
=
fileSystem
.
file
(
inputPath
)
..
writeAsBytesSync
(<
int
>[
0
,
1
,
2
]);
...
...
@@ -318,7 +318,7 @@ void main() {
});
testWithoutContext
(
'Non-constant instances'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -334,7 +334,7 @@ void main() {
artifacts:
artifacts
,
);
_
addConstFinderInvocation
(
appDill
.
path
,
stdout:
constFinderResultWithInvalid
);
addConstFinderInvocation
(
appDill
.
path
,
stdout:
constFinderResultWithInvalid
);
await
expectLater
(
()
=>
iconTreeShaker
.
subsetFont
(
...
...
@@ -352,7 +352,7 @@ void main() {
});
testWithoutContext
(
'Non-zero font-subset exit code'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -370,8 +370,8 @@ void main() {
);
final
CompleterIOSink
stdinSink
=
CompleterIOSink
();
_
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
_
resetFontSubsetInvocation
(
exitCode:
-
1
,
stdinSink:
stdinSink
);
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
resetFontSubsetInvocation
(
exitCode:
-
1
,
stdinSink:
stdinSink
);
await
expectLater
(
()
=>
iconTreeShaker
.
subsetFont
(
...
...
@@ -385,7 +385,7 @@ void main() {
});
testWithoutContext
(
'font-subset throws on write to sdtin'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -402,8 +402,8 @@ void main() {
);
final
CompleterIOSink
stdinSink
=
CompleterIOSink
(
throwOnAdd:
true
);
_
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
_
resetFontSubsetInvocation
(
exitCode:
-
1
,
stdinSink:
stdinSink
);
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
resetFontSubsetInvocation
(
exitCode:
-
1
,
stdinSink:
stdinSink
);
await
expectLater
(
()
=>
iconTreeShaker
.
subsetFont
(
...
...
@@ -417,7 +417,7 @@ void main() {
});
testWithoutContext
(
'Invalid font manifest'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -435,7 +435,7 @@ void main() {
artifacts:
artifacts
,
);
_
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
addConstFinderInvocation
(
appDill
.
path
,
stdout:
validConstFinderResult
);
await
expectLater
(
()
=>
iconTreeShaker
.
subsetFont
(
...
...
@@ -449,7 +449,7 @@ void main() {
});
testWithoutContext
(
'ConstFinder non-zero exit'
,
()
async
{
final
Environment
environment
=
_
createEnvironment
(<
String
,
String
>{
final
Environment
environment
=
createEnvironment
(<
String
,
String
>{
kIconTreeShakerFlag:
'true'
,
kBuildMode:
'release'
,
});
...
...
@@ -467,7 +467,7 @@ void main() {
artifacts:
artifacts
,
);
_
addConstFinderInvocation
(
appDill
.
path
,
exitCode:
-
1
);
addConstFinderInvocation
(
appDill
.
path
,
exitCode:
-
1
);
await
expectLater
(
()
async
=>
iconTreeShaker
.
subsetFont
(
...
...
packages/flutter_tools/test/general.shard/ios/xcresult_test.dart
View file @
b5e7fb07
...
...
@@ -15,7 +15,7 @@ import 'xcresult_test_data.dart';
void
main
(
)
{
// Creates a FakeCommand for the xcresult get call to build the app
// in the given configuration.
FakeCommand
_
setUpFakeXCResultGetCommand
({
FakeCommand
setUpFakeXCResultGetCommand
({
required
String
stdout
,
required
String
tempResultPath
,
required
Xcode
xcode
,
...
...
@@ -54,7 +54,7 @@ void main() {
exitCode:
1
,
);
XCResultGenerator
_
setupGenerator
({
XCResultGenerator
setupGenerator
({
required
String
resultJson
,
int
exitCode
=
0
,
String
stderr
=
''
,
...
...
@@ -73,7 +73,7 @@ void main() {
);
fakeProcessManager
.
addCommands
(
<
FakeCommand
>[
_
setUpFakeXCResultGetCommand
(
setUpFakeXCResultGetCommand
(
stdout:
resultJson
,
tempResultPath:
_tempResultPath
,
xcode:
xcode
,
...
...
@@ -95,7 +95,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json when there are issues.'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResult
result
=
await
generator
.
generate
();
expect
(
result
.
issues
.
length
,
2
);
expect
(
result
.
issues
.
first
.
type
,
XCResultIssueType
.
error
);
...
...
@@ -112,7 +112,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json when there are issues but invalid url.'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonWithIssuesAndInvalidUrl
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonWithIssuesAndInvalidUrl
);
final
XCResult
result
=
await
generator
.
generate
();
expect
(
result
.
issues
.
length
,
2
);
expect
(
result
.
issues
.
first
.
type
,
XCResultIssueType
.
error
);
...
...
@@ -130,7 +130,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json and discard all warnings'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultIssueDiscarder
discarder
=
XCResultIssueDiscarder
(
typeMatcher:
XCResultIssueType
.
warning
);
final
XCResult
result
=
await
generator
.
generate
(
issueDiscarders:
<
XCResultIssueDiscarder
>[
discarder
]);
expect
(
result
.
issues
.
length
,
1
);
...
...
@@ -144,7 +144,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json and discard base on subType'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultIssueDiscarder
discarder
=
XCResultIssueDiscarder
(
subTypeMatcher:
RegExp
(
r'^Warning$'
));
final
XCResult
result
=
await
generator
.
generate
(
issueDiscarders:
<
XCResultIssueDiscarder
>[
discarder
]);
expect
(
result
.
issues
.
length
,
1
);
...
...
@@ -158,7 +158,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json and discard base on message'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultIssueDiscarder
discarder
=
XCResultIssueDiscarder
(
messageMatcher:
RegExp
(
r"^The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.$"
));
final
XCResult
result
=
await
generator
.
generate
(
issueDiscarders:
<
XCResultIssueDiscarder
>[
discarder
]);
expect
(
result
.
issues
.
length
,
1
);
...
...
@@ -172,7 +172,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json and discard base on location'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultIssueDiscarder
discarder
=
XCResultIssueDiscarder
(
locationMatcher:
RegExp
(
r'/Users/m/Projects/test_create/ios/Runner/AppDelegate.m'
));
final
XCResult
result
=
await
generator
.
generate
(
issueDiscarders:
<
XCResultIssueDiscarder
>[
discarder
]);
expect
(
result
.
issues
.
length
,
1
);
...
...
@@ -186,7 +186,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json with multiple discarders.'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonWithIssues
);
final
XCResultIssueDiscarder
discardWarnings
=
XCResultIssueDiscarder
(
typeMatcher:
XCResultIssueType
.
warning
);
final
XCResultIssueDiscarder
discardSemanticIssues
=
XCResultIssueDiscarder
(
subTypeMatcher:
RegExp
(
r'^Semantic Issue$'
));
final
XCResult
result
=
await
generator
.
generate
(
issueDiscarders:
<
XCResultIssueDiscarder
>[
discardWarnings
,
discardSemanticIssues
]);
...
...
@@ -197,7 +197,7 @@ void main() {
testWithoutContext
(
'correctly parse sample result json when no issues.'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonNoIssues
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonNoIssues
);
final
XCResult
result
=
await
generator
.
generate
();
expect
(
result
.
issues
.
length
,
0
);
expect
(
result
.
parseSuccess
,
isTrue
);
...
...
@@ -208,7 +208,7 @@ void main() {
'error: `xcresulttool get` process fail should return an `XCResult` with stderr as `parsingErrorMessage`.'
,
()
async
{
const
String
fakeStderr
=
'Fake: fail to parse result json.'
;
final
XCResultGenerator
generator
=
_
setupGenerator
(
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
''
,
exitCode:
1
,
stderr:
fakeStderr
,
...
...
@@ -221,7 +221,7 @@ void main() {
});
testWithoutContext
(
'error: `xcresulttool get` no stdout'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
''
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
''
);
final
XCResult
result
=
await
generator
.
generate
();
expect
(
result
.
issues
.
length
,
0
);
...
...
@@ -231,7 +231,7 @@ void main() {
});
testWithoutContext
(
'error: wrong top level json format.'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
'[]'
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
'[]'
);
final
XCResult
result
=
await
generator
.
generate
();
expect
(
result
.
issues
.
length
,
0
);
...
...
@@ -241,7 +241,7 @@ void main() {
});
testWithoutContext
(
'error: fail to parse issue map'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
'{}'
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
'{}'
);
final
XCResult
result
=
await
generator
.
generate
();
expect
(
result
.
issues
.
length
,
0
);
...
...
@@ -251,7 +251,7 @@ void main() {
});
testWithoutContext
(
'error: invalid issue map'
,
()
async
{
final
XCResultGenerator
generator
=
_
setupGenerator
(
resultJson:
kSampleResultJsonInvalidIssuesMap
);
final
XCResultGenerator
generator
=
setupGenerator
(
resultJson:
kSampleResultJsonInvalidIssuesMap
);
final
XCResult
result
=
await
generator
.
generate
();
expect
(
result
.
issues
.
length
,
0
);
...
...
packages/flutter_tools/test/general.shard/plugins_test.dart
View file @
b5e7fb07
...
...
@@ -1557,7 +1557,7 @@ flutter:
tryToDelete
(
tempDir
);
});
void
_
createPubspecFile
(
String
yamlString
)
{
void
createPubspecFile
(
String
yamlString
)
{
projectDir
.
childFile
(
'pubspec.yaml'
)..
createSync
(
recursive:
true
)..
writeAsStringSync
(
yamlString
);
}
...
...
@@ -1581,7 +1581,7 @@ flutter:
pluginClass: SomePlugin
package: AndroidPackage
'''
;
_
createPubspecFile
(
pluginYaml
);
createPubspecFile
(
pluginYaml
);
validatePubspecForPlugin
(
projectDir:
projectDir
.
absolute
.
path
,
pluginClass:
'SomePlugin'
,
expectedPlatforms:
<
String
>[
'ios'
,
'macos'
,
'windows'
,
'linux'
,
'android'
,
'web'
,
],
androidIdentifier:
'AndroidPackage'
,
webFileName:
'lib/SomeFile.dart'
);
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
b5e7fb07
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/version_test.dart
View file @
b5e7fb07
...
...
@@ -274,7 +274,7 @@ void main() {
});
group
(
'
$VersionCheckStamp
for
$channel
'
,
()
{
void
_
expectDefault
(
VersionCheckStamp
stamp
)
{
void
expectDefault
(
VersionCheckStamp
stamp
)
{
expect
(
stamp
.
lastKnownRemoteVersion
,
isNull
);
expect
(
stamp
.
lastTimeVersionWasChecked
,
isNull
);
expect
(
stamp
.
lastTimeWarningWasPrinted
,
isNull
);
...
...
@@ -283,19 +283,19 @@ void main() {
testWithoutContext
(
'loads blank when stamp file missing'
,
()
async
{
cache
.
versionStamp
=
null
;
_
expectDefault
(
await
VersionCheckStamp
.
load
(
cache
,
BufferLogger
.
test
()));
expectDefault
(
await
VersionCheckStamp
.
load
(
cache
,
BufferLogger
.
test
()));
});
testWithoutContext
(
'loads blank when stamp file is malformed JSON'
,
()
async
{
cache
.
versionStamp
=
'<'
;
_
expectDefault
(
await
VersionCheckStamp
.
load
(
cache
,
BufferLogger
.
test
()));
expectDefault
(
await
VersionCheckStamp
.
load
(
cache
,
BufferLogger
.
test
()));
});
testWithoutContext
(
'loads blank when stamp file is well-formed but invalid JSON'
,
()
async
{
cache
.
versionStamp
=
'[]'
;
_
expectDefault
(
await
VersionCheckStamp
.
load
(
cache
,
BufferLogger
.
test
()));
expectDefault
(
await
VersionCheckStamp
.
load
(
cache
,
BufferLogger
.
test
()));
});
testWithoutContext
(
'loads valid JSON'
,
()
async
{
...
...
packages/flutter_tools/test/general.shard/windows/visual_studio_validator_test.dart
View file @
b5e7fb07
...
...
@@ -21,7 +21,7 @@ void main() {
});
// Assigns default values for a complete VS installation with necessary components.
void
_
configureMockVisualStudioAsInstalled
()
{
void
configureMockVisualStudioAsInstalled
()
{
fakeVisualStudio
.
isPrerelease
=
false
;
fakeVisualStudio
.
isRebootRequired
=
false
;
fakeVisualStudio
.
fullVersion
=
'16.2'
;
...
...
@@ -30,7 +30,7 @@ void main() {
}
// Assigns default values for a complete VS installation that is too old.
void
_
configureMockVisualStudioAsTooOld
()
{
void
configureMockVisualStudioAsTooOld
()
{
fakeVisualStudio
.
isAtLeastMinimumVersion
=
false
;
fakeVisualStudio
.
isPrerelease
=
false
;
fakeVisualStudio
.
isRebootRequired
=
false
;
...
...
@@ -40,7 +40,7 @@ void main() {
}
// Assigns default values for a missing VS installation.
void
_
configureMockVisualStudioAsNotInstalled
()
{
void
configureMockVisualStudioAsNotInstalled
()
{
fakeVisualStudio
.
isInstalled
=
false
;
fakeVisualStudio
.
isAtLeastMinimumVersion
=
false
;
fakeVisualStudio
.
isPrerelease
=
false
;
...
...
@@ -56,7 +56,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsInstalled
();
configureMockVisualStudioAsInstalled
();
fakeVisualStudio
.
isPrerelease
=
true
;
final
ValidationResult
result
=
await
validator
.
validate
();
...
...
@@ -70,7 +70,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsInstalled
();
configureMockVisualStudioAsInstalled
();
fakeVisualStudio
.
isComplete
=
false
;
final
ValidationResult
result
=
await
validator
.
validate
();
...
...
@@ -85,7 +85,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsInstalled
();
configureMockVisualStudioAsInstalled
();
fakeVisualStudio
.
isRebootRequired
=
true
;
final
ValidationResult
result
=
await
validator
.
validate
();
...
...
@@ -100,7 +100,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsInstalled
();
configureMockVisualStudioAsInstalled
();
fakeVisualStudio
.
isLaunchable
=
false
;
final
ValidationResult
result
=
await
validator
.
validate
();
...
...
@@ -115,7 +115,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsTooOld
();
configureMockVisualStudioAsTooOld
();
final
ValidationResult
result
=
await
validator
.
validate
();
final
ValidationMessage
expectedMessage
=
ValidationMessage
.
error
(
...
...
@@ -134,7 +134,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsInstalled
();
configureMockVisualStudioAsInstalled
();
fakeVisualStudio
.
hasNecessaryComponents
=
false
;
final
ValidationResult
result
=
await
validator
.
validate
();
...
...
@@ -146,7 +146,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsInstalled
();
configureMockVisualStudioAsInstalled
();
fakeVisualStudio
.
windows10SDKVersion
=
null
;
final
ValidationResult
result
=
await
validator
.
validate
();
...
...
@@ -158,7 +158,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsInstalled
();
configureMockVisualStudioAsInstalled
();
final
ValidationResult
result
=
await
validator
.
validate
();
final
ValidationMessage
expectedDisplayNameMessage
=
ValidationMessage
(
...
...
@@ -173,7 +173,7 @@ void main() {
userMessages:
userMessages
,
visualStudio:
fakeVisualStudio
,
);
_
configureMockVisualStudioAsNotInstalled
();
configureMockVisualStudioAsNotInstalled
();
final
ValidationResult
result
=
await
validator
.
validate
();
final
ValidationMessage
expectedMessage
=
ValidationMessage
.
error
(
...
...
packages/flutter_tools/test/integration.shard/analyze_once_test.dart
View file @
b5e7fb07
...
...
@@ -36,7 +36,7 @@ void main() {
expect
(
result
.
stderr
,
contains
(
exitMessageContains
));
}
void
_
createDotPackages
(
String
projectPath
,
[
bool
nullSafe
=
false
])
{
void
createDotPackages
(
String
projectPath
,
[
bool
nullSafe
=
false
])
{
final
StringBuffer
flutterRootUri
=
StringBuffer
(
'file://'
);
final
String
canonicalizedFlutterRootPath
=
fileSystem
.
path
.
canonicalize
(
getFlutterRoot
());
if
(
platform
.
isWindows
)
{
...
...
@@ -84,7 +84,7 @@ void main() {
fileSystem
.
file
(
fileSystem
.
path
.
join
(
projectPath
,
'pubspec.yaml'
))
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
pubspecYamlSrc
);
_
createDotPackages
(
projectPath
);
createDotPackages
(
projectPath
);
libMain
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
projectPath
,
'lib'
,
'main.dart'
))
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
mainDartSrc
);
...
...
packages/flutter_tools/test/integration.shard/flutter_build_android_app_project_builddir_test.dart
View file @
b5e7fb07
...
...
@@ -44,7 +44,7 @@ void main() {
tryToDelete
(
tempDir
);
});
void
_
checkBuildDir
()
{
void
checkBuildDir
()
{
// The android/app/build directory should not exists
final
Directory
appBuildDir
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
exampleAppDir
.
path
,
...
...
@@ -65,7 +65,7 @@ void main() {
'apk'
,
'--target-platform=android-arm'
,
],
workingDirectory:
exampleAppDir
.
path
);
_
checkBuildDir
();
checkBuildDir
();
},
);
...
...
@@ -79,7 +79,7 @@ void main() {
'appbundle'
,
'--target-platform=android-arm'
,
],
workingDirectory:
exampleAppDir
.
path
);
_
checkBuildDir
();
checkBuildDir
();
},
);
}
packages/flutter_tools/test/integration.shard/forbidden_imports_test.dart
View file @
b5e7fb07
...
...
@@ -17,12 +17,12 @@ void main() {
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'commands'
),
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'test'
),
];
bool
_
isNotSkipped
(
FileSystemEntity
entity
)
=>
skippedPaths
.
every
((
String
path
)
=>
!
entity
.
path
.
startsWith
(
path
));
bool
isNotSkipped
(
FileSystemEntity
entity
)
=>
skippedPaths
.
every
((
String
path
)
=>
!
entity
.
path
.
startsWith
(
path
));
final
Iterable
<
File
>
files
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
))
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
where
(
_
isNotSkipped
)
.
where
(
isNotSkipped
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
...
...
@@ -41,13 +41,13 @@ void main() {
test
(
'no imports of globals without a global prefix'
,
()
{
final
List
<
String
>
skippedPaths
=
<
String
>
[];
bool
_
isNotSkipped
(
FileSystemEntity
entity
)
=>
skippedPaths
.
every
((
String
path
)
=>
!
entity
.
path
.
startsWith
(
path
));
bool
isNotSkipped
(
FileSystemEntity
entity
)
=>
skippedPaths
.
every
((
String
path
)
=>
!
entity
.
path
.
startsWith
(
path
));
final
Iterable
<
File
>
files
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
))
.
listSync
(
recursive:
true
)
.
followedBy
(
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
flutterTools
,
'test'
,)).
listSync
(
recursive:
true
))
.
where
(
_isDartFile
)
.
where
(
_
isNotSkipped
)
.
where
(
isNotSkipped
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
...
...
@@ -70,13 +70,13 @@ void main() {
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'base'
,
'error_handling_io.dart'
),
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'base'
,
'multi_root_file_system.dart'
),
];
bool
_
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
path
!=
entity
.
path
);
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
)
.
where
(
isNotAllowed
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
...
...
@@ -95,13 +95,13 @@ void main() {
// Used only for multi-part file uploads, which are non-trivial to reimplement.
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'reporting'
,
'crash_reporting.dart'
),
];
bool
_
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
path
!=
entity
.
path
);
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
)
.
where
(
isNotAllowed
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
...
...
@@ -121,13 +121,13 @@ void main() {
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'test'
,
'flutter_web_platform.dart'
),
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'test'
,
'test_wrapper.dart'
),
];
bool
_
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
path
!=
entity
.
path
);
bool
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
path
!=
entity
.
path
);
for
(
final
String
dirName
in
<
String
>[
'lib'
])
{
final
Iterable
<
File
>
files
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
flutterTools
,
dirName
))
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
where
(
_
isNotAllowed
)
.
where
(
isNotAllowed
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
...
...
@@ -191,13 +191,13 @@ void main() {
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'convert.dart'
),
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'src'
,
'base'
,
'error_handling_io.dart'
),
];
bool
_
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
path
!=
entity
.
path
);
bool
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
path
!=
entity
.
path
);
for
(
final
String
dirName
in
<
String
>[
'lib'
])
{
final
Iterable
<
File
>
files
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
flutterTools
,
dirName
))
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
where
(
_
isNotAllowed
)
.
where
(
isNotAllowed
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
...
...
@@ -219,13 +219,13 @@ void main() {
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'devfs_web.dart'
),
fileSystem
.
path
.
join
(
flutterTools
,
'lib'
,
'resident_web_runner.dart'
),
];
bool
_
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
!
entity
.
path
.
contains
(
path
));
bool
isNotAllowed
(
FileSystemEntity
entity
)
=>
allowedPaths
.
every
((
String
path
)
=>
!
entity
.
path
.
contains
(
path
));
for
(
final
String
dirName
in
<
String
>[
'lib'
])
{
final
Iterable
<
File
>
files
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
flutterTools
,
dirName
))
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
where
(
_
isNotAllowed
)
.
where
(
isNotAllowed
)
.
map
(
_asFile
);
for
(
final
File
file
in
files
)
{
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
...
...
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