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
4ff46719
Unverified
Commit
4ff46719
authored
Apr 29, 2019
by
Jonah Williams
Committed by
GitHub
Apr 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make FlutterProject synchronous (#31757)
parent
5412ef07
Changes
50
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
137 additions
and
136 deletions
+137
-136
fuchsia_tester.dart
packages/flutter_tools/bin/fuchsia_tester.dart
+1
-1
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+1
-1
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+2
-2
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+8
-8
asset.dart
packages/flutter_tools/lib/src/asset.dart
+2
-2
build.dart
packages/flutter_tools/lib/src/base/build.dart
+2
-2
bundle.dart
packages/flutter_tools/lib/src/bundle.dart
+1
-1
codegen.dart
packages/flutter_tools/lib/src/codegen.dart
+1
-1
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+1
-1
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+1
-1
build_appbundle.dart
packages/flutter_tools/lib/src/commands/build_appbundle.dart
+1
-1
build_linux.dart
packages/flutter_tools/lib/src/commands/build_linux.dart
+1
-1
build_macos.dart
packages/flutter_tools/lib/src/commands/build_macos.dart
+1
-1
build_windows.dart
packages/flutter_tools/lib/src/commands/build_windows.dart
+1
-1
clean.dart
packages/flutter_tools/lib/src/commands/clean.dart
+1
-1
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+5
-5
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
generate.dart
packages/flutter_tools/lib/src/commands/generate.dart
+1
-1
inject_plugins.dart
packages/flutter_tools/lib/src/commands/inject_plugins.dart
+1
-1
make_host_app_editable.dart
...lutter_tools/lib/src/commands/make_host_app_editable.dart
+1
-1
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+1
-1
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-1
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+2
-2
compile.dart
packages/flutter_tools/lib/src/compile.dart
+1
-1
flutter_manifest.dart
packages/flutter_tools/lib/src/flutter_manifest.dart
+6
-8
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+1
-1
linux_device.dart
packages/flutter_tools/lib/src/linux/linux_device.dart
+1
-1
macos_device.dart
packages/flutter_tools/lib/src/macos/macos_device.dart
+1
-1
project.dart
packages/flutter_tools/lib/src/project.dart
+7
-7
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+1
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+2
-2
windows_device.dart
packages/flutter_tools/lib/src/windows/windows_device.dart
+1
-1
android_device_test.dart
packages/flutter_tools/test/android/android_device_test.dart
+3
-3
gradle_test.dart
packages/flutter_tools/test/android/gradle_test.dart
+2
-2
application_package_test.dart
packages/flutter_tools/test/application_package_test.dart
+5
-5
build_linux_test.dart
packages/flutter_tools/test/commands/build_linux_test.dart
+1
-1
build_macos_test.dart
packages/flutter_tools/test/commands/build_macos_test.dart
+1
-1
create_test.dart
packages/flutter_tools/test/commands/create_test.dart
+6
-6
flutter_manifest_test.dart
packages/flutter_tools/test/flutter_manifest_test.dart
+16
-16
cocoapods_test.dart
packages/flutter_tools/test/ios/cocoapods_test.dart
+6
-6
devices_test.dart
packages/flutter_tools/test/ios/devices_test.dart
+3
-3
simulators_test.dart
packages/flutter_tools/test/ios/simulators_test.dart
+3
-3
xcodeproj_test.dart
packages/flutter_tools/test/ios/xcodeproj_test.dart
+5
-5
linux_device_test.dart
packages/flutter_tools/test/linux/linux_device_test.dart
+2
-2
macos_device_test.dart
packages/flutter_tools/test/macos/macos_device_test.dart
+2
-2
project_test.dart
packages/flutter_tools/test/project_test.dart
+17
-14
test_compiler_test.dart
packages/flutter_tools/test/test_compiler_test.dart
+2
-2
devices_test.dart
packages/flutter_tools/test/web/devices_test.dart
+1
-1
windows_device_test.dart
packages/flutter_tools/test/windows/windows_device_test.dart
+2
-2
tool_coverage.dart
packages/flutter_tools/tool/tool_coverage.dart
+1
-1
No files found.
packages/flutter_tools/bin/fuchsia_tester.dart
View file @
4ff46719
...
@@ -117,7 +117,7 @@ Future<void> run(List<String> args) async {
...
@@ -117,7 +117,7 @@ Future<void> run(List<String> args) async {
CoverageCollector
collector
;
CoverageCollector
collector
;
if
(
argResults
[
'coverage'
])
{
if
(
argResults
[
'coverage'
])
{
collector
=
CoverageCollector
(
collector
=
CoverageCollector
(
flutterProject:
await
FlutterProject
.
current
(),
flutterProject:
FlutterProject
.
current
(),
coverageDirectory:
coverageDirectory
,
coverageDirectory:
coverageDirectory
,
);
);
if
(!
argResults
.
options
.
contains
(
_kOptionTestDirectory
))
{
if
(!
argResults
.
options
.
contains
(
_kOptionTestDirectory
))
{
...
...
packages/flutter_tools/lib/src/android/android_device.dart
View file @
4ff46719
...
@@ -373,7 +373,7 @@ class AndroidDevice extends Device {
...
@@ -373,7 +373,7 @@ class AndroidDevice extends Device {
if
(!
prebuiltApplication
||
androidSdk
.
licensesAvailable
&&
androidSdk
.
latestVersion
==
null
)
{
if
(!
prebuiltApplication
||
androidSdk
.
licensesAvailable
&&
androidSdk
.
latestVersion
==
null
)
{
printTrace
(
'Building APK'
);
printTrace
(
'Building APK'
);
final
FlutterProject
project
=
await
FlutterProject
.
current
();
final
FlutterProject
project
=
FlutterProject
.
current
();
await
buildApk
(
await
buildApk
(
project:
project
,
project:
project
,
target:
mainPath
,
target:
mainPath
,
...
...
packages/flutter_tools/lib/src/android/gradle.dart
View file @
4ff46719
...
@@ -112,7 +112,7 @@ Future<GradleProject> _gradleProject() async {
...
@@ -112,7 +112,7 @@ Future<GradleProject> _gradleProject() async {
/// potentially downloaded.
/// potentially downloaded.
Future
<
void
>
checkGradleDependencies
()
async
{
Future
<
void
>
checkGradleDependencies
()
async
{
final
Status
progress
=
logger
.
startProgress
(
'Ensuring gradle dependencies are up to date...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
final
Status
progress
=
logger
.
startProgress
(
'Ensuring gradle dependencies are up to date...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
String
gradle
=
await
_ensureGradle
(
flutterProject
);
final
String
gradle
=
await
_ensureGradle
(
flutterProject
);
await
runCheckedAsync
(
await
runCheckedAsync
(
<
String
>[
gradle
,
'dependencies'
],
<
String
>[
gradle
,
'dependencies'
],
...
@@ -126,7 +126,7 @@ Future<void> checkGradleDependencies() async {
...
@@ -126,7 +126,7 @@ Future<void> checkGradleDependencies() async {
// Note: Dependencies are resolved and possibly downloaded as a side-effect
// Note: Dependencies are resolved and possibly downloaded as a side-effect
// of calculating the app properties using Gradle. This may take minutes.
// of calculating the app properties using Gradle. This may take minutes.
Future
<
GradleProject
>
_readGradleProject
()
async
{
Future
<
GradleProject
>
_readGradleProject
()
async
{
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
String
gradle
=
await
_ensureGradle
(
flutterProject
);
final
String
gradle
=
await
_ensureGradle
(
flutterProject
);
updateLocalProperties
(
project:
flutterProject
);
updateLocalProperties
(
project:
flutterProject
);
final
Status
status
=
logger
.
startProgress
(
'Resolving dependencies...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
final
Status
status
=
logger
.
startProgress
(
'Resolving dependencies...'
,
timeout:
timeoutConfiguration
.
slowOperation
);
...
...
packages/flutter_tools/lib/src/application_package.dart
View file @
4ff46719
...
@@ -43,27 +43,27 @@ class ApplicationPackageFactory {
...
@@ -43,27 +43,27 @@ class ApplicationPackageFactory {
await
checkGradleDependencies
();
await
checkGradleDependencies
();
}
}
return
applicationBinary
==
null
return
applicationBinary
==
null
?
await
AndroidApk
.
fromAndroidProject
(
(
await
FlutterProject
.
current
()
).
android
)
?
await
AndroidApk
.
fromAndroidProject
(
FlutterProject
.
current
(
).
android
)
:
AndroidApk
.
fromApk
(
applicationBinary
);
:
AndroidApk
.
fromApk
(
applicationBinary
);
case
TargetPlatform
.
ios
:
case
TargetPlatform
.
ios
:
return
applicationBinary
==
null
return
applicationBinary
==
null
?
IOSApp
.
fromIosProject
(
(
await
FlutterProject
.
current
()
).
ios
)
?
IOSApp
.
fromIosProject
(
FlutterProject
.
current
(
).
ios
)
:
IOSApp
.
fromPrebuiltApp
(
applicationBinary
);
:
IOSApp
.
fromPrebuiltApp
(
applicationBinary
);
case
TargetPlatform
.
tester
:
case
TargetPlatform
.
tester
:
return
FlutterTesterApp
.
fromCurrentDirectory
();
return
FlutterTesterApp
.
fromCurrentDirectory
();
case
TargetPlatform
.
darwin_x64
:
case
TargetPlatform
.
darwin_x64
:
return
applicationBinary
==
null
return
applicationBinary
==
null
?
MacOSApp
.
fromMacOSProject
(
(
await
FlutterProject
.
current
()
).
macos
)
?
MacOSApp
.
fromMacOSProject
(
FlutterProject
.
current
(
).
macos
)
:
MacOSApp
.
fromPrebuiltApp
(
applicationBinary
);
:
MacOSApp
.
fromPrebuiltApp
(
applicationBinary
);
case
TargetPlatform
.
web
:
case
TargetPlatform
.
web
:
return
WebApplicationPackage
(
await
FlutterProject
.
current
());
return
WebApplicationPackage
(
FlutterProject
.
current
());
case
TargetPlatform
.
linux_x64
:
case
TargetPlatform
.
linux_x64
:
return
applicationBinary
==
null
return
applicationBinary
==
null
?
LinuxApp
.
fromLinuxProject
(
(
await
FlutterProject
.
current
()
).
linux
)
?
LinuxApp
.
fromLinuxProject
(
FlutterProject
.
current
(
).
linux
)
:
LinuxApp
.
fromPrebuiltApp
(
applicationBinary
);
:
LinuxApp
.
fromPrebuiltApp
(
applicationBinary
);
case
TargetPlatform
.
windows_x64
:
case
TargetPlatform
.
windows_x64
:
return
applicationBinary
==
null
return
applicationBinary
==
null
?
WindowsApp
.
fromWindowsProject
(
(
await
FlutterProject
.
current
()
).
windows
)
?
WindowsApp
.
fromWindowsProject
(
FlutterProject
.
current
(
).
windows
)
:
WindowsApp
.
fromPrebuiltApp
(
applicationBinary
);
:
WindowsApp
.
fromPrebuiltApp
(
applicationBinary
);
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
return
null
;
return
null
;
...
@@ -395,10 +395,10 @@ class ApplicationPackageStore {
...
@@ -395,10 +395,10 @@ class ApplicationPackageStore {
case
TargetPlatform
.
android_arm64
:
case
TargetPlatform
.
android_arm64
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x86
:
case
TargetPlatform
.
android_x86
:
android
??=
await
AndroidApk
.
fromAndroidProject
(
(
await
FlutterProject
.
current
()
).
android
);
android
??=
await
AndroidApk
.
fromAndroidProject
(
FlutterProject
.
current
(
).
android
);
return
android
;
return
android
;
case
TargetPlatform
.
ios
:
case
TargetPlatform
.
ios
:
iOS
??=
IOSApp
.
fromIosProject
(
(
await
FlutterProject
.
current
()
).
ios
);
iOS
??=
IOSApp
.
fromIosProject
(
FlutterProject
.
current
(
).
ios
);
return
iOS
;
return
iOS
;
case
TargetPlatform
.
darwin_x64
:
case
TargetPlatform
.
darwin_x64
:
case
TargetPlatform
.
linux_x64
:
case
TargetPlatform
.
linux_x64
:
...
...
packages/flutter_tools/lib/src/asset.dart
View file @
4ff46719
...
@@ -112,7 +112,7 @@ class _ManifestAssetBundle implements AssetBundle {
...
@@ -112,7 +112,7 @@ class _ManifestAssetBundle implements AssetBundle {
packagesPath
??=
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
packagesPath
??=
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
FlutterManifest
flutterManifest
;
FlutterManifest
flutterManifest
;
try
{
try
{
flutterManifest
=
await
FlutterManifest
.
createFromPath
(
manifestPath
);
flutterManifest
=
FlutterManifest
.
createFromPath
(
manifestPath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
printStatus
(
'Error detected in pubspec.yaml:'
,
emphasis:
true
);
printStatus
(
'Error detected in pubspec.yaml:'
,
emphasis:
true
);
printError
(
'
$e
'
);
printError
(
'
$e
'
);
...
@@ -162,7 +162,7 @@ class _ManifestAssetBundle implements AssetBundle {
...
@@ -162,7 +162,7 @@ class _ManifestAssetBundle implements AssetBundle {
final
Uri
package
=
packageMap
.
map
[
packageName
];
final
Uri
package
=
packageMap
.
map
[
packageName
];
if
(
package
!=
null
&&
package
.
scheme
==
'file'
)
{
if
(
package
!=
null
&&
package
.
scheme
==
'file'
)
{
final
String
packageManifestPath
=
fs
.
path
.
fromUri
(
package
.
resolve
(
'../pubspec.yaml'
));
final
String
packageManifestPath
=
fs
.
path
.
fromUri
(
package
.
resolve
(
'../pubspec.yaml'
));
final
FlutterManifest
packageFlutterManifest
=
await
FlutterManifest
.
createFromPath
(
packageManifestPath
);
final
FlutterManifest
packageFlutterManifest
=
FlutterManifest
.
createFromPath
(
packageManifestPath
);
if
(
packageFlutterManifest
==
null
)
if
(
packageFlutterManifest
==
null
)
continue
;
continue
;
// Skip the app itself
// Skip the app itself
...
...
packages/flutter_tools/lib/src/base/build.dart
View file @
4ff46719
...
@@ -88,7 +88,7 @@ class AOTSnapshotter {
...
@@ -88,7 +88,7 @@ class AOTSnapshotter {
})
async
{
})
async
{
FlutterProject
flutterProject
;
FlutterProject
flutterProject
;
if
(
fs
.
file
(
'pubspec.yaml'
).
existsSync
())
{
if
(
fs
.
file
(
'pubspec.yaml'
).
existsSync
())
{
flutterProject
=
await
FlutterProject
.
current
();
flutterProject
=
FlutterProject
.
current
();
}
}
if
(!
_isValidAotPlatform
(
platform
,
buildMode
))
{
if
(!
_isValidAotPlatform
(
platform
,
buildMode
))
{
printError
(
'
${getNameForTargetPlatform(platform)}
does not support AOT compilation.'
);
printError
(
'
${getNameForTargetPlatform(platform)}
does not support AOT compilation.'
);
...
@@ -304,7 +304,7 @@ class AOTSnapshotter {
...
@@ -304,7 +304,7 @@ class AOTSnapshotter {
@required
bool
trackWidgetCreation
,
@required
bool
trackWidgetCreation
,
List
<
String
>
extraFrontEndOptions
=
const
<
String
>[],
List
<
String
>
extraFrontEndOptions
=
const
<
String
>[],
})
async
{
})
async
{
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
Directory
outputDir
=
fs
.
directory
(
outputPath
);
final
Directory
outputDir
=
fs
.
directory
(
outputPath
);
outputDir
.
createSync
(
recursive:
true
);
outputDir
.
createSync
(
recursive:
true
);
...
...
packages/flutter_tools/lib/src/bundle.dart
View file @
4ff46719
...
@@ -70,7 +70,7 @@ Future<void> build({
...
@@ -70,7 +70,7 @@ Future<void> build({
assetDirPath
??=
getAssetBuildDirectory
();
assetDirPath
??=
getAssetBuildDirectory
();
packagesPath
??=
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
packagesPath
??=
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
applicationKernelFilePath
??=
getDefaultApplicationKernelPath
(
trackWidgetCreation:
trackWidgetCreation
);
applicationKernelFilePath
??=
getDefaultApplicationKernelPath
(
trackWidgetCreation:
trackWidgetCreation
);
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
if
(
compilationTraceFilePath
!=
null
)
{
if
(
compilationTraceFilePath
!=
null
)
{
if
(
buildMode
!=
BuildMode
.
dynamicProfile
&&
buildMode
!=
BuildMode
.
dynamicRelease
)
{
if
(
buildMode
!=
BuildMode
.
dynamicProfile
&&
buildMode
!=
BuildMode
.
dynamicRelease
)
{
...
...
packages/flutter_tools/lib/src/codegen.dart
View file @
4ff46719
...
@@ -115,7 +115,7 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
...
@@ -115,7 +115,7 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
'sdkRoot, packagesPath are not supported when using the experimental '
'sdkRoot, packagesPath are not supported when using the experimental '
'build* pipeline'
);
'build* pipeline'
);
}
}
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
codeGenerator
.
updatePackages
(
flutterProject
);
codeGenerator
.
updatePackages
(
flutterProject
);
final
CodegenDaemon
codegenDaemon
=
await
codeGenerator
.
daemon
(
flutterProject
);
final
CodegenDaemon
codegenDaemon
=
await
codeGenerator
.
daemon
(
flutterProject
);
codegenDaemon
.
startBuild
();
codegenDaemon
.
startBuild
();
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
4ff46719
...
@@ -160,7 +160,7 @@ class AttachCommand extends FlutterCommand {
...
@@ -160,7 +160,7 @@ class AttachCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
...
...
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
4ff46719
...
@@ -48,7 +48,7 @@ class BuildApkCommand extends BuildSubCommand {
...
@@ -48,7 +48,7 @@ class BuildApkCommand extends BuildSubCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
buildApk
(
await
buildApk
(
project:
await
FlutterProject
.
current
(),
project:
FlutterProject
.
current
(),
target:
targetFile
,
target:
targetFile
,
buildInfo:
getBuildInfo
(),
buildInfo:
getBuildInfo
(),
);
);
...
...
packages/flutter_tools/lib/src/commands/build_appbundle.dart
View file @
4ff46719
...
@@ -41,7 +41,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
...
@@ -41,7 +41,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
buildAppBundle
(
await
buildAppBundle
(
project:
await
FlutterProject
.
current
(),
project:
FlutterProject
.
current
(),
target:
targetFile
,
target:
targetFile
,
buildInfo:
getBuildInfo
(),
buildInfo:
getBuildInfo
(),
);
);
...
...
packages/flutter_tools/lib/src/commands/build_linux.dart
View file @
4ff46719
...
@@ -52,7 +52,7 @@ class BuildLinuxCommand extends BuildSubCommand {
...
@@ -52,7 +52,7 @@ class BuildLinuxCommand extends BuildSubCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
final
BuildInfo
buildInfo
=
getBuildInfo
();
final
BuildInfo
buildInfo
=
getBuildInfo
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
if
(!
platform
.
isLinux
)
{
if
(!
platform
.
isLinux
)
{
throwToolExit
(
'"build linux" only supported on Linux hosts.'
);
throwToolExit
(
'"build linux" only supported on Linux hosts.'
);
}
}
...
...
packages/flutter_tools/lib/src/commands/build_macos.dart
View file @
4ff46719
...
@@ -52,7 +52,7 @@ class BuildMacosCommand extends BuildSubCommand {
...
@@ -52,7 +52,7 @@ class BuildMacosCommand extends BuildSubCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
final
BuildInfo
buildInfo
=
getBuildInfo
();
final
BuildInfo
buildInfo
=
getBuildInfo
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
if
(!
platform
.
isMacOS
)
{
if
(!
platform
.
isMacOS
)
{
throwToolExit
(
'"build macos" only supported on macOS hosts.'
);
throwToolExit
(
'"build macos" only supported on macOS hosts.'
);
}
}
...
...
packages/flutter_tools/lib/src/commands/build_windows.dart
View file @
4ff46719
...
@@ -51,7 +51,7 @@ class BuildWindowsCommand extends BuildSubCommand {
...
@@ -51,7 +51,7 @@ class BuildWindowsCommand extends BuildSubCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
BuildInfo
buildInfo
=
getBuildInfo
();
final
BuildInfo
buildInfo
=
getBuildInfo
();
if
(!
platform
.
isWindows
)
{
if
(!
platform
.
isWindows
)
{
throwToolExit
(
'"build windows" only supported on Windows hosts.'
);
throwToolExit
(
'"build windows" only supported on Windows hosts.'
);
...
...
packages/flutter_tools/lib/src/commands/clean.dart
View file @
4ff46719
...
@@ -27,7 +27,7 @@ class CleanCommand extends FlutterCommand {
...
@@ -27,7 +27,7 @@ class CleanCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
Directory
buildDir
=
fs
.
directory
(
getBuildDirectory
());
final
Directory
buildDir
=
fs
.
directory
(
getBuildDirectory
());
printStatus
(
"Deleting '
${buildDir.path}${fs.path.separator}
'."
);
printStatus
(
"Deleting '
${buildDir.path}${fs.path.separator}
'."
);
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
4ff46719
...
@@ -304,7 +304,7 @@ class CreateCommand extends FlutterCommand {
...
@@ -304,7 +304,7 @@ class CreateCommand extends FlutterCommand {
String
organization
=
argResults
[
'org'
];
String
organization
=
argResults
[
'org'
];
if
(!
argResults
.
wasParsed
(
'org'
))
{
if
(!
argResults
.
wasParsed
(
'org'
))
{
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
projectDir
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
projectDir
);
final
Set
<
String
>
existingOrganizations
=
project
.
organizationNames
;
final
Set
<
String
>
existingOrganizations
=
project
.
organizationNames
;
if
(
existingOrganizations
.
length
==
1
)
{
if
(
existingOrganizations
.
length
==
1
)
{
organization
=
existingOrganizations
.
first
;
organization
=
existingOrganizations
.
first
;
...
@@ -385,7 +385,7 @@ class CreateCommand extends FlutterCommand {
...
@@ -385,7 +385,7 @@ class CreateCommand extends FlutterCommand {
printStatus
(
'Your module code is in
$relativeMainPath
.'
);
printStatus
(
'Your module code is in
$relativeMainPath
.'
);
}
else
{
}
else
{
// Run doctor; tell the user the next steps.
// Run doctor; tell the user the next steps.
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
projectDirPath
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
projectDirPath
);
final
FlutterProject
app
=
project
.
hasExampleApp
?
project
.
example
:
project
;
final
FlutterProject
app
=
project
.
hasExampleApp
?
project
.
example
:
project
;
final
String
relativeAppPath
=
fs
.
path
.
normalize
(
fs
.
path
.
relative
(
app
.
directory
.
path
));
final
String
relativeAppPath
=
fs
.
path
.
normalize
(
fs
.
path
.
relative
(
app
.
directory
.
path
));
final
String
relativeAppMain
=
fs
.
path
.
join
(
relativeAppPath
,
'lib'
,
'main.dart'
);
final
String
relativeAppMain
=
fs
.
path
.
join
(
relativeAppPath
,
'lib'
,
'main.dart'
);
...
@@ -443,7 +443,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
...
@@ -443,7 +443,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
directory:
directory
.
path
,
directory:
directory
.
path
,
offline:
argResults
[
'offline'
],
offline:
argResults
[
'offline'
],
);
);
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
directory
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
await
project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
false
);
await
project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
false
);
}
}
return
generatedCount
;
return
generatedCount
;
...
@@ -480,7 +480,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
...
@@ -480,7 +480,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
offline:
argResults
[
'offline'
],
offline:
argResults
[
'offline'
],
);
);
}
}
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
directory
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
gradle
.
updateLocalProperties
(
project:
project
,
requireAndroidSdk:
false
);
gradle
.
updateLocalProperties
(
project:
project
,
requireAndroidSdk:
false
);
final
String
projectName
=
templateContext
[
'projectName'
];
final
String
projectName
=
templateContext
[
'projectName'
];
...
@@ -501,7 +501,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
...
@@ -501,7 +501,7 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
Future
<
int
>
_generateApp
(
Directory
directory
,
Map
<
String
,
dynamic
>
templateContext
,
{
bool
overwrite
=
false
})
async
{
Future
<
int
>
_generateApp
(
Directory
directory
,
Map
<
String
,
dynamic
>
templateContext
,
{
bool
overwrite
=
false
})
async
{
int
generatedCount
=
0
;
int
generatedCount
=
0
;
generatedCount
+=
_renderTemplate
(
'app'
,
directory
,
templateContext
,
overwrite:
overwrite
);
generatedCount
+=
_renderTemplate
(
'app'
,
directory
,
templateContext
,
overwrite:
overwrite
);
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
directory
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
directory
);
generatedCount
+=
_injectGradleWrapper
(
project
);
generatedCount
+=
_injectGradleWrapper
(
project
);
if
(
argResults
[
'with-driver-test'
])
{
if
(
argResults
[
'with-driver-test'
])
{
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
4ff46719
...
@@ -345,7 +345,7 @@ class AppDomain extends Domain {
...
@@ -345,7 +345,7 @@ class AppDomain extends Domain {
// We change the current working directory for the duration of the `start` command.
// We change the current working directory for the duration of the `start` command.
final
Directory
cwd
=
fs
.
currentDirectory
;
final
Directory
cwd
=
fs
.
currentDirectory
;
fs
.
currentDirectory
=
fs
.
directory
(
projectDirectory
);
fs
.
currentDirectory
=
fs
.
directory
(
projectDirectory
);
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
FlutterDevice
flutterDevice
=
await
FlutterDevice
.
create
(
final
FlutterDevice
flutterDevice
=
await
FlutterDevice
.
create
(
device
,
device
,
...
...
packages/flutter_tools/lib/src/commands/generate.dart
View file @
4ff46719
...
@@ -29,7 +29,7 @@ class GenerateCommand extends FlutterCommand {
...
@@ -29,7 +29,7 @@ class GenerateCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
CodegenDaemon
codegenDaemon
=
await
codeGenerator
.
daemon
(
flutterProject
);
final
CodegenDaemon
codegenDaemon
=
await
codeGenerator
.
daemon
(
flutterProject
);
codegenDaemon
.
startBuild
();
codegenDaemon
.
startBuild
();
await
for
(
CodegenStatus
codegenStatus
in
codegenDaemon
.
buildResults
)
{
await
for
(
CodegenStatus
codegenStatus
in
codegenDaemon
.
buildResults
)
{
...
...
packages/flutter_tools/lib/src/commands/inject_plugins.dart
View file @
4ff46719
...
@@ -28,7 +28,7 @@ class InjectPluginsCommand extends FlutterCommand {
...
@@ -28,7 +28,7 @@ class InjectPluginsCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
FlutterProject
project
=
await
FlutterProject
.
current
();
final
FlutterProject
project
=
FlutterProject
.
current
();
refreshPluginsList
(
project
,
checkProjects:
true
);
refreshPluginsList
(
project
,
checkProjects:
true
);
await
injectPlugins
(
project
,
checkProjects:
true
);
await
injectPlugins
(
project
,
checkProjects:
true
);
final
bool
result
=
hasPlugins
(
project
);
final
bool
result
=
hasPlugins
(
project
);
...
...
packages/flutter_tools/lib/src/commands/make_host_app_editable.dart
View file @
4ff46719
...
@@ -36,7 +36,7 @@ class MakeHostAppEditableCommand extends FlutterCommand {
...
@@ -36,7 +36,7 @@ class MakeHostAppEditableCommand extends FlutterCommand {
@override
@override
Future
<
void
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
await
super
.
validateCommand
();
await
super
.
validateCommand
();
_project
=
await
FlutterProject
.
current
();
_project
=
FlutterProject
.
current
();
if
(!
_project
.
isModule
)
if
(!
_project
.
isModule
)
throw
ToolExit
(
"Only projects created using 'flutter create -t module' can have their host apps made editable."
);
throw
ToolExit
(
"Only projects created using 'flutter create -t module' can have their host apps made editable."
);
}
}
...
...
packages/flutter_tools/lib/src/commands/packages.dart
View file @
4ff46719
...
@@ -93,7 +93,7 @@ class PackagesGetCommand extends FlutterCommand {
...
@@ -93,7 +93,7 @@ class PackagesGetCommand extends FlutterCommand {
}
}
await
_runPubGet
(
target
);
await
_runPubGet
(
target
);
final
FlutterProject
rootProject
=
await
FlutterProject
.
fromPath
(
target
);
final
FlutterProject
rootProject
=
FlutterProject
.
fromPath
(
target
);
await
rootProject
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
await
rootProject
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
// Get/upgrade packages in example app as well
// Get/upgrade packages in example app as well
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
4ff46719
...
@@ -365,7 +365,7 @@ class RunCommand extends RunCommandBase {
...
@@ -365,7 +365,7 @@ class RunCommand extends RunCommandBase {
expFlags
=
argResults
[
FlutterOptions
.
kEnableExperiment
];
expFlags
=
argResults
[
FlutterOptions
.
kEnableExperiment
];
}
}
final
List
<
FlutterDevice
>
flutterDevices
=
<
FlutterDevice
>[];
final
List
<
FlutterDevice
>
flutterDevices
=
<
FlutterDevice
>[];
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
for
(
Device
device
in
devices
)
{
for
(
Device
device
in
devices
)
{
final
FlutterDevice
flutterDevice
=
await
FlutterDevice
.
create
(
final
FlutterDevice
flutterDevice
=
await
FlutterDevice
.
create
(
device
,
device
,
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
4ff46719
...
@@ -132,7 +132,7 @@ class TestCommand extends FastFlutterCommand {
...
@@ -132,7 +132,7 @@ class TestCommand extends FastFlutterCommand {
}
}
final
List
<
String
>
names
=
argResults
[
'name'
];
final
List
<
String
>
names
=
argResults
[
'name'
];
final
List
<
String
>
plainNames
=
argResults
[
'plain-name'
];
final
List
<
String
>
plainNames
=
argResults
[
'plain-name'
];
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
Iterable
<
String
>
files
=
argResults
.
rest
.
map
<
String
>((
String
testPath
)
=>
fs
.
path
.
absolute
(
testPath
)).
toList
();
Iterable
<
String
>
files
=
argResults
.
rest
.
map
<
String
>((
String
testPath
)
=>
fs
.
path
.
absolute
(
testPath
)).
toList
();
...
@@ -170,7 +170,7 @@ class TestCommand extends FastFlutterCommand {
...
@@ -170,7 +170,7 @@ class TestCommand extends FastFlutterCommand {
CoverageCollector
collector
;
CoverageCollector
collector
;
if
(
argResults
[
'coverage'
]
||
argResults
[
'merge-coverage'
])
{
if
(
argResults
[
'coverage'
]
||
argResults
[
'merge-coverage'
])
{
collector
=
CoverageCollector
(
collector
=
CoverageCollector
(
flutterProject:
await
FlutterProject
.
current
(),
flutterProject:
FlutterProject
.
current
(),
);
);
}
}
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
4ff46719
...
@@ -230,7 +230,7 @@ class KernelCompiler {
...
@@ -230,7 +230,7 @@ class KernelCompiler {
);
);
FlutterProject
flutterProject
;
FlutterProject
flutterProject
;
if
(
fs
.
file
(
'pubspec.yaml'
).
existsSync
())
{
if
(
fs
.
file
(
'pubspec.yaml'
).
existsSync
())
{
flutterProject
=
await
FlutterProject
.
current
();
flutterProject
=
FlutterProject
.
current
();
}
}
// TODO(cbracken): eliminate pathFilter.
// TODO(cbracken): eliminate pathFilter.
...
...
packages/flutter_tools/lib/src/flutter_manifest.dart
View file @
4ff46719
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:pub_semver/pub_semver.dart'
;
import
'package:pub_semver/pub_semver.dart'
;
import
'package:yaml/yaml.dart'
;
import
'package:yaml/yaml.dart'
;
...
@@ -27,22 +25,22 @@ class FlutterManifest {
...
@@ -27,22 +25,22 @@ class FlutterManifest {
}
}
/// Returns null on invalid manifest. Returns empty manifest on missing file.
/// Returns null on invalid manifest. Returns empty manifest on missing file.
static
F
uture
<
FlutterManifest
>
createFromPath
(
String
path
)
async
{
static
F
lutterManifest
createFromPath
(
String
path
)
{
if
(
path
==
null
||
!
fs
.
isFileSync
(
path
))
if
(
path
==
null
||
!
fs
.
isFileSync
(
path
))
return
_createFromYaml
(
null
);
return
_createFromYaml
(
null
);
final
String
manifest
=
await
fs
.
file
(
path
).
readAsString
();
final
String
manifest
=
fs
.
file
(
path
).
readAsStringSync
();
return
createFromString
(
manifest
);
return
createFromString
(
manifest
);
}
}
/// Returns null on missing or invalid manifest
/// Returns null on missing or invalid manifest
@visibleForTesting
@visibleForTesting
static
F
uture
<
FlutterManifest
>
createFromString
(
String
manifest
)
async
{
static
F
lutterManifest
createFromString
(
String
manifest
)
{
return
_createFromYaml
(
loadYaml
(
manifest
));
return
_createFromYaml
(
loadYaml
(
manifest
));
}
}
static
F
uture
<
FlutterManifest
>
_createFromYaml
(
dynamic
yamlDocument
)
async
{
static
F
lutterManifest
_createFromYaml
(
dynamic
yamlDocument
)
{
final
FlutterManifest
pubspec
=
FlutterManifest
.
_
();
final
FlutterManifest
pubspec
=
FlutterManifest
.
_
();
if
(
yamlDocument
!=
null
&&
!
await
_validate
(
yamlDocument
))
if
(
yamlDocument
!=
null
&&
!
_validate
(
yamlDocument
))
return
null
;
return
null
;
final
Map
<
dynamic
,
dynamic
>
yamlMap
=
yamlDocument
;
final
Map
<
dynamic
,
dynamic
>
yamlMap
=
yamlDocument
;
...
@@ -289,7 +287,7 @@ String buildSchemaPath(FileSystem fs) {
...
@@ -289,7 +287,7 @@ String buildSchemaPath(FileSystem fs) {
/// This method should be kept in sync with the schema in
/// This method should be kept in sync with the schema in
/// `$FLUTTER_ROOT/packages/flutter_tools/schema/pubspec_yaml.json`,
/// `$FLUTTER_ROOT/packages/flutter_tools/schema/pubspec_yaml.json`,
/// but avoid introducing depdendencies on packages for simple validation.
/// but avoid introducing depdendencies on packages for simple validation.
Future
<
bool
>
_validate
(
YamlMap
manifest
)
async
{
bool
_validate
(
YamlMap
manifest
)
{
final
List
<
String
>
errors
=
<
String
>[];
final
List
<
String
>
errors
=
<
String
>[];
for
(
final
MapEntry
<
dynamic
,
dynamic
>
kvp
in
manifest
.
entries
)
{
for
(
final
MapEntry
<
dynamic
,
dynamic
>
kvp
in
manifest
.
entries
)
{
if
(
kvp
.
key
is
!
String
)
{
if
(
kvp
.
key
is
!
String
)
{
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
4ff46719
...
@@ -365,7 +365,7 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -365,7 +365,7 @@ Future<XcodeBuildResult> buildXcodeProject({
// copied over to a location that is suitable for Xcodebuild to find them.
// copied over to a location that is suitable for Xcodebuild to find them.
await
_addServicesToBundle
(
app
.
project
.
hostAppRoot
);
await
_addServicesToBundle
(
app
.
project
.
hostAppRoot
);
final
FlutterProject
project
=
await
FlutterProject
.
current
();
final
FlutterProject
project
=
FlutterProject
.
current
();
await
updateGeneratedXcodeProperties
(
await
updateGeneratedXcodeProperties
(
project:
project
,
project:
project
,
targetOverride:
targetOverride
,
targetOverride:
targetOverride
,
...
...
packages/flutter_tools/lib/src/linux/linux_device.dart
View file @
4ff46719
...
@@ -73,7 +73,7 @@ class LinuxDevice extends Device {
...
@@ -73,7 +73,7 @@ class LinuxDevice extends Device {
})
async
{
})
async
{
_lastBuiltMode
=
debuggingOptions
.
buildInfo
.
mode
;
_lastBuiltMode
=
debuggingOptions
.
buildInfo
.
mode
;
if
(!
prebuiltApplication
)
{
if
(!
prebuiltApplication
)
{
await
buildLinux
(
(
await
FlutterProject
.
current
()
).
linux
,
debuggingOptions
.
buildInfo
);
await
buildLinux
(
FlutterProject
.
current
(
).
linux
,
debuggingOptions
.
buildInfo
);
}
}
await
stopApp
(
package
);
await
stopApp
(
package
);
final
Process
process
=
await
processManager
.
start
(<
String
>[
final
Process
process
=
await
processManager
.
start
(<
String
>[
...
...
packages/flutter_tools/lib/src/macos/macos_device.dart
View file @
4ff46719
...
@@ -75,7 +75,7 @@ class MacOSDevice extends Device {
...
@@ -75,7 +75,7 @@ class MacOSDevice extends Device {
// Stop any running applications with the same executable.
// Stop any running applications with the same executable.
if
(!
prebuiltApplication
)
{
if
(!
prebuiltApplication
)
{
Cache
.
releaseLockEarly
();
Cache
.
releaseLockEarly
();
await
buildMacOS
(
await
FlutterProject
.
current
(),
debuggingOptions
?.
buildInfo
);
await
buildMacOS
(
FlutterProject
.
current
(),
debuggingOptions
?.
buildInfo
);
}
}
// Make sure to call stop app after we've built.
// Make sure to call stop app after we've built.
await
stopApp
(
package
);
await
stopApp
(
package
);
...
...
packages/flutter_tools/lib/src/project.dart
View file @
4ff46719
...
@@ -39,12 +39,12 @@ class FlutterProject {
...
@@ -39,12 +39,12 @@ class FlutterProject {
/// Returns a future that completes with a [FlutterProject] view of the given directory
/// Returns a future that completes with a [FlutterProject] view of the given directory
/// or a ToolExit error, if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
/// or a ToolExit error, if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
static
F
uture
<
FlutterProject
>
fromDirectory
(
Directory
directory
)
async
{
static
F
lutterProject
fromDirectory
(
Directory
directory
)
{
assert
(
directory
!=
null
);
assert
(
directory
!=
null
);
final
FlutterManifest
manifest
=
await
_readManifest
(
final
FlutterManifest
manifest
=
_readManifest
(
directory
.
childFile
(
bundle
.
defaultManifestPath
).
path
,
directory
.
childFile
(
bundle
.
defaultManifestPath
).
path
,
);
);
final
FlutterManifest
exampleManifest
=
await
_readManifest
(
final
FlutterManifest
exampleManifest
=
_readManifest
(
_exampleDirectory
(
directory
).
childFile
(
bundle
.
defaultManifestPath
).
path
,
_exampleDirectory
(
directory
).
childFile
(
bundle
.
defaultManifestPath
).
path
,
);
);
return
FlutterProject
(
directory
,
manifest
,
exampleManifest
);
return
FlutterProject
(
directory
,
manifest
,
exampleManifest
);
...
@@ -52,11 +52,11 @@ class FlutterProject {
...
@@ -52,11 +52,11 @@ class FlutterProject {
/// Returns a future that completes with a [FlutterProject] view of the current directory.
/// Returns a future that completes with a [FlutterProject] view of the current directory.
/// or a ToolExit error, if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
/// or a ToolExit error, if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
static
F
uture
<
FlutterProject
>
current
()
=>
fromDirectory
(
fs
.
currentDirectory
);
static
F
lutterProject
current
()
=>
fromDirectory
(
fs
.
currentDirectory
);
/// Returns a future that completes with a [FlutterProject] view of the given directory.
/// Returns a future that completes with a [FlutterProject] view of the given directory.
/// or a ToolExit error, if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
/// or a ToolExit error, if `pubspec.yaml` or `example/pubspec.yaml` is invalid.
static
F
uture
<
FlutterProject
>
fromPath
(
String
path
)
=>
fromDirectory
(
fs
.
directory
(
path
));
static
F
lutterProject
fromPath
(
String
path
)
=>
fromDirectory
(
fs
.
directory
(
path
));
/// The location of this project.
/// The location of this project.
final
Directory
directory
;
final
Directory
directory
;
...
@@ -149,8 +149,8 @@ class FlutterProject {
...
@@ -149,8 +149,8 @@ class FlutterProject {
///
///
/// Completes with an empty [FlutterManifest], if the file does not exist.
/// Completes with an empty [FlutterManifest], if the file does not exist.
/// Completes with a ToolExit on validation error.
/// Completes with a ToolExit on validation error.
static
F
uture
<
FlutterManifest
>
_readManifest
(
String
path
)
async
{
static
F
lutterManifest
_readManifest
(
String
path
)
{
final
FlutterManifest
manifest
=
await
FlutterManifest
.
createFromPath
(
path
);
final
FlutterManifest
manifest
=
FlutterManifest
.
createFromPath
(
path
);
if
(
manifest
==
null
)
if
(
manifest
==
null
)
throwToolExit
(
'Please correct the pubspec.yaml file at
$path
'
);
throwToolExit
(
'Please correct the pubspec.yaml file at
$path
'
);
return
manifest
;
return
manifest
;
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
4ff46719
...
@@ -1047,7 +1047,7 @@ Future<String> getMissingPackageHintForPlatform(TargetPlatform platform) async {
...
@@ -1047,7 +1047,7 @@ Future<String> getMissingPackageHintForPlatform(TargetPlatform platform) async {
case
TargetPlatform
.
android_arm64
:
case
TargetPlatform
.
android_arm64
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x86
:
case
TargetPlatform
.
android_x86
:
final
FlutterProject
project
=
await
FlutterProject
.
current
();
final
FlutterProject
project
=
FlutterProject
.
current
();
final
String
manifestPath
=
fs
.
path
.
relative
(
project
.
android
.
appManifestFile
.
path
);
final
String
manifestPath
=
fs
.
path
.
relative
(
project
.
android
.
appManifestFile
.
path
);
return
'Is your project missing an
$manifestPath
?
\n
Consider running "flutter create ." to create one.'
;
return
'Is your project missing an
$manifestPath
?
\n
Consider running "flutter create ." to create one.'
;
case
TargetPlatform
.
ios
:
case
TargetPlatform
.
ios
:
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
4ff46719
...
@@ -474,7 +474,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -474,7 +474,7 @@ abstract class FlutterCommand extends Command<void> {
if
(
shouldRunPub
)
{
if
(
shouldRunPub
)
{
await
pubGet
(
context:
PubContext
.
getVerifyContext
(
name
));
await
pubGet
(
context:
PubContext
.
getVerifyContext
(
name
));
final
FlutterProject
project
=
await
FlutterProject
.
current
();
final
FlutterProject
project
=
FlutterProject
.
current
();
await
project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
await
project
.
ensureReadyForPlatformSpecificTooling
(
checkProjects:
true
);
}
}
...
@@ -531,7 +531,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -531,7 +531,7 @@ abstract class FlutterCommand extends Command<void> {
// then filter then list by those supported in the current project. If
// then filter then list by those supported in the current project. If
// this ends up with a single device we can proceed as normal.
// this ends up with a single device we can proceed as normal.
if
(
devices
.
length
>
1
&&
!
deviceManager
.
hasSpecifiedAllDevices
&&
!
deviceManager
.
hasSpecifiedDeviceId
)
{
if
(
devices
.
length
>
1
&&
!
deviceManager
.
hasSpecifiedAllDevices
&&
!
deviceManager
.
hasSpecifiedDeviceId
)
{
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
devices
.
removeWhere
((
Device
device
)
=>
!
device
.
isSupportedForProject
(
flutterProject
));
devices
.
removeWhere
((
Device
device
)
=>
!
device
.
isSupportedForProject
(
flutterProject
));
}
}
...
...
packages/flutter_tools/lib/src/windows/windows_device.dart
View file @
4ff46719
...
@@ -74,7 +74,7 @@ class WindowsDevice extends Device {
...
@@ -74,7 +74,7 @@ class WindowsDevice extends Device {
bool
ipv6
=
false
,
bool
ipv6
=
false
,
})
async
{
})
async
{
if
(!
prebuiltApplication
)
{
if
(!
prebuiltApplication
)
{
await
buildWindows
(
(
await
FlutterProject
.
current
()
).
windows
,
debuggingOptions
.
buildInfo
);
await
buildWindows
(
FlutterProject
.
current
(
).
windows
,
debuggingOptions
.
buildInfo
);
}
}
await
stopApp
(
package
);
await
stopApp
(
package
);
final
Process
process
=
await
processManager
.
start
(<
String
>[
final
Process
process
=
await
processManager
.
start
(<
String
>[
...
...
packages/flutter_tools/test/android/android_device_test.dart
View file @
4ff46719
...
@@ -170,7 +170,7 @@ flutter:
...
@@ -170,7 +170,7 @@ flutter:
module: {}
module: {}
'''
);
'''
);
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
AndroidDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
expect
(
AndroidDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -181,7 +181,7 @@ flutter:
...
@@ -181,7 +181,7 @@ flutter:
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
directory
(
'android'
).
createSync
();
fs
.
directory
(
'android'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
AndroidDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
expect
(
AndroidDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -191,7 +191,7 @@ flutter:
...
@@ -191,7 +191,7 @@ flutter:
testUsingContext
(
'isSupportedForProject is false with no host app and no module'
,
()
async
{
testUsingContext
(
'isSupportedForProject is false with no host app and no module'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
AndroidDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
false
);
expect
(
AndroidDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
...
packages/flutter_tools/test/android/gradle_test.dart
View file @
4ff46719
...
@@ -33,7 +33,7 @@ void main() {
...
@@ -33,7 +33,7 @@ void main() {
// This test is written to fail if our bots get Android SDKs in the future: shouldBeToolExit
// This test is written to fail if our bots get Android SDKs in the future: shouldBeToolExit
// will be null and our expectation would fail. That would remind us to make these tests
// will be null and our expectation would fail. That would remind us to make these tests
// hermetic before adding Android SDKs to the bots.
// hermetic before adding Android SDKs to the bots.
updateLocalProperties
(
project:
await
FlutterProject
.
current
());
updateLocalProperties
(
project:
FlutterProject
.
current
());
}
on
Exception
catch
(
e
)
{
}
on
Exception
catch
(
e
)
{
shouldBeToolExit
=
e
;
shouldBeToolExit
=
e
;
}
}
...
@@ -264,7 +264,7 @@ someOtherTask
...
@@ -264,7 +264,7 @@ someOtherTask
writeEmptySchemaFile
(
fs
);
writeEmptySchemaFile
(
fs
);
updateLocalProperties
(
updateLocalProperties
(
project:
await
FlutterProject
.
fromPath
(
'path/to/project'
),
project:
FlutterProject
.
fromPath
(
'path/to/project'
),
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
requireAndroidSdk:
false
,
requireAndroidSdk:
false
,
);
);
...
...
packages/flutter_tools/test/application_package_test.dart
View file @
4ff46719
...
@@ -59,7 +59,7 @@ void main() {
...
@@ -59,7 +59,7 @@ void main() {
environment:
anyNamed
(
'environment'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
_
)
async
=>
ProcessResult
(
1
,
0
,
'stdout'
,
'stderr'
));
)).
thenAnswer
((
_
)
async
=>
ProcessResult
(
1
,
0
,
'stdout'
,
'stderr'
));
when
(
mockProcessManager
.
runSync
(
any
)).
thenReturn
(
ProcessResult
(
1
,
0
,
'stdout'
,
'stderr'
));
when
(
mockProcessManager
.
runSync
(
any
)).
thenReturn
(
ProcessResult
(
1
,
0
,
'stdout'
,
'stderr'
));
final
FlutterProject
project
=
await
FlutterProject
.
current
();
final
FlutterProject
project
=
FlutterProject
.
current
();
gradle
=
fs
.
file
(
project
.
android
.
hostAppGradleRoot
.
childFile
(
gradle
=
fs
.
file
(
project
.
android
.
hostAppGradleRoot
.
childFile
(
platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
,
platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
,
).
path
)..
createSync
(
recursive:
true
);
).
path
)..
createSync
(
recursive:
true
);
...
@@ -95,7 +95,7 @@ void main() {
...
@@ -95,7 +95,7 @@ void main() {
testUsingContext
(
'Licenses available, build tools not, apk exists'
,
()
async
{
testUsingContext
(
'Licenses available, build tools not, apk exists'
,
()
async
{
when
(
sdk
.
latestVersion
).
thenReturn
(
null
);
when
(
sdk
.
latestVersion
).
thenReturn
(
null
);
final
FlutterProject
project
=
await
FlutterProject
.
current
();
final
FlutterProject
project
=
FlutterProject
.
current
();
final
File
gradle
=
project
.
android
.
hostAppGradleRoot
.
childFile
(
final
File
gradle
=
project
.
android
.
hostAppGradleRoot
.
childFile
(
platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
,
platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
,
)..
createSync
(
recursive:
true
);
)..
createSync
(
recursive:
true
);
...
@@ -281,7 +281,7 @@ void main() {
...
@@ -281,7 +281,7 @@ void main() {
testUsingContext
(
'returns null when there is no ios or .ios directory'
,
()
async
{
testUsingContext
(
'returns null when there is no ios or .ios directory'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
BuildableIOSApp
iosApp
=
IOSApp
.
fromIosProject
(
(
await
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
)
).
ios
);
final
BuildableIOSApp
iosApp
=
IOSApp
.
fromIosProject
(
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
).
ios
);
expect
(
iosApp
,
null
);
expect
(
iosApp
,
null
);
},
overrides:
overrides
);
},
overrides:
overrides
);
...
@@ -290,7 +290,7 @@ void main() {
...
@@ -290,7 +290,7 @@ void main() {
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'ios/FooBar.xcodeproj'
).
createSync
(
recursive:
true
);
fs
.
file
(
'ios/FooBar.xcodeproj'
).
createSync
(
recursive:
true
);
final
BuildableIOSApp
iosApp
=
IOSApp
.
fromIosProject
(
(
await
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
)
).
ios
);
final
BuildableIOSApp
iosApp
=
IOSApp
.
fromIosProject
(
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
).
ios
);
expect
(
iosApp
,
null
);
expect
(
iosApp
,
null
);
},
overrides:
overrides
);
},
overrides:
overrides
);
...
@@ -299,7 +299,7 @@ void main() {
...
@@ -299,7 +299,7 @@ void main() {
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'ios/Runner.xcodeproj'
).
createSync
(
recursive:
true
);
fs
.
file
(
'ios/Runner.xcodeproj'
).
createSync
(
recursive:
true
);
final
BuildableIOSApp
iosApp
=
IOSApp
.
fromIosProject
(
(
await
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
)
).
ios
);
final
BuildableIOSApp
iosApp
=
IOSApp
.
fromIosProject
(
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
).
ios
);
expect
(
iosApp
,
null
);
expect
(
iosApp
,
null
);
},
overrides:
overrides
);
},
overrides:
overrides
);
...
...
packages/flutter_tools/test/commands/build_linux_test.dart
View file @
4ff46719
...
@@ -100,7 +100,7 @@ BINARY_NAME=fizz_bar
...
@@ -100,7 +100,7 @@ BINARY_NAME=fizz_bar
'''
);
'''
);
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
makefileExecutableName
(
flutterProject
.
linux
),
'fizz_bar'
);
expect
(
makefileExecutableName
(
flutterProject
.
linux
),
'fizz_bar'
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
()});
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
()});
...
...
packages/flutter_tools/test/commands/build_macos_test.dart
View file @
4ff46719
...
@@ -68,7 +68,7 @@ void main() {
...
@@ -68,7 +68,7 @@ void main() {
fs
.
directory
(
'macos'
).
createSync
();
fs
.
directory
(
'macos'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
);
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectory
(
fs
.
currentDirectory
);
final
Directory
flutterBuildDir
=
fs
.
directory
(
getMacOSBuildDirectory
());
final
Directory
flutterBuildDir
=
fs
.
directory
(
getMacOSBuildDirectory
());
when
(
mockProcessManager
.
start
(<
String
>[
when
(
mockProcessManager
.
start
(<
String
>[
...
...
packages/flutter_tools/test/commands/create_test.dart
View file @
4ff46719
...
@@ -532,7 +532,7 @@ void main() {
...
@@ -532,7 +532,7 @@ void main() {
String
tmpProjectDir
=
fs
.
path
.
join
(
tempDir
.
path
,
'hello_flutter'
);
String
tmpProjectDir
=
fs
.
path
.
join
(
tempDir
.
path
,
'hello_flutter'
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'com.example'
,
tmpProjectDir
]);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'com.example'
,
tmpProjectDir
]);
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
fs
.
directory
(
tmpProjectDir
));
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
fs
.
directory
(
tmpProjectDir
));
expect
(
expect
(
project
.
ios
.
productBundleIdentifier
,
project
.
ios
.
productBundleIdentifier
,
'com.example.helloFlutter'
,
'com.example.helloFlutter'
,
...
@@ -544,7 +544,7 @@ void main() {
...
@@ -544,7 +544,7 @@ void main() {
tmpProjectDir
=
fs
.
path
.
join
(
tempDir
.
path
,
'test_abc'
);
tmpProjectDir
=
fs
.
path
.
join
(
tempDir
.
path
,
'test_abc'
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'abc^*.1#@'
,
tmpProjectDir
]);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'abc^*.1#@'
,
tmpProjectDir
]);
project
=
await
FlutterProject
.
fromDirectory
(
fs
.
directory
(
tmpProjectDir
));
project
=
FlutterProject
.
fromDirectory
(
fs
.
directory
(
tmpProjectDir
));
expect
(
expect
(
project
.
ios
.
productBundleIdentifier
,
project
.
ios
.
productBundleIdentifier
,
'abc.1.testAbc'
,
'abc.1.testAbc'
,
...
@@ -556,7 +556,7 @@ void main() {
...
@@ -556,7 +556,7 @@ void main() {
tmpProjectDir
=
fs
.
path
.
join
(
tempDir
.
path
,
'flutter_project'
);
tmpProjectDir
=
fs
.
path
.
join
(
tempDir
.
path
,
'flutter_project'
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'#+^%'
,
tmpProjectDir
]);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'#+^%'
,
tmpProjectDir
]);
project
=
await
FlutterProject
.
fromDirectory
(
fs
.
directory
(
tmpProjectDir
));
project
=
FlutterProject
.
fromDirectory
(
fs
.
directory
(
tmpProjectDir
));
expect
(
expect
(
project
.
ios
.
productBundleIdentifier
,
project
.
ios
.
productBundleIdentifier
,
'flutterProject.untitled'
,
'flutterProject.untitled'
,
...
@@ -681,7 +681,7 @@ void main() {
...
@@ -681,7 +681,7 @@ void main() {
);
);
projectDir
.
childDirectory
(
'.ios'
).
deleteSync
(
recursive:
true
);
projectDir
.
childDirectory
(
'.ios'
).
deleteSync
(
recursive:
true
);
await
_createProject
(
projectDir
,
<
String
>[],
<
String
>[]);
await
_createProject
(
projectDir
,
<
String
>[],
<
String
>[]);
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
projectDir
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
projectDir
);
expect
(
expect
(
project
.
ios
.
productBundleIdentifier
,
project
.
ios
.
productBundleIdentifier
,
'com.bar.foo.flutterProject'
,
'com.bar.foo.flutterProject'
,
...
@@ -715,7 +715,7 @@ void main() {
...
@@ -715,7 +715,7 @@ void main() {
);
);
projectDir
.
childDirectory
(
'ios'
).
deleteSync
(
recursive:
true
);
projectDir
.
childDirectory
(
'ios'
).
deleteSync
(
recursive:
true
);
await
_createProject
(
projectDir
,
<
String
>[
'--no-pub'
],
<
String
>[]);
await
_createProject
(
projectDir
,
<
String
>[
'--no-pub'
],
<
String
>[]);
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
projectDir
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
projectDir
);
expect
(
expect
(
project
.
ios
.
productBundleIdentifier
,
project
.
ios
.
productBundleIdentifier
,
'com.bar.foo.flutterProject'
,
'com.bar.foo.flutterProject'
,
...
@@ -742,7 +742,7 @@ void main() {
...
@@ -742,7 +742,7 @@ void main() {
'android/src/main/java/com/example/flutter_project/FlutterProjectPlugin.java'
,
'android/src/main/java/com/example/flutter_project/FlutterProjectPlugin.java'
,
],
],
);
);
final
FlutterProject
project
=
await
FlutterProject
.
fromDirectory
(
projectDir
);
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
projectDir
);
expect
(
expect
(
project
.
example
.
ios
.
productBundleIdentifier
,
project
.
example
.
ios
.
productBundleIdentifier
,
'com.bar.foo.flutterProjectExample'
,
'com.bar.foo.flutterProjectExample'
,
...
...
packages/flutter_tools/test/flutter_manifest_test.dart
View file @
4ff46719
...
@@ -21,7 +21,7 @@ void main() {
...
@@ -21,7 +21,7 @@ void main() {
group
(
'FlutterManifest'
,
()
{
group
(
'FlutterManifest'
,
()
{
testUsingContext
(
'is empty when the pubspec.yaml file is empty'
,
()
async
{
testUsingContext
(
'is empty when the pubspec.yaml file is empty'
,
()
async
{
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
''
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
''
);
expect
(
flutterManifest
.
isEmpty
,
true
);
expect
(
flutterManifest
.
isEmpty
,
true
);
expect
(
flutterManifest
.
appName
,
''
);
expect
(
flutterManifest
.
appName
,
''
);
expect
(
flutterManifest
.
usesMaterialDesign
,
false
);
expect
(
flutterManifest
.
usesMaterialDesign
,
false
);
...
@@ -37,7 +37,7 @@ dependencies:
...
@@ -37,7 +37,7 @@ dependencies:
flutter:
flutter:
sdk: flutter
sdk: flutter
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
,
isNotNull
);
expect
(
flutterManifest
,
isNotNull
);
expect
(
flutterManifest
.
isEmpty
,
false
);
expect
(
flutterManifest
.
isEmpty
,
false
);
expect
(
flutterManifest
.
appName
,
'test'
);
expect
(
flutterManifest
.
appName
,
'test'
);
...
@@ -56,7 +56,7 @@ dependencies:
...
@@ -56,7 +56,7 @@ dependencies:
flutter:
flutter:
uses-material-design: true
uses-material-design: true
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
usesMaterialDesign
,
true
);
expect
(
flutterManifest
.
usesMaterialDesign
,
true
);
});
});
...
@@ -72,7 +72,7 @@ flutter:
...
@@ -72,7 +72,7 @@ flutter:
- a/foo
- a/foo
- a/bar
- a/bar
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
assets
.
length
,
2
);
expect
(
flutterManifest
.
assets
.
length
,
2
);
expect
(
flutterManifest
.
assets
[
0
],
Uri
.
parse
(
'a/foo'
));
expect
(
flutterManifest
.
assets
[
0
],
Uri
.
parse
(
'a/foo'
));
expect
(
flutterManifest
.
assets
[
1
],
Uri
.
parse
(
'a/bar'
));
expect
(
flutterManifest
.
assets
[
1
],
Uri
.
parse
(
'a/bar'
));
...
@@ -91,7 +91,7 @@ flutter:
...
@@ -91,7 +91,7 @@ flutter:
fonts:
fonts:
- asset: a/bar
- asset: a/bar
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
...
@@ -123,7 +123,7 @@ flutter:
...
@@ -123,7 +123,7 @@ flutter:
- asset: a/bar
- asset: a/bar
weight: 400
weight: 400
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
...
@@ -160,7 +160,7 @@ flutter:
...
@@ -160,7 +160,7 @@ flutter:
weight: 400
weight: 400
style: italic
style: italic
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
...
@@ -204,7 +204,7 @@ flutter:
...
@@ -204,7 +204,7 @@ flutter:
asset: a/baz
asset: a/baz
style: italic
style: italic
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
final
dynamic
expectedFontsDescriptor
=
<
dynamic
>[
final
dynamic
expectedFontsDescriptor
=
<
dynamic
>[
{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
},
// ignore: always_specify_types
{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
},
// ignore: always_specify_types
{
'fonts'
:
[{
'asset'
:
'a/baz'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/baz'
}],
'family'
:
'bar'
},
// ignore: always_specify_types
{
'fonts'
:
[{
'asset'
:
'a/baz'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/baz'
}],
'family'
:
'bar'
},
// ignore: always_specify_types
...
@@ -265,7 +265,7 @@ flutter:
...
@@ -265,7 +265,7 @@ flutter:
weight: 400
weight: 400
style: italic
style: italic
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
...
@@ -304,7 +304,7 @@ flutter:
...
@@ -304,7 +304,7 @@ flutter:
style: italic
style: italic
- family: bar
- family: bar
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
final
dynamic
expectedFontsDescriptor
=
[{
'fonts'
:
[{
'asset'
:
'a/bar'
},
{
'style'
:
'italic'
,
'weight'
:
400
,
'asset'
:
'a/bar'
}],
'family'
:
'foo'
}];
// ignore: always_specify_types
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
expect
(
flutterManifest
.
fontsDescriptor
,
expectedFontsDescriptor
);
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
...
@@ -338,7 +338,7 @@ flutter:
...
@@ -338,7 +338,7 @@ flutter:
fonts:
fonts:
- weight: 400
- weight: 400
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
fontsDescriptor
,
<
dynamic
>[]);
expect
(
flutterManifest
.
fontsDescriptor
,
<
dynamic
>[]);
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
final
List
<
Font
>
fonts
=
flutterManifest
.
fonts
;
...
@@ -353,7 +353,7 @@ dependencies:
...
@@ -353,7 +353,7 @@ dependencies:
sdk: flutter
sdk: flutter
flutter:
flutter:
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
isEmpty
,
false
);
expect
(
flutterManifest
.
isEmpty
,
false
);
expect
(
flutterManifest
.
isModule
,
false
);
expect
(
flutterManifest
.
isModule
,
false
);
expect
(
flutterManifest
.
isPlugin
,
false
);
expect
(
flutterManifest
.
isPlugin
,
false
);
...
@@ -367,7 +367,7 @@ flutter:
...
@@ -367,7 +367,7 @@ flutter:
module:
module:
androidPackage: com.example
androidPackage: com.example
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
isModule
,
true
);
expect
(
flutterManifest
.
isModule
,
true
);
expect
(
flutterManifest
.
androidPackage
,
'com.example'
);
expect
(
flutterManifest
.
androidPackage
,
'com.example'
);
});
});
...
@@ -379,7 +379,7 @@ flutter:
...
@@ -379,7 +379,7 @@ flutter:
plugin:
plugin:
androidPackage: com.example
androidPackage: com.example
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
isPlugin
,
true
);
expect
(
flutterManifest
.
isPlugin
,
true
);
expect
(
flutterManifest
.
androidPackage
,
'com.example'
);
expect
(
flutterManifest
.
androidPackage
,
'com.example'
);
});
});
...
@@ -390,7 +390,7 @@ flutter:
...
@@ -390,7 +390,7 @@ flutter:
String
expectedBuildName
,
String
expectedBuildName
,
String
expectedBuildNumber
,
String
expectedBuildNumber
,
})
async
{
})
async
{
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
appVersion
,
expectedAppVersion
);
expect
(
flutterManifest
.
appVersion
,
expectedAppVersion
);
expect
(
flutterManifest
.
buildName
,
expectedBuildName
);
expect
(
flutterManifest
.
buildName
,
expectedBuildName
);
expect
(
flutterManifest
.
buildNumber
,
expectedBuildNumber
);
expect
(
flutterManifest
.
buildNumber
,
expectedBuildNumber
);
...
@@ -490,7 +490,7 @@ dependencies:
...
@@ -490,7 +490,7 @@ dependencies:
flutter:
flutter:
'''
;
'''
;
final
FlutterManifest
flutterManifest
=
await
FlutterManifest
.
createFromString
(
manifest
);
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
.
isEmpty
,
false
);
expect
(
flutterManifest
.
isEmpty
,
false
);
}
}
...
...
packages/flutter_tools/test/ios/cocoapods_test.dart
View file @
4ff46719
...
@@ -57,7 +57,7 @@ void main() {
...
@@ -57,7 +57,7 @@ void main() {
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
();
mockProcessManager
=
MockProcessManager
();
mockProcessManager
=
MockProcessManager
();
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
projectUnderTest
=
await
FlutterProject
.
fromDirectory
(
fs
.
directory
(
'project'
));
projectUnderTest
=
FlutterProject
.
fromDirectory
(
fs
.
directory
(
'project'
));
projectUnderTest
.
ios
.
xcodeProject
.
createSync
(
recursive:
true
);
projectUnderTest
.
ios
.
xcodeProject
.
createSync
(
recursive:
true
);
cocoaPodsUnderTest
=
CocoaPods
();
cocoaPodsUnderTest
=
CocoaPods
();
pretendPodVersionIs
(
'1.5.0'
);
pretendPodVersionIs
(
'1.5.0'
);
...
@@ -156,7 +156,7 @@ void main() {
...
@@ -156,7 +156,7 @@ void main() {
'SWIFT_VERSION'
:
'4.0'
,
'SWIFT_VERSION'
:
'4.0'
,
});
});
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'project'
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
expect
(
projectUnderTest
.
ios
.
podfile
.
readAsStringSync
(),
'Swift podfile template'
);
expect
(
projectUnderTest
.
ios
.
podfile
.
readAsStringSync
(),
'Swift podfile template'
);
...
@@ -168,7 +168,7 @@ void main() {
...
@@ -168,7 +168,7 @@ void main() {
testUsingContext
(
'does not recreate Podfile when already present'
,
()
async
{
testUsingContext
(
'does not recreate Podfile when already present'
,
()
async
{
projectUnderTest
.
ios
.
podfile
..
createSync
()..
writeAsStringSync
(
'Existing Podfile'
);
projectUnderTest
.
ios
.
podfile
..
createSync
()..
writeAsStringSync
(
'Existing Podfile'
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'project'
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
expect
(
projectUnderTest
.
ios
.
podfile
.
readAsStringSync
(),
'Existing Podfile'
);
expect
(
projectUnderTest
.
ios
.
podfile
.
readAsStringSync
(),
'Existing Podfile'
);
...
@@ -179,7 +179,7 @@ void main() {
...
@@ -179,7 +179,7 @@ void main() {
testUsingContext
(
'does not create Podfile when we cannot interpret Xcode projects'
,
()
async
{
testUsingContext
(
'does not create Podfile when we cannot interpret Xcode projects'
,
()
async
{
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
false
);
when
(
mockXcodeProjectInterpreter
.
isInstalled
).
thenReturn
(
false
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'project'
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
expect
(
projectUnderTest
.
ios
.
podfile
.
existsSync
(),
false
);
expect
(
projectUnderTest
.
ios
.
podfile
.
existsSync
(),
false
);
...
@@ -197,7 +197,7 @@ void main() {
...
@@ -197,7 +197,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'Existing release config'
);
..
writeAsStringSync
(
'Existing release config'
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'project'
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
cocoaPodsUnderTest
.
setupPodfile
(
project
.
ios
);
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
...
@@ -225,7 +225,7 @@ void main() {
...
@@ -225,7 +225,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'Existing release config'
);
..
writeAsStringSync
(
'Existing release config'
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'project'
);
await
injectPlugins
(
project
);
await
injectPlugins
(
project
);
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
final
String
debugContents
=
projectUnderTest
.
ios
.
xcodeConfigFor
(
'Debug'
).
readAsStringSync
();
...
...
packages/flutter_tools/test/ios/devices_test.dart
View file @
4ff46719
...
@@ -196,7 +196,7 @@ flutter:
...
@@ -196,7 +196,7 @@ flutter:
module: {}
module: {}
'''
);
'''
);
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
IOSDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
expect
(
IOSDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -207,7 +207,7 @@ flutter:
...
@@ -207,7 +207,7 @@ flutter:
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
directory
(
'ios'
).
createSync
();
fs
.
directory
(
'ios'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
IOSDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
expect
(
IOSDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -217,7 +217,7 @@ flutter:
...
@@ -217,7 +217,7 @@ flutter:
testUsingContext
(
'IOSDevice.isSupportedForProject is false with no host app and no module'
,
()
async
{
testUsingContext
(
'IOSDevice.isSupportedForProject is false with no host app and no module'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
IOSDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
false
);
expect
(
IOSDevice
(
'test'
).
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
...
packages/flutter_tools/test/ios/simulators_test.dart
View file @
4ff46719
...
@@ -427,7 +427,7 @@ flutter:
...
@@ -427,7 +427,7 @@ flutter:
module: {}
module: {}
'''
);
'''
);
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
IOSSimulator
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
expect
(
IOSSimulator
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -438,7 +438,7 @@ flutter:
...
@@ -438,7 +438,7 @@ flutter:
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
directory
(
'ios'
).
createSync
();
fs
.
directory
(
'ios'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
IOSSimulator
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
expect
(
IOSSimulator
(
'test'
).
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -448,7 +448,7 @@ flutter:
...
@@ -448,7 +448,7 @@ flutter:
testUsingContext
(
'IOSDevice.isSupportedForProject is false with no host app and no module'
,
()
async
{
testUsingContext
(
'IOSDevice.isSupportedForProject is false with no host app and no module'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
IOSSimulator
(
'test'
).
isSupportedForProject
(
flutterProject
),
false
);
expect
(
IOSSimulator
(
'test'
).
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
...
packages/flutter_tools/test/ios/xcodeproj_test.dart
View file @
4ff46719
...
@@ -287,7 +287,7 @@ Information about project "Runner":
...
@@ -287,7 +287,7 @@ Information about project "Runner":
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
targetPlatform:
TargetPlatform
.
ios
);
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
targetPlatform:
TargetPlatform
.
ios
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'path/to/project'
);
await
updateGeneratedXcodeProperties
(
await
updateGeneratedXcodeProperties
(
project:
project
,
project:
project
,
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
...
@@ -305,7 +305,7 @@ Information about project "Runner":
...
@@ -305,7 +305,7 @@ Information about project "Runner":
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
))).
thenReturn
(
'engine'
);
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
))).
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
trackWidgetCreation:
true
,
targetPlatform:
TargetPlatform
.
ios
);
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
trackWidgetCreation:
true
,
targetPlatform:
TargetPlatform
.
ios
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'path/to/project'
);
await
updateGeneratedXcodeProperties
(
await
updateGeneratedXcodeProperties
(
project:
project
,
project:
project
,
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
...
@@ -323,7 +323,7 @@ Information about project "Runner":
...
@@ -323,7 +323,7 @@ Information about project "Runner":
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
))).
thenReturn
(
'engine'
);
platform:
TargetPlatform
.
ios
,
mode:
anyNamed
(
'mode'
))).
thenReturn
(
'engine'
);
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile_arm'
));
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
targetPlatform:
TargetPlatform
.
ios
);
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
targetPlatform:
TargetPlatform
.
ios
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'path/to/project'
);
await
updateGeneratedXcodeProperties
(
await
updateGeneratedXcodeProperties
(
project:
project
,
project:
project
,
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
...
@@ -342,7 +342,7 @@ Information about project "Runner":
...
@@ -342,7 +342,7 @@ Information about project "Runner":
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile'
));
when
(
mockArtifacts
.
engineOutPath
).
thenReturn
(
fs
.
path
.
join
(
'out'
,
'ios_profile'
));
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
targetPlatform:
TargetPlatform
.
ios
);
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
debug
,
null
,
targetPlatform:
TargetPlatform
.
ios
);
final
FlutterProject
project
=
await
FlutterProject
.
fromPath
(
'path/to/project'
);
final
FlutterProject
project
=
FlutterProject
.
fromPath
(
'path/to/project'
);
await
updateGeneratedXcodeProperties
(
await
updateGeneratedXcodeProperties
(
project:
project
,
project:
project
,
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
...
@@ -382,7 +382,7 @@ Information about project "Runner":
...
@@ -382,7 +382,7 @@ Information about project "Runner":
writeEmptySchemaFile
(
fs
);
writeEmptySchemaFile
(
fs
);
await
updateGeneratedXcodeProperties
(
await
updateGeneratedXcodeProperties
(
project:
await
FlutterProject
.
fromPath
(
'path/to/project'
),
project:
FlutterProject
.
fromPath
(
'path/to/project'
),
buildInfo:
buildInfo
,
buildInfo:
buildInfo
,
);
);
...
...
packages/flutter_tools/test/linux/linux_device_test.dart
View file @
4ff46719
...
@@ -66,7 +66,7 @@ void main() {
...
@@ -66,7 +66,7 @@ void main() {
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
directory
(
'linux'
).
createSync
();
fs
.
directory
(
'linux'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
LinuxDevice
().
isSupportedForProject
(
flutterProject
),
true
);
expect
(
LinuxDevice
().
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -76,7 +76,7 @@ void main() {
...
@@ -76,7 +76,7 @@ void main() {
testUsingContext
(
'LinuxDevice.isSupportedForProject is false with no host app'
,
()
async
{
testUsingContext
(
'LinuxDevice.isSupportedForProject is false with no host app'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
LinuxDevice
().
isSupportedForProject
(
flutterProject
),
false
);
expect
(
LinuxDevice
().
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
...
packages/flutter_tools/test/macos/macos_device_test.dart
View file @
4ff46719
...
@@ -113,7 +113,7 @@ tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applica
...
@@ -113,7 +113,7 @@ tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applica
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
directory
(
'macos'
).
createSync
();
fs
.
directory
(
'macos'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
MacOSDevice
().
isSupportedForProject
(
flutterProject
),
true
);
expect
(
MacOSDevice
().
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -123,7 +123,7 @@ tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applica
...
@@ -123,7 +123,7 @@ tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applica
testUsingContext
(
'isSupportedForProject is false with no host app'
,
()
async
{
testUsingContext
(
'isSupportedForProject is false with no host app'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
MacOSDevice
().
isSupportedForProject
(
flutterProject
),
false
);
expect
(
MacOSDevice
().
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
...
packages/flutter_tools/test/project_test.dart
View file @
4ff46719
...
@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/project.dart';
...
@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/project.dart';
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:file/file.dart'
;
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
import
'package:meta/meta.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
import
'src/common.dart'
;
import
'src/common.dart'
;
...
@@ -24,8 +25,8 @@ void main() {
...
@@ -24,8 +25,8 @@ void main() {
group
(
'Project'
,
()
{
group
(
'Project'
,
()
{
group
(
'construction'
,
()
{
group
(
'construction'
,
()
{
testInMemory
(
'fails on null directory'
,
()
async
{
testInMemory
(
'fails on null directory'
,
()
async
{
await
expectLater
(
expect
(
FlutterProject
.
fromDirectory
(
null
),
()
=>
FlutterProject
.
fromDirectory
(
null
),
throwsA
(
isInstanceOf
<
AssertionError
>()),
throwsA
(
isInstanceOf
<
AssertionError
>()),
);
);
});
});
...
@@ -35,9 +36,10 @@ void main() {
...
@@ -35,9 +36,10 @@ void main() {
directory
.
childFile
(
'pubspec.yaml'
)
directory
.
childFile
(
'pubspec.yaml'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
invalidPubspec
);
..
writeAsStringSync
(
invalidPubspec
);
await
expectToolExitLater
(
FlutterProject
.
fromDirectory
(
directory
),
expect
(
contains
(
'pubspec.yaml'
),
()
=>
FlutterProject
.
fromDirectory
(
directory
),
throwsA
(
isInstanceOf
<
Exception
>()),
);
);
});
});
...
@@ -46,17 +48,17 @@ void main() {
...
@@ -46,17 +48,17 @@ void main() {
directory
.
childDirectory
(
'example'
).
childFile
(
'pubspec.yaml'
)
directory
.
childDirectory
(
'example'
).
childFile
(
'pubspec.yaml'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
invalidPubspec
);
..
writeAsStringSync
(
invalidPubspec
);
await
expectToolExitLater
(
FlutterProject
.
fromDirectory
(
directory
),
expect
(
contains
(
'pubspec.yaml'
),
()
=>
FlutterProject
.
fromDirectory
(
directory
),
throwsA
(
isInstanceOf
<
Exception
>()),
);
);
});
});
testInMemory
(
'treats missing pubspec.yaml as empty'
,
()
async
{
testInMemory
(
'treats missing pubspec.yaml as empty'
,
()
async
{
final
Directory
directory
=
fs
.
directory
(
'myproject'
)
final
Directory
directory
=
fs
.
directory
(
'myproject'
)
..
createSync
(
recursive:
true
);
..
createSync
(
recursive:
true
);
expect
(
expect
((
FlutterProject
.
fromDirectory
(
directory
)).
manifest
.
isEmpty
,
(
await
FlutterProject
.
fromDirectory
(
directory
)).
manifest
.
isEmpty
,
true
,
true
,
);
);
});
});
...
@@ -67,7 +69,7 @@ void main() {
...
@@ -67,7 +69,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
validPubspec
);
..
writeAsStringSync
(
validPubspec
);
expect
(
expect
(
(
await
FlutterProject
.
fromDirectory
(
directory
)
).
manifest
.
appName
,
FlutterProject
.
fromDirectory
(
directory
).
manifest
.
appName
,
'hello'
,
'hello'
,
);
);
});
});
...
@@ -75,15 +77,15 @@ void main() {
...
@@ -75,15 +77,15 @@ void main() {
testInMemory
(
'sets up location'
,
()
async
{
testInMemory
(
'sets up location'
,
()
async
{
final
Directory
directory
=
fs
.
directory
(
'myproject'
);
final
Directory
directory
=
fs
.
directory
(
'myproject'
);
expect
(
expect
(
(
await
FlutterProject
.
fromDirectory
(
directory
)
).
directory
.
absolute
.
path
,
FlutterProject
.
fromDirectory
(
directory
).
directory
.
absolute
.
path
,
directory
.
absolute
.
path
,
directory
.
absolute
.
path
,
);
);
expect
(
expect
(
(
await
FlutterProject
.
fromPath
(
directory
.
path
)
).
directory
.
absolute
.
path
,
FlutterProject
.
fromPath
(
directory
.
path
).
directory
.
absolute
.
path
,
directory
.
absolute
.
path
,
directory
.
absolute
.
path
,
);
);
expect
(
expect
(
(
await
FlutterProject
.
current
()
).
directory
.
absolute
.
path
,
FlutterProject
.
current
(
).
directory
.
absolute
.
path
,
fs
.
currentDirectory
.
absolute
.
path
,
fs
.
currentDirectory
.
absolute
.
path
,
);
);
});
});
...
@@ -380,6 +382,7 @@ flutter:
...
@@ -380,6 +382,7 @@ flutter:
/// Executes the [testMethod] in a context where the file system
/// Executes the [testMethod] in a context where the file system
/// is in memory.
/// is in memory.
@isTest
void
testInMemory
(
String
description
,
Future
<
void
>
testMethod
())
{
void
testInMemory
(
String
description
,
Future
<
void
>
testMethod
())
{
Cache
.
flutterRoot
=
getFlutterRoot
();
Cache
.
flutterRoot
=
getFlutterRoot
();
final
FileSystem
testFileSystem
=
MemoryFileSystem
(
final
FileSystem
testFileSystem
=
MemoryFileSystem
(
...
...
packages/flutter_tools/test/test_compiler_test.dart
View file @
4ff46719
...
@@ -21,7 +21,7 @@ void main() {
...
@@ -21,7 +21,7 @@ void main() {
final
MockResidentCompiler
residentCompiler
=
MockResidentCompiler
();
final
MockResidentCompiler
residentCompiler
=
MockResidentCompiler
();
final
TestCompiler
testCompiler
=
FakeTestCompiler
(
final
TestCompiler
testCompiler
=
FakeTestCompiler
(
false
,
false
,
await
FlutterProject
.
current
(),
FlutterProject
.
current
(),
residentCompiler
,
residentCompiler
,
);
);
when
(
residentCompiler
.
recompile
(
when
(
residentCompiler
.
recompile
(
...
@@ -46,7 +46,7 @@ void main() {
...
@@ -46,7 +46,7 @@ void main() {
final
MockResidentCompiler
residentCompiler
=
MockResidentCompiler
();
final
MockResidentCompiler
residentCompiler
=
MockResidentCompiler
();
final
TestCompiler
testCompiler
=
FakeTestCompiler
(
final
TestCompiler
testCompiler
=
FakeTestCompiler
(
false
,
false
,
await
FlutterProject
.
current
(),
FlutterProject
.
current
(),
residentCompiler
,
residentCompiler
,
);
);
when
(
residentCompiler
.
recompile
(
when
(
residentCompiler
.
recompile
(
...
...
packages/flutter_tools/test/web/devices_test.dart
View file @
4ff46719
...
@@ -20,7 +20,7 @@ void main() {
...
@@ -20,7 +20,7 @@ void main() {
FlutterProject
flutterProject
;
FlutterProject
flutterProject
;
setUp
(()
async
{
setUp
(()
async
{
flutterProject
=
await
FlutterProject
.
fromPath
(
fs
.
path
.
join
(
getFlutterRoot
(),
'dev'
,
'integration_tests'
,
'web'
));
flutterProject
=
FlutterProject
.
fromPath
(
fs
.
path
.
join
(
getFlutterRoot
(),
'dev'
,
'integration_tests'
,
'web'
));
when
(
mockWebCompiler
.
compile
(
when
(
mockWebCompiler
.
compile
(
target:
anyNamed
(
'target'
),
target:
anyNamed
(
'target'
),
minify:
anyNamed
(
'minify'
),
minify:
anyNamed
(
'minify'
),
...
...
packages/flutter_tools/test/windows/windows_device_test.dart
View file @
4ff46719
...
@@ -65,7 +65,7 @@ void main() {
...
@@ -65,7 +65,7 @@ void main() {
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
directory
(
'windows'
).
createSync
();
fs
.
directory
(
'windows'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
WindowsDevice
().
isSupportedForProject
(
flutterProject
),
true
);
expect
(
WindowsDevice
().
isSupportedForProject
(
flutterProject
),
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -75,7 +75,7 @@ void main() {
...
@@ -75,7 +75,7 @@ void main() {
testUsingContext
(
'isSupportedForProject is false with no host app'
,
()
async
{
testUsingContext
(
'isSupportedForProject is false with no host app'
,
()
async
{
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'pubspec.yaml'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
fs
.
file
(
'.packages'
).
createSync
();
final
FlutterProject
flutterProject
=
await
FlutterProject
.
current
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
expect
(
WindowsDevice
().
isSupportedForProject
(
flutterProject
),
false
);
expect
(
WindowsDevice
().
isSupportedForProject
(
flutterProject
),
false
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
...
packages/flutter_tools/tool/tool_coverage.dart
View file @
4ff46719
...
@@ -44,7 +44,7 @@ Future<void> main(List<String> arguments) async {
...
@@ -44,7 +44,7 @@ Future<void> main(List<String> arguments) async {
final
ArgResults
argResults
=
argParser
.
parse
(
arguments
);
final
ArgResults
argResults
=
argParser
.
parse
(
arguments
);
await
runInContext
(()
async
{
await
runInContext
(()
async
{
final
CoverageCollector
coverageCollector
=
CoverageCollector
(
final
CoverageCollector
coverageCollector
=
CoverageCollector
(
flutterProject:
await
FlutterProject
.
current
(),
flutterProject:
FlutterProject
.
current
(),
);
);
/// A temp directory to create synthetic test files in.
/// A temp directory to create synthetic test files in.
final
Directory
tempDirectory
=
Directory
.
systemTemp
.
createTempSync
(
'_flutter_coverage'
)
final
Directory
tempDirectory
=
Directory
.
systemTemp
.
createTempSync
(
'_flutter_coverage'
)
...
...
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