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
04182572
Unverified
Commit
04182572
authored
Feb 18, 2021
by
Jonah Williams
Committed by
GitHub
Feb 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] allow bypassing context for FlutterProject creation, remove fromPath (#76258)
parent
c785efad
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
110 additions
and
97 deletions
+110
-97
build_aar.dart
packages/flutter_tools/lib/src/commands/build_aar.dart
+1
-1
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+1
-1
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+1
-1
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+3
-3
project.dart
packages/flutter_tools/lib/src/project.dart
+19
-3
build_linux_test.dart
..._tools/test/commands.shard/hermetic/build_linux_test.dart
+1
-1
build_web_test.dart
...er_tools/test/commands.shard/hermetic/build_web_test.dart
+2
-1
android_gradle_builder_test.dart
...st/general.shard/android/android_gradle_builder_test.dart
+19
-19
gradle_errors_test.dart
..._tools/test/general.shard/android/gradle_errors_test.dart
+7
-7
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+5
-5
application_package_test.dart
...er_tools/test/general.shard/application_package_test.dart
+3
-2
bundle_shim_test.dart
...es/flutter_tools/test/general.shard/bundle_shim_test.dart
+2
-2
fuchsia_device_test.dart
...tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+15
-21
simulators_test.dart
...flutter_tools/test/general.shard/ios/simulators_test.dart
+3
-3
xcodeproj_test.dart
.../flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+6
-6
cocoapods_test.dart
...lutter_tools/test/general.shard/macos/cocoapods_test.dart
+6
-6
project_test.dart
packages/flutter_tools/test/general.shard/project_test.dart
+1
-1
resident_web_runner_cold_test.dart
...ols/test/general.shard/resident_web_runner_cold_test.dart
+2
-1
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+10
-10
test_compiler_test.dart
...ter_tools/test/general.shard/test/test_compiler_test.dart
+3
-3
No files found.
packages/flutter_tools/lib/src/commands/build_aar.dart
View file @
04182572
...
...
@@ -145,6 +145,6 @@ class BuildAarCommand extends BuildSubCommand {
if
(
argResults
.
rest
.
isEmpty
)
{
return
FlutterProject
.
current
();
}
return
FlutterProject
.
from
Path
(
findProjectRoot
(
argResults
.
rest
.
first
));
return
FlutterProject
.
from
Directory
(
globals
.
fs
.
directory
(
findProjectRoot
(
argResults
.
rest
.
first
)
));
}
}
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
04182572
...
...
@@ -70,7 +70,7 @@ class BuildBundleCommand extends BuildSubCommand {
@override
Future
<
Map
<
CustomDimensions
,
String
>>
get
usageValues
async
{
final
String
projectDir
=
globals
.
fs
.
file
(
targetFile
).
parent
.
parent
.
path
;
final
FlutterProject
flutterProject
=
FlutterProject
.
from
Path
(
projectDir
);
final
FlutterProject
flutterProject
=
FlutterProject
.
from
Directory
(
globals
.
fs
.
directory
(
projectDir
)
);
if
(
flutterProject
==
null
)
{
return
const
<
CustomDimensions
,
String
>{};
}
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
04182572
...
...
@@ -310,7 +310,7 @@ class CreateCommand extends CreateBase {
_printPluginAddPlatformMessage
(
relativePluginPath
);
}
else
{
// Tell the user the next steps.
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
projectDirPath
);
final
FlutterProject
project
=
FlutterProject
.
from
Directory
(
globals
.
fs
.
directory
(
projectDirPath
)
);
final
FlutterProject
app
=
project
.
hasExampleApp
?
project
.
example
:
project
;
final
String
relativeAppPath
=
globals
.
fs
.
path
.
normalize
(
globals
.
fs
.
path
.
relative
(
app
.
directory
.
path
));
final
String
relativeAppMain
=
globals
.
fs
.
path
.
join
(
relativeAppPath
,
'lib'
,
'main.dart'
);
...
...
packages/flutter_tools/lib/src/commands/packages.dart
View file @
04182572
...
...
@@ -88,7 +88,7 @@ class PackagesGetCommand extends FlutterCommand {
if
(
target
==
null
)
{
return
usageValues
;
}
final
FlutterProject
rootProject
=
FlutterProject
.
from
Path
(
target
);
final
FlutterProject
rootProject
=
FlutterProject
.
from
Directory
(
globals
.
fs
.
directory
(
target
)
);
// Do not send plugin analytics if pub has not run before.
final
bool
hasPlugins
=
rootProject
.
flutterPluginsDependenciesFile
.
existsSync
()
&&
rootProject
.
packagesFile
.
existsSync
()
...
...
@@ -160,7 +160,7 @@ class PackagesGetCommand extends FlutterCommand {
'
${ workingDirectory ?? "current working directory" }
.'
);
}
final
FlutterProject
rootProject
=
FlutterProject
.
from
Path
(
target
);
final
FlutterProject
rootProject
=
FlutterProject
.
from
Directory
(
globals
.
fs
.
directory
(
target
)
);
await
_runPubGet
(
target
,
rootProject
);
await
rootProject
.
regeneratePlatformSpecificTooling
();
...
...
@@ -311,7 +311,7 @@ class PackagesInteractiveGetCommand extends FlutterCommand {
throwToolExit
(
'Expected to find project root in '
'current working directory.'
);
}
final
FlutterProject
flutterProject
=
FlutterProject
.
from
Path
(
target
);
final
FlutterProject
flutterProject
=
FlutterProject
.
from
Directory
(
globals
.
fs
.
directory
(
target
)
);
if
(
flutterProject
.
manifest
.
generateSyntheticPackage
)
{
final
Environment
environment
=
Environment
(
...
...
packages/flutter_tools/lib/src/project.dart
View file @
04182572
...
...
@@ -86,9 +86,25 @@ class FlutterProject {
/// if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
static
FlutterProject
current
()
=>
globals
.
projectFactory
.
fromDirectory
(
globals
.
fs
.
currentDirectory
);
/// Returns a [FlutterProject] view of the given directory or a ToolExit error,
/// if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
static
FlutterProject
fromPath
(
String
path
)
=>
globals
.
projectFactory
.
fromDirectory
(
globals
.
fs
.
directory
(
path
));
/// Create a [FlutterProject] and bypass the project caching.
@visibleForTesting
static
FlutterProject
fromDirectoryTest
(
Directory
directory
,
[
Logger
logger
])
{
final
FileSystem
fileSystem
=
directory
.
fileSystem
;
logger
??=
BufferLogger
.
test
();
final
FlutterManifest
manifest
=
FlutterProject
.
_readManifest
(
directory
.
childFile
(
bundle
.
defaultManifestPath
).
path
,
logger:
logger
,
fileSystem:
fileSystem
,
);
final
FlutterManifest
exampleManifest
=
FlutterProject
.
_readManifest
(
FlutterProject
.
_exampleDirectory
(
directory
)
.
childFile
(
bundle
.
defaultManifestPath
)
.
path
,
logger:
logger
,
fileSystem:
fileSystem
,
);
return
FlutterProject
(
directory
,
manifest
,
exampleManifest
);
}
/// The location of this project.
final
Directory
directory
;
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart
View file @
04182572
...
...
@@ -465,7 +465,7 @@ set(BINARY_NAME "fizz_bar")
'''
);
fileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
fileSystem
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
(
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
expect
(
getCmakeExecutableName
(
flutterProject
.
linux
),
'fizz_bar'
);
},
overrides:
<
Type
,
Generator
>{
...
...
packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart
View file @
04182572
...
...
@@ -52,9 +52,10 @@ void main() {
testUsingContext
(
'Refuses to build for web when missing index.html'
,
()
async
{
fileSystem
.
file
(
fileSystem
.
path
.
join
(
'web'
,
'index.html'
)).
deleteSync
();
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
expect
(
buildWeb
(
FlutterProject
.
current
()
,
project
,
fileSystem
.
path
.
join
(
'lib'
,
'main.dart'
),
BuildInfo
.
debug
,
false
,
...
...
packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
View file @
04182572
...
...
@@ -114,7 +114,7 @@ void main() {
bool
handlerCalled
=
false
;
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -219,7 +219,7 @@ void main() {
int
testFnCalled
=
0
;
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -311,7 +311,7 @@ void main() {
bool
handlerCalled
=
false
;
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -403,7 +403,7 @@ void main() {
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -483,7 +483,7 @@ void main() {
.
createSync
(
recursive:
true
);
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -595,7 +595,7 @@ void main() {
..
writeAsStringSync
(
'{}'
);
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -681,7 +681,7 @@ void main() {
bool
builtPluginAsAar
=
false
;
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -781,7 +781,7 @@ void main() {
.
createSync
(
recursive:
true
);
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -850,7 +850,7 @@ void main() {
await
builder
.
buildGradleAar
(
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
)),
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
outputDirectory:
fileSystem
.
directory
(
'build/'
),
target:
''
,
buildNumber:
'1.0'
,
...
...
@@ -919,7 +919,7 @@ void main() {
await
expectLater
(()
async
=>
await
builder
.
buildGradleAar
(
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
)),
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
outputDirectory:
fileSystem
.
directory
(
'build/'
),
target:
''
,
buildNumber:
'1.0'
,
...
...
@@ -989,7 +989,7 @@ void main() {
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -1067,7 +1067,7 @@ void main() {
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -1145,7 +1145,7 @@ void main() {
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -1223,7 +1223,7 @@ void main() {
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -1281,7 +1281,7 @@ void main() {
await
expectLater
(()
async
{
await
builder
.
buildGradleApp
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
...
...
@@ -1373,7 +1373,7 @@ void main() {
await
builder
.
buildGradleAar
(
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
)),
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
outputDirectory:
fileSystem
.
directory
(
'build/'
),
target:
''
,
buildNumber:
'2.0'
,
...
...
@@ -1462,7 +1462,7 @@ void main() {
await
builder
.
buildGradleAar
(
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
)),
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
outputDirectory:
fileSystem
.
directory
(
'build/'
),
target:
''
,
buildNumber:
'2.0'
,
...
...
@@ -1551,7 +1551,7 @@ void main() {
await
builder
.
buildGradleAar
(
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
)),
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
outputDirectory:
fileSystem
.
directory
(
'build/'
),
target:
''
,
buildNumber:
'2.0'
,
...
...
@@ -1640,7 +1640,7 @@ void main() {
await
builder
.
buildGradleAar
(
androidBuildInfo:
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
)),
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
outputDirectory:
fileSystem
.
directory
(
'build/'
),
target:
''
,
buildNumber:
'2.0'
,
...
...
packages/flutter_tools/test/general.shard/android/gradle_errors_test.dart
View file @
04182572
...
...
@@ -352,7 +352,7 @@ Command: /home/android/gradlew assembleRelease
testUsingContext('
handler
-
no
plugins
', () async {
final GradleBuildStatus status = await androidXFailureHandler
.handler(line: '', project: FlutterProject.
current(
));
.handler(line: '', project: FlutterProject.
fromDirectoryTest(globals.fs.currentDirectory
));
expect(testUsage.events, contains(
const TestUsageEvent(
...
...
@@ -378,7 +378,7 @@ Command: /home/android/gradlew assembleRelease
final GradleBuildStatus status = await androidXFailureHandler
.handler(
line: '',
project: FlutterProject.
current(
),
project: FlutterProject.
fromDirectoryTest(globals.fs.currentDirectory
),
usesAndroidX: false,
);
...
...
@@ -412,7 +412,7 @@ Command: /home/android/gradlew assembleRelease
final
GradleBuildStatus
status
=
await
androidXFailureHandler
.
handler
(
line:
''
,
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
usesAndroidX:
true
,
shouldBuildPluginAsAar:
true
,
);
...
...
@@ -440,7 +440,7 @@ Command: /home/android/gradlew assembleRelease
final
GradleBuildStatus
status
=
await
androidXFailureHandler
.
handler
(
line:
''
,
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
usesAndroidX:
true
,
shouldBuildPluginAsAar:
false
,
);
...
...
@@ -509,7 +509,7 @@ Command: /home/android/gradlew assembleRelease
testUsingContext
(
'handler'
,
()
async
{
await
licenseNotAcceptedHandler
.
handler
(
line:
'You have not accepted the license agreements of the following SDK components: [foo, bar]'
,
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
);
expect
(
...
...
@@ -581,7 +581,7 @@ assembleFooTest
));
await
flavorUndefinedHandler
.
handler
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
);
expect
(
...
...
@@ -623,7 +623,7 @@ assembleProfile
));
await
flavorUndefinedHandler
.
handler
(
project:
FlutterProject
.
current
(
),
project:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
);
expect
(
...
...
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
04182572
...
...
@@ -314,7 +314,7 @@ void main() {
});
testUsingContext
(
'aab not found'
,
()
{
final
FlutterProject
project
=
FlutterProject
.
current
(
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
);
expect
(
()
{
findBundleFile
(
project
,
const
BuildInfo
(
BuildMode
.
debug
,
'foo_bar'
,
treeShakeIcons:
false
),
BufferLogger
.
test
());
...
...
@@ -404,7 +404,7 @@ void main() {
group
(
'gradle build'
,
()
{
testUsingContext
(
'do not crash if there is no Android SDK'
,
()
async
{
expect
(()
{
updateLocalProperties
(
project:
FlutterProject
.
current
(
));
updateLocalProperties
(
project:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
));
},
throwsToolExit
(
message:
'
$warningMark
No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.'
,
));
...
...
@@ -573,7 +573,7 @@ include ':app'
updateLocalProperties
(
project:
FlutterProject
.
from
Path
(
'path/to/project'
),
project:
FlutterProject
.
from
DirectoryTest
(
globals
.
fs
.
directory
(
'path/to/project'
)
),
buildInfo:
buildInfo
,
requireAndroidSdk:
false
,
);
...
...
@@ -966,7 +966,7 @@ plugin2=${plugin2.path}
));
await
builder
.
buildPluginsAsAar
(
FlutterProject
.
from
Path
(
androidDirectory
.
path
),
FlutterProject
.
from
DirectoryTest
(
androidDirectory
),
const
AndroidBuildInfo
(
BuildInfo
(
BuildMode
.
release
,
''
,
...
...
@@ -1019,7 +1019,7 @@ plugin1=${plugin1.path}
.
createSync
(
recursive:
true
);
await
builder
.
buildPluginsAsAar
(
FlutterProject
.
from
Path
(
androidDirectory
.
path
),
FlutterProject
.
from
DirectoryTest
(
androidDirectory
),
const
AndroidBuildInfo
(
BuildInfo
.
release
),
buildDirectory:
buildDirectory
,
);
...
...
packages/flutter_tools/test/general.shard/application_package_test.dart
View file @
04182572
...
...
@@ -41,6 +41,7 @@ void main() {
FakeProcessManager
fakeProcessManager
;
MemoryFileSystem
fs
;
Cache
cache
;
final
Map
<
Type
,
Generator
>
overrides
=
<
Type
,
Generator
>{
AndroidSdk:
()
=>
sdk
,
ProcessManager:
()
=>
fakeProcessManager
,
...
...
@@ -57,7 +58,7 @@ void main() {
);
Cache
.
flutterRoot
=
'../..'
;
when
(
sdk
.
licensesAvailable
).
thenReturn
(
true
);
final
FlutterProject
project
=
FlutterProject
.
current
(
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
currentDirectory
);
fs
.
file
(
project
.
android
.
hostAppGradleRoot
.
childFile
(
globals
.
platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
,
).
path
).
createSync
(
recursive:
true
);
...
...
@@ -96,7 +97,7 @@ void main() {
testUsingContext
(
'Licenses available, build tools not, apk exists'
,
()
async
{
when
(
sdk
.
latestVersion
).
thenReturn
(
null
);
final
FlutterProject
project
=
FlutterProject
.
current
(
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fs
.
currentDirectory
);
final
File
gradle
=
project
.
android
.
hostAppGradleRoot
.
childFile
(
globals
.
platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
,
)..
createSync
(
recursive:
true
);
...
...
packages/flutter_tools/test/general.shard/bundle_shim_test.dart
View file @
04182572
...
...
@@ -35,7 +35,7 @@ void main() {
});
await
buildWithAssemble
(
buildMode:
BuildMode
.
debug
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
mainPath:
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
),
outputDir:
'example'
,
targetPlatform:
TargetPlatform
.
ios
,
...
...
@@ -57,7 +57,7 @@ void main() {
expect
(()
=>
buildWithAssemble
(
buildMode:
BuildMode
.
debug
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
mainPath:
'lib/main.dart'
,
outputDir:
'example'
,
targetPlatform:
TargetPlatform
.
linux_x64
,
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
04182572
...
...
@@ -175,18 +175,16 @@ void main() {
verify
(
mockPortForwarder
.
dispose
()).
called
(
1
);
});
test
Using
Context
(
'default capabilities'
,
()
async
{
test
Without
Context
(
'default capabilities'
,
()
async
{
final
FuchsiaDevice
device
=
FuchsiaDevice
(
'123'
);
globals
.
fs
.
directory
(
'fuchsia'
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
memoryFileSystem
.
currentDirectory
);
memoryFileSystem
.
directory
(
'fuchsia'
).
createSync
(
recursive:
true
);
memoryFileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
expect
(
device
.
supportsHotReload
,
true
);
expect
(
device
.
supportsHotRestart
,
false
);
expect
(
device
.
supportsFlutterExit
,
false
);
expect
(
device
.
isSupportedForProject
(
FlutterProject
.
current
()),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
expect
(
device
.
isSupportedForProject
(
project
),
true
);
});
test
(
'is ephemeral'
,
()
{
...
...
@@ -195,25 +193,21 @@ void main() {
expect
(
device
.
ephemeral
,
true
);
});
test
Using
Context
(
'supported for project'
,
()
async
{
test
Without
Context
(
'supported for project'
,
()
async
{
final
FuchsiaDevice
device
=
FuchsiaDevice
(
'123'
);
globals
.
fs
.
directory
(
'fuchsia'
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
memoryFileSystem
.
currentDirectory
);
memoryFileSystem
.
directory
(
'fuchsia'
).
createSync
(
recursive:
true
);
memoryFileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
expect
(
device
.
isSupportedForProject
(
FlutterProject
.
current
()),
true
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
expect
(
device
.
isSupportedForProject
(
project
),
true
);
});
test
Using
Context
(
'not supported for project'
,
()
async
{
test
Without
Context
(
'not supported for project'
,
()
async
{
final
FuchsiaDevice
device
=
FuchsiaDevice
(
'123'
);
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
memoryFileSystem
.
currentDirectory
);
memoryFileSystem
.
file
(
'pubspec.yaml'
).
createSync
();
expect
(
device
.
isSupportedForProject
(
FlutterProject
.
current
()),
false
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
memoryFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
expect
(
device
.
isSupportedForProject
(
project
),
false
);
});
testUsingContext
(
'targetPlatform does not throw when sshConfig is missing'
,
()
async
{
...
...
@@ -945,7 +939,7 @@ void main() {
..
writeAsStringSync
(
'{}'
);
globals
.
fs
.
file
(
'.packages'
).
createSync
();
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
app
=
BuildableFuchsiaApp
(
project:
FlutterProject
.
current
(
).
fuchsia
);
app
=
BuildableFuchsiaApp
(
project:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
).
fuchsia
);
}
final
DebuggingOptions
debuggingOptions
=
DebuggingOptions
.
disabled
(
BuildInfo
(
mode
,
null
,
treeShakeIcons:
false
));
...
...
packages/flutter_tools/test/general.shard/ios/simulators_test.dart
View file @
04182572
...
...
@@ -931,7 +931,7 @@ flutter:
module: {}
'''
);
globals
.
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
(
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
);
final
IOSSimulator
simulator
=
IOSSimulator
(
'test'
,
...
...
@@ -949,7 +949,7 @@ flutter:
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'.packages'
).
createSync
();
globals
.
fs
.
directory
(
'ios'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
(
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
);
final
IOSSimulator
simulator
=
IOSSimulator
(
'test'
,
...
...
@@ -965,7 +965,7 @@ flutter:
testUsingContext
(
'is false with no host app and no module'
,
()
async
{
globals
.
fs
.
file
(
'pubspec.yaml'
).
createSync
();
globals
.
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
(
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
);
final
IOSSimulator
simulator
=
IOSSimulator
(
'test'
,
...
...
packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
View file @
04182572
...
...
@@ -668,7 +668,7 @@ Information about project "Runner":
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
fs
.
directory
(
'path/to/project'
)
);
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
...
...
@@ -696,7 +696,7 @@ Information about project "Runner":
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_debug_sim_unopt'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
fs
.
directory
(
'path/to/project'
)
);
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
...
...
@@ -723,7 +723,7 @@ Information about project "Runner":
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
trackWidgetCreation:
true
,
treeShakeIcons:
false
);
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
fs
.
directory
(
'path/to/project'
)
);
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
...
...
@@ -750,7 +750,7 @@ Information about project "Runner":
.
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
fs
.
directory
(
'path/to/project'
)
);
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
...
...
@@ -778,7 +778,7 @@ Information about project "Runner":
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile'
));
const
BuildInfo
buildInfo
=
BuildInfo
.
debug
;
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
fs
.
directory
(
'path/to/project'
)
);
await
updateGeneratedXcodeProperties
(
project:
project
,
buildInfo:
buildInfo
,
...
...
@@ -818,7 +818,7 @@ Information about project "Runner":
manifestFile
.
writeAsStringSync
(
manifestString
);
await
updateGeneratedXcodeProperties
(
project:
FlutterProject
.
from
Path
(
'path/to/project'
),
project:
FlutterProject
.
from
DirectoryTest
(
fs
.
directory
(
'path/to/project'
)
),
buildInfo:
buildInfo
,
);
...
...
packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
View file @
04182572
...
...
@@ -194,7 +194,7 @@ void main() {
'SWIFT_VERSION'
:
'5.0'
,
});
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
globals
.
fs
.
directory
(
'project'
)
);
await
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
expect
(
projectUnderTest
.
ios
.
podfile
.
readAsStringSync
(),
'Swift iOS podfile template'
);
...
...
@@ -214,7 +214,7 @@ void main() {
testUsingContext
(
'does not recreate Podfile when already present'
,
()
async
{
projectUnderTest
.
ios
.
podfile
..
createSync
()..
writeAsStringSync
(
'Existing Podfile'
);
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
fileSystem
.
directory
(
'project'
)
);
await
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
expect
(
projectUnderTest
.
ios
.
podfile
.
readAsStringSync
(),
'Existing Podfile'
);
...
...
@@ -226,7 +226,7 @@ void main() {
testUsingContext
(
'does not create Podfile when we cannot interpret Xcode projects'
,
()
async
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
false
);
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
globals
.
fs
.
directory
(
'project'
)
);
await
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
expect
(
projectUnderTest
.
ios
.
podfile
.
existsSync
(),
false
);
...
...
@@ -245,7 +245,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'Existing release config'
);
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
globals
.
fs
.
directory
(
'project'
)
);
await
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
...
...
@@ -273,7 +273,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
legacyReleaseInclude
);
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
globals
.
fs
.
directory
(
'project'
)
);
await
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
...
...
@@ -305,7 +305,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'Existing release config'
);
final
FlutterProject
project
=
FlutterProject
.
from
Path
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
from
DirectoryTest
(
globals
.
fs
.
directory
(
'project'
)
);
await
injectPlugins
(
project
,
iosPlatform:
true
);
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
...
...
packages/flutter_tools/test/general.shard/project_test.dart
View file @
04182572
...
...
@@ -118,7 +118,7 @@ void main() {
directory
.
absolute
.
path
,
);
expect
(
FlutterProject
.
from
Path
(
directory
.
path
).
directory
.
absolute
.
path
,
FlutterProject
.
from
DirectoryTest
(
directory
).
directory
.
absolute
.
path
,
directory
.
absolute
.
path
,
);
expect
(
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart
View file @
04182572
...
...
@@ -48,9 +48,10 @@ void main() {
});
testbed
=
Testbed
(
setup:
()
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
);
residentWebRunner
=
residentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
()
,
flutterProject:
project
,
debuggingOptions:
DebuggingOptions
.
disabled
(
BuildInfo
.
release
),
ipv6:
true
,
stayResident:
true
,
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
04182572
...
...
@@ -172,7 +172,7 @@ void main() {
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
final
ResidentRunner
profileResidentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
ipv6:
true
,
stayResident:
true
,
...
...
@@ -203,7 +203,7 @@ void main() {
));
final
ResidentRunner
profileResidentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
startPaused:
true
),
ipv6:
true
,
stayResident:
true
,
...
...
@@ -224,7 +224,7 @@ void main() {
..
writeAsStringSync
(
'
\n
'
);
final
ResidentRunner
residentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
ipv6:
true
,
stayResident:
true
,
...
...
@@ -234,7 +234,7 @@ void main() {
when
(
mockFlutterDevice
.
device
).
thenReturn
(
mockChromeDevice
);
final
ResidentRunner
profileResidentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
profile
),
ipv6:
true
,
stayResident:
true
,
...
...
@@ -341,7 +341,7 @@ void main() {
.
deleteSync
();
final
ResidentWebRunner
residentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
ipv6:
true
,
stayResident:
false
,
...
...
@@ -363,7 +363,7 @@ void main() {
_setupMocks
();
final
ResidentRunner
residentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
ipv6:
true
,
stayResident:
false
,
...
...
@@ -487,7 +487,7 @@ void main() {
testUsingContext
(
'Does not run main with --start-paused'
,
()
async
{
final
ResidentRunner
residentWebRunner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
startPaused:
true
),
ipv6:
true
,
stayResident:
true
,
...
...
@@ -1459,7 +1459,7 @@ void main() {
fakeStatusLogger
.
status
=
mockStatus
;
final
ResidentWebRunner
runner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
ipv6:
true
,
stayResident:
true
,
...
...
@@ -1506,7 +1506,7 @@ void main() {
fakeStatusLogger
.
status
=
mockStatus
;
final
ResidentWebRunner
runner
=
DwdsWebRunnerFactory
().
createWebRunner
(
mockFlutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
ipv6:
true
,
stayResident:
true
,
...
...
@@ -1635,7 +1635,7 @@ void main() {
ResidentRunner
setUpResidentRunner
(
FlutterDevice
flutterDevice
)
{
return
DwdsWebRunnerFactory
().
createWebRunner
(
flutterDevice
,
flutterProject:
FlutterProject
.
current
(
),
flutterProject:
FlutterProject
.
fromDirectoryTest
(
globals
.
fs
.
currentDirectory
),
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
ipv6:
true
,
stayResident:
true
,
...
...
packages/flutter_tools/test/general.shard/test/test_compiler_test.dart
View file @
04182572
...
...
@@ -47,7 +47,7 @@ void main() {
testUsingContext
(
'TestCompiler reports a dill file when compile is successful'
,
()
async
{
final
FakeTestCompiler
testCompiler
=
FakeTestCompiler
(
debugBuild
,
FlutterProject
.
current
(
),
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
residentCompiler
,
);
when
(
residentCompiler
.
recompile
(
...
...
@@ -72,7 +72,7 @@ void main() {
testUsingContext
(
'TestCompiler reports null when a compile fails'
,
()
async
{
final
FakeTestCompiler
testCompiler
=
FakeTestCompiler
(
debugBuild
,
FlutterProject
.
current
(
),
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
residentCompiler
,
);
when
(
residentCompiler
.
recompile
(
...
...
@@ -98,7 +98,7 @@ void main() {
testUsingContext
(
'TestCompiler disposing test compiler shuts down backing compiler'
,
()
async
{
final
FakeTestCompiler
testCompiler
=
FakeTestCompiler
(
debugBuild
,
FlutterProject
.
current
(
),
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
),
residentCompiler
,
);
testCompiler
.
compiler
=
residentCompiler
;
...
...
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