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
5e54fd54
Commit
5e54fd54
authored
Feb 14, 2017
by
Michael Goderbauer
Committed by
GitHub
Feb 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ban package:path from Flutter Tools (#8119)
parent
9df8b721
Changes
69
Hide whitespace changes
Inline
Side-by-side
Showing
69 changed files
with
415 additions
and
457 deletions
+415
-457
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+13
-14
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+5
-7
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+10
-11
asset.dart
packages/flutter_tools/lib/src/asset.dart
+15
-16
common.dart
packages/flutter_tools/lib/src/base/common.dart
+2
-3
config.dart
packages/flutter_tools/lib/src/base/config.dart
+1
-3
file_system.dart
packages/flutter_tools/lib/src/base/file_system.dart
+3
-3
os.dart
packages/flutter_tools/lib/src/base/os.dart
+3
-4
utils.dart
packages/flutter_tools/lib/src/base/utils.dart
+1
-2
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+5
-6
cache.dart
packages/flutter_tools/lib/src/cache.dart
+18
-20
analyze_base.dart
packages/flutter_tools/lib/src/commands/analyze_base.dart
+3
-4
analyze_continuously.dart
.../flutter_tools/lib/src/commands/analyze_continuously.dart
+4
-5
analyze_once.dart
packages/flutter_tools/lib/src/commands/analyze_once.dart
+20
-21
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+32
-34
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+14
-16
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+2
-3
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+16
-18
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+9
-11
format.dart
packages/flutter_tools/lib/src/commands/format.dart
+2
-3
screenshot.dart
packages/flutter_tools/lib/src/commands/screenshot.dart
+1
-2
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+4
-5
trace.dart
packages/flutter_tools/lib/src/commands/trace.dart
+1
-3
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+3
-5
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+2
-3
analysis.dart
packages/flutter_tools/lib/src/dart/analysis.dart
+2
-3
dependencies.dart
packages/flutter_tools/lib/src/dart/dependencies.dart
+2
-3
package_map.dart
packages/flutter_tools/lib/src/dart/package_map.dart
+2
-3
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+3
-5
sdk.dart
packages/flutter_tools/lib/src/dart/sdk.dart
+3
-4
dependency_checker.dart
packages/flutter_tools/lib/src/dependency_checker.dart
+1
-3
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+11
-13
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+10
-11
flx.dart
packages/flutter_tools/lib/src/flx.dart
+5
-7
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+9
-10
plist_utils.dart
packages/flutter_tools/lib/src/ios/plist_utils.dart
+1
-3
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+11
-13
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+5
-7
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+4
-5
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+3
-4
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+25
-26
services.dart
packages/flutter_tools/lib/src/services.dart
+2
-3
template.dart
packages/flutter_tools/lib/src/template.dart
+6
-7
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+1
-2
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+1
-2
toolchain.dart
packages/flutter_tools/lib/src/toolchain.dart
+6
-8
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+2
-2
zip.dart
packages/flutter_tools/lib/src/zip.dart
+1
-2
pubspec.yaml
packages/flutter_tools/pubspec.yaml
+0
-1
all.dart
packages/flutter_tools/test/all.dart
+2
-0
analyze_continuously_test.dart
packages/flutter_tools/test/analyze_continuously_test.dart
+2
-3
analyze_duplicate_names_test.dart
...ages/flutter_tools/test/analyze_duplicate_names_test.dart
+2
-3
analyze_test.dart
packages/flutter_tools/test/analyze_test.dart
+2
-3
android_sdk_test.dart
packages/flutter_tools/test/android_sdk_test.dart
+1
-2
asset_bundle_test.dart
packages/flutter_tools/test/asset_bundle_test.dart
+1
-2
config_test.dart
packages/flutter_tools/test/config_test.dart
+1
-2
create_test.dart
packages/flutter_tools/test/create_test.dart
+2
-3
dart_dependencies_test.dart
packages/flutter_tools/test/dart_dependencies_test.dart
+9
-9
dependency_checker_test.dart
packages/flutter_tools/test/dependency_checker_test.dart
+12
-13
devfs_test.dart
packages/flutter_tools/test/devfs_test.dart
+19
-20
doctor_test.dart
packages/flutter_tools/test/doctor_test.dart
+2
-2
forbid_dart_io_test.dart
packages/flutter_tools/test/forbid_dart_io_test.dart
+3
-4
forbid_package_path_test.dart
packages/flutter_tools/test/forbid_package_path_test.dart
+36
-0
format_test.dart
packages/flutter_tools/test/format_test.dart
+1
-2
os_utils_test.dart
packages/flutter_tools/test/os_utils_test.dart
+1
-2
context.dart
packages/flutter_tools/test/src/context.dart
+2
-3
test_test.dart
packages/flutter_tools/test/test_test.dart
+7
-8
toolchain_test.dart
packages/flutter_tools/test/toolchain_test.dart
+2
-3
upgrade_test.dart
packages/flutter_tools/test/upgrade_test.dart
+3
-4
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
5e54fd54
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +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
'package:path/path.dart'
as
path
;
import
'package:pub_semver/pub_semver.dart'
;
import
'package:pub_semver/pub_semver.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
...
@@ -69,20 +68,20 @@ class AndroidSdk {
...
@@ -69,20 +68,20 @@ class AndroidSdk {
androidHomeDir
=
platform
.
environment
[
kAndroidHome
];
androidHomeDir
=
platform
.
environment
[
kAndroidHome
];
}
else
if
(
platform
.
isLinux
)
{
}
else
if
(
platform
.
isLinux
)
{
if
(
homeDirPath
!=
null
)
if
(
homeDirPath
!=
null
)
androidHomeDir
=
path
.
join
(
homeDirPath
,
'Android'
,
'Sdk'
);
androidHomeDir
=
fs
.
path
.
join
(
homeDirPath
,
'Android'
,
'Sdk'
);
}
else
if
(
platform
.
isMacOS
)
{
}
else
if
(
platform
.
isMacOS
)
{
if
(
homeDirPath
!=
null
)
if
(
homeDirPath
!=
null
)
androidHomeDir
=
path
.
join
(
homeDirPath
,
'Library'
,
'Android'
,
'sdk'
);
androidHomeDir
=
fs
.
path
.
join
(
homeDirPath
,
'Library'
,
'Android'
,
'sdk'
);
}
else
if
(
platform
.
isWindows
)
{
}
else
if
(
platform
.
isWindows
)
{
if
(
homeDirPath
!=
null
)
if
(
homeDirPath
!=
null
)
androidHomeDir
=
path
.
join
(
homeDirPath
,
'AppData'
,
'Local'
,
'Android'
,
'sdk'
);
androidHomeDir
=
fs
.
path
.
join
(
homeDirPath
,
'AppData'
,
'Local'
,
'Android'
,
'sdk'
);
}
}
if
(
androidHomeDir
!=
null
)
{
if
(
androidHomeDir
!=
null
)
{
if
(
validSdkDirectory
(
androidHomeDir
))
if
(
validSdkDirectory
(
androidHomeDir
))
return
new
AndroidSdk
(
androidHomeDir
);
return
new
AndroidSdk
(
androidHomeDir
);
if
(
validSdkDirectory
(
path
.
join
(
androidHomeDir
,
'sdk'
)))
if
(
validSdkDirectory
(
fs
.
path
.
join
(
androidHomeDir
,
'sdk'
)))
return
new
AndroidSdk
(
path
.
join
(
androidHomeDir
,
'sdk'
));
return
new
AndroidSdk
(
fs
.
path
.
join
(
androidHomeDir
,
'sdk'
));
}
}
File
aaptBin
=
os
.
which
(
'aapt'
);
// in build-tools/$version/aapt
File
aaptBin
=
os
.
which
(
'aapt'
);
// in build-tools/$version/aapt
...
@@ -109,7 +108,7 @@ class AndroidSdk {
...
@@ -109,7 +108,7 @@ class AndroidSdk {
}
}
static
bool
validSdkDirectory
(
String
dir
)
{
static
bool
validSdkDirectory
(
String
dir
)
{
return
fs
.
isDirectorySync
(
path
.
join
(
dir
,
'platform-tools'
));
return
fs
.
isDirectorySync
(
fs
.
path
.
join
(
dir
,
'platform-tools'
));
}
}
List
<
AndroidSdkVersion
>
get
sdkVersions
=>
_sdkVersions
;
List
<
AndroidSdkVersion
>
get
sdkVersions
=>
_sdkVersions
;
...
@@ -131,30 +130,30 @@ class AndroidSdk {
...
@@ -131,30 +130,30 @@ class AndroidSdk {
}
}
String
getPlatformToolsPath
(
String
binaryName
)
{
String
getPlatformToolsPath
(
String
binaryName
)
{
return
path
.
join
(
directory
,
'platform-tools'
,
binaryName
);
return
fs
.
path
.
join
(
directory
,
'platform-tools'
,
binaryName
);
}
}
void
_init
()
{
void
_init
()
{
List
<
String
>
platforms
=
<
String
>[];
// android-22, ...
List
<
String
>
platforms
=
<
String
>[];
// android-22, ...
Directory
platformsDir
=
fs
.
directory
(
path
.
join
(
directory
,
'platforms'
));
Directory
platformsDir
=
fs
.
directory
(
fs
.
path
.
join
(
directory
,
'platforms'
));
if
(
platformsDir
.
existsSync
())
{
if
(
platformsDir
.
existsSync
())
{
platforms
=
platformsDir
platforms
=
platformsDir
.
listSync
()
.
listSync
()
.
map
((
FileSystemEntity
entity
)
=>
path
.
basename
(
entity
.
path
))
.
map
((
FileSystemEntity
entity
)
=>
fs
.
path
.
basename
(
entity
.
path
))
.
where
((
String
name
)
=>
name
.
startsWith
(
'android-'
))
.
where
((
String
name
)
=>
name
.
startsWith
(
'android-'
))
.
toList
();
.
toList
();
}
}
List
<
Version
>
buildTools
=
<
Version
>[];
// 19.1.0, 22.0.1, ...
List
<
Version
>
buildTools
=
<
Version
>[];
// 19.1.0, 22.0.1, ...
Directory
buildToolsDir
=
fs
.
directory
(
path
.
join
(
directory
,
'build-tools'
));
Directory
buildToolsDir
=
fs
.
directory
(
fs
.
path
.
join
(
directory
,
'build-tools'
));
if
(
buildToolsDir
.
existsSync
())
{
if
(
buildToolsDir
.
existsSync
())
{
buildTools
=
buildToolsDir
buildTools
=
buildToolsDir
.
listSync
()
.
listSync
()
.
map
((
FileSystemEntity
entity
)
{
.
map
((
FileSystemEntity
entity
)
{
try
{
try
{
return
new
Version
.
parse
(
path
.
basename
(
entity
.
path
));
return
new
Version
.
parse
(
fs
.
path
.
basename
(
entity
.
path
));
}
catch
(
error
)
{
}
catch
(
error
)
{
return
null
;
return
null
;
}
}
...
@@ -243,11 +242,11 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
...
@@ -243,11 +242,11 @@ class AndroidSdkVersion implements Comparable<AndroidSdkVersion> {
}
}
String
getPlatformsPath
(
String
itemName
)
{
String
getPlatformsPath
(
String
itemName
)
{
return
path
.
join
(
sdk
.
directory
,
'platforms'
,
platformVersionName
,
itemName
);
return
fs
.
path
.
join
(
sdk
.
directory
,
'platforms'
,
platformVersionName
,
itemName
);
}
}
String
getBuildToolsPath
(
String
binaryName
)
{
String
getBuildToolsPath
(
String
binaryName
)
{
return
path
.
join
(
sdk
.
directory
,
'build-tools'
,
buildToolsVersionName
,
binaryName
);
return
fs
.
path
.
join
(
sdk
.
directory
,
'build-tools'
,
buildToolsVersionName
,
binaryName
);
}
}
@override
@override
...
...
packages/flutter_tools/lib/src/android/gradle.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
...
@@ -83,7 +81,7 @@ String _locateSystemGradle() {
...
@@ -83,7 +81,7 @@ String _locateSystemGradle() {
if
(
gradleDir
!=
null
)
{
if
(
gradleDir
!=
null
)
{
if
(
fs
.
isFileSync
(
gradleDir
))
if
(
fs
.
isFileSync
(
gradleDir
))
return
gradleDir
;
return
gradleDir
;
return
path
.
join
(
gradleDir
,
'bin'
,
'gradle'
);
return
fs
.
path
.
join
(
gradleDir
,
'bin'
,
'gradle'
);
}
}
// Look relative to Android Studio.
// Look relative to Android Studio.
...
@@ -98,14 +96,14 @@ String _locateSystemGradle() {
...
@@ -98,14 +96,14 @@ String _locateSystemGradle() {
if
(
studioPath
!=
null
)
{
if
(
studioPath
!=
null
)
{
// '/Applications/Android Studio.app/Contents/gradle/gradle-2.10/bin/gradle'
// '/Applications/Android Studio.app/Contents/gradle/gradle-2.10/bin/gradle'
if
(
os
.
isMacOS
&&
!
studioPath
.
endsWith
(
'Contents'
))
if
(
os
.
isMacOS
&&
!
studioPath
.
endsWith
(
'Contents'
))
studioPath
=
path
.
join
(
studioPath
,
'Contents'
);
studioPath
=
fs
.
path
.
join
(
studioPath
,
'Contents'
);
Directory
dir
=
fs
.
directory
(
path
.
join
(
studioPath
,
'gradle'
));
Directory
dir
=
fs
.
directory
(
fs
.
path
.
join
(
studioPath
,
'gradle'
));
if
(
dir
.
existsSync
())
{
if
(
dir
.
existsSync
())
{
// We find the first valid gradle directory.
// We find the first valid gradle directory.
for
(
FileSystemEntity
entity
in
dir
.
listSync
())
{
for
(
FileSystemEntity
entity
in
dir
.
listSync
())
{
if
(
entity
is
Directory
&&
path
.
basename
(
entity
.
path
).
startsWith
(
'gradle-'
))
{
if
(
entity
is
Directory
&&
fs
.
path
.
basename
(
entity
.
path
).
startsWith
(
'gradle-'
))
{
String
executable
=
path
.
join
(
entity
.
path
,
'bin'
,
'gradle'
);
String
executable
=
fs
.
path
.
join
(
entity
.
path
,
'bin'
,
'gradle'
);
if
(
fs
.
isFileSync
(
executable
))
if
(
fs
.
isFileSync
(
executable
))
return
executable
;
return
executable
;
}
}
...
...
packages/flutter_tools/lib/src/application_package.dart
View file @
5e54fd54
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +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
'package:path/path.dart'
as
path
;
import
'package:xml/xml.dart'
as
xml
;
import
'package:xml/xml.dart'
as
xml
;
import
'android/android_sdk.dart'
;
import
'android/android_sdk.dart'
;
...
@@ -86,8 +85,8 @@ class AndroidApk extends ApplicationPackage {
...
@@ -86,8 +85,8 @@ class AndroidApk extends ApplicationPackage {
manifestPath
=
gradleManifestPath
;
manifestPath
=
gradleManifestPath
;
apkPath
=
gradleAppOut
;
apkPath
=
gradleAppOut
;
}
else
{
}
else
{
manifestPath
=
path
.
join
(
'android'
,
'AndroidManifest.xml'
);
manifestPath
=
fs
.
path
.
join
(
'android'
,
'AndroidManifest.xml'
);
apkPath
=
path
.
join
(
getAndroidBuildDirectory
(),
'app.apk'
);
apkPath
=
fs
.
path
.
join
(
getAndroidBuildDirectory
(),
'app.apk'
);
}
}
if
(!
fs
.
isFileSync
(
manifestPath
))
if
(!
fs
.
isFileSync
(
manifestPath
))
...
@@ -125,7 +124,7 @@ class AndroidApk extends ApplicationPackage {
...
@@ -125,7 +124,7 @@ class AndroidApk extends ApplicationPackage {
String
get
packagePath
=>
apkPath
;
String
get
packagePath
=>
apkPath
;
@override
@override
String
get
name
=>
path
.
basename
(
apkPath
);
String
get
name
=>
fs
.
path
.
basename
(
apkPath
);
}
}
/// Tests whether a [FileSystemEntity] is an iOS bundle directory
/// Tests whether a [FileSystemEntity] is an iOS bundle directory
...
@@ -142,14 +141,14 @@ abstract class IOSApp extends ApplicationPackage {
...
@@ -142,14 +141,14 @@ abstract class IOSApp extends ApplicationPackage {
Directory
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_app_'
);
Directory
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_app_'
);
addShutdownHook
(()
async
=>
await
tempDir
.
delete
(
recursive:
true
));
addShutdownHook
(()
async
=>
await
tempDir
.
delete
(
recursive:
true
));
os
.
unzip
(
fs
.
file
(
applicationBinary
),
tempDir
);
os
.
unzip
(
fs
.
file
(
applicationBinary
),
tempDir
);
Directory
payloadDir
=
fs
.
directory
(
path
.
join
(
tempDir
.
path
,
'Payload'
));
Directory
payloadDir
=
fs
.
directory
(
fs
.
path
.
join
(
tempDir
.
path
,
'Payload'
));
bundleDir
=
payloadDir
.
listSync
().
singleWhere
(
_isBundleDirectory
);
bundleDir
=
payloadDir
.
listSync
().
singleWhere
(
_isBundleDirectory
);
}
on
StateError
catch
(
e
,
stackTrace
)
{
}
on
StateError
catch
(
e
,
stackTrace
)
{
printError
(
'Invalid prebuilt iOS binary:
${e.toString()}
'
,
stackTrace
);
printError
(
'Invalid prebuilt iOS binary:
${e.toString()}
'
,
stackTrace
);
return
null
;
return
null
;
}
}
String
plistPath
=
path
.
join
(
bundleDir
.
path
,
'Info.plist'
);
String
plistPath
=
fs
.
path
.
join
(
bundleDir
.
path
,
'Info.plist'
);
String
id
=
plist
.
getValueFromFile
(
plistPath
,
plist
.
kCFBundleIdentifierKey
);
String
id
=
plist
.
getValueFromFile
(
plistPath
,
plist
.
kCFBundleIdentifierKey
);
if
(
id
==
null
)
if
(
id
==
null
)
return
null
;
return
null
;
...
@@ -157,7 +156,7 @@ abstract class IOSApp extends ApplicationPackage {
...
@@ -157,7 +156,7 @@ abstract class IOSApp extends ApplicationPackage {
return
new
PrebuiltIOSApp
(
return
new
PrebuiltIOSApp
(
ipaPath:
applicationBinary
,
ipaPath:
applicationBinary
,
bundleDir:
bundleDir
,
bundleDir:
bundleDir
,
bundleName:
path
.
basename
(
bundleDir
.
path
),
bundleName:
fs
.
path
.
basename
(
bundleDir
.
path
),
projectBundleId:
id
,
projectBundleId:
id
,
);
);
}
}
...
@@ -166,15 +165,15 @@ abstract class IOSApp extends ApplicationPackage {
...
@@ -166,15 +165,15 @@ abstract class IOSApp extends ApplicationPackage {
if
(
getCurrentHostPlatform
()
!=
HostPlatform
.
darwin_x64
)
if
(
getCurrentHostPlatform
()
!=
HostPlatform
.
darwin_x64
)
return
null
;
return
null
;
String
plistPath
=
path
.
join
(
'ios'
,
'Runner'
,
'Info.plist'
);
String
plistPath
=
fs
.
path
.
join
(
'ios'
,
'Runner'
,
'Info.plist'
);
String
id
=
plist
.
getValueFromFile
(
plistPath
,
plist
.
kCFBundleIdentifierKey
);
String
id
=
plist
.
getValueFromFile
(
plistPath
,
plist
.
kCFBundleIdentifierKey
);
if
(
id
==
null
)
if
(
id
==
null
)
return
null
;
return
null
;
String
projectPath
=
path
.
join
(
'ios'
,
'Runner.xcodeproj'
);
String
projectPath
=
fs
.
path
.
join
(
'ios'
,
'Runner.xcodeproj'
);
id
=
substituteXcodeVariables
(
id
,
projectPath
,
'Runner'
);
id
=
substituteXcodeVariables
(
id
,
projectPath
,
'Runner'
);
return
new
BuildableIOSApp
(
return
new
BuildableIOSApp
(
appDirectory:
path
.
join
(
'ios'
),
appDirectory:
fs
.
path
.
join
(
'ios'
),
projectBundleId:
id
projectBundleId:
id
);
);
}
}
...
@@ -207,7 +206,7 @@ class BuildableIOSApp extends IOSApp {
...
@@ -207,7 +206,7 @@ class BuildableIOSApp extends IOSApp {
String
get
deviceBundlePath
=>
_buildAppPath
(
'iphoneos'
);
String
get
deviceBundlePath
=>
_buildAppPath
(
'iphoneos'
);
String
_buildAppPath
(
String
type
)
{
String
_buildAppPath
(
String
type
)
{
return
path
.
join
(
getIosBuildDirectory
(),
'Release-
$type
'
,
kBundleName
);
return
fs
.
path
.
join
(
getIosBuildDirectory
(),
'Release-
$type
'
,
kBundleName
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/asset.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:json_schema/json_schema.dart'
;
import
'package:json_schema/json_schema.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'package:yaml/yaml.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
...
@@ -46,7 +45,7 @@ class AssetBundle {
...
@@ -46,7 +45,7 @@ class AssetBundle {
for
(
String
asset
in
assets
)
{
for
(
String
asset
in
assets
)
{
if
(
asset
==
''
)
if
(
asset
==
''
)
continue
;
continue
;
final
String
assetPath
=
path
.
join
(
projectRoot
,
asset
);
final
String
assetPath
=
fs
.
path
.
join
(
projectRoot
,
asset
);
final
String
archivePath
=
asset
;
final
String
archivePath
=
asset
;
entries
[
archivePath
]
=
new
DevFSFileContent
(
fs
.
file
(
assetPath
));
entries
[
archivePath
]
=
new
DevFSFileContent
(
fs
.
file
(
assetPath
));
}
}
...
@@ -74,7 +73,7 @@ class AssetBundle {
...
@@ -74,7 +73,7 @@ class AssetBundle {
bool
reportLicensedPackages:
false
bool
reportLicensedPackages:
false
})
async
{
})
async
{
workingDirPath
??=
getAssetBuildDirectory
();
workingDirPath
??=
getAssetBuildDirectory
();
packagesPath
??=
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
packagesPath
??=
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
Object
manifest
;
Object
manifest
;
try
{
try
{
manifest
=
_loadFlutterManifest
(
manifestPath
);
manifest
=
_loadFlutterManifest
(
manifestPath
);
...
@@ -95,7 +94,7 @@ class AssetBundle {
...
@@ -95,7 +94,7 @@ class AssetBundle {
}
}
Map
<
String
,
dynamic
>
manifestDescriptor
=
manifest
;
Map
<
String
,
dynamic
>
manifestDescriptor
=
manifest
;
manifestDescriptor
=
manifestDescriptor
[
'flutter'
]
??
<
String
,
dynamic
>{};
manifestDescriptor
=
manifestDescriptor
[
'flutter'
]
??
<
String
,
dynamic
>{};
String
assetBasePath
=
path
.
dirname
(
path
.
absolute
(
manifestPath
));
String
assetBasePath
=
fs
.
path
.
dirname
(
fs
.
path
.
absolute
(
manifestPath
));
_lastBuildTimestamp
=
new
DateTime
.
now
();
_lastBuildTimestamp
=
new
DateTime
.
now
();
...
@@ -193,7 +192,7 @@ class _Asset {
...
@@ -193,7 +192,7 @@ class _Asset {
}
}
Map
<
String
,
dynamic
>
_readMaterialFontsManifest
()
{
Map
<
String
,
dynamic
>
_readMaterialFontsManifest
()
{
String
fontsPath
=
path
.
join
(
path
.
absolute
(
Cache
.
flutterRoot
),
String
fontsPath
=
fs
.
path
.
join
(
fs
.
path
.
absolute
(
Cache
.
flutterRoot
),
'packages'
,
'flutter_tools'
,
'schema'
,
'material_fonts.yaml'
);
'packages'
,
'flutter_tools'
,
'schema'
,
'material_fonts.yaml'
);
return
loadYaml
(
fs
.
file
(
fontsPath
).
readAsStringSync
());
return
loadYaml
(
fs
.
file
(
fontsPath
).
readAsStringSync
());
...
@@ -212,8 +211,8 @@ List<_Asset> _getMaterialAssets(String fontSet) {
...
@@ -212,8 +211,8 @@ List<_Asset> _getMaterialAssets(String fontSet) {
for
(
Map
<
String
,
dynamic
>
font
in
family
[
'fonts'
])
{
for
(
Map
<
String
,
dynamic
>
font
in
family
[
'fonts'
])
{
String
assetKey
=
font
[
'asset'
];
String
assetKey
=
font
[
'asset'
];
result
.
add
(
new
_Asset
(
result
.
add
(
new
_Asset
(
base:
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'artifacts'
,
'material_fonts'
),
base:
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'artifacts'
,
'material_fonts'
),
source
:
path
.
basename
(
assetKey
),
source
:
fs
.
path
.
basename
(
assetKey
),
relativePath:
assetKey
relativePath:
assetKey
));
));
}
}
...
@@ -338,7 +337,7 @@ Map<_Asset, List<_Asset>> _parseAssets(
...
@@ -338,7 +337,7 @@ Map<_Asset, List<_Asset>> _parseAssets(
return
result
;
return
result
;
excludeDirs
=
excludeDirs
.
map
(
excludeDirs
=
excludeDirs
.
map
(
(
String
exclude
)
=>
path
.
absolute
(
exclude
)
+
fs
.
path
.
separator
).
toList
();
(
String
exclude
)
=>
fs
.
path
.
absolute
(
exclude
)
+
fs
.
path
.
separator
).
toList
();
if
(
manifestDescriptor
.
containsKey
(
'assets'
))
{
if
(
manifestDescriptor
.
containsKey
(
'assets'
))
{
for
(
String
asset
in
manifestDescriptor
[
'assets'
])
{
for
(
String
asset
in
manifestDescriptor
[
'assets'
])
{
...
@@ -354,8 +353,8 @@ Map<_Asset, List<_Asset>> _parseAssets(
...
@@ -354,8 +353,8 @@ Map<_Asset, List<_Asset>> _parseAssets(
// Find asset variants
// Find asset variants
String
assetPath
=
baseAsset
.
assetFile
.
path
;
String
assetPath
=
baseAsset
.
assetFile
.
path
;
String
assetFilename
=
path
.
basename
(
assetPath
);
String
assetFilename
=
fs
.
path
.
basename
(
assetPath
);
Directory
assetDir
=
fs
.
directory
(
path
.
dirname
(
assetPath
));
Directory
assetDir
=
fs
.
directory
(
fs
.
path
.
dirname
(
assetPath
));
List
<
FileSystemEntity
>
files
=
assetDir
.
listSync
(
recursive:
true
);
List
<
FileSystemEntity
>
files
=
assetDir
.
listSync
(
recursive:
true
);
...
@@ -367,11 +366,11 @@ Map<_Asset, List<_Asset>> _parseAssets(
...
@@ -367,11 +366,11 @@ Map<_Asset, List<_Asset>> _parseAssets(
if
(
excludeDirs
.
any
((
String
exclude
)
=>
entity
.
path
.
startsWith
(
exclude
)))
if
(
excludeDirs
.
any
((
String
exclude
)
=>
entity
.
path
.
startsWith
(
exclude
)))
continue
;
continue
;
if
(
path
.
basename
(
entity
.
path
)
==
assetFilename
&&
entity
.
path
!=
assetPath
)
{
if
(
fs
.
path
.
basename
(
entity
.
path
)
==
assetFilename
&&
entity
.
path
!=
assetPath
)
{
String
key
=
path
.
relative
(
entity
.
path
,
from:
baseAsset
.
base
);
String
key
=
fs
.
path
.
relative
(
entity
.
path
,
from:
baseAsset
.
base
);
String
assetEntry
;
String
assetEntry
;
if
(
baseAsset
.
symbolicPrefix
!=
null
)
if
(
baseAsset
.
symbolicPrefix
!=
null
)
assetEntry
=
path
.
join
(
baseAsset
.
symbolicPrefix
,
key
);
assetEntry
=
fs
.
path
.
join
(
baseAsset
.
symbolicPrefix
,
key
);
variants
.
add
(
new
_Asset
(
base:
baseAsset
.
base
,
assetEntry:
assetEntry
,
relativePath:
key
));
variants
.
add
(
new
_Asset
(
base:
baseAsset
.
base
,
assetEntry:
assetEntry
,
relativePath:
key
));
}
}
}
}
...
@@ -407,7 +406,7 @@ _Asset _resolveAsset(
...
@@ -407,7 +406,7 @@ _Asset _resolveAsset(
String
assetBase
,
String
assetBase
,
String
asset
String
asset
)
{
)
{
if
(
asset
.
startsWith
(
'packages/'
)
&&
!
fs
.
isFileSync
(
path
.
join
(
assetBase
,
asset
)))
{
if
(
asset
.
startsWith
(
'packages/'
)
&&
!
fs
.
isFileSync
(
fs
.
path
.
join
(
assetBase
,
asset
)))
{
// Convert packages/flutter_gallery_assets/clouds-0.png to clouds-0.png.
// Convert packages/flutter_gallery_assets/clouds-0.png to clouds-0.png.
String
packageKey
=
asset
.
substring
(
9
);
String
packageKey
=
asset
.
substring
(
9
);
String
relativeAsset
=
asset
;
String
relativeAsset
=
asset
;
...
@@ -436,9 +435,9 @@ dynamic _loadFlutterManifest(String manifestPath) {
...
@@ -436,9 +435,9 @@ dynamic _loadFlutterManifest(String manifestPath) {
}
}
Future
<
int
>
_validateFlutterManifest
(
Object
manifest
)
async
{
Future
<
int
>
_validateFlutterManifest
(
Object
manifest
)
async
{
String
schemaPath
=
path
.
join
(
path
.
absolute
(
Cache
.
flutterRoot
),
String
schemaPath
=
fs
.
path
.
join
(
fs
.
path
.
absolute
(
Cache
.
flutterRoot
),
'packages'
,
'flutter_tools'
,
'schema'
,
'pubspec_yaml.json'
);
'packages'
,
'flutter_tools'
,
'schema'
,
'pubspec_yaml.json'
);
Schema
schema
=
await
Schema
.
createSchemaFromUrl
(
path
.
toUri
(
schemaPath
).
toString
());
Schema
schema
=
await
Schema
.
createSchemaFromUrl
(
fs
.
path
.
toUri
(
schemaPath
).
toString
());
Validator
validator
=
new
Validator
(
schema
);
Validator
validator
=
new
Validator
(
schema
);
if
(
validator
.
validate
(
manifest
))
{
if
(
validator
.
validate
(
manifest
))
{
...
...
packages/flutter_tools/lib/src/base/common.dart
View file @
5e54fd54
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
// 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
'package:path/path.dart'
as
path
;
import
'file_system.dart'
;
import
'platform.dart'
;
import
'platform.dart'
;
const
int
kDefaultObservatoryPort
=
8100
;
const
int
kDefaultObservatoryPort
=
8100
;
...
@@ -16,7 +15,7 @@ String get homeDirPath {
...
@@ -16,7 +15,7 @@ String get homeDirPath {
?
platform
.
environment
[
'USERPROFILE'
]
?
platform
.
environment
[
'USERPROFILE'
]
:
platform
.
environment
[
'HOME'
];
:
platform
.
environment
[
'HOME'
];
if
(
_homeDirPath
!=
null
)
if
(
_homeDirPath
!=
null
)
_homeDirPath
=
path
.
absolute
(
_homeDirPath
);
_homeDirPath
=
fs
.
path
.
absolute
(
_homeDirPath
);
}
}
return
_homeDirPath
;
return
_homeDirPath
;
}
}
...
...
packages/flutter_tools/lib/src/base/config.dart
View file @
5e54fd54
...
@@ -4,15 +4,13 @@
...
@@ -4,15 +4,13 @@
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:path/path.dart'
as
path
;
import
'context.dart'
;
import
'context.dart'
;
import
'file_system.dart'
;
import
'file_system.dart'
;
import
'platform.dart'
;
import
'platform.dart'
;
class
Config
{
class
Config
{
Config
([
File
configFile
])
{
Config
([
File
configFile
])
{
_configFile
=
configFile
??
fs
.
file
(
path
.
join
(
_userHomeDir
(),
'.flutter_settings'
));
_configFile
=
configFile
??
fs
.
file
(
fs
.
path
.
join
(
_userHomeDir
(),
'.flutter_settings'
));
if
(
_configFile
.
existsSync
())
if
(
_configFile
.
existsSync
())
_values
=
JSON
.
decode
(
_configFile
.
readAsStringSync
());
_values
=
JSON
.
decode
(
_configFile
.
readAsStringSync
());
}
}
...
...
packages/flutter_tools/lib/src/base/file_system.dart
View file @
5e54fd54
...
@@ -6,7 +6,7 @@ import 'package:file/file.dart';
...
@@ -6,7 +6,7 @@ import 'package:file/file.dart';
import
'package:file/local.dart'
;
import
'package:file/local.dart'
;
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
import
'package:file/record_replay.dart'
;
import
'package:file/record_replay.dart'
;
import
'package:path/path.dart'
as
path
;
import
'common.dart'
show
throwToolExit
;
import
'common.dart'
show
throwToolExit
;
import
'context.dart'
;
import
'context.dart'
;
...
@@ -56,7 +56,7 @@ void enableReplayFileSystem(String location) {
...
@@ -56,7 +56,7 @@ void enableReplayFileSystem(String location) {
/// Create the ancestor directories of a file path if they do not already exist.
/// Create the ancestor directories of a file path if they do not already exist.
void
ensureDirectoryExists
(
String
filePath
)
{
void
ensureDirectoryExists
(
String
filePath
)
{
String
dirPath
=
path
.
dirname
(
filePath
);
String
dirPath
=
fs
.
path
.
dirname
(
filePath
);
if
(
fs
.
isDirectorySync
(
dirPath
))
if
(
fs
.
isDirectorySync
(
dirPath
))
return
;
return
;
try
{
try
{
...
@@ -77,7 +77,7 @@ void copyDirectorySync(Directory srcDir, Directory destDir) {
...
@@ -77,7 +77,7 @@ void copyDirectorySync(Directory srcDir, Directory destDir) {
destDir
.
createSync
(
recursive:
true
);
destDir
.
createSync
(
recursive:
true
);
srcDir
.
listSync
().
forEach
((
FileSystemEntity
entity
)
{
srcDir
.
listSync
().
forEach
((
FileSystemEntity
entity
)
{
String
newPath
=
path
.
join
(
destDir
.
path
,
path
.
basename
(
entity
.
path
));
String
newPath
=
fs
.
path
.
join
(
destDir
.
path
,
fs
.
path
.
basename
(
entity
.
path
));
if
(
entity
is
File
)
{
if
(
entity
is
File
)
{
File
newFile
=
destDir
.
fileSystem
.
file
(
newPath
);
File
newFile
=
destDir
.
fileSystem
.
file
(
newPath
);
newFile
.
writeAsBytesSync
(
entity
.
readAsBytesSync
());
newFile
.
writeAsBytesSync
(
entity
.
readAsBytesSync
());
...
...
packages/flutter_tools/lib/src/base/os.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:archive/archive.dart'
;
import
'package:archive/archive.dart'
;
import
'package:path/path.dart'
as
path
;
import
'context.dart'
;
import
'context.dart'
;
import
'file_system.dart'
;
import
'file_system.dart'
;
...
@@ -106,7 +105,7 @@ class _WindowsUtils extends OperatingSystemUtils {
...
@@ -106,7 +105,7 @@ class _WindowsUtils extends OperatingSystemUtils {
if
(!
archiveFile
.
isFile
||
archiveFile
.
name
.
endsWith
(
'/'
))
if
(!
archiveFile
.
isFile
||
archiveFile
.
name
.
endsWith
(
'/'
))
continue
;
continue
;
File
destFile
=
fs
.
file
(
path
.
join
(
targetDirectory
.
path
,
archiveFile
.
name
));
File
destFile
=
fs
.
file
(
fs
.
path
.
join
(
targetDirectory
.
path
,
archiveFile
.
name
));
if
(!
destFile
.
parent
.
existsSync
())
if
(!
destFile
.
parent
.
existsSync
())
destFile
.
parent
.
createSync
(
recursive:
true
);
destFile
.
parent
.
createSync
(
recursive:
true
);
destFile
.
writeAsBytesSync
(
archiveFile
.
content
);
destFile
.
writeAsBytesSync
(
archiveFile
.
content
);
...
@@ -162,9 +161,9 @@ String findProjectRoot([String directory]) {
...
@@ -162,9 +161,9 @@ String findProjectRoot([String directory]) {
const
String
kProjectRootSentinel
=
'pubspec.yaml'
;
const
String
kProjectRootSentinel
=
'pubspec.yaml'
;
directory
??=
fs
.
currentDirectory
.
path
;
directory
??=
fs
.
currentDirectory
.
path
;
while
(
true
)
{
while
(
true
)
{
if
(
fs
.
isFileSync
(
path
.
join
(
directory
,
kProjectRootSentinel
)))
if
(
fs
.
isFileSync
(
fs
.
path
.
join
(
directory
,
kProjectRootSentinel
)))
return
directory
;
return
directory
;
String
parent
=
path
.
dirname
(
directory
);
String
parent
=
fs
.
path
.
dirname
(
directory
);
if
(
directory
==
parent
)
return
null
;
if
(
directory
==
parent
)
return
null
;
directory
=
parent
;
directory
=
parent
;
}
}
...
...
packages/flutter_tools/lib/src/base/utils.dart
View file @
5e54fd54
...
@@ -7,7 +7,6 @@ import 'dart:convert';
...
@@ -7,7 +7,6 @@ import 'dart:convert';
import
'dart:math'
show
Random
;
import
'dart:math'
show
Random
;
import
'package:crypto/crypto.dart'
;
import
'package:crypto/crypto.dart'
;
import
'package:path/path.dart'
as
path
;
import
'file_system.dart'
;
import
'file_system.dart'
;
import
'platform.dart'
;
import
'platform.dart'
;
...
@@ -66,7 +65,7 @@ File getUniqueFile(Directory dir, String baseName, String ext) {
...
@@ -66,7 +65,7 @@ File getUniqueFile(Directory dir, String baseName, String ext) {
while
(
true
)
{
while
(
true
)
{
String
name
=
'
${baseName}
_
${i.toString().padLeft(2, '0')}
.
$ext
'
;
String
name
=
'
${baseName}
_
${i.toString().padLeft(2, '0')}
.
$ext
'
;
File
file
=
fs
.
file
(
path
.
join
(
dir
.
path
,
name
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
dir
.
path
,
name
));
if
(!
file
.
existsSync
())
if
(!
file
.
existsSync
())
return
file
;
return
file
;
i
++;
i
++;
...
...
packages/flutter_tools/lib/src/build_info.dart
View file @
5e54fd54
...
@@ -2,9 +2,8 @@
...
@@ -2,9 +2,8 @@
// 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
'package:path/path.dart'
as
path
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/platform.dart'
;
import
'base/platform.dart'
;
import
'base/utils.dart'
;
import
'base/utils.dart'
;
import
'globals.dart'
;
import
'globals.dart'
;
...
@@ -129,7 +128,7 @@ String getBuildDirectory() {
...
@@ -129,7 +128,7 @@ String getBuildDirectory() {
return
'build'
;
return
'build'
;
String
buildDir
=
config
.
getValue
(
'build-dir'
)
??
'build'
;
String
buildDir
=
config
.
getValue
(
'build-dir'
)
??
'build'
;
if
(
path
.
isAbsolute
(
buildDir
))
{
if
(
fs
.
path
.
isAbsolute
(
buildDir
))
{
throw
new
Exception
(
throw
new
Exception
(
'build-dir config setting in
${config.configPath}
must be relative'
);
'build-dir config setting in
${config.configPath}
must be relative'
);
}
}
...
@@ -144,15 +143,15 @@ String getAndroidBuildDirectory() {
...
@@ -144,15 +143,15 @@ String getAndroidBuildDirectory() {
/// Returns the AOT build output directory.
/// Returns the AOT build output directory.
String
getAotBuildDirectory
(
)
{
String
getAotBuildDirectory
(
)
{
return
path
.
join
(
getBuildDirectory
(),
'aot'
);
return
fs
.
path
.
join
(
getBuildDirectory
(),
'aot'
);
}
}
/// Returns the asset build output directory.
/// Returns the asset build output directory.
String
getAssetBuildDirectory
(
)
{
String
getAssetBuildDirectory
(
)
{
return
path
.
join
(
getBuildDirectory
(),
'flx'
);
return
fs
.
path
.
join
(
getBuildDirectory
(),
'flx'
);
}
}
/// Returns the iOS build output directory.
/// Returns the iOS build output directory.
String
getIosBuildDirectory
(
)
{
String
getIosBuildDirectory
(
)
{
return
path
.
join
(
getBuildDirectory
(),
'ios'
);
return
fs
.
path
.
join
(
getBuildDirectory
(),
'ios'
);
}
}
packages/flutter_tools/lib/src/cache.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
import
'base/logger.dart'
;
import
'base/logger.dart'
;
...
@@ -52,7 +50,7 @@ class Cache {
...
@@ -52,7 +50,7 @@ class Cache {
if
(!
_lockEnabled
)
if
(!
_lockEnabled
)
return
null
;
return
null
;
assert
(
_lock
==
null
);
assert
(
_lock
==
null
);
_lock
=
fs
.
file
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'lockfile'
)).
openSync
(
mode:
FileMode
.
WRITE
);
_lock
=
fs
.
file
(
fs
.
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
,
'lockfile'
)).
openSync
(
mode:
FileMode
.
WRITE
);
bool
locked
=
false
;
bool
locked
=
false
;
bool
printed
=
false
;
bool
printed
=
false
;
while
(!
locked
)
{
while
(!
locked
)
{
...
@@ -91,7 +89,7 @@ class Cache {
...
@@ -91,7 +89,7 @@ class Cache {
static
String
get
engineRevision
{
static
String
get
engineRevision
{
if
(
_engineRevision
==
null
)
{
if
(
_engineRevision
==
null
)
{
File
revisionFile
=
fs
.
file
(
path
.
join
(
flutterRoot
,
'bin'
,
'internal'
,
'engine.version'
));
File
revisionFile
=
fs
.
file
(
fs
.
path
.
join
(
flutterRoot
,
'bin'
,
'internal'
,
'engine.version'
));
if
(
revisionFile
.
existsSync
())
if
(
revisionFile
.
existsSync
())
_engineRevision
=
revisionFile
.
readAsStringSync
().
trim
();
_engineRevision
=
revisionFile
.
readAsStringSync
().
trim
();
}
}
...
@@ -103,14 +101,14 @@ class Cache {
...
@@ -103,14 +101,14 @@ class Cache {
/// Return the top-level directory in the cache; this is `bin/cache`.
/// Return the top-level directory in the cache; this is `bin/cache`.
Directory
getRoot
()
{
Directory
getRoot
()
{
if
(
_rootOverride
!=
null
)
if
(
_rootOverride
!=
null
)
return
fs
.
directory
(
path
.
join
(
_rootOverride
.
path
,
'bin'
,
'cache'
));
return
fs
.
directory
(
fs
.
path
.
join
(
_rootOverride
.
path
,
'bin'
,
'cache'
));
else
else
return
fs
.
directory
(
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
));
return
fs
.
directory
(
fs
.
path
.
join
(
flutterRoot
,
'bin'
,
'cache'
));
}
}
/// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
/// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
Directory
getCacheDir
(
String
name
)
{
Directory
getCacheDir
(
String
name
)
{
Directory
dir
=
fs
.
directory
(
path
.
join
(
getRoot
().
path
,
name
));
Directory
dir
=
fs
.
directory
(
fs
.
path
.
join
(
getRoot
().
path
,
name
));
if
(!
dir
.
existsSync
())
if
(!
dir
.
existsSync
())
dir
.
createSync
(
recursive:
true
);
dir
.
createSync
(
recursive:
true
);
return
dir
;
return
dir
;
...
@@ -122,11 +120,11 @@ class Cache {
...
@@ -122,11 +120,11 @@ class Cache {
/// Get a named directory from with the cache's artifact directory; for example,
/// Get a named directory from with the cache's artifact directory; for example,
/// `material_fonts` would return `bin/cache/artifacts/material_fonts`.
/// `material_fonts` would return `bin/cache/artifacts/material_fonts`.
Directory
getArtifactDirectory
(
String
name
)
{
Directory
getArtifactDirectory
(
String
name
)
{
return
fs
.
directory
(
path
.
join
(
getCacheArtifacts
().
path
,
name
));
return
fs
.
directory
(
fs
.
path
.
join
(
getCacheArtifacts
().
path
,
name
));
}
}
String
getVersionFor
(
String
artifactName
)
{
String
getVersionFor
(
String
artifactName
)
{
File
versionFile
=
fs
.
file
(
path
.
join
(
_rootOverride
?.
path
??
flutterRoot
,
'bin'
,
'internal'
,
'
$artifactName
.version'
));
File
versionFile
=
fs
.
file
(
fs
.
path
.
join
(
_rootOverride
?.
path
??
flutterRoot
,
'bin'
,
'internal'
,
'
$artifactName
.version'
));
return
versionFile
.
existsSync
()
?
versionFile
.
readAsStringSync
().
trim
()
:
null
;
return
versionFile
.
existsSync
()
?
versionFile
.
readAsStringSync
().
trim
()
:
null
;
}
}
...
@@ -140,7 +138,7 @@ class Cache {
...
@@ -140,7 +138,7 @@ class Cache {
}
}
File
getStampFileFor
(
String
artifactName
)
{
File
getStampFileFor
(
String
artifactName
)
{
return
fs
.
file
(
path
.
join
(
getRoot
().
path
,
'
$artifactName
.stamp'
));
return
fs
.
file
(
fs
.
path
.
join
(
getRoot
().
path
,
'
$artifactName
.stamp'
));
}
}
bool
isUpToDate
()
{
bool
isUpToDate
()
{
...
@@ -156,11 +154,11 @@ class Cache {
...
@@ -156,11 +154,11 @@ class Cache {
Uri
url
=
Uri
.
parse
(
urlStr
);
Uri
url
=
Uri
.
parse
(
urlStr
);
Directory
thirdPartyDir
=
getArtifactDirectory
(
'third_party'
);
Directory
thirdPartyDir
=
getArtifactDirectory
(
'third_party'
);
Directory
serviceDir
=
fs
.
directory
(
path
.
join
(
thirdPartyDir
.
path
,
serviceName
));
Directory
serviceDir
=
fs
.
directory
(
fs
.
path
.
join
(
thirdPartyDir
.
path
,
serviceName
));
if
(!
serviceDir
.
existsSync
())
if
(!
serviceDir
.
existsSync
())
serviceDir
.
createSync
(
recursive:
true
);
serviceDir
.
createSync
(
recursive:
true
);
File
cachedFile
=
fs
.
file
(
path
.
join
(
serviceDir
.
path
,
url
.
pathSegments
.
last
));
File
cachedFile
=
fs
.
file
(
fs
.
path
.
join
(
serviceDir
.
path
,
url
.
pathSegments
.
last
));
if
(!
cachedFile
.
existsSync
())
{
if
(!
cachedFile
.
existsSync
())
{
try
{
try
{
await
_downloadFileToCache
(
url
,
cachedFile
,
unzip
);
await
_downloadFileToCache
(
url
,
cachedFile
,
unzip
);
...
@@ -197,7 +195,7 @@ class Cache {
...
@@ -197,7 +195,7 @@ class Cache {
if
(
location
is
Directory
&&
!
location
.
existsSync
())
if
(
location
is
Directory
&&
!
location
.
existsSync
())
location
.
createSync
(
recursive:
true
);
location
.
createSync
(
recursive:
true
);
File
tempFile
=
fs
.
file
(
path
.
join
(
fs
.
systemTempDirectory
.
path
,
'
${url.toString().hashCode}
.zip'
));
File
tempFile
=
fs
.
file
(
fs
.
path
.
join
(
fs
.
systemTempDirectory
.
path
,
'
${url.toString().hashCode}
.zip'
));
tempFile
.
writeAsBytesSync
(
fileBytes
,
flush:
true
);
tempFile
.
writeAsBytesSync
(
fileBytes
,
flush:
true
);
os
.
unzip
(
tempFile
,
location
);
os
.
unzip
(
tempFile
,
location
);
tempFile
.
deleteSync
();
tempFile
.
deleteSync
();
...
@@ -311,14 +309,14 @@ class FlutterEngine {
...
@@ -311,14 +309,14 @@ class FlutterEngine {
bool
isUpToDate
()
{
bool
isUpToDate
()
{
Directory
pkgDir
=
cache
.
getCacheDir
(
'pkg'
);
Directory
pkgDir
=
cache
.
getCacheDir
(
'pkg'
);
for
(
String
pkgName
in
_getPackageDirs
())
{
for
(
String
pkgName
in
_getPackageDirs
())
{
String
pkgPath
=
path
.
join
(
pkgDir
.
path
,
pkgName
);
String
pkgPath
=
fs
.
path
.
join
(
pkgDir
.
path
,
pkgName
);
if
(!
fs
.
directory
(
pkgPath
).
existsSync
())
if
(!
fs
.
directory
(
pkgPath
).
existsSync
())
return
false
;
return
false
;
}
}
Directory
engineDir
=
cache
.
getArtifactDirectory
(
kName
);
Directory
engineDir
=
cache
.
getArtifactDirectory
(
kName
);
for
(
List
<
String
>
toolsDir
in
_getBinaryDirs
())
{
for
(
List
<
String
>
toolsDir
in
_getBinaryDirs
())
{
Directory
dir
=
fs
.
directory
(
path
.
join
(
engineDir
.
path
,
toolsDir
[
0
]));
Directory
dir
=
fs
.
directory
(
fs
.
path
.
join
(
engineDir
.
path
,
toolsDir
[
0
]));
if
(!
dir
.
existsSync
())
if
(!
dir
.
existsSync
())
return
false
;
return
false
;
}
}
...
@@ -332,7 +330,7 @@ class FlutterEngine {
...
@@ -332,7 +330,7 @@ class FlutterEngine {
Directory
pkgDir
=
cache
.
getCacheDir
(
'pkg'
);
Directory
pkgDir
=
cache
.
getCacheDir
(
'pkg'
);
for
(
String
pkgName
in
_getPackageDirs
())
{
for
(
String
pkgName
in
_getPackageDirs
())
{
String
pkgPath
=
path
.
join
(
pkgDir
.
path
,
pkgName
);
String
pkgPath
=
fs
.
path
.
join
(
pkgDir
.
path
,
pkgName
);
Directory
dir
=
fs
.
directory
(
pkgPath
);
Directory
dir
=
fs
.
directory
(
pkgPath
);
if
(
dir
.
existsSync
())
if
(
dir
.
existsSync
())
dir
.
deleteSync
(
recursive:
true
);
dir
.
deleteSync
(
recursive:
true
);
...
@@ -346,14 +344,14 @@ class FlutterEngine {
...
@@ -346,14 +344,14 @@ class FlutterEngine {
for
(
List
<
String
>
toolsDir
in
_getBinaryDirs
())
{
for
(
List
<
String
>
toolsDir
in
_getBinaryDirs
())
{
String
cacheDir
=
toolsDir
[
0
];
String
cacheDir
=
toolsDir
[
0
];
String
urlPath
=
toolsDir
[
1
];
String
urlPath
=
toolsDir
[
1
];
Directory
dir
=
fs
.
directory
(
path
.
join
(
engineDir
.
path
,
cacheDir
));
Directory
dir
=
fs
.
directory
(
fs
.
path
.
join
(
engineDir
.
path
,
cacheDir
));
await
_downloadItem
(
'Downloading
$cacheDir
tools...'
,
url
+
urlPath
,
dir
);
await
_downloadItem
(
'Downloading
$cacheDir
tools...'
,
url
+
urlPath
,
dir
);
_makeFilesExecutable
(
dir
);
_makeFilesExecutable
(
dir
);
File
frameworkZip
=
fs
.
file
(
path
.
join
(
dir
.
path
,
'Flutter.framework.zip'
));
File
frameworkZip
=
fs
.
file
(
fs
.
path
.
join
(
dir
.
path
,
'Flutter.framework.zip'
));
if
(
frameworkZip
.
existsSync
())
{
if
(
frameworkZip
.
existsSync
())
{
Directory
framework
=
fs
.
directory
(
path
.
join
(
dir
.
path
,
'Flutter.framework'
));
Directory
framework
=
fs
.
directory
(
fs
.
path
.
join
(
dir
.
path
,
'Flutter.framework'
));
framework
.
createSync
();
framework
.
createSync
();
os
.
unzip
(
frameworkZip
,
framework
);
os
.
unzip
(
frameworkZip
,
framework
);
}
}
...
@@ -365,7 +363,7 @@ class FlutterEngine {
...
@@ -365,7 +363,7 @@ class FlutterEngine {
void
_makeFilesExecutable
(
Directory
dir
)
{
void
_makeFilesExecutable
(
Directory
dir
)
{
for
(
FileSystemEntity
entity
in
dir
.
listSync
())
{
for
(
FileSystemEntity
entity
in
dir
.
listSync
())
{
if
(
entity
is
File
)
{
if
(
entity
is
File
)
{
String
name
=
path
.
basename
(
entity
.
path
);
String
name
=
fs
.
path
.
basename
(
entity
.
path
);
if
(
name
==
'sky_snapshot'
||
name
==
'sky_shell'
)
if
(
name
==
'sky_snapshot'
||
name
==
'sky_shell'
)
os
.
makeExecutable
(
entity
);
os
.
makeExecutable
(
entity
);
}
}
...
...
packages/flutter_tools/lib/src/commands/analyze_base.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:args/args.dart'
;
import
'package:args/args.dart'
;
import
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/utils.dart'
;
import
'../base/utils.dart'
;
...
@@ -56,11 +55,11 @@ abstract class AnalyzeBase {
...
@@ -56,11 +55,11 @@ abstract class AnalyzeBase {
/// If [fileList] is empty, then return `true` if the current directory resides inside the Flutter repository.
/// If [fileList] is empty, then return `true` if the current directory resides inside the Flutter repository.
bool
inRepo
(
List
<
String
>
fileList
)
{
bool
inRepo
(
List
<
String
>
fileList
)
{
if
(
fileList
==
null
||
fileList
.
isEmpty
)
if
(
fileList
==
null
||
fileList
.
isEmpty
)
fileList
=
<
String
>[
path
.
current
];
fileList
=
<
String
>[
fs
.
path
.
current
];
String
root
=
path
.
normalize
(
path
.
absolute
(
Cache
.
flutterRoot
));
String
root
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
Cache
.
flutterRoot
));
String
prefix
=
root
+
fs
.
path
.
separator
;
String
prefix
=
root
+
fs
.
path
.
separator
;
for
(
String
file
in
fileList
)
{
for
(
String
file
in
fileList
)
{
file
=
path
.
normalize
(
path
.
absolute
(
file
));
file
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
file
));
if
(
file
==
root
||
file
.
startsWith
(
prefix
))
if
(
file
==
root
||
file
.
startsWith
(
prefix
))
return
true
;
return
true
;
}
}
...
...
packages/flutter_tools/lib/src/commands/analyze_continuously.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:args/args.dart'
;
import
'package:args/args.dart'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
...
@@ -41,7 +40,7 @@ class AnalyzeContinuously extends AnalyzeBase {
...
@@ -41,7 +40,7 @@ class AnalyzeContinuously extends AnalyzeBase {
analysisTarget
=
'Flutter repository'
;
analysisTarget
=
'Flutter repository'
;
printTrace
(
'Analyzing Flutter repository:'
);
printTrace
(
'Analyzing Flutter repository:'
);
for
(
String
projectPath
in
directories
)
for
(
String
projectPath
in
directories
)
printTrace
(
'
${path.relative(projectPath)}
'
);
printTrace
(
'
${
fs.
path.relative(projectPath)}
'
);
}
else
{
}
else
{
directories
=
<
String
>[
fs
.
currentDirectory
.
path
];
directories
=
<
String
>[
fs
.
currentDirectory
.
path
];
analysisTarget
=
fs
.
currentDirectory
.
path
;
analysisTarget
=
fs
.
currentDirectory
.
path
;
...
@@ -157,9 +156,9 @@ class AnalysisServer {
...
@@ -157,9 +156,9 @@ class AnalysisServer {
int
_id
=
0
;
int
_id
=
0
;
Future
<
Null
>
start
()
async
{
Future
<
Null
>
start
()
async
{
String
snapshot
=
path
.
join
(
sdk
,
'bin/snapshots/analysis_server.dart.snapshot'
);
String
snapshot
=
fs
.
path
.
join
(
sdk
,
'bin/snapshots/analysis_server.dart.snapshot'
);
List
<
String
>
command
=
<
String
>[
List
<
String
>
command
=
<
String
>[
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
),
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
),
snapshot
,
snapshot
,
'--sdk'
,
'--sdk'
,
sdk
,
sdk
,
...
@@ -309,7 +308,7 @@ class AnalysisError implements Comparable<AnalysisError> {
...
@@ -309,7 +308,7 @@ class AnalysisError implements Comparable<AnalysisError> {
@override
@override
String
toString
()
{
String
toString
()
{
String
relativePath
=
path
.
relative
(
file
);
String
relativePath
=
fs
.
path
.
relative
(
file
);
return
'
${severity.toLowerCase().padLeft(7)}
•
$message
•
$relativePath
:
$startLine
:
$startColumn
'
;
return
'
${severity.toLowerCase().padLeft(7)}
•
$message
•
$relativePath
:
$startLine
:
$startColumn
'
;
}
}
...
...
packages/flutter_tools/lib/src/commands/analyze_once.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:collection'
;
import
'dart:collection'
;
import
'package:args/args.dart'
;
import
'package:args/args.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
as
yaml
;
import
'package:yaml/yaml.dart'
as
yaml
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
...
@@ -34,12 +33,12 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -34,12 +33,12 @@ class AnalyzeOnce extends AnalyzeBase {
List
<
File
>
dartFiles
=
<
File
>[];
List
<
File
>
dartFiles
=
<
File
>[];
for
(
String
file
in
argResults
.
rest
.
toList
())
{
for
(
String
file
in
argResults
.
rest
.
toList
())
{
file
=
path
.
normalize
(
path
.
absolute
(
file
));
file
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
file
));
String
root
=
path
.
rootPrefix
(
file
);
String
root
=
fs
.
path
.
rootPrefix
(
file
);
dartFiles
.
add
(
fs
.
file
(
file
));
dartFiles
.
add
(
fs
.
file
(
file
));
while
(
file
!=
root
)
{
while
(
file
!=
root
)
{
file
=
path
.
dirname
(
file
);
file
=
fs
.
path
.
dirname
(
file
);
if
(
fs
.
isFileSync
(
path
.
join
(
file
,
'pubspec.yaml'
)))
{
if
(
fs
.
isFileSync
(
fs
.
path
.
join
(
file
,
'pubspec.yaml'
)))
{
pubSpecDirectories
.
add
(
fs
.
directory
(
file
));
pubSpecDirectories
.
add
(
fs
.
directory
(
file
));
break
;
break
;
}
}
...
@@ -83,7 +82,7 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -83,7 +82,7 @@ class AnalyzeOnce extends AnalyzeBase {
// determine what all the various .packages files depend on
// determine what all the various .packages files depend on
PackageDependencyTracker
dependencies
=
new
PackageDependencyTracker
();
PackageDependencyTracker
dependencies
=
new
PackageDependencyTracker
();
for
(
Directory
directory
in
pubSpecDirectories
)
{
for
(
Directory
directory
in
pubSpecDirectories
)
{
String
pubSpecYamlPath
=
path
.
join
(
directory
.
path
,
'pubspec.yaml'
);
String
pubSpecYamlPath
=
fs
.
path
.
join
(
directory
.
path
,
'pubspec.yaml'
);
File
pubSpecYamlFile
=
fs
.
file
(
pubSpecYamlPath
);
File
pubSpecYamlFile
=
fs
.
file
(
pubSpecYamlPath
);
if
(
pubSpecYamlFile
.
existsSync
())
{
if
(
pubSpecYamlFile
.
existsSync
())
{
// we are analyzing the actual canonical source for this package;
// we are analyzing the actual canonical source for this package;
...
@@ -91,10 +90,10 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -91,10 +90,10 @@ class AnalyzeOnce extends AnalyzeBase {
// pointing elsewhere somehow.
// pointing elsewhere somehow.
yaml
.
YamlMap
pubSpecYaml
=
yaml
.
loadYaml
(
fs
.
file
(
pubSpecYamlPath
).
readAsStringSync
());
yaml
.
YamlMap
pubSpecYaml
=
yaml
.
loadYaml
(
fs
.
file
(
pubSpecYamlPath
).
readAsStringSync
());
String
packageName
=
pubSpecYaml
[
'name'
];
String
packageName
=
pubSpecYaml
[
'name'
];
String
packagePath
=
path
.
normalize
(
path
.
absolute
(
path
.
join
(
directory
.
path
,
'lib'
)));
String
packagePath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
fs
.
path
.
join
(
directory
.
path
,
'lib'
)));
dependencies
.
addCanonicalCase
(
packageName
,
packagePath
,
pubSpecYamlPath
);
dependencies
.
addCanonicalCase
(
packageName
,
packagePath
,
pubSpecYamlPath
);
}
}
String
dotPackagesPath
=
path
.
join
(
directory
.
path
,
'.packages'
);
String
dotPackagesPath
=
fs
.
path
.
join
(
directory
.
path
,
'.packages'
);
File
dotPackages
=
fs
.
file
(
dotPackagesPath
);
File
dotPackages
=
fs
.
file
(
dotPackagesPath
);
if
(
dotPackages
.
existsSync
())
{
if
(
dotPackages
.
existsSync
())
{
// this directory has opinions about what we should be using
// this directory has opinions about what we should be using
...
@@ -106,12 +105,12 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -106,12 +105,12 @@ class AnalyzeOnce extends AnalyzeBase {
int
colon
=
line
.
indexOf
(
':'
);
int
colon
=
line
.
indexOf
(
':'
);
if
(
colon
>
0
)
{
if
(
colon
>
0
)
{
String
packageName
=
line
.
substring
(
0
,
colon
);
String
packageName
=
line
.
substring
(
0
,
colon
);
String
packagePath
=
path
.
fromUri
(
line
.
substring
(
colon
+
1
));
String
packagePath
=
fs
.
path
.
fromUri
(
line
.
substring
(
colon
+
1
));
// Ensure that we only add the `analyzer` package defined in the vended SDK (and referred to with a local
path
directive).
// Ensure that we only add the `analyzer` package defined in the vended SDK (and referred to with a local
fs.path.
directive).
// Analyzer package versions reached via transitive dependencies (e.g., via `test`) are ignored since they would produce
// Analyzer package versions reached via transitive dependencies (e.g., via `test`) are ignored since they would produce
// spurious conflicts.
// spurious conflicts.
if
(
packageName
!=
'analyzer'
||
packagePath
.
startsWith
(
'..'
))
if
(
packageName
!=
'analyzer'
||
packagePath
.
startsWith
(
'..'
))
dependencies
.
add
(
packageName
,
path
.
normalize
(
path
.
absolute
(
directory
.
path
,
packagePath
)),
dotPackagesPath
);
dependencies
.
add
(
packageName
,
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
directory
.
path
,
packagePath
)),
dotPackagesPath
);
}
}
});
});
}
}
...
@@ -138,7 +137,7 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -138,7 +137,7 @@ class AnalyzeOnce extends AnalyzeBase {
if
(
argResults
[
'preamble'
])
{
if
(
argResults
[
'preamble'
])
{
if
(
dartFiles
.
length
==
1
)
{
if
(
dartFiles
.
length
==
1
)
{
logger
.
printStatus
(
'Analyzing
${path.relative(dartFiles.first.path)}
...'
);
logger
.
printStatus
(
'Analyzing
${
fs.
path.relative(dartFiles.first.path)}
...'
);
}
else
{
}
else
{
logger
.
printStatus
(
'Analyzing
${dartFiles.length}
files...'
);
logger
.
printStatus
(
'Analyzing
${dartFiles.length}
files...'
);
}
}
...
@@ -147,8 +146,8 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -147,8 +146,8 @@ class AnalyzeOnce extends AnalyzeBase {
options
.
dartSdkPath
=
argResults
[
'dart-sdk'
];
options
.
dartSdkPath
=
argResults
[
'dart-sdk'
];
options
.
packageMap
=
packages
;
options
.
packageMap
=
packages
;
options
.
analysisOptionsFile
=
flutterRepo
options
.
analysisOptionsFile
=
flutterRepo
?
path
.
join
(
Cache
.
flutterRoot
,
'.analysis_options_repo'
)
?
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'.analysis_options_repo'
)
:
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter'
,
'lib'
,
'analysis_options_user.yaml'
);
:
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter'
,
'lib'
,
'analysis_options_user.yaml'
);
AnalysisDriver
analyzer
=
new
AnalysisDriver
(
options
);
AnalysisDriver
analyzer
=
new
AnalysisDriver
(
options
);
// TODO(pq): consider error handling
// TODO(pq): consider error handling
...
@@ -200,8 +199,8 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -200,8 +199,8 @@ class AnalyzeOnce extends AnalyzeBase {
List
<
String
>
flutterRootComponents
;
List
<
String
>
flutterRootComponents
;
bool
isFlutterLibrary
(
String
filename
)
{
bool
isFlutterLibrary
(
String
filename
)
{
flutterRootComponents
??=
path
.
normalize
(
path
.
absolute
(
Cache
.
flutterRoot
)).
split
(
path
.
separator
);
flutterRootComponents
??=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
Cache
.
flutterRoot
)).
split
(
fs
.
path
.
separator
);
List
<
String
>
filenameComponents
=
path
.
normalize
(
path
.
absolute
(
filename
)).
split
(
path
.
separator
);
List
<
String
>
filenameComponents
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
filename
)).
split
(
fs
.
path
.
separator
);
if
(
filenameComponents
.
length
<
flutterRootComponents
.
length
+
4
)
// the 4: 'packages', package_name, 'lib', file_name
if
(
filenameComponents
.
length
<
flutterRootComponents
.
length
+
4
)
// the 4: 'packages', package_name, 'lib', file_name
return
false
;
return
false
;
for
(
int
index
=
0
;
index
<
flutterRootComponents
.
length
;
index
+=
1
)
{
for
(
int
index
=
0
;
index
<
flutterRootComponents
.
length
;
index
+=
1
)
{
...
@@ -219,14 +218,14 @@ class AnalyzeOnce extends AnalyzeBase {
...
@@ -219,14 +218,14 @@ class AnalyzeOnce extends AnalyzeBase {
List
<
File
>
_collectDartFiles
(
Directory
dir
,
List
<
File
>
collected
)
{
List
<
File
>
_collectDartFiles
(
Directory
dir
,
List
<
File
>
collected
)
{
// Bail out in case of a .dartignore.
// Bail out in case of a .dartignore.
if
(
fs
.
isFileSync
(
path
.
join
(
dir
.
path
,
'.dartignore'
)))
if
(
fs
.
isFileSync
(
fs
.
path
.
join
(
dir
.
path
,
'.dartignore'
)))
return
collected
;
return
collected
;
for
(
FileSystemEntity
entity
in
dir
.
listSync
(
recursive:
false
,
followLinks:
false
))
{
for
(
FileSystemEntity
entity
in
dir
.
listSync
(
recursive:
false
,
followLinks:
false
))
{
if
(
isDartFile
(
entity
))
if
(
isDartFile
(
entity
))
collected
.
add
(
entity
);
collected
.
add
(
entity
);
if
(
entity
is
Directory
)
{
if
(
entity
is
Directory
)
{
String
name
=
path
.
basename
(
entity
.
path
);
String
name
=
fs
.
path
.
basename
(
entity
.
path
);
if
(!
name
.
startsWith
(
'.'
)
&&
name
!=
'packages'
)
if
(!
name
.
startsWith
(
'.'
)
&&
name
!=
'packages'
)
_collectDartFiles
(
entity
,
collected
);
_collectDartFiles
(
entity
,
collected
);
}
}
...
@@ -251,11 +250,11 @@ class PackageDependency {
...
@@ -251,11 +250,11 @@ class PackageDependency {
}
}
bool
get
hasConflict
=>
values
.
length
>
1
;
bool
get
hasConflict
=>
values
.
length
>
1
;
bool
get
hasConflictAffectingFlutterRepo
{
bool
get
hasConflictAffectingFlutterRepo
{
assert
(
path
.
isAbsolute
(
Cache
.
flutterRoot
));
assert
(
fs
.
path
.
isAbsolute
(
Cache
.
flutterRoot
));
for
(
List
<
String
>
targetSources
in
values
.
values
)
{
for
(
List
<
String
>
targetSources
in
values
.
values
)
{
for
(
String
source
in
targetSources
)
{
for
(
String
source
in
targetSources
)
{
assert
(
path
.
isAbsolute
(
source
));
assert
(
fs
.
path
.
isAbsolute
(
source
));
if
(
path
.
isWithin
(
Cache
.
flutterRoot
,
source
))
if
(
fs
.
path
.
isWithin
(
Cache
.
flutterRoot
,
source
))
return
true
;
return
true
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
...
@@ -51,7 +49,7 @@ class BuildAotCommand extends BuildSubCommand {
...
@@ -51,7 +49,7 @@ class BuildAotCommand extends BuildSubCommand {
if
(
platform
==
null
)
if
(
platform
==
null
)
throwToolExit
(
'Unknown platform:
$targetPlatform
'
);
throwToolExit
(
'Unknown platform:
$targetPlatform
'
);
String
typeName
=
path
.
basename
(
tools
.
getEngineArtifactsDirectory
(
platform
,
getBuildMode
()).
path
);
String
typeName
=
fs
.
path
.
basename
(
tools
.
getEngineArtifactsDirectory
(
platform
,
getBuildMode
()).
path
);
Status
status
=
logger
.
startProgress
(
'Building AOT snapshot in
${getModeName(getBuildMode())}
mode (
$typeName
)...'
,
Status
status
=
logger
.
startProgress
(
'Building AOT snapshot in
${getModeName(getBuildMode())}
mode (
$typeName
)...'
,
expectSlowOperation:
true
);
expectSlowOperation:
true
);
String
outputPath
=
await
buildAotSnapshot
(
String
outputPath
=
await
buildAotSnapshot
(
...
@@ -71,7 +69,7 @@ class BuildAotCommand extends BuildSubCommand {
...
@@ -71,7 +69,7 @@ class BuildAotCommand extends BuildSubCommand {
}
}
String
_getSdkExtensionPath
(
PackageMap
packageMap
,
String
package
)
{
String
_getSdkExtensionPath
(
PackageMap
packageMap
,
String
package
)
{
return
path
.
dirname
(
packageMap
.
map
[
package
].
toFilePath
());
return
fs
.
path
.
dirname
(
packageMap
.
map
[
package
].
toFilePath
());
}
}
/// Build an AOT snapshot. Return `null` (and log to `printError`) if the method
/// Build an AOT snapshot. Return `null` (and log to `printError`) if the method
...
@@ -122,15 +120,15 @@ Future<String> _buildAotSnapshot(
...
@@ -122,15 +120,15 @@ Future<String> _buildAotSnapshot(
String
engineSrc
=
tools
.
engineSrcPath
;
String
engineSrc
=
tools
.
engineSrcPath
;
String
genSnapshotExecutable
=
'gen_snapshot'
;
String
genSnapshotExecutable
=
'gen_snapshot'
;
if
(
engineSrc
!=
null
)
{
if
(
engineSrc
!=
null
)
{
entryPointsDir
=
path
.
join
(
engineSrc
,
'flutter'
,
'runtime'
);
entryPointsDir
=
fs
.
path
.
join
(
engineSrc
,
'flutter'
,
'runtime'
);
dartEntryPointsDir
=
path
.
join
(
engineSrc
,
'dart'
,
'runtime'
,
'bin'
);
dartEntryPointsDir
=
fs
.
path
.
join
(
engineSrc
,
'dart'
,
'runtime'
,
'bin'
);
snapshotterDir
=
path
.
join
(
engineSrc
,
'flutter'
,
'lib'
,
'snapshot'
);
snapshotterDir
=
fs
.
path
.
join
(
engineSrc
,
'flutter'
,
'lib'
,
'snapshot'
);
String
engineOut
=
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
).
path
;
String
engineOut
=
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
).
path
;
if
(
platform
==
TargetPlatform
.
ios
)
{
if
(
platform
==
TargetPlatform
.
ios
)
{
genSnapshot
=
path
.
join
(
engineOut
,
'clang_x64'
,
genSnapshotExecutable
);
genSnapshot
=
fs
.
path
.
join
(
engineOut
,
'clang_x64'
,
genSnapshotExecutable
);
}
else
{
}
else
{
String
host32BitToolchain
=
getCurrentHostPlatform
()
==
HostPlatform
.
darwin_x64
?
'clang_i386'
:
'clang_x86'
;
String
host32BitToolchain
=
getCurrentHostPlatform
()
==
HostPlatform
.
darwin_x64
?
'clang_i386'
:
'clang_x86'
;
genSnapshot
=
path
.
join
(
engineOut
,
host32BitToolchain
,
genSnapshotExecutable
);
genSnapshot
=
fs
.
path
.
join
(
engineOut
,
host32BitToolchain
,
genSnapshotExecutable
);
}
}
}
else
{
}
else
{
String
artifactsDir
=
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
).
path
;
String
artifactsDir
=
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
).
path
;
...
@@ -138,22 +136,22 @@ Future<String> _buildAotSnapshot(
...
@@ -138,22 +136,22 @@ Future<String> _buildAotSnapshot(
dartEntryPointsDir
=
entryPointsDir
;
dartEntryPointsDir
=
entryPointsDir
;
snapshotterDir
=
entryPointsDir
;
snapshotterDir
=
entryPointsDir
;
if
(
platform
==
TargetPlatform
.
ios
)
{
if
(
platform
==
TargetPlatform
.
ios
)
{
genSnapshot
=
path
.
join
(
artifactsDir
,
genSnapshotExecutable
);
genSnapshot
=
fs
.
path
.
join
(
artifactsDir
,
genSnapshotExecutable
);
}
else
{
}
else
{
String
hostToolsDir
=
path
.
join
(
artifactsDir
,
getNameForHostPlatform
(
getCurrentHostPlatform
()));
String
hostToolsDir
=
fs
.
path
.
join
(
artifactsDir
,
getNameForHostPlatform
(
getCurrentHostPlatform
()));
genSnapshot
=
path
.
join
(
hostToolsDir
,
genSnapshotExecutable
);
genSnapshot
=
fs
.
path
.
join
(
hostToolsDir
,
genSnapshotExecutable
);
}
}
}
}
Directory
outputDir
=
fs
.
directory
(
outputPath
);
Directory
outputDir
=
fs
.
directory
(
outputPath
);
outputDir
.
createSync
(
recursive:
true
);
outputDir
.
createSync
(
recursive:
true
);
String
vmSnapshotData
=
path
.
join
(
outputDir
.
path
,
'vm_snapshot_data'
);
String
vmSnapshotData
=
fs
.
path
.
join
(
outputDir
.
path
,
'vm_snapshot_data'
);
String
vmSnapshotInstructions
=
path
.
join
(
outputDir
.
path
,
'vm_snapshot_instr'
);
String
vmSnapshotInstructions
=
fs
.
path
.
join
(
outputDir
.
path
,
'vm_snapshot_instr'
);
String
isolateSnapshotData
=
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_data'
);
String
isolateSnapshotData
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_data'
);
String
isolateSnapshotInstructions
=
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_instr'
);
String
isolateSnapshotInstructions
=
fs
.
path
.
join
(
outputDir
.
path
,
'isolate_snapshot_instr'
);
String
vmEntryPoints
=
path
.
join
(
entryPointsDir
,
'dart_vm_entry_points.txt'
);
String
vmEntryPoints
=
fs
.
path
.
join
(
entryPointsDir
,
'dart_vm_entry_points.txt'
);
String
ioEntryPoints
=
path
.
join
(
dartEntryPointsDir
,
'dart_io_entries.txt'
);
String
ioEntryPoints
=
fs
.
path
.
join
(
dartEntryPointsDir
,
'dart_io_entries.txt'
);
PackageMap
packageMap
=
new
PackageMap
(
PackageMap
.
globalPackagesPath
);
PackageMap
packageMap
=
new
PackageMap
(
PackageMap
.
globalPackagesPath
);
String
packageMapError
=
packageMap
.
checkValid
();
String
packageMapError
=
packageMap
.
checkValid
();
...
@@ -163,9 +161,9 @@ Future<String> _buildAotSnapshot(
...
@@ -163,9 +161,9 @@ Future<String> _buildAotSnapshot(
}
}
String
skyEnginePkg
=
_getSdkExtensionPath
(
packageMap
,
'sky_engine'
);
String
skyEnginePkg
=
_getSdkExtensionPath
(
packageMap
,
'sky_engine'
);
String
uiPath
=
path
.
join
(
skyEnginePkg
,
'dart_ui'
,
'ui.dart'
);
String
uiPath
=
fs
.
path
.
join
(
skyEnginePkg
,
'dart_ui'
,
'ui.dart'
);
String
jniPath
=
path
.
join
(
skyEnginePkg
,
'dart_jni'
,
'jni.dart'
);
String
jniPath
=
fs
.
path
.
join
(
skyEnginePkg
,
'dart_jni'
,
'jni.dart'
);
String
vmServicePath
=
path
.
join
(
skyEnginePkg
,
'sdk_ext'
,
'vmservice_io.dart'
);
String
vmServicePath
=
fs
.
path
.
join
(
skyEnginePkg
,
'sdk_ext'
,
'vmservice_io.dart'
);
List
<
String
>
filePaths
=
<
String
>[
List
<
String
>
filePaths
=
<
String
>[
vmEntryPoints
,
vmEntryPoints
,
...
@@ -186,14 +184,14 @@ Future<String> _buildAotSnapshot(
...
@@ -186,14 +184,14 @@ Future<String> _buildAotSnapshot(
case
TargetPlatform
.
android_arm
:
case
TargetPlatform
.
android_arm
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x64
:
case
TargetPlatform
.
android_x86
:
case
TargetPlatform
.
android_x86
:
vmEntryPointsAndroid
=
path
.
join
(
entryPointsDir
,
'dart_vm_entry_points_android.txt'
);
vmEntryPointsAndroid
=
fs
.
path
.
join
(
entryPointsDir
,
'dart_vm_entry_points_android.txt'
);
filePaths
.
addAll
(<
String
>[
filePaths
.
addAll
(<
String
>[
vmEntryPointsAndroid
,
vmEntryPointsAndroid
,
]);
]);
break
;
break
;
case
TargetPlatform
.
ios
:
case
TargetPlatform
.
ios
:
snapshotDartIOS
=
path
.
join
(
snapshotterDir
,
'snapshot.dart'
);
snapshotDartIOS
=
fs
.
path
.
join
(
snapshotterDir
,
'snapshot.dart'
);
assembly
=
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.S'
);
assembly
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.S'
);
filePaths
.
addAll
(<
String
>[
filePaths
.
addAll
(<
String
>[
snapshotDartIOS
,
snapshotDartIOS
,
]);
]);
...
@@ -276,23 +274,23 @@ Future<String> _buildAotSnapshot(
...
@@ -276,23 +274,23 @@ Future<String> _buildAotSnapshot(
String
kVmSnapshotData
=
'kDartVmSnapshotData'
;
String
kVmSnapshotData
=
'kDartVmSnapshotData'
;
String
kIsolateSnapshotData
=
'kDartIsolateSnapshotData'
;
String
kIsolateSnapshotData
=
'kDartIsolateSnapshotData'
;
String
kVmSnapshotDataC
=
path
.
join
(
outputDir
.
path
,
'
$kVmSnapshotData
.c'
);
String
kVmSnapshotDataC
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kVmSnapshotData
.c'
);
String
kIsolateSnapshotDataC
=
path
.
join
(
outputDir
.
path
,
'
$kIsolateSnapshotData
.c'
);
String
kIsolateSnapshotDataC
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kIsolateSnapshotData
.c'
);
String
kVmSnapshotDataO
=
path
.
join
(
outputDir
.
path
,
'
$kVmSnapshotData
.o'
);
String
kVmSnapshotDataO
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kVmSnapshotData
.o'
);
String
kIsolateSnapshotDataO
=
path
.
join
(
outputDir
.
path
,
'
$kIsolateSnapshotData
.o'
);
String
kIsolateSnapshotDataO
=
fs
.
path
.
join
(
outputDir
.
path
,
'
$kIsolateSnapshotData
.o'
);
String
assemblyO
=
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.o'
);
String
assemblyO
=
fs
.
path
.
join
(
outputDir
.
path
,
'snapshot_assembly.o'
);
List
<
String
>
commonBuildOptions
=
<
String
>[
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
];
List
<
String
>
commonBuildOptions
=
<
String
>[
'-arch'
,
'arm64'
,
'-miphoneos-version-min=8.0'
];
if
(
interpreter
)
{
if
(
interpreter
)
{
runCheckedSync
(<
String
>[
'mv'
,
vmSnapshotData
,
path
.
join
(
outputDir
.
path
,
kVmSnapshotData
)]);
runCheckedSync
(<
String
>[
'mv'
,
vmSnapshotData
,
fs
.
path
.
join
(
outputDir
.
path
,
kVmSnapshotData
)]);
runCheckedSync
(<
String
>[
'mv'
,
isolateSnapshotData
,
path
.
join
(
outputDir
.
path
,
kIsolateSnapshotData
)]);
runCheckedSync
(<
String
>[
'mv'
,
isolateSnapshotData
,
fs
.
path
.
join
(
outputDir
.
path
,
kIsolateSnapshotData
)]);
runCheckedSync
(<
String
>[
runCheckedSync
(<
String
>[
'xxd'
,
'--include'
,
kVmSnapshotData
,
path
.
basename
(
kVmSnapshotDataC
)
'xxd'
,
'--include'
,
kVmSnapshotData
,
fs
.
path
.
basename
(
kVmSnapshotDataC
)
],
workingDirectory:
outputDir
.
path
);
],
workingDirectory:
outputDir
.
path
);
runCheckedSync
(<
String
>[
runCheckedSync
(<
String
>[
'xxd'
,
'--include'
,
kIsolateSnapshotData
,
path
.
basename
(
kIsolateSnapshotDataC
)
'xxd'
,
'--include'
,
kIsolateSnapshotData
,
fs
.
path
.
basename
(
kIsolateSnapshotDataC
)
],
workingDirectory:
outputDir
.
path
);
],
workingDirectory:
outputDir
.
path
);
runCheckedSync
(<
String
>[
'xcrun'
,
'cc'
]
runCheckedSync
(<
String
>[
'xcrun'
,
'cc'
]
...
@@ -307,7 +305,7 @@ Future<String> _buildAotSnapshot(
...
@@ -307,7 +305,7 @@ Future<String> _buildAotSnapshot(
..
addAll
(<
String
>[
'-c'
,
assembly
,
'-o'
,
assemblyO
]));
..
addAll
(<
String
>[
'-c'
,
assembly
,
'-o'
,
assemblyO
]));
}
}
String
appSo
=
path
.
join
(
outputDir
.
path
,
'app.dylib'
);
String
appSo
=
fs
.
path
.
join
(
outputDir
.
path
,
'app.dylib'
);
List
<
String
>
linkCommand
=
<
String
>[
'xcrun'
,
'clang'
]
List
<
String
>
linkCommand
=
<
String
>[
'xcrun'
,
'clang'
]
..
addAll
(
commonBuildOptions
)
..
addAll
(
commonBuildOptions
)
...
...
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
5e54fd54
...
@@ -5,8 +5,6 @@
...
@@ -5,8 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'dart:convert'
show
JSON
;
import
'dart:convert'
show
JSON
;
import
'package:path/path.dart'
as
path
;
import
'../android/android_sdk.dart'
;
import
'../android/android_sdk.dart'
;
import
'../android/gradle.dart'
;
import
'../android/gradle.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
...
@@ -39,8 +37,8 @@ const String _kDebugKeystoreKeyAlias = "chromiumdebugkey";
...
@@ -39,8 +37,8 @@ const String _kDebugKeystoreKeyAlias = "chromiumdebugkey";
// Password for the Chromium debug keystore
// Password for the Chromium debug keystore
const
String
_kDebugKeystorePassword
=
"chromium"
;
const
String
_kDebugKeystorePassword
=
"chromium"
;
// Default APK output path.
// Default APK output
fs.
path.
String
get
_defaultOutputPath
=>
path
.
join
(
getAndroidBuildDirectory
(),
'app.apk'
);
String
get
_defaultOutputPath
=>
fs
.
path
.
join
(
getAndroidBuildDirectory
(),
'app.apk'
);
/// Copies files into a new directory structure.
/// Copies files into a new directory structure.
class
_AssetBuilder
{
class
_AssetBuilder
{
...
@@ -54,7 +52,7 @@ class _AssetBuilder {
...
@@ -54,7 +52,7 @@ class _AssetBuilder {
}
}
void
add
(
File
asset
,
String
relativePath
)
{
void
add
(
File
asset
,
String
relativePath
)
{
String
destPath
=
path
.
join
(
_assetDir
.
path
,
relativePath
);
String
destPath
=
fs
.
path
.
join
(
_assetDir
.
path
,
relativePath
);
ensureDirectoryExists
(
destPath
);
ensureDirectoryExists
(
destPath
);
asset
.
copySync
(
destPath
);
asset
.
copySync
(
destPath
);
}
}
...
@@ -176,7 +174,7 @@ class BuildApkCommand extends BuildSubCommand {
...
@@ -176,7 +174,7 @@ class BuildApkCommand extends BuildSubCommand {
help:
'Android manifest XML file.'
);
help:
'Android manifest XML file.'
);
argParser
.
addOption
(
'resources'
,
argParser
.
addOption
(
'resources'
,
abbr:
'r'
,
abbr:
'r'
,
help:
'Resources directory path.'
);
help:
'Resources directory
fs.
path.'
);
argParser
.
addOption
(
'output-file'
,
argParser
.
addOption
(
'output-file'
,
abbr:
'o'
,
abbr:
'o'
,
defaultsTo:
_defaultOutputPath
,
defaultsTo:
_defaultOutputPath
,
...
@@ -301,12 +299,12 @@ Future<_ApkComponents> _findApkComponents(
...
@@ -301,12 +299,12 @@ Future<_ApkComponents> _findApkComponents(
}
else
{
}
else
{
Directory
artifacts
=
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
);
Directory
artifacts
=
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
);
components
.
icuData
=
fs
.
file
(
path
.
join
(
artifacts
.
path
,
'icudtl.dat'
));
components
.
icuData
=
fs
.
file
(
fs
.
path
.
join
(
artifacts
.
path
,
'icudtl.dat'
));
components
.
jars
=
<
File
>[
components
.
jars
=
<
File
>[
fs
.
file
(
path
.
join
(
artifacts
.
path
,
'classes.dex.jar'
))
fs
.
file
(
fs
.
path
.
join
(
artifacts
.
path
,
'classes.dex.jar'
))
];
];
components
.
libSkyShell
=
fs
.
file
(
path
.
join
(
artifacts
.
path
,
'libsky_shell.so'
));
components
.
libSkyShell
=
fs
.
file
(
fs
.
path
.
join
(
artifacts
.
path
,
'libsky_shell.so'
));
components
.
debugKeystore
=
fs
.
file
(
path
.
join
(
artifacts
.
path
,
'chromium-debug.keystore'
));
components
.
debugKeystore
=
fs
.
file
(
fs
.
path
.
join
(
artifacts
.
path
,
'chromium-debug.keystore'
));
}
}
await
parseServiceConfigs
(
components
.
services
,
jars:
components
.
jars
);
await
parseServiceConfigs
(
components
.
services
,
jars:
components
.
jars
);
...
@@ -465,7 +463,7 @@ bool _needsRebuild(
...
@@ -465,7 +463,7 @@ bool _needsRebuild(
if
(!
fs
.
isFileSync
(
'
$apkPath
.sha1'
))
if
(!
fs
.
isFileSync
(
'
$apkPath
.sha1'
))
return
true
;
return
true
;
String
lastBuildType
=
_readBuildMeta
(
path
.
dirname
(
apkPath
))[
'targetBuildType'
];
String
lastBuildType
=
_readBuildMeta
(
fs
.
path
.
dirname
(
apkPath
))[
'targetBuildType'
];
String
targetBuildType
=
_getTargetBuildTypeToken
(
platform
,
buildMode
,
fs
.
file
(
apkPath
));
String
targetBuildType
=
_getTargetBuildTypeToken
(
platform
,
buildMode
,
fs
.
file
(
apkPath
));
if
(
lastBuildType
!=
targetBuildType
)
if
(
lastBuildType
!=
targetBuildType
)
return
true
;
return
true
;
...
@@ -534,7 +532,7 @@ Future<Null> buildAndroid(
...
@@ -534,7 +532,7 @@ Future<Null> buildAndroid(
if
(
components
==
null
)
if
(
components
==
null
)
throwToolExit
(
'Failure building APK: unable to find components.'
);
throwToolExit
(
'Failure building APK: unable to find components.'
);
String
typeName
=
path
.
basename
(
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
).
path
);
String
typeName
=
fs
.
path
.
basename
(
tools
.
getEngineArtifactsDirectory
(
platform
,
buildMode
).
path
);
Status
status
=
logger
.
startProgress
(
'Building APK in
${getModeName(buildMode)}
mode (
$typeName
)...'
,
Status
status
=
logger
.
startProgress
(
'Building APK in
${getModeName(buildMode)}
mode (
$typeName
)...'
,
expectSlowOperation:
true
);
expectSlowOperation:
true
);
...
@@ -567,7 +565,7 @@ Future<Null> buildAndroid(
...
@@ -567,7 +565,7 @@ Future<Null> buildAndroid(
if
(!
fs
.
isDirectorySync
(
aotPath
))
if
(!
fs
.
isDirectorySync
(
aotPath
))
throwToolExit
(
'AOT snapshot does not exist:
$aotPath
'
);
throwToolExit
(
'AOT snapshot does not exist:
$aotPath
'
);
for
(
String
aotFilename
in
kAotSnapshotFiles
)
{
for
(
String
aotFilename
in
kAotSnapshotFiles
)
{
String
aotFilePath
=
path
.
join
(
aotPath
,
aotFilename
);
String
aotFilePath
=
fs
.
path
.
join
(
aotPath
,
aotFilename
);
if
(!
fs
.
isFileSync
(
aotFilePath
))
if
(!
fs
.
isFileSync
(
aotFilePath
))
throwToolExit
(
'Missing AOT snapshot file:
$aotFilePath
'
);
throwToolExit
(
'Missing AOT snapshot file:
$aotFilePath
'
);
components
.
extraFiles
[
'assets/
$aotFilename
'
]
=
fs
.
file
(
aotFilePath
);
components
.
extraFiles
[
'assets/
$aotFilename
'
]
=
fs
.
file
(
aotFilePath
);
...
@@ -584,7 +582,7 @@ Future<Null> buildAndroid(
...
@@ -584,7 +582,7 @@ Future<Null> buildAndroid(
printTrace
(
'Built
$outputFile
(
${getSizeAsMB(apkFile.lengthSync())}
).'
);
printTrace
(
'Built
$outputFile
(
${getSizeAsMB(apkFile.lengthSync())}
).'
);
_writeBuildMetaEntry
(
_writeBuildMetaEntry
(
path
.
dirname
(
outputFile
),
fs
.
path
.
dirname
(
outputFile
),
'targetBuildType'
,
'targetBuildType'
,
_getTargetBuildTypeToken
(
platform
,
buildMode
,
fs
.
file
(
outputFile
))
_getTargetBuildTypeToken
(
platform
,
buildMode
,
fs
.
file
(
outputFile
))
);
);
...
@@ -640,7 +638,7 @@ Future<Null> buildApk(
...
@@ -640,7 +638,7 @@ Future<Null> buildApk(
}
}
Map
<
String
,
dynamic
>
_readBuildMeta
(
String
buildDirectoryPath
)
{
Map
<
String
,
dynamic
>
_readBuildMeta
(
String
buildDirectoryPath
)
{
File
buildMetaFile
=
fs
.
file
(
path
.
join
(
buildDirectoryPath
,
'build_meta.json'
));
File
buildMetaFile
=
fs
.
file
(
fs
.
path
.
join
(
buildDirectoryPath
,
'build_meta.json'
));
if
(
buildMetaFile
.
existsSync
())
if
(
buildMetaFile
.
existsSync
())
return
JSON
.
decode
(
buildMetaFile
.
readAsStringSync
());
return
JSON
.
decode
(
buildMetaFile
.
readAsStringSync
());
return
<
String
,
dynamic
>{};
return
<
String
,
dynamic
>{};
...
@@ -649,7 +647,7 @@ Map<String, dynamic> _readBuildMeta(String buildDirectoryPath) {
...
@@ -649,7 +647,7 @@ Map<String, dynamic> _readBuildMeta(String buildDirectoryPath) {
void
_writeBuildMetaEntry
(
String
buildDirectoryPath
,
String
key
,
dynamic
value
)
{
void
_writeBuildMetaEntry
(
String
buildDirectoryPath
,
String
key
,
dynamic
value
)
{
Map
<
String
,
dynamic
>
meta
=
_readBuildMeta
(
buildDirectoryPath
);
Map
<
String
,
dynamic
>
meta
=
_readBuildMeta
(
buildDirectoryPath
);
meta
[
key
]
=
value
;
meta
[
key
]
=
value
;
File
buildMetaFile
=
fs
.
file
(
path
.
join
(
buildDirectoryPath
,
'build_meta.json'
));
File
buildMetaFile
=
fs
.
file
(
fs
.
path
.
join
(
buildDirectoryPath
,
'build_meta.json'
));
buildMetaFile
.
writeAsStringSync
(
toPrettyJson
(
meta
));
buildMetaFile
.
writeAsStringSync
(
toPrettyJson
(
meta
));
}
}
...
...
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
5e54fd54
...
@@ -4,10 +4,9 @@
...
@@ -4,10 +4,9 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../application_package.dart'
;
import
'../application_package.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
import
'../base/utils.dart'
;
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
...
@@ -64,7 +63,7 @@ class BuildIOSCommand extends BuildSubCommand {
...
@@ -64,7 +63,7 @@ class BuildIOSCommand extends BuildSubCommand {
String
logTarget
=
forSimulator
?
'simulator'
:
'device'
;
String
logTarget
=
forSimulator
?
'simulator'
:
'device'
;
String
typeName
=
path
.
basename
(
tools
.
getEngineArtifactsDirectory
(
TargetPlatform
.
ios
,
getBuildMode
()).
path
);
String
typeName
=
fs
.
path
.
basename
(
tools
.
getEngineArtifactsDirectory
(
TargetPlatform
.
ios
,
getBuildMode
()).
path
);
Status
status
=
logger
.
startProgress
(
'Building
$app
for
$logTarget
(
$typeName
)...'
,
Status
status
=
logger
.
startProgress
(
'Building
$app
for
$logTarget
(
$typeName
)...'
,
expectSlowOperation:
true
);
expectSlowOperation:
true
);
XcodeBuildResult
result
=
await
buildXcodeProject
(
XcodeBuildResult
result
=
await
buildXcodeProject
(
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../android/android.dart'
as
android
;
import
'../android/android.dart'
as
android
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
...
@@ -68,21 +66,21 @@ class CreateCommand extends FlutterCommand {
...
@@ -68,21 +66,21 @@ class CreateCommand extends FlutterCommand {
await
Cache
.
instance
.
updateAll
();
await
Cache
.
instance
.
updateAll
();
String
flutterRoot
=
path
.
absolute
(
Cache
.
flutterRoot
);
String
flutterRoot
=
fs
.
path
.
absolute
(
Cache
.
flutterRoot
);
String
flutterPackagesDirectory
=
path
.
join
(
flutterRoot
,
'packages'
);
String
flutterPackagesDirectory
=
fs
.
path
.
join
(
flutterRoot
,
'packages'
);
String
flutterPackagePath
=
path
.
join
(
flutterPackagesDirectory
,
'flutter'
);
String
flutterPackagePath
=
fs
.
path
.
join
(
flutterPackagesDirectory
,
'flutter'
);
if
(!
fs
.
isFileSync
(
path
.
join
(
flutterPackagePath
,
'pubspec.yaml'
)))
if
(!
fs
.
isFileSync
(
fs
.
path
.
join
(
flutterPackagePath
,
'pubspec.yaml'
)))
throwToolExit
(
'Unable to find package:flutter in
$flutterPackagePath
'
,
exitCode:
2
);
throwToolExit
(
'Unable to find package:flutter in
$flutterPackagePath
'
,
exitCode:
2
);
String
flutterDriverPackagePath
=
path
.
join
(
flutterRoot
,
'packages'
,
'flutter_driver'
);
String
flutterDriverPackagePath
=
fs
.
path
.
join
(
flutterRoot
,
'packages'
,
'flutter_driver'
);
if
(!
fs
.
isFileSync
(
path
.
join
(
flutterDriverPackagePath
,
'pubspec.yaml'
)))
if
(!
fs
.
isFileSync
(
fs
.
path
.
join
(
flutterDriverPackagePath
,
'pubspec.yaml'
)))
throwToolExit
(
'Unable to find package:flutter_driver in
$flutterDriverPackagePath
'
,
exitCode:
2
);
throwToolExit
(
'Unable to find package:flutter_driver in
$flutterDriverPackagePath
'
,
exitCode:
2
);
Directory
projectDir
=
fs
.
directory
(
argResults
.
rest
.
first
);
Directory
projectDir
=
fs
.
directory
(
argResults
.
rest
.
first
);
String
dirPath
=
path
.
normalize
(
projectDir
.
absolute
.
path
);
String
dirPath
=
fs
.
path
.
normalize
(
projectDir
.
absolute
.
path
);
String
relativePath
=
path
.
relative
(
dirPath
);
String
relativePath
=
fs
.
path
.
relative
(
dirPath
);
String
projectName
=
_normalizeProjectName
(
path
.
basename
(
dirPath
));
String
projectName
=
_normalizeProjectName
(
fs
.
path
.
basename
(
dirPath
));
String
error
=
_validateProjectDir
(
dirPath
,
flutterRoot:
flutterRoot
);
String
error
=
_validateProjectDir
(
dirPath
,
flutterRoot:
flutterRoot
);
if
(
error
!=
null
)
if
(
error
!=
null
)
...
@@ -141,10 +139,10 @@ Your main program file is lib/main.dart in the $relativePath directory.
...
@@ -141,10 +139,10 @@ Your main program file is lib/main.dart in the $relativePath directory.
String
flutterPackagesDirectory
,
{
bool
renderDriverTest:
false
})
{
String
flutterPackagesDirectory
,
{
bool
renderDriverTest:
false
})
{
fs
.
directory
(
dirPath
).
createSync
(
recursive:
true
);
fs
.
directory
(
dirPath
).
createSync
(
recursive:
true
);
flutterPackagesDirectory
=
path
.
normalize
(
flutterPackagesDirectory
);
flutterPackagesDirectory
=
fs
.
path
.
normalize
(
flutterPackagesDirectory
);
flutterPackagesDirectory
=
_relativePath
(
from:
dirPath
,
to:
flutterPackagesDirectory
);
flutterPackagesDirectory
=
_relativePath
(
from:
dirPath
,
to:
flutterPackagesDirectory
);
printStatus
(
'Creating project
${path.relative(dirPath)}
...'
);
printStatus
(
'Creating project
${
fs.
path.relative(dirPath)}
...'
);
Map
<
String
,
dynamic
>
templateContext
=
<
String
,
dynamic
>{
Map
<
String
,
dynamic
>
templateContext
=
<
String
,
dynamic
>{
'projectName'
:
projectName
,
'projectName'
:
projectName
,
...
@@ -168,7 +166,7 @@ Your main program file is lib/main.dart in the $relativePath directory.
...
@@ -168,7 +166,7 @@ Your main program file is lib/main.dart in the $relativePath directory.
if
(
renderDriverTest
)
{
if
(
renderDriverTest
)
{
Template
driverTemplate
=
new
Template
.
fromName
(
'driver'
);
Template
driverTemplate
=
new
Template
.
fromName
(
'driver'
);
fileCount
+=
driverTemplate
.
render
(
fs
.
directory
(
path
.
join
(
dirPath
,
'test_driver'
)),
fileCount
+=
driverTemplate
.
render
(
fs
.
directory
(
fs
.
path
.
join
(
dirPath
,
'test_driver'
)),
templateContext
,
overwriteExisting:
false
);
templateContext
,
overwriteExisting:
false
);
}
}
...
@@ -229,7 +227,7 @@ String _validateProjectName(String projectName) {
...
@@ -229,7 +227,7 @@ String _validateProjectName(String projectName) {
/// Return `null` if the project directory is legal. Return a validation message
/// Return `null` if the project directory is legal. Return a validation message
/// if we should disallow the directory name.
/// if we should disallow the directory name.
String
_validateProjectDir
(
String
dirPath
,
{
String
flutterRoot
})
{
String
_validateProjectDir
(
String
dirPath
,
{
String
flutterRoot
})
{
if
(
path
.
isWithin
(
flutterRoot
,
dirPath
))
{
if
(
fs
.
path
.
isWithin
(
flutterRoot
,
dirPath
))
{
return
"Cannot create a project within the Flutter SDK.
\n
"
return
"Cannot create a project within the Flutter SDK.
\n
"
"Target directory '
$dirPath
' is within the Flutter SDK at '
$flutterRoot
'."
;
"Target directory '
$dirPath
' is within the Flutter SDK at '
$flutterRoot
'."
;
}
}
...
@@ -251,9 +249,9 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) {
...
@@ -251,9 +249,9 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) {
}
}
String
_relativePath
(
{
String
from
,
String
to
})
{
String
_relativePath
(
{
String
from
,
String
to
})
{
String
result
=
path
.
relative
(
to
,
from:
from
);
String
result
=
fs
.
path
.
relative
(
to
,
from:
from
);
// `path.relative()` doesn't always return a correct result: dart-lang/path#12.
// `
fs.
path.relative()` doesn't always return a correct result: dart-lang/path#12.
if
(
fs
.
isDirectorySync
(
path
.
join
(
from
,
result
)))
if
(
fs
.
isDirectorySync
(
fs
.
path
.
join
(
from
,
result
)))
return
result
;
return
result
;
return
to
;
return
to
;
}
}
packages/flutter_tools/lib/src/commands/drive.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../android/android_device.dart'
show
AndroidDevice
;
import
'../android/android_device.dart'
show
AndroidDevice
;
import
'../application_package.dart'
;
import
'../application_package.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
...
@@ -140,25 +138,25 @@ class DriveCommand extends RunCommandBase {
...
@@ -140,25 +138,25 @@ class DriveCommand extends RunCommandBase {
}
}
String
_getTestFile
()
{
String
_getTestFile
()
{
String
appFile
=
path
.
normalize
(
targetFile
);
String
appFile
=
fs
.
path
.
normalize
(
targetFile
);
// This command extends `flutter start` and therefore CWD == package dir
// This command extends `flutter start` and therefore CWD == package dir
String
packageDir
=
fs
.
currentDirectory
.
path
;
String
packageDir
=
fs
.
currentDirectory
.
path
;
// Make appFile path relative to package directory because we are looking
// Make appFile path relative to package directory because we are looking
// for the corresponding test file relative to it.
// for the corresponding test file relative to it.
if
(!
path
.
isRelative
(
appFile
))
{
if
(!
fs
.
path
.
isRelative
(
appFile
))
{
if
(!
path
.
isWithin
(
packageDir
,
appFile
))
{
if
(!
fs
.
path
.
isWithin
(
packageDir
,
appFile
))
{
printError
(
printError
(
'Application file
$appFile
is outside the package directory
$packageDir
'
'Application file
$appFile
is outside the package directory
$packageDir
'
);
);
return
null
;
return
null
;
}
}
appFile
=
path
.
relative
(
appFile
,
from:
packageDir
);
appFile
=
fs
.
path
.
relative
(
appFile
,
from:
packageDir
);
}
}
List
<
String
>
parts
=
path
.
split
(
appFile
);
List
<
String
>
parts
=
fs
.
path
.
split
(
appFile
);
if
(
parts
.
length
<
2
)
{
if
(
parts
.
length
<
2
)
{
printError
(
printError
(
...
@@ -171,9 +169,9 @@ class DriveCommand extends RunCommandBase {
...
@@ -171,9 +169,9 @@ class DriveCommand extends RunCommandBase {
// Look for the test file inside `test_driver/` matching the sub-path, e.g.
// Look for the test file inside `test_driver/` matching the sub-path, e.g.
// if the application is `lib/foo/bar.dart`, the test file is expected to
// if the application is `lib/foo/bar.dart`, the test file is expected to
// be `test_driver/foo/bar_test.dart`.
// be `test_driver/foo/bar_test.dart`.
String
pathWithNoExtension
=
path
.
withoutExtension
(
path
.
joinAll
(
String
pathWithNoExtension
=
fs
.
path
.
withoutExtension
(
fs
.
path
.
joinAll
(
<
String
>[
packageDir
,
'test_driver'
]..
addAll
(
parts
.
skip
(
1
))));
<
String
>[
packageDir
,
'test_driver'
]..
addAll
(
parts
.
skip
(
1
))));
return
'
${pathWithNoExtension}
_test
${path.extension(appFile)}
'
;
return
'
${pathWithNoExtension}
_test
${
fs.
path.extension(appFile)}
'
;
}
}
}
}
...
@@ -317,11 +315,11 @@ void restoreTestRunner() {
...
@@ -317,11 +315,11 @@ void restoreTestRunner() {
Future
<
Null
>
_runTests
(
List
<
String
>
testArgs
,
String
observatoryUri
)
async
{
Future
<
Null
>
_runTests
(
List
<
String
>
testArgs
,
String
observatoryUri
)
async
{
printTrace
(
'Running driver tests.'
);
printTrace
(
'Running driver tests.'
);
PackageMap
.
globalPackagesPath
=
path
.
normalize
(
path
.
absolute
(
PackageMap
.
globalPackagesPath
));
PackageMap
.
globalPackagesPath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
));
List
<
String
>
args
=
testArgs
.
toList
()
List
<
String
>
args
=
testArgs
.
toList
()
..
add
(
'--packages=
${PackageMap.globalPackagesPath}
'
)
..
add
(
'--packages=
${PackageMap.globalPackagesPath}
'
)
..
add
(
'-rexpanded'
);
..
add
(
'-rexpanded'
);
String
dartVmPath
=
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
);
String
dartVmPath
=
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
);
int
result
=
await
runCommandAndStreamOutput
(
int
result
=
await
runCommandAndStreamOutput
(
<
String
>[
dartVmPath
]..
addAll
(
args
),
<
String
>[
dartVmPath
]..
addAll
(
args
),
environment:
<
String
,
String
>{
'VM_SERVICE_URL'
:
observatoryUri
}
environment:
<
String
,
String
>{
'VM_SERVICE_URL'
:
observatoryUri
}
...
...
packages/flutter_tools/lib/src/commands/format.dart
View file @
5e54fd54
...
@@ -4,9 +4,8 @@
...
@@ -4,9 +4,8 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
import
'../runner/flutter_command.dart'
;
import
'../runner/flutter_command.dart'
;
...
@@ -37,7 +36,7 @@ class FormatCommand extends FlutterCommand {
...
@@ -37,7 +36,7 @@ class FormatCommand extends FlutterCommand {
);
);
}
}
String
dartfmt
=
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
'dartfmt'
);
String
dartfmt
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
'dartfmt'
);
List
<
String
>
cmd
=
<
String
>[
dartfmt
,
'-w'
]..
addAll
(
argResults
.
rest
);
List
<
String
>
cmd
=
<
String
>[
dartfmt
,
'-w'
]..
addAll
(
argResults
.
rest
);
int
result
=
await
runCommandAndStreamOutput
(
cmd
);
int
result
=
await
runCommandAndStreamOutput
(
cmd
);
if
(
result
!=
0
)
if
(
result
!=
0
)
...
...
packages/flutter_tools/lib/src/commands/screenshot.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:http/http.dart'
as
http
;
import
'package:http/http.dart'
as
http
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
...
@@ -139,6 +138,6 @@ class ScreenshotCommand extends FlutterCommand {
...
@@ -139,6 +138,6 @@ class ScreenshotCommand extends FlutterCommand {
Future
<
Null
>
showOutputFileInfo
(
File
outputFile
)
async
{
Future
<
Null
>
showOutputFileInfo
(
File
outputFile
)
async
{
int
sizeKB
=
(
await
outputFile
.
length
())
~/
1024
;
int
sizeKB
=
(
await
outputFile
.
length
())
~/
1024
;
printStatus
(
'Screenshot written to
${path.relative(outputFile.path)}
(
${sizeKB}
kB).'
);
printStatus
(
'Screenshot written to
${
fs.
path.relative(outputFile.path)}
(
${sizeKB}
kB).'
);
}
}
}
}
packages/flutter_tools/lib/src/commands/test.dart
View file @
5e54fd54
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/src/executable.dart'
as
test
;
// ignore: implementation_imports
import
'package:test/src/executable.dart'
as
test
;
// ignore: implementation_imports
import
'../base/common.dart'
;
import
'../base/common.dart'
;
...
@@ -69,7 +68,7 @@ class TestCommand extends FlutterCommand {
...
@@ -69,7 +68,7 @@ class TestCommand extends FlutterCommand {
return
directory
.
listSync
(
recursive:
true
,
followLinks:
false
)
return
directory
.
listSync
(
recursive:
true
,
followLinks:
false
)
.
where
((
FileSystemEntity
entity
)
=>
entity
.
path
.
endsWith
(
'_test.dart'
)
&&
.
where
((
FileSystemEntity
entity
)
=>
entity
.
path
.
endsWith
(
'_test.dart'
)
&&
fs
.
isFileSync
(
entity
.
path
))
fs
.
isFileSync
(
entity
.
path
))
.
map
((
FileSystemEntity
entity
)
=>
path
.
absolute
(
entity
.
path
));
.
map
((
FileSystemEntity
entity
)
=>
fs
.
path
.
absolute
(
entity
.
path
));
}
}
Directory
get
_currentPackageTestDir
{
Directory
get
_currentPackageTestDir
{
...
@@ -83,7 +82,7 @@ class TestCommand extends FlutterCommand {
...
@@ -83,7 +82,7 @@ class TestCommand extends FlutterCommand {
try
{
try
{
if
(
testDirectory
!=
null
)
{
if
(
testDirectory
!=
null
)
{
printTrace
(
'switching to directory
$testDirectory
to run tests'
);
printTrace
(
'switching to directory
$testDirectory
to run tests'
);
PackageMap
.
globalPackagesPath
=
path
.
normalize
(
path
.
absolute
(
PackageMap
.
globalPackagesPath
));
PackageMap
.
globalPackagesPath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
));
fs
.
currentDirectory
=
testDirectory
;
fs
.
currentDirectory
=
testDirectory
;
}
}
printTrace
(
'running test package with arguments:
$testArgs
'
);
printTrace
(
'running test package with arguments:
$testArgs
'
);
...
@@ -139,7 +138,7 @@ class TestCommand extends FlutterCommand {
...
@@ -139,7 +138,7 @@ class TestCommand extends FlutterCommand {
Directory
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools'
);
Directory
tempDir
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_tools'
);
try
{
try
{
File
sourceFile
=
coverageFile
.
copySync
(
path
.
join
(
tempDir
.
path
,
'lcov.source.info'
));
File
sourceFile
=
coverageFile
.
copySync
(
fs
.
path
.
join
(
tempDir
.
path
,
'lcov.source.info'
));
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
'lcov'
,
'lcov'
,
'--add-tracefile'
,
baseCoverageData
,
'--add-tracefile'
,
baseCoverageData
,
...
@@ -173,7 +172,7 @@ class TestCommand extends FlutterCommand {
...
@@ -173,7 +172,7 @@ class TestCommand extends FlutterCommand {
testArgs
.
add
(
'--'
);
testArgs
.
add
(
'--'
);
Directory
testDir
;
Directory
testDir
;
Iterable
<
String
>
files
=
argResults
.
rest
.
map
((
String
testPath
)
=>
path
.
absolute
(
testPath
)).
toList
();
Iterable
<
String
>
files
=
argResults
.
rest
.
map
((
String
testPath
)
=>
fs
.
path
.
absolute
(
testPath
)).
toList
();
if
(
argResults
[
'start-paused'
])
{
if
(
argResults
[
'start-paused'
])
{
if
(
files
.
length
!=
1
)
if
(
files
.
length
!=
1
)
throwToolExit
(
'When using --start-paused, you must specify a single test file to run.'
,
exitCode:
1
);
throwToolExit
(
'When using --start-paused, you must specify a single test file to run.'
,
exitCode:
1
);
...
...
packages/flutter_tools/lib/src/commands/trace.dart
View file @
5e54fd54
...
@@ -5,8 +5,6 @@
...
@@ -5,8 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/utils.dart'
;
import
'../base/utils.dart'
;
...
@@ -160,7 +158,7 @@ class Tracing {
...
@@ -160,7 +158,7 @@ class Tracing {
/// Download the startup trace information from the given observatory client and
/// Download the startup trace information from the given observatory client and
/// store it to build/start_up_info.json.
/// store it to build/start_up_info.json.
Future
<
Null
>
downloadStartupTrace
(
VMService
observatory
)
async
{
Future
<
Null
>
downloadStartupTrace
(
VMService
observatory
)
async
{
String
traceInfoFilePath
=
path
.
join
(
getBuildDirectory
(),
'start_up_info.json'
);
String
traceInfoFilePath
=
fs
.
path
.
join
(
getBuildDirectory
(),
'start_up_info.json'
);
File
traceInfoFile
=
fs
.
file
(
traceInfoFilePath
);
File
traceInfoFile
=
fs
.
file
(
traceInfoFilePath
);
// Delete old startup data, if any.
// Delete old startup data, if any.
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
import
'../base/net.dart'
;
import
'../base/net.dart'
;
...
@@ -35,11 +33,11 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -35,11 +33,11 @@ class UpdatePackagesCommand extends FlutterCommand {
Future
<
Null
>
_downloadCoverageData
()
async
{
Future
<
Null
>
_downloadCoverageData
()
async
{
Status
status
=
logger
.
startProgress
(
"Downloading lcov data for package:flutter..."
,
expectSlowOperation:
true
);
Status
status
=
logger
.
startProgress
(
"Downloading lcov data for package:flutter..."
,
expectSlowOperation:
true
);
final
List
<
int
>
data
=
await
fetchUrl
(
Uri
.
parse
(
'https://storage.googleapis.com/flutter_infra/flutter/coverage/lcov.info'
));
final
List
<
int
>
data
=
await
fetchUrl
(
Uri
.
parse
(
'https://storage.googleapis.com/flutter_infra/flutter/coverage/lcov.info'
));
final
String
coverageDir
=
path
.
join
(
Cache
.
flutterRoot
,
'packages/flutter/coverage'
);
final
String
coverageDir
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'packages/flutter/coverage'
);
fs
.
file
(
path
.
join
(
coverageDir
,
'lcov.base.info'
))
fs
.
file
(
fs
.
path
.
join
(
coverageDir
,
'lcov.base.info'
))
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
data
,
flush:
true
);
..
writeAsBytesSync
(
data
,
flush:
true
);
fs
.
file
(
path
.
join
(
coverageDir
,
'lcov.info'
))
fs
.
file
(
fs
.
path
.
join
(
coverageDir
,
'lcov.info'
))
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
data
,
flush:
true
);
..
writeAsBytesSync
(
data
,
flush:
true
);
status
.
stop
();
status
.
stop
();
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
5e54fd54
...
@@ -4,9 +4,8 @@
...
@@ -4,9 +4,8 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/os.dart'
;
import
'../base/os.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
...
@@ -60,7 +59,7 @@ class UpgradeCommand extends FlutterCommand {
...
@@ -60,7 +59,7 @@ class UpgradeCommand extends FlutterCommand {
printStatus
(
'Upgrading engine...'
);
printStatus
(
'Upgrading engine...'
);
code
=
await
runCommandAndStreamOutput
(
code
=
await
runCommandAndStreamOutput
(
<
String
>[
<
String
>[
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'flutter'
),
'--no-color'
,
'precache'
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'flutter'
),
'--no-color'
,
'precache'
],
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
allowReentrantFlutter:
true
allowReentrantFlutter:
true
...
...
packages/flutter_tools/lib/src/dart/analysis.dart
View file @
5e54fd54
...
@@ -21,7 +21,6 @@ import 'package:linter/src/rules.dart' as linter; // ignore: implementation_impo
...
@@ -21,7 +21,6 @@ import 'package:linter/src/rules.dart' as linter; // ignore: implementation_impo
import
'package:cli_util/cli_util.dart'
as
cli_util
;
import
'package:cli_util/cli_util.dart'
as
cli_util
;
import
'package:package_config/packages.dart'
show
Packages
;
import
'package:package_config/packages.dart'
show
Packages
;
import
'package:package_config/src/packages_impl.dart'
show
MapPackages
;
// ignore: implementation_imports
import
'package:package_config/src/packages_impl.dart'
show
MapPackages
;
// ignore: implementation_imports
import
'package:path/path.dart'
as
path
;
import
'package:plugin/manager.dart'
;
import
'package:plugin/manager.dart'
;
import
'package:plugin/plugin.dart'
;
import
'package:plugin/plugin.dart'
;
...
@@ -47,7 +46,7 @@ class AnalysisDriver {
...
@@ -47,7 +46,7 @@ class AnalysisDriver {
DriverOptions
options
;
DriverOptions
options
;
String
get
sdkDir
{
String
get
sdkDir
{
return
options
.
dartSdkPath
??
path
.
absolute
(
cli_util
.
getSdkDir
().
path
);
return
options
.
dartSdkPath
??
fs
.
path
.
absolute
(
cli_util
.
getSdkDir
().
path
);
}
}
List
<
AnalysisErrorDescription
>
analyze
(
Iterable
<
File
>
files
)
{
List
<
AnalysisErrorDescription
>
analyze
(
Iterable
<
File
>
files
)
{
...
@@ -74,7 +73,7 @@ class AnalysisDriver {
...
@@ -74,7 +73,7 @@ class AnalysisDriver {
List
<
Source
>
sources
=
<
Source
>[];
List
<
Source
>
sources
=
<
Source
>[];
ChangeSet
changeSet
=
new
ChangeSet
();
ChangeSet
changeSet
=
new
ChangeSet
();
for
(
File
file
in
files
)
{
for
(
File
file
in
files
)
{
JavaFile
sourceFile
=
new
JavaFile
(
path
.
normalize
(
file
.
absolute
.
path
));
JavaFile
sourceFile
=
new
JavaFile
(
fs
.
path
.
normalize
(
file
.
absolute
.
path
));
Source
source
=
new
FileBasedSource
(
sourceFile
,
sourceFile
.
toURI
());
Source
source
=
new
FileBasedSource
(
sourceFile
,
sourceFile
.
toURI
());
Uri
uri
=
context
.
sourceFactory
.
restoreUri
(
source
);
Uri
uri
=
context
.
sourceFactory
.
restoreUri
(
source
);
if
(
uri
!=
null
)
{
if
(
uri
!=
null
)
{
...
...
packages/flutter_tools/lib/src/dart/dependencies.dart
View file @
5e54fd54
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../toolchain.dart'
;
import
'../toolchain.dart'
;
...
@@ -37,7 +36,7 @@ class DartDependencySetBuilder {
...
@@ -37,7 +36,7 @@ class DartDependencySetBuilder {
if
(!
line
.
startsWith
(
'package:'
))
{
if
(!
line
.
startsWith
(
'package:'
))
{
// We convert the uris so that they are relative to the project
// We convert the uris so that they are relative to the project
// root.
// root.
line
=
path
.
relative
(
line
,
from:
projectRootPath
);
line
=
fs
.
path
.
relative
(
line
,
from:
projectRootPath
);
}
}
minimalDependencies
.
add
(
line
);
minimalDependencies
.
add
(
line
);
}
}
...
...
packages/flutter_tools/lib/src/dart/package_map.dart
View file @
5e54fd54
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:package_config/packages_file.dart'
as
packages_file
;
import
'package:package_config/packages_file.dart'
as
packages_file
;
import
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
...
@@ -46,7 +45,7 @@ class PackageMap {
...
@@ -46,7 +45,7 @@ class PackageMap {
List
<
String
>
pathSegments
=
packageUri
.
pathSegments
.
toList
();
List
<
String
>
pathSegments
=
packageUri
.
pathSegments
.
toList
();
String
packageName
=
pathSegments
.
removeAt
(
0
);
String
packageName
=
pathSegments
.
removeAt
(
0
);
Uri
packageBase
=
map
[
packageName
];
Uri
packageBase
=
map
[
packageName
];
String
packageRelativePath
=
path
.
joinAll
(
pathSegments
);
String
packageRelativePath
=
fs
.
path
.
joinAll
(
pathSegments
);
return
packageBase
.
resolve
(
packageRelativePath
).
path
;
return
packageBase
.
resolve
(
packageRelativePath
).
path
;
}
}
...
@@ -54,7 +53,7 @@ class PackageMap {
...
@@ -54,7 +53,7 @@ class PackageMap {
if
(
fs
.
isFileSync
(
packagesPath
))
if
(
fs
.
isFileSync
(
packagesPath
))
return
null
;
return
null
;
String
message
=
'
$packagesPath
does not exist.'
;
String
message
=
'
$packagesPath
does not exist.'
;
String
pubspecPath
=
path
.
absolute
(
path
.
dirname
(
packagesPath
),
'pubspec.yaml'
);
String
pubspecPath
=
fs
.
path
.
absolute
(
fs
.
path
.
dirname
(
packagesPath
),
'pubspec.yaml'
);
if
(
fs
.
isFileSync
(
pubspecPath
))
if
(
fs
.
isFileSync
(
pubspecPath
))
message
+=
'
\n
Did you run "flutter packages get" in this directory?'
;
message
+=
'
\n
Did you run "flutter packages get" in this directory?'
;
else
else
...
...
packages/flutter_tools/lib/src/dart/pub.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/logger.dart'
;
...
@@ -36,8 +34,8 @@ Future<Null> pubGet({
...
@@ -36,8 +34,8 @@ Future<Null> pubGet({
if
(
directory
==
null
)
if
(
directory
==
null
)
directory
=
fs
.
currentDirectory
.
path
;
directory
=
fs
.
currentDirectory
.
path
;
File
pubSpecYaml
=
fs
.
file
(
path
.
join
(
directory
,
'pubspec.yaml'
));
File
pubSpecYaml
=
fs
.
file
(
fs
.
path
.
join
(
directory
,
'pubspec.yaml'
));
File
dotPackages
=
fs
.
file
(
path
.
join
(
directory
,
'.packages'
));
File
dotPackages
=
fs
.
file
(
fs
.
path
.
join
(
directory
,
'.packages'
));
if
(!
pubSpecYaml
.
existsSync
())
{
if
(!
pubSpecYaml
.
existsSync
())
{
if
(!
skipIfAbsent
)
if
(!
skipIfAbsent
)
...
@@ -47,7 +45,7 @@ Future<Null> pubGet({
...
@@ -47,7 +45,7 @@ Future<Null> pubGet({
if
(!
checkLastModified
||
_shouldRunPubGet
(
pubSpecYaml:
pubSpecYaml
,
dotPackages:
dotPackages
))
{
if
(!
checkLastModified
||
_shouldRunPubGet
(
pubSpecYaml:
pubSpecYaml
,
dotPackages:
dotPackages
))
{
String
command
=
upgrade
?
'upgrade'
:
'get'
;
String
command
=
upgrade
?
'upgrade'
:
'get'
;
Status
status
=
logger
.
startProgress
(
"Running 'flutter packages
$command
' in
${path.basename(directory)}
..."
,
Status
status
=
logger
.
startProgress
(
"Running 'flutter packages
$command
' in
${
fs.
path.basename(directory)}
..."
,
expectSlowOperation:
true
);
expectSlowOperation:
true
);
int
code
=
await
runCommandAndStreamOutput
(
int
code
=
await
runCommandAndStreamOutput
(
<
String
>[
sdkBinaryName
(
'pub'
),
'--verbosity=warning'
,
command
,
'--no-packages-dir'
,
'--no-precompile'
],
<
String
>[
sdkBinaryName
(
'pub'
),
'--verbosity=warning'
,
command
,
'--no-packages-dir'
,
'--no-precompile'
],
...
...
packages/flutter_tools/lib/src/dart/sdk.dart
View file @
5e54fd54
...
@@ -2,19 +2,18 @@
...
@@ -2,19 +2,18 @@
// 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
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/platform.dart'
;
import
'../base/platform.dart'
;
import
'../cache.dart'
;
import
'../cache.dart'
;
/// Locate the Dart SDK.
/// Locate the Dart SDK.
String
get
dartSdkPath
{
String
get
dartSdkPath
{
return
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
);
return
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'cache'
,
'dart-sdk'
);
}
}
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
/// ==> `pub.bat`. The default SDK location can be overridden with a specified
/// ==> `pub.bat`. The default SDK location can be overridden with a specified
/// [sdkLocation].
/// [sdkLocation].
String
sdkBinaryName
(
String
name
,
{
String
sdkLocation
})
{
String
sdkBinaryName
(
String
name
,
{
String
sdkLocation
})
{
return
path
.
absolute
(
path
.
join
(
sdkLocation
??
dartSdkPath
,
'bin'
,
platform
.
isWindows
?
'
$name
.bat'
:
name
));
return
fs
.
path
.
absolute
(
fs
.
path
.
join
(
sdkLocation
??
dartSdkPath
,
'bin'
,
platform
.
isWindows
?
'
$name
.bat'
:
name
));
}
}
packages/flutter_tools/lib/src/dependency_checker.dart
View file @
5e54fd54
...
@@ -9,8 +9,6 @@ import 'dart/dependencies.dart';
...
@@ -9,8 +9,6 @@ import 'dart/dependencies.dart';
import
'dart/package_map.dart'
;
import
'dart/package_map.dart'
;
import
'asset.dart'
;
import
'asset.dart'
;
import
'package:path/path.dart'
as
pathos
;
class
DependencyChecker
{
class
DependencyChecker
{
final
DartDependencySetBuilder
builder
;
final
DartDependencySetBuilder
builder
;
final
Set
<
String
>
_dependencies
=
new
Set
<
String
>();
final
Set
<
String
>
_dependencies
=
new
Set
<
String
>();
...
@@ -38,7 +36,7 @@ class DependencyChecker {
...
@@ -38,7 +36,7 @@ class DependencyChecker {
if
(
path
.
startsWith
(
'package:'
))
{
if
(
path
.
startsWith
(
'package:'
))
{
path
=
packageMap
.
pathForPackage
(
Uri
.
parse
(
path
));
path
=
packageMap
.
pathForPackage
(
Uri
.
parse
(
path
));
}
else
{
}
else
{
path
=
pathos
.
join
(
builder
.
projectRootPath
,
path
);
path
=
fs
.
path
.
join
(
builder
.
projectRootPath
,
path
);
}
}
_dependencies
.
add
(
path
);
_dependencies
.
add
(
path
);
}
}
...
...
packages/flutter_tools/lib/src/devfs.dart
View file @
5e54fd54
...
@@ -5,8 +5,6 @@
...
@@ -5,8 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'dart:convert'
show
BASE64
,
UTF8
;
import
'dart:convert'
show
BASE64
,
UTF8
;
import
'package:path/path.dart'
as
path
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
import
'base/io.dart'
;
import
'base/io.dart'
;
...
@@ -298,7 +296,7 @@ class DevFS {
...
@@ -298,7 +296,7 @@ class DevFS {
_httpWriter
=
new
_DevFSHttpWriter
(
fsName
,
serviceProtocol
),
_httpWriter
=
new
_DevFSHttpWriter
(
fsName
,
serviceProtocol
),
fsName
=
fsName
{
fsName
=
fsName
{
_packagesFilePath
=
_packagesFilePath
=
packagesFilePath
??
path
.
join
(
rootDirectory
.
path
,
kPackagesFileName
);
packagesFilePath
??
fs
.
path
.
join
(
rootDirectory
.
path
,
kPackagesFileName
);
}
}
DevFS
.
operations
(
this
.
_operations
,
DevFS
.
operations
(
this
.
_operations
,
...
@@ -308,7 +306,7 @@ class DevFS {
...
@@ -308,7 +306,7 @@ class DevFS {
})
})
:
_httpWriter
=
null
{
:
_httpWriter
=
null
{
_packagesFilePath
=
_packagesFilePath
=
packagesFilePath
??
path
.
join
(
rootDirectory
.
path
,
kPackagesFileName
);
packagesFilePath
??
fs
.
path
.
join
(
rootDirectory
.
path
,
kPackagesFileName
);
}
}
final
DevFSOperations
_operations
;
final
DevFSOperations
_operations
;
...
@@ -365,7 +363,7 @@ class DevFS {
...
@@ -365,7 +363,7 @@ class DevFS {
// Handle deletions.
// Handle deletions.
printTrace
(
'Scanning for deleted files'
);
printTrace
(
'Scanning for deleted files'
);
String
assetBuildDirPrefix
=
getAssetBuildDirectory
()
+
path
.
separator
;
String
assetBuildDirPrefix
=
getAssetBuildDirectory
()
+
fs
.
path
.
separator
;
final
List
<
String
>
toRemove
=
new
List
<
String
>();
final
List
<
String
>
toRemove
=
new
List
<
String
>();
_entries
.
forEach
((
String
devicePath
,
DevFSContent
content
)
{
_entries
.
forEach
((
String
devicePath
,
DevFSContent
content
)
{
if
(!
content
.
_exists
)
{
if
(!
content
.
_exists
)
{
...
@@ -446,7 +444,7 @@ class DevFS {
...
@@ -446,7 +444,7 @@ class DevFS {
void
_scanBundleEntry
(
String
archivePath
,
DevFSContent
content
,
bool
bundleDirty
)
{
void
_scanBundleEntry
(
String
archivePath
,
DevFSContent
content
,
bool
bundleDirty
)
{
// We write the assets into the AssetBundle working dir so that they
// We write the assets into the AssetBundle working dir so that they
// are in the same location in DevFS and the iOS simulator.
// are in the same location in DevFS and the iOS simulator.
final
String
devicePath
=
path
.
join
(
getAssetBuildDirectory
(),
archivePath
);
final
String
devicePath
=
fs
.
path
.
join
(
getAssetBuildDirectory
(),
archivePath
);
_entries
[
devicePath
]
=
content
;
_entries
[
devicePath
]
=
content
;
content
.
_exists
=
true
;
content
.
_exists
=
true
;
...
@@ -472,7 +470,7 @@ class DevFS {
...
@@ -472,7 +470,7 @@ class DevFS {
Set
<
String
>
fileFilter
})
async
{
Set
<
String
>
fileFilter
})
async
{
String
prefix
=
directoryName
;
String
prefix
=
directoryName
;
if
(
prefix
==
null
)
{
if
(
prefix
==
null
)
{
prefix
=
path
.
relative
(
directory
.
path
,
from:
rootDirectory
.
path
);
prefix
=
fs
.
path
.
relative
(
directory
.
path
,
from:
rootDirectory
.
path
);
if
(
prefix
==
'.'
)
if
(
prefix
==
'.'
)
prefix
=
''
;
prefix
=
''
;
}
}
...
@@ -494,20 +492,20 @@ class DevFS {
...
@@ -494,20 +492,20 @@ class DevFS {
continue
;
continue
;
}
}
assert
((
file
is
Link
)
||
(
file
is
File
));
assert
((
file
is
Link
)
||
(
file
is
File
));
if
(
ignoreDotFiles
&&
path
.
basename
(
file
.
path
).
startsWith
(
'.'
))
{
if
(
ignoreDotFiles
&&
fs
.
path
.
basename
(
file
.
path
).
startsWith
(
'.'
))
{
// Skip dot files.
// Skip dot files.
continue
;
continue
;
}
}
final
String
relativePath
=
final
String
relativePath
=
path
.
relative
(
file
.
path
,
from:
directory
.
path
);
fs
.
path
.
relative
(
file
.
path
,
from:
directory
.
path
);
final
String
devicePath
=
path
.
join
(
prefix
,
relativePath
);
final
String
devicePath
=
fs
.
path
.
join
(
prefix
,
relativePath
);
bool
filtered
=
false
;
bool
filtered
=
false
;
if
((
fileFilter
!=
null
)
&&
if
((
fileFilter
!=
null
)
&&
!
fileFilter
.
contains
(
devicePath
))
{
!
fileFilter
.
contains
(
devicePath
))
{
if
(
packagesDirectoryName
!=
null
)
{
if
(
packagesDirectoryName
!=
null
)
{
// Double check the filter for packages/packagename/
// Double check the filter for packages/packagename/
final
String
packagesDevicePath
=
final
String
packagesDevicePath
=
path
.
join
(
packagesDirectoryName
,
relativePath
);
fs
.
path
.
join
(
packagesDirectoryName
,
relativePath
);
if
(!
fileFilter
.
contains
(
packagesDevicePath
))
{
if
(!
fileFilter
.
contains
(
packagesDevicePath
))
{
// File was not in the filter set.
// File was not in the filter set.
filtered
=
true
;
filtered
=
true
;
...
@@ -544,13 +542,13 @@ class DevFS {
...
@@ -544,13 +542,13 @@ class DevFS {
// This project's own package.
// This project's own package.
final
bool
isProjectPackage
=
uri
.
toString
()
==
'lib/'
;
final
bool
isProjectPackage
=
uri
.
toString
()
==
'lib/'
;
final
String
directoryName
=
final
String
directoryName
=
isProjectPackage
?
'lib'
:
path
.
join
(
'packages'
,
packageName
);
isProjectPackage
?
'lib'
:
fs
.
path
.
join
(
'packages'
,
packageName
);
// If this is the project's package, we need to pass both
// If this is the project's package, we need to pass both
// package:<package_name> and lib/ as paths to be checked against
// package:<package_name> and lib/ as paths to be checked against
// the filter because we must support both package: imports and relative
// the filter because we must support both package: imports and relative
// path imports within the project's own code.
// path imports within the project's own code.
final
String
packagesDirectoryName
=
final
String
packagesDirectoryName
=
isProjectPackage
?
path
.
join
(
'packages'
,
packageName
)
:
null
;
isProjectPackage
?
fs
.
path
.
join
(
'packages'
,
packageName
)
:
null
;
Directory
directory
=
fs
.
directory
(
uri
);
Directory
directory
=
fs
.
directory
(
uri
);
bool
packageExists
=
bool
packageExists
=
await
_scanDirectory
(
directory
,
await
_scanDirectory
(
directory
,
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:convert'
show
UTF8
;
import
'dart:convert'
show
UTF8
;
import
'package:archive/archive.dart'
;
import
'package:archive/archive.dart'
;
import
'package:path/path.dart'
as
path
;
import
'android/android_workflow.dart'
;
import
'android/android_workflow.dart'
;
import
'base/common.dart'
;
import
'base/common.dart'
;
...
@@ -300,8 +299,8 @@ abstract class IntelliJValidator extends DoctorValidator {
...
@@ -300,8 +299,8 @@ abstract class IntelliJValidator extends DoctorValidator {
String
_readPackageVersion
(
String
packageName
)
{
String
_readPackageVersion
(
String
packageName
)
{
String
jarPath
=
packageName
.
endsWith
(
'.jar'
)
String
jarPath
=
packageName
.
endsWith
(
'.jar'
)
?
path
.
join
(
pluginsPath
,
packageName
)
?
fs
.
path
.
join
(
pluginsPath
,
packageName
)
:
path
.
join
(
pluginsPath
,
packageName
,
'lib'
,
'
$packageName
.jar'
);
:
fs
.
path
.
join
(
pluginsPath
,
packageName
,
'lib'
,
'
$packageName
.jar'
);
// TODO(danrubel) look for a better way to extract a single 2K file from the zip
// TODO(danrubel) look for a better way to extract a single 2K file from the zip
// rather than reading the entire file into memory.
// rather than reading the entire file into memory.
try
{
try
{
...
@@ -318,7 +317,7 @@ abstract class IntelliJValidator extends DoctorValidator {
...
@@ -318,7 +317,7 @@ abstract class IntelliJValidator extends DoctorValidator {
}
}
bool
hasPackage
(
String
packageName
)
{
bool
hasPackage
(
String
packageName
)
{
String
packagePath
=
path
.
join
(
pluginsPath
,
packageName
);
String
packagePath
=
fs
.
path
.
join
(
pluginsPath
,
packageName
);
if
(
packageName
.
endsWith
(
'.jar'
))
if
(
packageName
.
endsWith
(
'.jar'
))
return
fs
.
isFileSync
(
packagePath
);
return
fs
.
isFileSync
(
packagePath
);
return
fs
.
isDirectorySync
(
packagePath
);
return
fs
.
isDirectorySync
(
packagePath
);
...
@@ -356,18 +355,18 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
...
@@ -356,18 +355,18 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
for
(
FileSystemEntity
dir
in
fs
.
directory
(
homeDirPath
).
listSync
())
{
for
(
FileSystemEntity
dir
in
fs
.
directory
(
homeDirPath
).
listSync
())
{
if
(
dir
is
Directory
)
{
if
(
dir
is
Directory
)
{
String
name
=
path
.
basename
(
dir
.
path
);
String
name
=
fs
.
path
.
basename
(
dir
.
path
);
IntelliJValidator
.
_idToTitle
.
forEach
((
String
id
,
String
title
)
{
IntelliJValidator
.
_idToTitle
.
forEach
((
String
id
,
String
title
)
{
if
(
name
.
startsWith
(
'.
$id
'
))
{
if
(
name
.
startsWith
(
'.
$id
'
))
{
String
version
=
name
.
substring
(
id
.
length
+
1
);
String
version
=
name
.
substring
(
id
.
length
+
1
);
String
installPath
;
String
installPath
;
try
{
try
{
installPath
=
fs
.
file
(
path
.
join
(
dir
.
path
,
'system'
,
'.home'
)).
readAsStringSync
();
installPath
=
fs
.
file
(
fs
.
path
.
join
(
dir
.
path
,
'system'
,
'.home'
)).
readAsStringSync
();
}
catch
(
e
)
{
}
catch
(
e
)
{
// ignored
// ignored
}
}
if
(
installPath
!=
null
&&
fs
.
isDirectorySync
(
installPath
))
{
if
(
installPath
!=
null
&&
fs
.
isDirectorySync
(
installPath
))
{
String
pluginsPath
=
path
.
join
(
dir
.
path
,
'config'
,
'plugins'
);
String
pluginsPath
=
fs
.
path
.
join
(
dir
.
path
,
'config'
,
'plugins'
);
addValidator
(
title
,
version
,
installPath
,
pluginsPath
);
addValidator
(
title
,
version
,
installPath
,
pluginsPath
);
}
}
}
}
...
@@ -392,10 +391,10 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
...
@@ -392,10 +391,10 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
static
Iterable
<
DoctorValidator
>
get
installed
{
static
Iterable
<
DoctorValidator
>
get
installed
{
List
<
DoctorValidator
>
validators
=
<
DoctorValidator
>[];
List
<
DoctorValidator
>
validators
=
<
DoctorValidator
>[];
List
<
String
>
installPaths
=
<
String
>[
'/Applications'
,
path
.
join
(
homeDirPath
,
'Applications'
)];
List
<
String
>
installPaths
=
<
String
>[
'/Applications'
,
fs
.
path
.
join
(
homeDirPath
,
'Applications'
)];
void
checkForIntelliJ
(
Directory
dir
)
{
void
checkForIntelliJ
(
Directory
dir
)
{
String
name
=
path
.
basename
(
dir
.
path
);
String
name
=
fs
.
path
.
basename
(
dir
.
path
);
_dirNameToId
.
forEach
((
String
dirName
,
String
id
)
{
_dirNameToId
.
forEach
((
String
dirName
,
String
id
)
{
if
(
name
==
dirName
)
{
if
(
name
==
dirName
)
{
String
title
=
IntelliJValidator
.
_idToTitle
[
id
];
String
title
=
IntelliJValidator
.
_idToTitle
[
id
];
...
@@ -437,7 +436,7 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
...
@@ -437,7 +436,7 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
if
(
_version
==
null
)
{
if
(
_version
==
null
)
{
String
plist
;
String
plist
;
try
{
try
{
plist
=
fs
.
file
(
path
.
join
(
installPath
,
'Contents'
,
'Info.plist'
)).
readAsStringSync
();
plist
=
fs
.
file
(
fs
.
path
.
join
(
installPath
,
'Contents'
,
'Info.plist'
)).
readAsStringSync
();
int
index
=
plist
.
indexOf
(
'CFBundleShortVersionString'
);
int
index
=
plist
.
indexOf
(
'CFBundleShortVersionString'
);
if
(
index
>
0
)
{
if
(
index
>
0
)
{
int
start
=
plist
.
indexOf
(
'<string>'
,
index
);
int
start
=
plist
.
indexOf
(
'<string>'
,
index
);
...
@@ -462,7 +461,7 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
...
@@ -462,7 +461,7 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
List
<
String
>
split
=
version
.
split
(
'.'
);
List
<
String
>
split
=
version
.
split
(
'.'
);
String
major
=
split
[
0
];
String
major
=
split
[
0
];
String
minor
=
split
[
1
];
String
minor
=
split
[
1
];
return
path
.
join
(
homeDirPath
,
'Library'
,
'Application Support'
,
'
$id$major
.
$minor
'
);
return
fs
.
path
.
join
(
homeDirPath
,
'Library'
,
'Application Support'
,
'
$id$major
.
$minor
'
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/flx.dart
View file @
5e54fd54
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:path/path.dart'
as
path
;
import
'asset.dart'
;
import
'asset.dart'
;
import
'base/common.dart'
;
import
'base/common.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
...
@@ -20,9 +18,9 @@ import 'zip.dart';
...
@@ -20,9 +18,9 @@ import 'zip.dart';
const
String
defaultMainPath
=
'lib/main.dart'
;
const
String
defaultMainPath
=
'lib/main.dart'
;
const
String
defaultAssetBasePath
=
'.'
;
const
String
defaultAssetBasePath
=
'.'
;
const
String
defaultManifestPath
=
'pubspec.yaml'
;
const
String
defaultManifestPath
=
'pubspec.yaml'
;
String
get
defaultFlxOutputPath
=>
path
.
join
(
getBuildDirectory
(),
'app.flx'
);
String
get
defaultFlxOutputPath
=>
fs
.
path
.
join
(
getBuildDirectory
(),
'app.flx'
);
String
get
defaultSnapshotPath
=>
path
.
join
(
getBuildDirectory
(),
'snapshot_blob.bin'
);
String
get
defaultSnapshotPath
=>
fs
.
path
.
join
(
getBuildDirectory
(),
'snapshot_blob.bin'
);
String
get
defaultDepfilePath
=>
path
.
join
(
getBuildDirectory
(),
'snapshot_blob.bin.d'
);
String
get
defaultDepfilePath
=>
fs
.
path
.
join
(
getBuildDirectory
(),
'snapshot_blob.bin.d'
);
const
String
defaultPrivateKeyPath
=
'privatekey.der'
;
const
String
defaultPrivateKeyPath
=
'privatekey.der'
;
const
String
_kSnapshotKey
=
'snapshot_blob.bin'
;
const
String
_kSnapshotKey
=
'snapshot_blob.bin'
;
...
@@ -89,7 +87,7 @@ Future<Null> build({
...
@@ -89,7 +87,7 @@ Future<Null> build({
snapshotPath
??=
defaultSnapshotPath
;
snapshotPath
??=
defaultSnapshotPath
;
depfilePath
??=
defaultDepfilePath
;
depfilePath
??=
defaultDepfilePath
;
workingDirPath
??=
getAssetBuildDirectory
();
workingDirPath
??=
getAssetBuildDirectory
();
packagesPath
??=
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
packagesPath
??=
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
File
snapshotFile
;
File
snapshotFile
;
if
(!
precompiledSnapshot
)
{
if
(!
precompiledSnapshot
)
{
...
@@ -135,7 +133,7 @@ Future<Null> assemble({
...
@@ -135,7 +133,7 @@ Future<Null> assemble({
})
async
{
})
async
{
outputPath
??=
defaultFlxOutputPath
;
outputPath
??=
defaultFlxOutputPath
;
workingDirPath
??=
getAssetBuildDirectory
();
workingDirPath
??=
getAssetBuildDirectory
();
packagesPath
??=
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
packagesPath
??=
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
printTrace
(
'Building
$outputPath
'
);
printTrace
(
'Building
$outputPath
'
);
// Build the asset bundle.
// Build the asset bundle.
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:convert'
show
JSON
;
import
'dart:convert'
show
JSON
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:path/path.dart'
as
path
;
import
'../application_package.dart'
;
import
'../application_package.dart'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
...
@@ -133,11 +132,11 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -133,11 +132,11 @@ Future<XcodeBuildResult> buildXcodeProject({
List
<
FileSystemEntity
>
contents
=
fs
.
directory
(
app
.
appDirectory
).
listSync
();
List
<
FileSystemEntity
>
contents
=
fs
.
directory
(
app
.
appDirectory
).
listSync
();
for
(
FileSystemEntity
entity
in
contents
)
{
for
(
FileSystemEntity
entity
in
contents
)
{
if
(
path
.
extension
(
entity
.
path
)
==
'.xcworkspace'
)
{
if
(
fs
.
path
.
extension
(
entity
.
path
)
==
'.xcworkspace'
)
{
commands
.
addAll
(<
String
>[
commands
.
addAll
(<
String
>[
'-workspace'
,
path
.
basename
(
entity
.
path
),
'-workspace'
,
fs
.
path
.
basename
(
entity
.
path
),
'-scheme'
,
path
.
basenameWithoutExtension
(
entity
.
path
),
'-scheme'
,
fs
.
path
.
basenameWithoutExtension
(
entity
.
path
),
"BUILD_DIR=
${path.absolute(getIosBuildDirectory())}
"
,
"BUILD_DIR=
${
fs.
path.absolute(getIosBuildDirectory())}
"
,
]);
]);
break
;
break
;
}
}
...
@@ -191,7 +190,7 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -191,7 +190,7 @@ Future<XcodeBuildResult> buildXcodeProject({
Match
match
=
regexp
.
firstMatch
(
result
.
stdout
);
Match
match
=
regexp
.
firstMatch
(
result
.
stdout
);
String
outputDir
;
String
outputDir
;
if
(
match
!=
null
)
if
(
match
!=
null
)
outputDir
=
path
.
join
(
app
.
appDirectory
,
match
.
group
(
1
));
outputDir
=
fs
.
path
.
join
(
app
.
appDirectory
,
match
.
group
(
1
));
return
new
XcodeBuildResult
(
success:
true
,
output:
outputDir
);
return
new
XcodeBuildResult
(
success:
true
,
output:
outputDir
);
}
}
}
}
...
@@ -320,17 +319,17 @@ Future<Null> _addServicesToBundle(Directory bundle) async {
...
@@ -320,17 +319,17 @@ Future<Null> _addServicesToBundle(Directory bundle) async {
printTrace("Found
${services.length}
service definition(s).");
printTrace("Found
${services.length}
service definition(s).");
// Step 2: Copy framework dylibs to the correct spot for xcodebuild to pick up.
// Step 2: Copy framework dylibs to the correct spot for xcodebuild to pick up.
Directory frameworksDirectory = fs.directory(path.join(bundle.path, "Frameworks"));
Directory frameworksDirectory = fs.directory(
fs.
path.join(bundle.path, "Frameworks"));
await _copyServiceFrameworks(services, frameworksDirectory);
await _copyServiceFrameworks(services, frameworksDirectory);
// Step 3: Copy the service definitions manifest at the correct spot for
// Step 3: Copy the service definitions manifest at the correct spot for
// xcodebuild to pick up.
// xcodebuild to pick up.
File manifestFile = fs.file(path.join(bundle.path, "ServiceDefinitions.json"));
File manifestFile = fs.file(
fs.
path.join(bundle.path, "ServiceDefinitions.json"));
_copyServiceDefinitionsManifest(services, manifestFile);
_copyServiceDefinitionsManifest(services, manifestFile);
}
}
Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Directory frameworksDirectory) async {
Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Directory frameworksDirectory) async {
printTrace("Copying service frameworks to '
$
{
path
.
absolute
(
frameworksDirectory
.
path
)}
'.");
printTrace("Copying service frameworks to '
$
{
fs
.
path
.
absolute
(
frameworksDirectory
.
path
)}
'.");
frameworksDirectory.createSync(recursive: true);
frameworksDirectory.createSync(recursive: true);
for (Map<String, String> service in services) {
for (Map<String, String> service in services) {
String dylibPath = await getServiceFromUrl(service['
ios
-
framework
'], service['
root
'], service['
name
']);
String dylibPath = await getServiceFromUrl(service['
ios
-
framework
'], service['
root
'], service['
name
']);
...
@@ -351,7 +350,7 @@ void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File ma
...
@@ -351,7 +350,7 @@ void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File ma
'
name
': service['
name
'],
'
name
': service['
name
'],
// Since we have already moved it to the Frameworks directory. Strip away
// Since we have already moved it to the Frameworks directory. Strip away
// the directory and basenames.
// the directory and basenames.
'
framework
': path.basenameWithoutExtension(service['
ios
-
framework
'])
'
framework
':
fs.
path.basenameWithoutExtension(service['
ios
-
framework
'])
}).toList();
}).toList();
Map<String, dynamic> json = <String, dynamic>{ '
services
' : jsonServices };
Map<String, dynamic> json = <String, dynamic>{ '
services
' : jsonServices };
manifest.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
manifest.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
...
...
packages/flutter_tools/lib/src/ios/plist_utils.dart
View file @
5e54fd54
...
@@ -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
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
...
@@ -20,7 +18,7 @@ String getValueFromFile(String plistFilePath, String key) {
...
@@ -20,7 +18,7 @@ String getValueFromFile(String plistFilePath, String key) {
if
(!
fs
.
isFileSync
(
plistFilePath
))
if
(!
fs
.
isFileSync
(
plistFilePath
))
return
null
;
return
null
;
String
normalizedPlistPath
=
path
.
withoutExtension
(
path
.
absolute
(
plistFilePath
));
String
normalizedPlistPath
=
fs
.
path
.
withoutExtension
(
fs
.
path
.
absolute
(
plistFilePath
));
try
{
try
{
String
value
=
runCheckedSync
(<
String
>[
String
value
=
runCheckedSync
(<
String
>[
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
5e54fd54
...
@@ -6,8 +6,6 @@ import 'dart:async';
...
@@ -6,8 +6,6 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:convert'
;
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'package:path/path.dart'
as
path
;
import
'../application_package.dart'
;
import
'../application_package.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/context.dart'
;
import
'../base/context.dart'
;
...
@@ -319,17 +317,17 @@ class IOSSimulator extends Device {
...
@@ -319,17 +317,17 @@ class IOSSimulator extends Device {
Map
<
ApplicationPackage
,
_IOSSimulatorLogReader
>
_logReaders
;
Map
<
ApplicationPackage
,
_IOSSimulatorLogReader
>
_logReaders
;
_IOSSimulatorDevicePortForwarder
_portForwarder
;
_IOSSimulatorDevicePortForwarder
_portForwarder
;
String
get
xcrunPath
=>
path
.
join
(
'/usr'
,
'bin'
,
'xcrun'
);
String
get
xcrunPath
=>
fs
.
path
.
join
(
'/usr'
,
'bin'
,
'xcrun'
);
String
_getSimulatorPath
()
{
String
_getSimulatorPath
()
{
return
path
.
join
(
homeDirPath
,
'Library'
,
'Developer'
,
'CoreSimulator'
,
'Devices'
,
id
);
return
fs
.
path
.
join
(
homeDirPath
,
'Library'
,
'Developer'
,
'CoreSimulator'
,
'Devices'
,
id
);
}
}
String
_getSimulatorAppHomeDirectory
(
ApplicationPackage
app
)
{
String
_getSimulatorAppHomeDirectory
(
ApplicationPackage
app
)
{
String
simulatorPath
=
_getSimulatorPath
();
String
simulatorPath
=
_getSimulatorPath
();
if
(
simulatorPath
==
null
)
if
(
simulatorPath
==
null
)
return
null
;
return
null
;
return
path
.
join
(
simulatorPath
,
'data'
);
return
fs
.
path
.
join
(
simulatorPath
,
'data'
);
}
}
@override
@override
...
@@ -438,9 +436,9 @@ class IOSSimulator extends Device {
...
@@ -438,9 +436,9 @@ class IOSSimulator extends Device {
if
(!
prebuiltApplication
)
{
if
(!
prebuiltApplication
)
{
args
.
addAll
(<
String
>[
args
.
addAll
(<
String
>[
'--flx=
${
path.absolute(
path.join(getBuildDirectory(), 'app.flx'))}
'
,
'--flx=
${
fs.path.absolute(fs.
path.join(getBuildDirectory(), 'app.flx'))}
'
,
'--dart-main=
${path.absolute(mainPath)}
'
,
'--dart-main=
${
fs.
path.absolute(mainPath)}
'
,
'--packages=
${path.absolute('.packages')}
'
,
'--packages=
${
fs.
path.absolute('.packages')}
'
,
]);
]);
}
}
...
@@ -520,7 +518,7 @@ class IOSSimulator extends Device {
...
@@ -520,7 +518,7 @@ class IOSSimulator extends Device {
throwToolExit
(
'Could not find the built application bundle at
${bundle.path}
.'
);
throwToolExit
(
'Could not find the built application bundle at
${bundle.path}
.'
);
// Step 3: Install the updated bundle to the simulator.
// Step 3: Install the updated bundle to the simulator.
SimControl
.
instance
.
install
(
id
,
path
.
absolute
(
bundle
.
path
));
SimControl
.
instance
.
install
(
id
,
fs
.
path
.
absolute
(
bundle
.
path
));
}
}
Future
<
Null
>
_sideloadUpdatedAssetsForInstalledApplicationBundle
(
ApplicationPackage
app
)
=>
Future
<
Null
>
_sideloadUpdatedAssetsForInstalledApplicationBundle
(
ApplicationPackage
app
)
=>
...
@@ -536,14 +534,14 @@ class IOSSimulator extends Device {
...
@@ -536,14 +534,14 @@ class IOSSimulator extends Device {
ApplicationPackage
app
,
String
localFile
,
String
targetFile
)
async
{
ApplicationPackage
app
,
String
localFile
,
String
targetFile
)
async
{
if
(
p
.
platform
.
isMacOS
)
{
if
(
p
.
platform
.
isMacOS
)
{
String
simulatorHomeDirectory
=
_getSimulatorAppHomeDirectory
(
app
);
String
simulatorHomeDirectory
=
_getSimulatorAppHomeDirectory
(
app
);
runCheckedSync
(<
String
>[
'cp'
,
localFile
,
path
.
join
(
simulatorHomeDirectory
,
targetFile
)]);
runCheckedSync
(<
String
>[
'cp'
,
localFile
,
fs
.
path
.
join
(
simulatorHomeDirectory
,
targetFile
)]);
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
String
get
logFilePath
{
String
get
logFilePath
{
return
path
.
join
(
homeDirPath
,
'Library'
,
'Logs'
,
'CoreSimulator'
,
id
,
'system.log'
);
return
fs
.
path
.
join
(
homeDirPath
,
'Library'
,
'Logs'
,
'CoreSimulator'
,
id
,
'system.log'
);
}
}
@override
@override
...
@@ -587,13 +585,13 @@ class IOSSimulator extends Device {
...
@@ -587,13 +585,13 @@ class IOSSimulator extends Device {
@override
@override
Future
<
Null
>
takeScreenshot
(
File
outputFile
)
async
{
Future
<
Null
>
takeScreenshot
(
File
outputFile
)
async
{
Directory
desktopDir
=
fs
.
directory
(
path
.
join
(
homeDirPath
,
'Desktop'
));
Directory
desktopDir
=
fs
.
directory
(
fs
.
path
.
join
(
homeDirPath
,
'Desktop'
));
// 'Simulator Screen Shot Mar 25, 2016, 2.59.43 PM.png'
// 'Simulator Screen Shot Mar 25, 2016, 2.59.43 PM.png'
Set
<
File
>
getScreenshots
()
{
Set
<
File
>
getScreenshots
()
{
return
new
Set
<
File
>.
from
(
desktopDir
.
listSync
().
where
((
FileSystemEntity
entity
)
{
return
new
Set
<
File
>.
from
(
desktopDir
.
listSync
().
where
((
FileSystemEntity
entity
)
{
String
name
=
path
.
basename
(
entity
.
path
);
String
name
=
fs
.
path
.
basename
(
entity
.
path
);
return
entity
is
File
&&
name
.
startsWith
(
'Simulator'
)
&&
name
.
endsWith
(
'.png'
);
return
entity
is
File
&&
name
.
startsWith
(
'Simulator'
)
&&
name
.
endsWith
(
'.png'
);
}));
}));
}
}
...
...
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
5e54fd54
...
@@ -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
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/process.dart'
;
import
'../base/process.dart'
;
import
'../build_info.dart'
;
import
'../build_info.dart'
;
...
@@ -18,11 +16,11 @@ void updateXcodeGeneratedProperties(String projectPath, BuildMode mode, String t
...
@@ -18,11 +16,11 @@ void updateXcodeGeneratedProperties(String projectPath, BuildMode mode, String t
localsBuffer
.
writeln
(
'// This is a generated file; do not edit or check into version control.'
);
localsBuffer
.
writeln
(
'// This is a generated file; do not edit or check into version control.'
);
String
flutterRoot
=
path
.
normalize
(
Cache
.
flutterRoot
);
String
flutterRoot
=
fs
.
path
.
normalize
(
Cache
.
flutterRoot
);
localsBuffer
.
writeln
(
'FLUTTER_ROOT=
$flutterRoot
'
);
localsBuffer
.
writeln
(
'FLUTTER_ROOT=
$flutterRoot
'
);
// This holds because requiresProjectRoot is true for this command
// This holds because requiresProjectRoot is true for this command
String
applicationRoot
=
path
.
normalize
(
fs
.
currentDirectory
.
path
);
String
applicationRoot
=
fs
.
path
.
normalize
(
fs
.
currentDirectory
.
path
);
localsBuffer
.
writeln
(
'FLUTTER_APPLICATION_PATH=
$applicationRoot
'
);
localsBuffer
.
writeln
(
'FLUTTER_APPLICATION_PATH=
$applicationRoot
'
);
// Relative to FLUTTER_APPLICATION_PATH, which is [Directory.current].
// Relative to FLUTTER_APPLICATION_PATH, which is [Directory.current].
...
@@ -36,19 +34,19 @@ void updateXcodeGeneratedProperties(String projectPath, BuildMode mode, String t
...
@@ -36,19 +34,19 @@ void updateXcodeGeneratedProperties(String projectPath, BuildMode mode, String t
localsBuffer
.
writeln
(
'SYMROOT=
\
${SOURCE_ROOT}
/../
${getIosBuildDirectory()}
'
);
localsBuffer
.
writeln
(
'SYMROOT=
\
${SOURCE_ROOT}
/../
${getIosBuildDirectory()}
'
);
String
flutterFrameworkDir
=
path
.
normalize
(
tools
.
getEngineArtifactsDirectory
(
TargetPlatform
.
ios
,
mode
).
path
);
String
flutterFrameworkDir
=
fs
.
path
.
normalize
(
tools
.
getEngineArtifactsDirectory
(
TargetPlatform
.
ios
,
mode
).
path
);
localsBuffer
.
writeln
(
'FLUTTER_FRAMEWORK_DIR=
$flutterFrameworkDir
'
);
localsBuffer
.
writeln
(
'FLUTTER_FRAMEWORK_DIR=
$flutterFrameworkDir
'
);
if
(
tools
.
isLocalEngine
)
if
(
tools
.
isLocalEngine
)
localsBuffer
.
writeln
(
'LOCAL_ENGINE=
${tools.engineBuildPath}
'
);
localsBuffer
.
writeln
(
'LOCAL_ENGINE=
${tools.engineBuildPath}
'
);
File
localsFile
=
fs
.
file
(
path
.
join
(
projectPath
,
'ios'
,
'Flutter'
,
'Generated.xcconfig'
));
File
localsFile
=
fs
.
file
(
fs
.
path
.
join
(
projectPath
,
'ios'
,
'Flutter'
,
'Generated.xcconfig'
));
localsFile
.
createSync
(
recursive:
true
);
localsFile
.
createSync
(
recursive:
true
);
localsFile
.
writeAsStringSync
(
localsBuffer
.
toString
());
localsFile
.
writeAsStringSync
(
localsBuffer
.
toString
());
}
}
Map
<
String
,
String
>
getXcodeBuildSettings
(
String
xcodeProjPath
,
String
target
)
{
Map
<
String
,
String
>
getXcodeBuildSettings
(
String
xcodeProjPath
,
String
target
)
{
String
absProjPath
=
path
.
absolute
(
xcodeProjPath
);
String
absProjPath
=
fs
.
path
.
absolute
(
xcodeProjPath
);
String
out
=
runCheckedSync
(<
String
>[
String
out
=
runCheckedSync
(<
String
>[
'/usr/bin/xcodebuild'
,
'-project'
,
absProjPath
,
'-target'
,
target
,
'-showBuildSettings'
'/usr/bin/xcodebuild'
,
'-project'
,
absProjPath
,
'-target'
,
target
,
'-showBuildSettings'
]);
]);
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:path/path.dart'
as
path
;
import
'application_package.dart'
;
import
'application_package.dart'
;
import
'asset.dart'
;
import
'asset.dart'
;
...
@@ -37,7 +36,7 @@ abstract class ResidentRunner {
...
@@ -37,7 +36,7 @@ abstract class ResidentRunner {
_mainPath
=
findMainDartFile
(
target
);
_mainPath
=
findMainDartFile
(
target
);
_projectRootPath
=
projectRootPath
??
fs
.
currentDirectory
.
path
;
_projectRootPath
=
projectRootPath
??
fs
.
currentDirectory
.
path
;
_packagesFilePath
=
_packagesFilePath
=
packagesFilePath
??
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
packagesFilePath
??
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
);
if
(
projectAssets
!=
null
)
if
(
projectAssets
!=
null
)
_assetBundle
=
new
AssetBundle
.
fixed
(
_projectRootPath
,
projectAssets
);
_assetBundle
=
new
AssetBundle
.
fixed
(
_projectRootPath
,
projectAssets
);
else
else
...
@@ -133,7 +132,7 @@ abstract class ResidentRunner {
...
@@ -133,7 +132,7 @@ abstract class ResidentRunner {
}
}
int
sizeKB
=
(
await
outputFile
.
length
())
~/
1024
;
int
sizeKB
=
(
await
outputFile
.
length
())
~/
1024
;
status
.
stop
();
status
.
stop
();
printStatus
(
'Screenshot written to
${path.relative(outputFile.path)}
(
${sizeKB}
kB).'
);
printStatus
(
'Screenshot written to
${
fs.
path.relative(outputFile.path)}
(
${sizeKB}
kB).'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
status
.
stop
();
status
.
stop
();
printError
(
'Error taking screenshot:
$error
'
);
printError
(
'Error taking screenshot:
$error
'
);
...
@@ -377,9 +376,9 @@ class OperationResult {
...
@@ -377,9 +376,9 @@ class OperationResult {
String
findMainDartFile
(
[
String
target
])
{
String
findMainDartFile
(
[
String
target
])
{
if
(
target
==
null
)
if
(
target
==
null
)
target
=
''
;
target
=
''
;
String
targetPath
=
path
.
absolute
(
target
);
String
targetPath
=
fs
.
path
.
absolute
(
target
);
if
(
fs
.
isDirectorySync
(
targetPath
))
if
(
fs
.
isDirectorySync
(
targetPath
))
return
path
.
join
(
targetPath
,
'lib'
,
'main.dart'
);
return
fs
.
path
.
join
(
targetPath
,
'lib'
,
'main.dart'
);
else
else
return
targetPath
;
return
targetPath
;
}
}
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:stack_trace/stack_trace.dart'
;
import
'package:stack_trace/stack_trace.dart'
;
import
'application_package.dart'
;
import
'application_package.dart'
;
...
@@ -257,7 +256,7 @@ class HotRunner extends ResidentRunner {
...
@@ -257,7 +256,7 @@ class HotRunner extends ResidentRunner {
DevFS
_devFS
;
DevFS
_devFS
;
Future
<
Uri
>
_initDevFS
()
{
Future
<
Uri
>
_initDevFS
()
{
String
fsName
=
path
.
basename
(
projectRootPath
);
String
fsName
=
fs
.
path
.
basename
(
projectRootPath
);
_devFS
=
new
DevFS
(
vmService
,
_devFS
=
new
DevFS
(
vmService
,
fsName
,
fsName
,
fs
.
directory
(
projectRootPath
),
fs
.
directory
(
projectRootPath
),
...
@@ -324,7 +323,7 @@ class HotRunner extends ResidentRunner {
...
@@ -324,7 +323,7 @@ class HotRunner extends ResidentRunner {
Future
<
Null
>
_launchFromDevFS
(
ApplicationPackage
package
,
Future
<
Null
>
_launchFromDevFS
(
ApplicationPackage
package
,
String
mainScript
)
async
{
String
mainScript
)
async
{
String
entryPath
=
path
.
relative
(
mainScript
,
from:
projectRootPath
);
String
entryPath
=
fs
.
path
.
relative
(
mainScript
,
from:
projectRootPath
);
String
deviceEntryPath
=
String
deviceEntryPath
=
_devFS
.
baseUri
.
resolve
(
entryPath
).
toFilePath
();
_devFS
.
baseUri
.
resolve
(
entryPath
).
toFilePath
();
String
devicePackagesPath
=
String
devicePackagesPath
=
...
@@ -435,7 +434,7 @@ class HotRunner extends ResidentRunner {
...
@@ -435,7 +434,7 @@ class HotRunner extends ResidentRunner {
return
new
OperationResult
(
1
,
'Dart Source Error'
);
return
new
OperationResult
(
1
,
'Dart Source Error'
);
String
reloadMessage
;
String
reloadMessage
;
try
{
try
{
String
entryPath
=
path
.
relative
(
mainPath
,
from:
projectRootPath
);
String
entryPath
=
fs
.
path
.
relative
(
mainPath
,
from:
projectRootPath
);
String
deviceEntryPath
=
String
deviceEntryPath
=
_devFS
.
baseUri
.
resolve
(
entryPath
).
toFilePath
();
_devFS
.
baseUri
.
resolve
(
entryPath
).
toFilePath
();
String
devicePackagesPath
=
String
devicePackagesPath
=
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'package:args/args.dart'
;
import
'package:args/args.dart'
;
import
'package:args/command_runner.dart'
;
import
'package:args/command_runner.dart'
;
import
'package:path/path.dart'
as
path
;
import
'../android/android_sdk.dart'
;
import
'../android/android_sdk.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
...
@@ -124,10 +123,10 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -124,10 +123,10 @@ class FlutterCommandRunner extends CommandRunner<Null> {
if
(
platform
.
script
.
scheme
==
'data'
)
if
(
platform
.
script
.
scheme
==
'data'
)
return
'../..'
;
// we're running as a test
return
'../..'
;
// we're running as a test
String
script
=
platform
.
script
.
toFilePath
();
String
script
=
platform
.
script
.
toFilePath
();
if
(
path
.
basename
(
script
)
==
kSnapshotFileName
)
if
(
fs
.
path
.
basename
(
script
)
==
kSnapshotFileName
)
return
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
script
)));
return
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
script
)));
if
(
path
.
basename
(
script
)
==
kFlutterToolsScriptFileName
)
if
(
fs
.
path
.
basename
(
script
)
==
kFlutterToolsScriptFileName
)
return
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
script
))));
return
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
script
))));
// If run from a bare script within the repo.
// If run from a bare script within the repo.
if
(
script
.
contains
(
'flutter/packages/'
))
if
(
script
.
contains
(
'flutter/packages/'
))
...
@@ -188,7 +187,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -188,7 +187,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
// We must set Cache.flutterRoot early because other features use it (e.g.
// We must set Cache.flutterRoot early because other features use it (e.g.
// enginePath's initialiser uses it).
// enginePath's initialiser uses it).
Cache
.
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
globalResults
[
'flutter-root'
]));
Cache
.
flutterRoot
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
globalResults
[
'flutter-root'
]));
if
(
platform
.
environment
[
'FLUTTER_ALREADY_LOCKED'
]
!=
'true'
)
if
(
platform
.
environment
[
'FLUTTER_ALREADY_LOCKED'
]
!=
'true'
)
await
Cache
.
lock
();
await
Cache
.
lock
();
...
@@ -199,7 +198,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -199,7 +198,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
_checkFlutterCopy
();
_checkFlutterCopy
();
if
(
globalResults
.
wasParsed
(
'packages'
))
if
(
globalResults
.
wasParsed
(
'packages'
))
PackageMap
.
globalPackagesPath
=
path
.
normalize
(
path
.
absolute
(
globalResults
[
'packages'
]));
PackageMap
.
globalPackagesPath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
globalResults
[
'packages'
]));
// See if the user specified a specific device.
// See if the user specified a specific device.
deviceManager
.
specifiedDeviceId
=
globalResults
[
'device-id'
];
deviceManager
.
specifiedDeviceId
=
globalResults
[
'device-id'
];
...
@@ -224,7 +223,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -224,7 +223,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
}
}
String
_tryEnginePath
(
String
enginePath
)
{
String
_tryEnginePath
(
String
enginePath
)
{
if
(
fs
.
isDirectorySync
(
path
.
join
(
enginePath
,
'out'
)))
if
(
fs
.
isDirectorySync
(
fs
.
path
.
join
(
enginePath
,
'out'
)))
return
enginePath
;
return
enginePath
;
return
null
;
return
null
;
}
}
...
@@ -236,15 +235,15 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -236,15 +235,15 @@ class FlutterCommandRunner extends CommandRunner<Null> {
try
{
try
{
Uri
engineUri
=
new
PackageMap
(
PackageMap
.
globalPackagesPath
).
map
[
kFlutterEnginePackageName
];
Uri
engineUri
=
new
PackageMap
(
PackageMap
.
globalPackagesPath
).
map
[
kFlutterEnginePackageName
];
if
(
engineUri
!=
null
)
{
if
(
engineUri
!=
null
)
{
engineSourcePath
=
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
engineUri
.
path
))));
engineSourcePath
=
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
fs
.
path
.
dirname
(
engineUri
.
path
))));
bool
dirExists
=
fs
.
isDirectorySync
(
path
.
join
(
engineSourcePath
,
'out'
));
bool
dirExists
=
fs
.
isDirectorySync
(
fs
.
path
.
join
(
engineSourcePath
,
'out'
));
if
(
engineSourcePath
==
'/'
||
engineSourcePath
.
isEmpty
||
!
dirExists
)
if
(
engineSourcePath
==
'/'
||
engineSourcePath
.
isEmpty
||
!
dirExists
)
engineSourcePath
=
null
;
engineSourcePath
=
null
;
}
}
}
on
FileSystemException
{
}
on
FormatException
{
}
}
on
FileSystemException
{
}
on
FormatException
{
}
if
(
engineSourcePath
==
null
)
if
(
engineSourcePath
==
null
)
engineSourcePath
=
_tryEnginePath
(
path
.
join
(
Cache
.
flutterRoot
,
'../engine/src'
));
engineSourcePath
=
_tryEnginePath
(
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'../engine/src'
));
if
(
engineSourcePath
==
null
)
{
if
(
engineSourcePath
==
null
)
{
printError
(
'Unable to detect local Flutter engine build directory.
\n
'
printError
(
'Unable to detect local Flutter engine build directory.
\n
'
...
@@ -274,7 +273,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -274,7 +273,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
throw
new
ProcessExit
(
2
);
throw
new
ProcessExit
(
2
);
}
}
String
engineBuildPath
=
path
.
normalize
(
path
.
join
(
enginePath
,
'out'
,
localEngine
));
String
engineBuildPath
=
fs
.
path
.
normalize
(
fs
.
path
.
join
(
enginePath
,
'out'
,
localEngine
));
if
(!
fs
.
isDirectorySync
(
engineBuildPath
))
{
if
(!
fs
.
isDirectorySync
(
engineBuildPath
))
{
printError
(
'No Flutter engine build found at
$engineBuildPath
.'
);
printError
(
'No Flutter engine build found at
$engineBuildPath
.'
);
throw
new
ProcessExit
(
2
);
throw
new
ProcessExit
(
2
);
...
@@ -290,16 +289,16 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -290,16 +289,16 @@ class FlutterCommandRunner extends CommandRunner<Null> {
/// Get all pub packages in the Flutter repo.
/// Get all pub packages in the Flutter repo.
List
<
Directory
>
getRepoPackages
()
{
List
<
Directory
>
getRepoPackages
()
{
return
_gatherProjectPaths
(
path
.
absolute
(
Cache
.
flutterRoot
))
return
_gatherProjectPaths
(
fs
.
path
.
absolute
(
Cache
.
flutterRoot
))
.
map
((
String
dir
)
=>
fs
.
directory
(
dir
))
.
map
((
String
dir
)
=>
fs
.
directory
(
dir
))
.
toList
();
.
toList
();
}
}
static
List
<
String
>
_gatherProjectPaths
(
String
rootPath
)
{
static
List
<
String
>
_gatherProjectPaths
(
String
rootPath
)
{
if
(
fs
.
isFileSync
(
path
.
join
(
rootPath
,
'.dartignore'
)))
if
(
fs
.
isFileSync
(
fs
.
path
.
join
(
rootPath
,
'.dartignore'
)))
return
<
String
>[];
return
<
String
>[];
if
(
fs
.
isFileSync
(
path
.
join
(
rootPath
,
'pubspec.yaml'
)))
if
(
fs
.
isFileSync
(
fs
.
path
.
join
(
rootPath
,
'pubspec.yaml'
)))
return
<
String
>[
rootPath
];
return
<
String
>[
rootPath
];
return
fs
.
directory
(
rootPath
)
return
fs
.
directory
(
rootPath
)
...
@@ -312,15 +311,15 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -312,15 +311,15 @@ class FlutterCommandRunner extends CommandRunner<Null> {
/// Get the entry-points we want to analyze in the Flutter repo.
/// Get the entry-points we want to analyze in the Flutter repo.
List
<
Directory
>
getRepoAnalysisEntryPoints
()
{
List
<
Directory
>
getRepoAnalysisEntryPoints
()
{
final
String
rootPath
=
path
.
absolute
(
Cache
.
flutterRoot
);
final
String
rootPath
=
fs
.
path
.
absolute
(
Cache
.
flutterRoot
);
final
List
<
Directory
>
result
=
<
Directory
>[
final
List
<
Directory
>
result
=
<
Directory
>[
// not bin, and not the root
// not bin, and not the root
fs
.
directory
(
path
.
join
(
rootPath
,
'dev'
)),
fs
.
directory
(
fs
.
path
.
join
(
rootPath
,
'dev'
)),
fs
.
directory
(
path
.
join
(
rootPath
,
'examples'
)),
fs
.
directory
(
fs
.
path
.
join
(
rootPath
,
'examples'
)),
];
];
// And since analyzer refuses to look at paths that end in "packages/":
// And since analyzer refuses to look at paths that end in "packages/":
result
.
addAll
(
result
.
addAll
(
_gatherProjectPaths
(
path
.
join
(
rootPath
,
'packages'
))
_gatherProjectPaths
(
fs
.
path
.
join
(
rootPath
,
'packages'
))
.
map
<
Directory
>((
String
path
)
=>
fs
.
directory
(
path
))
.
map
<
Directory
>((
String
path
)
=>
fs
.
directory
(
path
))
);
);
return
result
;
return
result
;
...
@@ -329,7 +328,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -329,7 +328,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
void
_checkFlutterCopy
()
{
void
_checkFlutterCopy
()
{
// If the current directory is contained by a flutter repo, check that it's
// If the current directory is contained by a flutter repo, check that it's
// the same flutter that is currently running.
// the same flutter that is currently running.
String
directory
=
path
.
normalize
(
path
.
absolute
(
fs
.
currentDirectory
.
path
));
String
directory
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
fs
.
currentDirectory
.
path
));
// Check if the cwd is a flutter dir.
// Check if the cwd is a flutter dir.
while
(
directory
.
isNotEmpty
)
{
while
(
directory
.
isNotEmpty
)
{
...
@@ -347,7 +346,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -347,7 +346,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
break
;
break
;
}
}
String
parent
=
path
.
dirname
(
directory
);
String
parent
=
fs
.
path
.
dirname
(
directory
);
if
(
parent
==
directory
)
if
(
parent
==
directory
)
break
;
break
;
directory
=
parent
;
directory
=
parent
;
...
@@ -361,7 +360,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -361,7 +360,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
if
(
flutterUri
!=
null
&&
(
flutterUri
.
scheme
==
'file'
||
flutterUri
.
scheme
==
''
))
{
if
(
flutterUri
!=
null
&&
(
flutterUri
.
scheme
==
'file'
||
flutterUri
.
scheme
==
''
))
{
// .../flutter/packages/flutter/lib
// .../flutter/packages/flutter/lib
Uri
rootUri
=
flutterUri
.
resolve
(
'../../..'
);
Uri
rootUri
=
flutterUri
.
resolve
(
'../../..'
);
String
flutterPath
=
path
.
normalize
(
fs
.
file
(
rootUri
).
absolute
.
path
);
String
flutterPath
=
fs
.
path
.
normalize
(
fs
.
file
(
rootUri
).
absolute
.
path
);
if
(!
fs
.
isDirectorySync
(
flutterPath
))
{
if
(!
fs
.
isDirectorySync
(
flutterPath
))
{
printError
(
printError
(
...
@@ -394,14 +393,14 @@ class FlutterCommandRunner extends CommandRunner<Null> {
...
@@ -394,14 +393,14 @@ class FlutterCommandRunner extends CommandRunner<Null> {
// Check if `bin/flutter` and `bin/cache/engine.stamp` exist.
// Check if `bin/flutter` and `bin/cache/engine.stamp` exist.
bool
_isDirectoryFlutterRepo
(
String
directory
)
{
bool
_isDirectoryFlutterRepo
(
String
directory
)
{
return
return
fs
.
isFileSync
(
path
.
join
(
directory
,
'bin/flutter'
))
&&
fs
.
isFileSync
(
fs
.
path
.
join
(
directory
,
'bin/flutter'
))
&&
fs
.
isFileSync
(
path
.
join
(
directory
,
'bin/cache/engine.stamp'
));
fs
.
isFileSync
(
fs
.
path
.
join
(
directory
,
'bin/cache/engine.stamp'
));
}
}
}
}
bool
_compareResolvedPaths
(
String
path1
,
String
path2
)
{
bool
_compareResolvedPaths
(
String
path1
,
String
path2
)
{
path1
=
fs
.
directory
(
path
.
absolute
(
path1
)).
resolveSymbolicLinksSync
();
path1
=
fs
.
directory
(
fs
.
path
.
absolute
(
path1
)).
resolveSymbolicLinksSync
();
path2
=
fs
.
directory
(
path
.
absolute
(
path2
)).
resolveSymbolicLinksSync
();
path2
=
fs
.
directory
(
fs
.
path
.
absolute
(
path2
)).
resolveSymbolicLinksSync
();
return
path1
==
path2
;
return
path1
==
path2
;
}
}
packages/flutter_tools/lib/src/services.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:path/path.dart'
as
path
;
import
'package:yaml/yaml.dart'
;
import
'package:yaml/yaml.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
...
@@ -86,7 +85,7 @@ Future<String> getServiceFromUrl(
...
@@ -86,7 +85,7 @@ Future<String> getServiceFromUrl(
return
await
cache
.
getThirdPartyFile
(
url
,
serviceName
,
unzip:
unzip
);
return
await
cache
.
getThirdPartyFile
(
url
,
serviceName
,
unzip:
unzip
);
}
else
{
}
else
{
// Assume url is a path relative to the service's root dir.
// Assume url is a path relative to the service's root dir.
return
path
.
join
(
rootDir
,
url
);
return
fs
.
path
.
join
(
rootDir
,
url
);
}
}
}
}
...
@@ -107,7 +106,7 @@ File generateServiceDefinitions(
...
@@ -107,7 +106,7 @@ File generateServiceDefinitions(
}).
toList
();
}).
toList
();
Map
<
String
,
dynamic
>
json
=
<
String
,
dynamic
>{
'services'
:
services
};
Map
<
String
,
dynamic
>
json
=
<
String
,
dynamic
>{
'services'
:
services
};
File
servicesFile
=
fs
.
file
(
path
.
join
(
dir
,
'services.json'
));
File
servicesFile
=
fs
.
file
(
fs
.
path
.
join
(
dir
,
'services.json'
));
servicesFile
.
writeAsStringSync
(
JSON
.
encode
(
json
),
mode:
FileMode
.
WRITE
,
flush:
true
);
servicesFile
.
writeAsStringSync
(
JSON
.
encode
(
json
),
mode:
FileMode
.
WRITE
,
flush:
true
);
return
servicesFile
;
return
servicesFile
;
}
}
packages/flutter_tools/lib/src/template.dart
View file @
5e54fd54
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:mustache/mustache.dart'
as
mustache
;
import
'package:mustache/mustache.dart'
as
mustache
;
import
'package:path/path.dart'
as
path
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
import
'cache.dart'
;
import
'cache.dart'
;
...
@@ -39,14 +38,14 @@ class Template {
...
@@ -39,14 +38,14 @@ class Template {
continue
;
continue
;
}
}
String
relativePath
=
path
.
relative
(
entity
.
path
,
String
relativePath
=
fs
.
path
.
relative
(
entity
.
path
,
from:
baseDir
.
absolute
.
path
);
from:
baseDir
.
absolute
.
path
);
if
(
relativePath
.
contains
(
_kTemplateExtension
))
{
if
(
relativePath
.
contains
(
_kTemplateExtension
))
{
// If '.tmpl' appears anywhere within the path of this entity, it is
// If '.tmpl' appears anywhere within the path of this entity, it is
// is a candidate for rendering. This catches cases where the folder
// is a candidate for rendering. This catches cases where the folder
// itself is a template.
// itself is a template.
_templateFilePaths
[
relativePath
]
=
path
.
absolute
(
entity
.
path
);
_templateFilePaths
[
relativePath
]
=
fs
.
path
.
absolute
(
entity
.
path
);
}
}
}
}
}
}
...
@@ -71,14 +70,14 @@ class Template {
...
@@ -71,14 +70,14 @@ class Template {
String
destinationDirPath
=
destination
.
absolute
.
path
;
String
destinationDirPath
=
destination
.
absolute
.
path
;
_templateFilePaths
.
forEach
((
String
relativeDestPath
,
String
absoluteSrcPath
)
{
_templateFilePaths
.
forEach
((
String
relativeDestPath
,
String
absoluteSrcPath
)
{
String
finalDestinationPath
=
path
String
finalDestinationPath
=
fs
.
path
.
join
(
destinationDirPath
,
relativeDestPath
)
.
join
(
destinationDirPath
,
relativeDestPath
)
.
replaceAll
(
_kCopyTemplateExtension
,
''
)
.
replaceAll
(
_kCopyTemplateExtension
,
''
)
.
replaceAll
(
_kTemplateExtension
,
''
);
.
replaceAll
(
_kTemplateExtension
,
''
);
if
(
projectName
!=
null
)
if
(
projectName
!=
null
)
finalDestinationPath
=
finalDestinationPath
.
replaceAll
(
'projectName'
,
projectName
);
finalDestinationPath
=
finalDestinationPath
.
replaceAll
(
'projectName'
,
projectName
);
File
finalDestinationFile
=
fs
.
file
(
finalDestinationPath
);
File
finalDestinationFile
=
fs
.
file
(
finalDestinationPath
);
String
relativePathForLogging
=
path
.
relative
(
finalDestinationFile
.
path
);
String
relativePathForLogging
=
fs
.
path
.
relative
(
finalDestinationFile
.
path
);
// Step 1: Check if the file needs to be overwritten.
// Step 1: Check if the file needs to be overwritten.
...
@@ -132,7 +131,7 @@ class Template {
...
@@ -132,7 +131,7 @@ class Template {
}
}
Directory
_templateDirectoryInPackage
(
String
name
)
{
Directory
_templateDirectoryInPackage
(
String
name
)
{
String
templatesDir
=
path
.
join
(
Cache
.
flutterRoot
,
String
templatesDir
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'templates'
);
'packages'
,
'flutter_tools'
,
'templates'
);
return
fs
.
directory
(
path
.
join
(
templatesDir
,
name
));
return
fs
.
directory
(
fs
.
path
.
join
(
templatesDir
,
name
));
}
}
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:coverage/coverage.dart'
;
import
'package:coverage/coverage.dart'
;
import
'package:path/path.dart'
as
path
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
import
'../base/io.dart'
;
import
'../base/io.dart'
;
...
@@ -66,7 +65,7 @@ class CoverageCollector {
...
@@ -66,7 +65,7 @@ class CoverageCollector {
if
(
formatter
==
null
)
{
if
(
formatter
==
null
)
{
Resolver
resolver
=
new
Resolver
(
packagesPath:
PackageMap
.
globalPackagesPath
);
Resolver
resolver
=
new
Resolver
(
packagesPath:
PackageMap
.
globalPackagesPath
);
String
packagePath
=
fs
.
currentDirectory
.
path
;
String
packagePath
=
fs
.
currentDirectory
.
path
;
List
<
String
>
reportOn
=
<
String
>[
path
.
join
(
packagePath
,
'lib'
)];
List
<
String
>
reportOn
=
<
String
>[
fs
.
path
.
join
(
packagePath
,
'lib'
)];
formatter
=
new
LcovFormatter
(
resolver
,
reportOn:
reportOn
,
basePath:
packagePath
);
formatter
=
new
LcovFormatter
(
resolver
,
reportOn:
reportOn
,
basePath:
packagePath
);
}
}
String
result
=
await
formatter
.
format
(
_globalHitmap
);
String
result
=
await
formatter
.
format
(
_globalHitmap
);
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:stream_channel/stream_channel.dart'
;
import
'package:stream_channel/stream_channel.dart'
;
import
'package:test/src/backend/test_platform.dart'
;
// ignore: implementation_imports
import
'package:test/src/backend/test_platform.dart'
;
// ignore: implementation_imports
...
@@ -164,7 +163,7 @@ class _FlutterPlatform extends PlatformPlugin {
...
@@ -164,7 +163,7 @@ class _FlutterPlatform extends PlatformPlugin {
File
listenerFile
=
fs
.
file
(
'
${temporaryDirectory.path}
/listener.dart'
);
File
listenerFile
=
fs
.
file
(
'
${temporaryDirectory.path}
/listener.dart'
);
listenerFile
.
createSync
();
listenerFile
.
createSync
();
listenerFile
.
writeAsStringSync
(
_generateTestMain
(
listenerFile
.
writeAsStringSync
(
_generateTestMain
(
testUrl:
path
.
toUri
(
path
.
absolute
(
testPath
)).
toString
(),
testUrl:
fs
.
path
.
toUri
(
fs
.
path
.
absolute
(
testPath
)).
toString
(),
encodedWebsocketUrl:
Uri
.
encodeComponent
(
"ws://
${_kHost.address}
:
${server.port}
"
),
encodedWebsocketUrl:
Uri
.
encodeComponent
(
"ws://
${_kHost.address}
:
${server.port}
"
),
));
));
...
...
packages/flutter_tools/lib/src/toolchain.dart
View file @
5e54fd54
...
@@ -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
'package:path/path.dart'
as
path
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
import
'build_info.dart'
;
import
'build_info.dart'
;
...
@@ -56,27 +54,27 @@ class ToolConfiguration {
...
@@ -56,27 +54,27 @@ class ToolConfiguration {
// Create something like `android-arm` or `android-arm-release`.
// Create something like `android-arm` or `android-arm-release`.
String
dirName
=
getNameForTargetPlatform
(
platform
)
+
suffix
;
String
dirName
=
getNameForTargetPlatform
(
platform
)
+
suffix
;
Directory
engineDir
=
cache
.
getArtifactDirectory
(
'engine'
);
Directory
engineDir
=
cache
.
getArtifactDirectory
(
'engine'
);
return
fs
.
directory
(
path
.
join
(
engineDir
.
path
,
dirName
));
return
fs
.
directory
(
fs
.
path
.
join
(
engineDir
.
path
,
dirName
));
}
}
}
}
String
getHostToolPath
(
HostTool
tool
)
{
String
getHostToolPath
(
HostTool
tool
)
{
if
(
engineBuildPath
==
null
)
{
if
(
engineBuildPath
==
null
)
{
return
path
.
join
(
cache
.
getArtifactDirectory
(
'engine'
).
path
,
return
fs
.
path
.
join
(
cache
.
getArtifactDirectory
(
'engine'
).
path
,
getNameForHostPlatform
(
getCurrentHostPlatform
()),
getNameForHostPlatform
(
getCurrentHostPlatform
()),
_kHostToolFileName
[
tool
]);
_kHostToolFileName
[
tool
]);
}
}
if
(
tool
==
HostTool
.
SkySnapshot
)
{
if
(
tool
==
HostTool
.
SkySnapshot
)
{
String
clangPath
=
path
.
join
(
engineBuildPath
,
'clang_x64'
,
'sky_snapshot'
);
String
clangPath
=
fs
.
path
.
join
(
engineBuildPath
,
'clang_x64'
,
'sky_snapshot'
);
if
(
fs
.
isFileSync
(
clangPath
))
if
(
fs
.
isFileSync
(
clangPath
))
return
clangPath
;
return
clangPath
;
return
path
.
join
(
engineBuildPath
,
'sky_snapshot'
);
return
fs
.
path
.
join
(
engineBuildPath
,
'sky_snapshot'
);
}
else
if
(
tool
==
HostTool
.
SkyShell
)
{
}
else
if
(
tool
==
HostTool
.
SkyShell
)
{
if
(
getCurrentHostPlatform
()
==
HostPlatform
.
linux_x64
)
{
if
(
getCurrentHostPlatform
()
==
HostPlatform
.
linux_x64
)
{
return
path
.
join
(
engineBuildPath
,
'sky_shell'
);
return
fs
.
path
.
join
(
engineBuildPath
,
'sky_shell'
);
}
else
if
(
getCurrentHostPlatform
()
==
HostPlatform
.
darwin_x64
)
{
}
else
if
(
getCurrentHostPlatform
()
==
HostPlatform
.
darwin_x64
)
{
return
path
.
join
(
engineBuildPath
,
'SkyShell.app'
,
'Contents'
,
'MacOS'
,
'SkyShell'
);
return
fs
.
path
.
join
(
engineBuildPath
,
'SkyShell.app'
,
'Contents'
,
'MacOS'
,
'SkyShell'
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
5e54fd54
...
@@ -7,10 +7,10 @@ import 'dart:convert' show BASE64;
...
@@ -7,10 +7,10 @@ import 'dart:convert' show BASE64;
import
'package:json_rpc_2/error_code.dart'
as
rpc_error_code
;
import
'package:json_rpc_2/error_code.dart'
as
rpc_error_code
;
import
'package:json_rpc_2/json_rpc_2.dart'
as
rpc
;
import
'package:json_rpc_2/json_rpc_2.dart'
as
rpc
;
import
'package:path/path.dart'
as
path
;
import
'package:stream_channel/stream_channel.dart'
;
import
'package:stream_channel/stream_channel.dart'
;
import
'package:web_socket_channel/io.dart'
;
import
'package:web_socket_channel/io.dart'
;
import
'base/file_system.dart'
;
import
'base/io.dart'
;
import
'base/io.dart'
;
import
'globals.dart'
;
import
'globals.dart'
;
...
@@ -35,7 +35,7 @@ class VMService {
...
@@ -35,7 +35,7 @@ class VMService {
/// Requests made via the returns [VMService] time out after [requestTimeout]
/// Requests made via the returns [VMService] time out after [requestTimeout]
/// amount of time, which is [kDefaultRequestTimeout] by default.
/// amount of time, which is [kDefaultRequestTimeout] by default.
static
Future
<
VMService
>
connect
(
Uri
httpUri
,
{
Duration
requestTimeout:
kDefaultRequestTimeout
})
async
{
static
Future
<
VMService
>
connect
(
Uri
httpUri
,
{
Duration
requestTimeout:
kDefaultRequestTimeout
})
async
{
Uri
wsUri
=
httpUri
.
replace
(
scheme:
'ws'
,
path:
path
.
join
(
httpUri
.
path
,
'ws'
));
Uri
wsUri
=
httpUri
.
replace
(
scheme:
'ws'
,
path:
fs
.
path
.
join
(
httpUri
.
path
,
'ws'
));
WebSocket
ws
;
WebSocket
ws
;
try
{
try
{
ws
=
await
WebSocket
.
connect
(
wsUri
.
toString
());
ws
=
await
WebSocket
.
connect
(
wsUri
.
toString
());
...
...
packages/flutter_tools/lib/src/zip.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:archive/archive.dart'
;
import
'package:archive/archive.dart'
;
import
'package:path/path.dart'
as
path
;
import
'devfs.dart'
;
import
'devfs.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
...
@@ -74,7 +73,7 @@ class _ZipToolBuilder extends ZipBuilder {
...
@@ -74,7 +73,7 @@ class _ZipToolBuilder extends ZipBuilder {
int
count
=
entries
.
length
;
int
count
=
entries
.
length
;
entries
.
forEach
((
String
archivePath
,
DevFSContent
content
)
{
entries
.
forEach
((
String
archivePath
,
DevFSContent
content
)
{
content
.
contentsAsBytes
().
then
<
Null
>((
List
<
int
>
data
)
{
content
.
contentsAsBytes
().
then
<
Null
>((
List
<
int
>
data
)
{
File
file
=
fs
.
file
(
path
.
join
(
zipBuildDir
.
path
,
archivePath
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
zipBuildDir
.
path
,
archivePath
));
file
.
parent
.
createSync
(
recursive:
true
);
file
.
parent
.
createSync
(
recursive:
true
);
file
.
writeAsBytes
(
data
).
then
<
Null
>((
File
value
)
{
file
.
writeAsBytes
(
data
).
then
<
Null
>((
File
value
)
{
count
-=
1
;
count
-=
1
;
...
...
packages/flutter_tools/pubspec.yaml
View file @
5e54fd54
...
@@ -21,7 +21,6 @@ dependencies:
...
@@ -21,7 +21,6 @@ dependencies:
meta
:
^1.0.4
meta
:
^1.0.4
mustache
:
^0.2.5
mustache
:
^0.2.5
package_config
:
'
>=0.1.5
<2.0.0'
package_config
:
'
>=0.1.5
<2.0.0'
path
:
^1.4.0
platform
:
1.0.1
platform
:
1.0.1
process
:
2.0.1
process
:
2.0.1
pub_semver
:
^1.0.0
pub_semver
:
^1.0.0
...
...
packages/flutter_tools/test/all.dart
View file @
5e54fd54
...
@@ -31,6 +31,7 @@ import 'devices_test.dart' as devices_test;
...
@@ -31,6 +31,7 @@ import 'devices_test.dart' as devices_test;
import
'doctor_test.dart'
as
doctor_test
;
import
'doctor_test.dart'
as
doctor_test
;
import
'drive_test.dart'
as
drive_test
;
import
'drive_test.dart'
as
drive_test
;
import
'forbid_dart_io_test.dart'
as
forbid_dart_io_test
;
import
'forbid_dart_io_test.dart'
as
forbid_dart_io_test
;
import
'forbid_package_path_test.dart'
as
forbid_package_path_test
;
import
'format_test.dart'
as
format_test
;
import
'format_test.dart'
as
format_test
;
import
'hot_test.dart'
as
hot_test
;
import
'hot_test.dart'
as
hot_test
;
import
'install_test.dart'
as
install_test
;
import
'install_test.dart'
as
install_test
;
...
@@ -70,6 +71,7 @@ void main() {
...
@@ -70,6 +71,7 @@ void main() {
doctor_test
.
main
();
doctor_test
.
main
();
drive_test
.
main
();
drive_test
.
main
();
forbid_dart_io_test
.
main
();
forbid_dart_io_test
.
main
();
forbid_package_path_test
.
main
();
format_test
.
main
();
format_test
.
main
();
hot_test
.
main
();
hot_test
.
main
();
install_test
.
main
();
install_test
.
main
();
...
...
packages/flutter_tools/test/analyze_continuously_test.dart
View file @
5e54fd54
...
@@ -10,7 +10,6 @@ import 'package:flutter_tools/src/commands/analyze_continuously.dart';
...
@@ -10,7 +10,6 @@ import 'package:flutter_tools/src/commands/analyze_continuously.dart';
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
...
@@ -71,12 +70,12 @@ void main() {
...
@@ -71,12 +70,12 @@ void main() {
}
}
void
_createSampleProject
(
Directory
directory
,
{
bool
brokenCode:
false
})
{
void
_createSampleProject
(
Directory
directory
,
{
bool
brokenCode:
false
})
{
File
pubspecFile
=
fs
.
file
(
path
.
join
(
directory
.
path
,
'pubspec.yaml'
));
File
pubspecFile
=
fs
.
file
(
fs
.
path
.
join
(
directory
.
path
,
'pubspec.yaml'
));
pubspecFile
.
writeAsStringSync
(
'''
pubspecFile
.
writeAsStringSync
(
'''
name: foo_project
name: foo_project
'''
);
'''
);
File
dartFile
=
fs
.
file
(
path
.
join
(
directory
.
path
,
'lib'
,
'main.dart'
));
File
dartFile
=
fs
.
file
(
fs
.
path
.
join
(
directory
.
path
,
'lib'
,
'main.dart'
));
dartFile
.
parent
.
createSync
();
dartFile
.
parent
.
createSync
();
dartFile
.
writeAsStringSync
(
'''
dartFile
.
writeAsStringSync
(
'''
void main() {
void main() {
...
...
packages/flutter_tools/test/analyze_duplicate_names_test.dart
View file @
5e54fd54
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/commands/analyze.dart'
;
import
'package:flutter_tools/src/commands/analyze.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/common.dart'
;
...
@@ -24,10 +23,10 @@ void main() {
...
@@ -24,10 +23,10 @@ void main() {
group
(
'analyze'
,
()
{
group
(
'analyze'
,
()
{
testUsingContext
(
'flutter analyze with two files with the same name'
,
()
async
{
testUsingContext
(
'flutter analyze with two files with the same name'
,
()
async
{
File
dartFileA
=
fs
.
file
(
path
.
join
(
tempDir
.
path
,
'a.dart'
));
File
dartFileA
=
fs
.
file
(
fs
.
path
.
join
(
tempDir
.
path
,
'a.dart'
));
dartFileA
.
parent
.
createSync
();
dartFileA
.
parent
.
createSync
();
dartFileA
.
writeAsStringSync
(
'library test;'
);
dartFileA
.
writeAsStringSync
(
'library test;'
);
File
dartFileB
=
fs
.
file
(
path
.
join
(
tempDir
.
path
,
'b.dart'
));
File
dartFileB
=
fs
.
file
(
fs
.
path
.
join
(
tempDir
.
path
,
'b.dart'
));
dartFileB
.
writeAsStringSync
(
'library test;'
);
dartFileB
.
writeAsStringSync
(
'library test;'
);
AnalyzeCommand
command
=
new
AnalyzeCommand
();
AnalyzeCommand
command
=
new
AnalyzeCommand
();
...
...
packages/flutter_tools/test/analyze_test.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
...
@@ -6,7 +6,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/analyze_base.dart'
;
import
'package:flutter_tools/src/commands/analyze_base.dart'
;
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
...
@@ -28,9 +27,9 @@ void main() {
...
@@ -28,9 +27,9 @@ void main() {
testUsingContext
(
'inRepo'
,
()
{
testUsingContext
(
'inRepo'
,
()
{
// Absolute paths
// Absolute paths
expect
(
inRepo
(<
String
>[
tempDir
.
path
]),
isFalse
);
expect
(
inRepo
(<
String
>[
tempDir
.
path
]),
isFalse
);
expect
(
inRepo
(<
String
>[
path
.
join
(
tempDir
.
path
,
'foo'
)]),
isFalse
);
expect
(
inRepo
(<
String
>[
fs
.
path
.
join
(
tempDir
.
path
,
'foo'
)]),
isFalse
);
expect
(
inRepo
(<
String
>[
Cache
.
flutterRoot
]),
isTrue
);
expect
(
inRepo
(<
String
>[
Cache
.
flutterRoot
]),
isTrue
);
expect
(
inRepo
(<
String
>[
path
.
join
(
Cache
.
flutterRoot
,
'foo'
)]),
isTrue
);
expect
(
inRepo
(<
String
>[
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'foo'
)]),
isTrue
);
// Relative paths
// Relative paths
String
oldWorkingDirectory
=
fs
.
currentDirectory
.
path
;
String
oldWorkingDirectory
=
fs
.
currentDirectory
.
path
;
try
{
try
{
...
...
packages/flutter_tools/test/android_sdk_test.dart
View file @
5e54fd54
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
'package:flutter_tools/src/android/android_sdk.dart'
;
import
'package:flutter_tools/src/android/android_sdk.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
...
@@ -71,6 +70,6 @@ Directory _createSdkDirectory({ bool withAndroidN: false }) {
...
@@ -71,6 +70,6 @@ Directory _createSdkDirectory({ bool withAndroidN: false }) {
}
}
void
_createSdkFile
(
Directory
dir
,
String
filePath
)
{
void
_createSdkFile
(
Directory
dir
,
String
filePath
)
{
File
file
=
fs
.
file
(
path
.
join
(
dir
.
path
,
filePath
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
dir
.
path
,
filePath
));
file
.
createSync
(
recursive:
true
);
file
.
createSync
(
recursive:
true
);
}
}
packages/flutter_tools/test/asset_bundle_test.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'dart:convert';
...
@@ -6,7 +6,6 @@ import 'dart:convert';
import
'package:flutter_tools/src/asset.dart'
;
import
'package:flutter_tools/src/asset.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
void
main
(
)
{
...
@@ -16,7 +15,7 @@ void main() {
...
@@ -16,7 +15,7 @@ void main() {
String
projectRoot
=
tempDir
.
path
;
String
projectRoot
=
tempDir
.
path
;
String
assetPath
=
'banana.txt'
;
String
assetPath
=
'banana.txt'
;
String
assetContents
=
'banana'
;
String
assetContents
=
'banana'
;
File
tempFile
=
fs
.
file
(
path
.
join
(
projectRoot
,
assetPath
));
File
tempFile
=
fs
.
file
(
fs
.
path
.
join
(
projectRoot
,
assetPath
));
tempFile
.
parent
.
createSync
(
recursive:
true
);
tempFile
.
parent
.
createSync
(
recursive:
true
);
tempFile
.
writeAsBytesSync
(
UTF8
.
encode
(
assetContents
));
tempFile
.
writeAsBytesSync
(
UTF8
.
encode
(
assetContents
));
...
...
packages/flutter_tools/test/config_test.dart
View file @
5e54fd54
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
void
main
(
)
{
...
@@ -12,7 +11,7 @@ void main() {
...
@@ -12,7 +11,7 @@ void main() {
setUp
(()
{
setUp
(()
{
Directory
tempDiretory
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_test'
);
Directory
tempDiretory
=
fs
.
systemTempDirectory
.
createTempSync
(
'flutter_test'
);
File
file
=
fs
.
file
(
path
.
join
(
tempDiretory
.
path
,
'.settings'
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
tempDiretory
.
path
,
'.settings'
));
config
=
new
Config
(
file
);
config
=
new
Config
(
file
);
});
});
...
...
packages/flutter_tools/test/create_test.dart
View file @
5e54fd54
...
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/base/io.dart';
...
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/base/io.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/common.dart'
;
...
@@ -123,9 +122,9 @@ Future<Null> _createAndAnalyzeProject(Directory dir, List<String> createArgs) as
...
@@ -123,9 +122,9 @@ Future<Null> _createAndAnalyzeProject(Directory dir, List<String> createArgs) as
args
.
add
(
dir
.
path
);
args
.
add
(
dir
.
path
);
await
runner
.
run
(
args
);
await
runner
.
run
(
args
);
String
mainPath
=
path
.
join
(
dir
.
path
,
'lib'
,
'main.dart'
);
String
mainPath
=
fs
.
path
.
join
(
dir
.
path
,
'lib'
,
'main.dart'
);
expect
(
fs
.
file
(
mainPath
).
existsSync
(),
true
);
expect
(
fs
.
file
(
mainPath
).
existsSync
(),
true
);
String
flutterToolsPath
=
path
.
absolute
(
path
.
join
(
'bin'
,
'flutter_tools.dart'
));
String
flutterToolsPath
=
fs
.
path
.
absolute
(
fs
.
path
.
join
(
'bin'
,
'flutter_tools.dart'
));
ProcessResult
exec
=
Process
.
runSync
(
ProcessResult
exec
=
Process
.
runSync
(
'
$dartSdkPath
/bin/dart'
,
<
String
>[
flutterToolsPath
,
'analyze'
],
'
$dartSdkPath
/bin/dart'
,
<
String
>[
flutterToolsPath
,
'analyze'
],
workingDirectory:
dir
.
path
workingDirectory:
dir
.
path
...
...
packages/flutter_tools/test/dart_dependencies_test.dart
View file @
5e54fd54
...
@@ -5,19 +5,19 @@
...
@@ -5,19 +5,19 @@
import
'dart:io'
as
io
;
import
'dart:io'
as
io
;
import
'package:flutter_tools/src/dart/dependencies.dart'
;
import
'package:flutter_tools/src/dart/dependencies.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
void
main
(
)
{
void
main
(
)
{
group
(
'DartDependencySetBuilder'
,
()
{
group
(
'DartDependencySetBuilder'
,
()
{
final
String
basePath
=
path
.
dirname
(
platform
.
script
.
path
);
final
String
basePath
=
fs
.
path
.
dirname
(
platform
.
script
.
path
);
final
String
dataPath
=
path
.
join
(
basePath
,
'data'
,
'dart_dependencies_test'
);
final
String
dataPath
=
fs
.
path
.
join
(
basePath
,
'data'
,
'dart_dependencies_test'
);
testUsingContext
(
'good'
,
()
{
testUsingContext
(
'good'
,
()
{
final
String
testPath
=
path
.
join
(
dataPath
,
'good'
);
final
String
testPath
=
fs
.
path
.
join
(
dataPath
,
'good'
);
final
String
mainPath
=
path
.
join
(
testPath
,
'main.dart'
);
final
String
mainPath
=
fs
.
path
.
join
(
testPath
,
'main.dart'
);
final
String
packagesPath
=
path
.
join
(
testPath
,
'.packages'
);
final
String
packagesPath
=
fs
.
path
.
join
(
testPath
,
'.packages'
);
DartDependencySetBuilder
builder
=
DartDependencySetBuilder
builder
=
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
Set
<
String
>
dependencies
=
builder
.
build
();
Set
<
String
>
dependencies
=
builder
.
build
();
...
@@ -25,9 +25,9 @@ void main() {
...
@@ -25,9 +25,9 @@ void main() {
expect
(
dependencies
.
contains
(
'foo.dart'
),
isTrue
);
expect
(
dependencies
.
contains
(
'foo.dart'
),
isTrue
);
});
});
testUsingContext
(
'syntax_error'
,
()
{
testUsingContext
(
'syntax_error'
,
()
{
final
String
testPath
=
path
.
join
(
dataPath
,
'syntax_error'
);
final
String
testPath
=
fs
.
path
.
join
(
dataPath
,
'syntax_error'
);
final
String
mainPath
=
path
.
join
(
testPath
,
'main.dart'
);
final
String
mainPath
=
fs
.
path
.
join
(
testPath
,
'main.dart'
);
final
String
packagesPath
=
path
.
join
(
testPath
,
'.packages'
);
final
String
packagesPath
=
fs
.
path
.
join
(
testPath
,
'.packages'
);
DartDependencySetBuilder
builder
=
DartDependencySetBuilder
builder
=
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
try
{
try
{
...
...
packages/flutter_tools/test/dependency_checker_test.dart
View file @
5e54fd54
...
@@ -11,15 +11,14 @@ import 'package:flutter_tools/src/cache.dart';
...
@@ -11,15 +11,14 @@ import 'package:flutter_tools/src/cache.dart';
import
'package:flutter_tools/src/commands/devices.dart'
;
import
'package:flutter_tools/src/commands/devices.dart'
;
import
'package:flutter_tools/src/dart/dependencies.dart'
;
import
'package:flutter_tools/src/dart/dependencies.dart'
;
import
'package:flutter_tools/src/dependency_checker.dart'
;
import
'package:flutter_tools/src/dependency_checker.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/common.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
void
main
(
)
{
void
main
(
)
{
group
(
'DependencyChecker'
,
()
{
group
(
'DependencyChecker'
,
()
{
final
String
basePath
=
path
.
dirname
(
path
.
fromUri
(
platform
.
script
));
final
String
basePath
=
fs
.
path
.
dirname
(
fs
.
path
.
fromUri
(
platform
.
script
));
final
String
dataPath
=
path
.
join
(
basePath
,
'data'
,
'dart_dependencies_test'
);
final
String
dataPath
=
fs
.
path
.
join
(
basePath
,
'data'
,
'dart_dependencies_test'
);
MemoryFileSystem
testFileSystem
;
MemoryFileSystem
testFileSystem
;
setUp
(()
{
setUp
(()
{
...
@@ -28,11 +27,11 @@ void main() {
...
@@ -28,11 +27,11 @@ void main() {
});
});
testUsingContext
(
'good'
,
()
{
testUsingContext
(
'good'
,
()
{
final
String
testPath
=
path
.
join
(
dataPath
,
'good'
);
final
String
testPath
=
fs
.
path
.
join
(
dataPath
,
'good'
);
final
String
mainPath
=
path
.
join
(
testPath
,
'main.dart'
);
final
String
mainPath
=
fs
.
path
.
join
(
testPath
,
'main.dart'
);
final
String
fooPath
=
path
.
join
(
testPath
,
'foo.dart'
);
final
String
fooPath
=
fs
.
path
.
join
(
testPath
,
'foo.dart'
);
final
String
barPath
=
path
.
join
(
testPath
,
'lib'
,
'bar.dart'
);
final
String
barPath
=
fs
.
path
.
join
(
testPath
,
'lib'
,
'bar.dart'
);
final
String
packagesPath
=
path
.
join
(
testPath
,
'.packages'
);
final
String
packagesPath
=
fs
.
path
.
join
(
testPath
,
'.packages'
);
DartDependencySetBuilder
builder
=
DartDependencySetBuilder
builder
=
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
DependencyChecker
dependencyChecker
=
DependencyChecker
dependencyChecker
=
...
@@ -59,10 +58,10 @@ void main() {
...
@@ -59,10 +58,10 @@ void main() {
expect
(
dependencyChecker
.
check
(
baseTime
),
isTrue
);
expect
(
dependencyChecker
.
check
(
baseTime
),
isTrue
);
});
});
testUsingContext
(
'syntax error'
,
()
{
testUsingContext
(
'syntax error'
,
()
{
final
String
testPath
=
path
.
join
(
dataPath
,
'syntax_error'
);
final
String
testPath
=
fs
.
path
.
join
(
dataPath
,
'syntax_error'
);
final
String
mainPath
=
path
.
join
(
testPath
,
'main.dart'
);
final
String
mainPath
=
fs
.
path
.
join
(
testPath
,
'main.dart'
);
final
String
fooPath
=
path
.
join
(
testPath
,
'foo.dart'
);
final
String
fooPath
=
fs
.
path
.
join
(
testPath
,
'foo.dart'
);
final
String
packagesPath
=
path
.
join
(
testPath
,
'.packages'
);
final
String
packagesPath
=
fs
.
path
.
join
(
testPath
,
'.packages'
);
DartDependencySetBuilder
builder
=
DartDependencySetBuilder
builder
=
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
new
DartDependencySetBuilder
(
mainPath
,
testPath
,
packagesPath
);
...
@@ -89,7 +88,7 @@ void main() {
...
@@ -89,7 +88,7 @@ void main() {
String
destinationPath
=
'/some/test/location'
;
String
destinationPath
=
'/some/test/location'
;
// Copy the golden input and let the test run in an isolated temporary in-memory file system.
// Copy the golden input and let the test run in an isolated temporary in-memory file system.
copyDirectorySync
(
copyDirectorySync
(
new
LocalFileSystem
().
directory
(
path
.
join
(
dataPath
,
'changed_sdk_location'
)),
new
LocalFileSystem
().
directory
(
fs
.
path
.
join
(
dataPath
,
'changed_sdk_location'
)),
fs
.
directory
(
destinationPath
));
fs
.
directory
(
destinationPath
));
fs
.
currentDirectory
=
destinationPath
;
fs
.
currentDirectory
=
destinationPath
;
...
...
packages/flutter_tools/test/devfs_test.dart
View file @
5e54fd54
...
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/build_info.dart';
...
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/build_info.dart';
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:flutter_tools/src/devfs.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/common.dart'
;
...
@@ -20,8 +19,8 @@ import 'src/context.dart';
...
@@ -20,8 +19,8 @@ import 'src/context.dart';
import
'src/mocks.dart'
;
import
'src/mocks.dart'
;
void
main
(
)
{
void
main
(
)
{
final
String
filePath
=
path
.
join
(
'bar'
,
'foo.txt'
);
final
String
filePath
=
fs
.
path
.
join
(
'bar'
,
'foo.txt'
);
final
String
filePath2
=
path
.
join
(
'foo'
,
'bar.txt'
);
final
String
filePath2
=
fs
.
path
.
join
(
'foo'
,
'bar.txt'
);
Directory
tempDir
;
Directory
tempDir
;
String
basePath
;
String
basePath
;
DevFS
devFS
;
DevFS
devFS
;
...
@@ -68,7 +67,7 @@ void main() {
...
@@ -68,7 +67,7 @@ void main() {
testUsingContext
(
'create dev file system'
,
()
async
{
testUsingContext
(
'create dev file system'
,
()
async
{
// simulate workspace
// simulate workspace
File
file
=
fs
.
file
(
path
.
join
(
basePath
,
filePath
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
basePath
,
filePath
));
await
file
.
parent
.
create
(
recursive:
true
);
await
file
.
parent
.
create
(
recursive:
true
);
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
...
@@ -83,25 +82,25 @@ void main() {
...
@@ -83,25 +82,25 @@ void main() {
int
bytes
=
await
devFS
.
update
();
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test .packages'
,
'writeFile test .packages'
,
'writeFile test
${path.join('bar', 'foo.txt')}
'
,
'writeFile test
${
fs.
path.join('bar', 'foo.txt')}
'
,
'writeFile test
${path.join('packages', 'somepkg', 'somefile.txt')}
'
,
'writeFile test
${
fs.
path.join('packages', 'somepkg', 'somefile.txt')}
'
,
]);
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
31
);
expect
(
bytes
,
31
);
});
});
testUsingContext
(
'add new file to local file system'
,
()
async
{
testUsingContext
(
'add new file to local file system'
,
()
async
{
File
file
=
fs
.
file
(
path
.
join
(
basePath
,
filePath2
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
basePath
,
filePath2
));
await
file
.
parent
.
create
(
recursive:
true
);
await
file
.
parent
.
create
(
recursive:
true
);
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
,
4
,
5
,
6
,
7
]);
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
,
4
,
5
,
6
,
7
]);
int
bytes
=
await
devFS
.
update
();
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test
${path.join('foo', 'bar.txt')}
'
,
'writeFile test
${
fs.
path.join('foo', 'bar.txt')}
'
,
]);
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
7
);
expect
(
bytes
,
7
);
});
});
testUsingContext
(
'modify existing file on local file system'
,
()
async
{
testUsingContext
(
'modify existing file on local file system'
,
()
async
{
File
file
=
fs
.
file
(
path
.
join
(
basePath
,
filePath
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
basePath
,
filePath
));
// Set the last modified time to 5 seconds in the past.
// Set the last modified time to 5 seconds in the past.
updateFileModificationTime
(
file
.
path
,
new
DateTime
.
now
(),
-
5
);
updateFileModificationTime
(
file
.
path
,
new
DateTime
.
now
(),
-
5
);
int
bytes
=
await
devFS
.
update
();
int
bytes
=
await
devFS
.
update
();
...
@@ -112,17 +111,17 @@ void main() {
...
@@ -112,17 +111,17 @@ void main() {
await
file
.
writeAsBytes
(<
int
>[
1
,
2
,
3
,
4
,
5
,
6
]);
await
file
.
writeAsBytes
(<
int
>[
1
,
2
,
3
,
4
,
5
,
6
]);
bytes
=
await
devFS
.
update
();
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test
${path.join('bar', 'foo.txt')}
'
,
'writeFile test
${
fs.
path.join('bar', 'foo.txt')}
'
,
]);
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
6
);
expect
(
bytes
,
6
);
},
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when updateFileModificationTime is ported to Windows
},
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when updateFileModificationTime is ported to Windows
testUsingContext
(
'delete a file from the local file system'
,
()
async
{
testUsingContext
(
'delete a file from the local file system'
,
()
async
{
File
file
=
fs
.
file
(
path
.
join
(
basePath
,
filePath
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
basePath
,
filePath
));
await
file
.
delete
();
await
file
.
delete
();
int
bytes
=
await
devFS
.
update
();
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
devFSOperations
.
expectMessages
(<
String
>[
'deleteFile test
${path.join('bar', 'foo.txt')}
'
,
'deleteFile test
${
fs.
path.join('bar', 'foo.txt')}
'
,
]);
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
0
);
expect
(
bytes
,
0
);
...
@@ -132,7 +131,7 @@ void main() {
...
@@ -132,7 +131,7 @@ void main() {
int
bytes
=
await
devFS
.
update
();
int
bytes
=
await
devFS
.
update
();
devFSOperations
.
expectMessages
(<
String
>[
devFSOperations
.
expectMessages
(<
String
>[
'writeFile test .packages'
,
'writeFile test .packages'
,
'writeFile test
${path.join('packages', 'newpkg', 'anotherfile.txt')}
'
,
'writeFile test
${
fs.
path.join('packages', 'newpkg', 'anotherfile.txt')}
'
,
]);
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
51
);
expect
(
bytes
,
51
);
...
@@ -217,7 +216,7 @@ void main() {
...
@@ -217,7 +216,7 @@ void main() {
testUsingContext
(
'create dev file system'
,
()
async
{
testUsingContext
(
'create dev file system'
,
()
async
{
// simulate workspace
// simulate workspace
File
file
=
fs
.
file
(
path
.
join
(
basePath
,
filePath
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
basePath
,
filePath
));
await
file
.
parent
.
create
(
recursive:
true
);
await
file
.
parent
.
create
(
recursive:
true
);
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
file
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
]);
...
@@ -232,8 +231,8 @@ void main() {
...
@@ -232,8 +231,8 @@ void main() {
int
bytes
=
await
devFS
.
update
();
int
bytes
=
await
devFS
.
update
();
vmService
.
expectMessages
(<
String
>[
vmService
.
expectMessages
(<
String
>[
'writeFile test .packages'
,
'writeFile test .packages'
,
'writeFile test
${path.join('bar', 'foo.txt')}
'
,
'writeFile test
${
fs.
path.join('bar', 'foo.txt')}
'
,
'writeFile test
${path.join('packages', 'somepkg', 'somefile.txt')}
'
,
'writeFile test
${
fs.
path.join('packages', 'somepkg', 'somefile.txt')}
'
,
]);
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
31
);
expect
(
bytes
,
31
);
...
@@ -329,16 +328,16 @@ void _cleanupTempDirs() {
...
@@ -329,16 +328,16 @@ void _cleanupTempDirs() {
Future
<
Null
>
_createPackage
(
String
pkgName
,
String
pkgFileName
)
async
{
Future
<
Null
>
_createPackage
(
String
pkgName
,
String
pkgFileName
)
async
{
final
Directory
pkgTempDir
=
_newTempDir
();
final
Directory
pkgTempDir
=
_newTempDir
();
File
pkgFile
=
fs
.
file
(
path
.
join
(
pkgTempDir
.
path
,
pkgName
,
'lib'
,
pkgFileName
));
File
pkgFile
=
fs
.
file
(
fs
.
path
.
join
(
pkgTempDir
.
path
,
pkgName
,
'lib'
,
pkgFileName
));
await
pkgFile
.
parent
.
create
(
recursive:
true
);
await
pkgFile
.
parent
.
create
(
recursive:
true
);
pkgFile
.
writeAsBytesSync
(<
int
>[
11
,
12
,
13
]);
pkgFile
.
writeAsBytesSync
(<
int
>[
11
,
12
,
13
]);
_packages
[
pkgName
]
=
pkgTempDir
;
_packages
[
pkgName
]
=
pkgTempDir
;
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
_packages
.
forEach
((
String
pkgName
,
Directory
pkgTempDir
)
{
_packages
.
forEach
((
String
pkgName
,
Directory
pkgTempDir
)
{
Uri
pkgPath
=
path
.
toUri
(
path
.
join
(
pkgTempDir
.
path
,
pkgName
,
'lib'
));
Uri
pkgPath
=
fs
.
path
.
toUri
(
fs
.
path
.
join
(
pkgTempDir
.
path
,
pkgName
,
'lib'
));
sb
.
writeln
(
'
$pkgName
:
$pkgPath
'
);
sb
.
writeln
(
'
$pkgName
:
$pkgPath
'
);
});
});
fs
.
file
(
path
.
join
(
_tempDirs
[
0
].
path
,
'.packages'
)).
writeAsStringSync
(
sb
.
toString
());
fs
.
file
(
fs
.
path
.
join
(
_tempDirs
[
0
].
path
,
'.packages'
)).
writeAsStringSync
(
sb
.
toString
());
}
}
String
_inAssetBuildDirectory
(
String
filename
)
=>
path
.
join
(
getAssetBuildDirectory
(),
filename
);
String
_inAssetBuildDirectory
(
String
filename
)
=>
fs
.
path
.
join
(
getAssetBuildDirectory
(),
filename
);
\ No newline at end of file
\ No newline at end of file
packages/flutter_tools/test/doctor_test.dart
View file @
5e54fd54
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
// 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
'package:
path/path.dart'
as
path
;
import
'package:
flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:flutter_tools/src/doctor.dart'
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
...
@@ -31,7 +31,7 @@ class IntelliJValidatorTestTarget extends IntelliJValidator {
...
@@ -31,7 +31,7 @@ class IntelliJValidatorTestTarget extends IntelliJValidator {
IntelliJValidatorTestTarget
(
String
title
)
:
super
(
title
);
IntelliJValidatorTestTarget
(
String
title
)
:
super
(
title
);
@override
@override
String
get
pluginsPath
=>
path
.
join
(
'test'
,
'data'
,
'intellij'
,
'plugins'
);
String
get
pluginsPath
=>
fs
.
path
.
join
(
'test'
,
'data'
,
'intellij'
,
'plugins'
);
@override
@override
String
get
version
=>
'test.test.test'
;
String
get
version
=>
'test.test.test'
;
...
...
packages/flutter_tools/test/forbid_dart_io_test.dart
View file @
5e54fd54
...
@@ -4,14 +4,13 @@
...
@@ -4,14 +4,13 @@
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
void
main
(
)
{
setUp
(()
{
setUp
(()
{
String
flutterTools
=
path
.
join
(
platform
.
environment
[
'FLUTTER_ROOT'
],
String
flutterTools
=
fs
.
path
.
join
(
platform
.
environment
[
'FLUTTER_ROOT'
],
'packages'
,
'flutter_tools'
);
'packages'
,
'flutter_tools'
);
assert
(
path
.
equals
(
fs
.
currentDirectory
.
path
,
flutterTools
));
assert
(
fs
.
path
.
equals
(
fs
.
currentDirectory
.
path
,
flutterTools
));
});
});
test
(
'no unauthorized imports of dart:io'
,
()
{
test
(
'no unauthorized imports of dart:io'
,
()
{
...
@@ -38,6 +37,6 @@ bool _isDartFile(FileSystemEntity entity) =>
...
@@ -38,6 +37,6 @@ bool _isDartFile(FileSystemEntity entity) =>
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
bool
_isNotWhitelisted
(
FileSystemEntity
entity
)
=>
bool
_isNotWhitelisted
(
FileSystemEntity
entity
)
=>
entity
.
path
!=
path
.
join
(
'lib'
,
'src'
,
'base'
,
'io.dart'
);
entity
.
path
!=
fs
.
path
.
join
(
'lib'
,
'src'
,
'base'
,
'io.dart'
);
File
_asFile
(
FileSystemEntity
entity
)
=>
entity
;
File
_asFile
(
FileSystemEntity
entity
)
=>
entity
;
packages/flutter_tools/test/forbid_package_path_test.dart
0 → 100644
View file @
5e54fd54
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
setUp
(()
{
String
flutterTools
=
fs
.
path
.
join
(
platform
.
environment
[
'FLUTTER_ROOT'
],
'packages'
,
'flutter_tools'
);
assert
(
fs
.
path
.
equals
(
fs
.
currentDirectory
.
path
,
flutterTools
));
});
test
(
'no unauthorized imports of package:path'
,
()
{
for
(
String
path
in
<
String
>[
'lib'
,
'bin'
,
'test'
])
{
fs
.
directory
(
path
)
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
map
(
_asFile
)
.
forEach
((
File
file
)
{
for
(
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
new
RegExp
(
'import.*package:path/path.dart'
)))
{
fail
(
"
${file.path}
imports 'package:path/path.dart'; use 'fs.path' instead"
);
}
}
}
);
}
});
}
bool
_isDartFile
(
FileSystemEntity
entity
)
=>
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
File
_asFile
(
FileSystemEntity
entity
)
=>
entity
;
packages/flutter_tools/test/format_test.dart
View file @
5e54fd54
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/commands/format.dart'
;
import
'package:flutter_tools/src/commands/format.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/common.dart'
;
...
@@ -38,7 +37,7 @@ void main() {
...
@@ -38,7 +37,7 @@ void main() {
testUsingContext
(
'a file'
,
()
async
{
testUsingContext
(
'a file'
,
()
async
{
await
createProject
();
await
createProject
();
File
srcFile
=
fs
.
file
(
path
.
join
(
temp
.
path
,
'lib'
,
'main.dart'
));
File
srcFile
=
fs
.
file
(
fs
.
path
.
join
(
temp
.
path
,
'lib'
,
'main.dart'
));
String
original
=
srcFile
.
readAsStringSync
();
String
original
=
srcFile
.
readAsStringSync
();
srcFile
.
writeAsStringSync
(
original
.
replaceFirst
(
'main()'
,
'main( )'
));
srcFile
.
writeAsStringSync
(
original
.
replaceFirst
(
'main()'
,
'main( )'
));
...
...
packages/flutter_tools/test/os_utils_test.dart
View file @
5e54fd54
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/os.dart'
;
import
'package:flutter_tools/src/base/os.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
...
@@ -23,7 +22,7 @@ void main() {
...
@@ -23,7 +22,7 @@ void main() {
});
});
testUsingContext
(
'makeExecutable'
,
()
async
{
testUsingContext
(
'makeExecutable'
,
()
async
{
File
file
=
fs
.
file
(
path
.
join
(
temp
.
path
,
'foo.script'
));
File
file
=
fs
.
file
(
fs
.
path
.
join
(
temp
.
path
,
'foo.script'
));
file
.
writeAsStringSync
(
'hello world'
);
file
.
writeAsStringSync
(
'hello world'
);
os
.
makeExecutable
(
file
);
os
.
makeExecutable
(
file
);
...
...
packages/flutter_tools/test/src/context.dart
View file @
5e54fd54
...
@@ -21,7 +21,6 @@ import 'package:flutter_tools/src/toolchain.dart';
...
@@ -21,7 +21,6 @@ import 'package:flutter_tools/src/toolchain.dart';
import
'package:flutter_tools/src/usage.dart'
;
import
'package:flutter_tools/src/usage.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:process/process.dart'
;
import
'package:process/process.dart'
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
...
@@ -70,9 +69,9 @@ void testUsingContext(String description, dynamic testMethod(), {
...
@@ -70,9 +69,9 @@ void testUsingContext(String description, dynamic testMethod(), {
testContext
.
putIfAbsent
(
SimControl
,
()
=>
new
MockSimControl
());
testContext
.
putIfAbsent
(
SimControl
,
()
=>
new
MockSimControl
());
testContext
.
putIfAbsent
(
Usage
,
()
=>
new
MockUsage
());
testContext
.
putIfAbsent
(
Usage
,
()
=>
new
MockUsage
());
final
String
basePath
=
path
.
dirname
(
path
.
fromUri
(
platform
.
script
));
final
String
basePath
=
fs
.
path
.
dirname
(
fs
.
path
.
fromUri
(
platform
.
script
));
final
String
flutterRoot
=
final
String
flutterRoot
=
path
.
normalize
(
path
.
join
(
basePath
,
'..'
,
'..'
,
'..'
));
fs
.
path
.
normalize
(
fs
.
path
.
join
(
basePath
,
'..'
,
'..'
,
'..'
));
try
{
try
{
return
await
testContext
.
runInZone
(()
{
return
await
testContext
.
runInZone
(()
{
// Apply the overrides to the test context in the zone since their
// Apply the overrides to the test context in the zone since their
...
...
packages/flutter_tools/test/test_test.dart
View file @
5e54fd54
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
...
@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
...
@@ -18,8 +17,8 @@ import 'src/context.dart';
...
@@ -18,8 +17,8 @@ import 'src/context.dart';
void
main
(
)
{
void
main
(
)
{
group
(
'test'
,
()
{
group
(
'test'
,
()
{
final
String
automatedTestsDirectory
=
path
.
join
(
'..'
,
'..'
,
'dev'
,
'automated_tests'
);
final
String
automatedTestsDirectory
=
fs
.
path
.
join
(
'..'
,
'..'
,
'dev'
,
'automated_tests'
);
final
String
flutterTestDirectory
=
path
.
join
(
automatedTestsDirectory
,
'flutter_test'
);
final
String
flutterTestDirectory
=
fs
.
path
.
join
(
automatedTestsDirectory
,
'flutter_test'
);
testUsingContext
(
'TestAsyncUtils guarded function test'
,
()
async
{
testUsingContext
(
'TestAsyncUtils guarded function test'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
Cache
.
flutterRoot
=
'../..'
;
...
@@ -30,7 +29,7 @@ void main() {
...
@@ -30,7 +29,7 @@ void main() {
return
_testFile
(
'test_async_utils_unguarded'
,
1
,
automatedTestsDirectory
,
flutterTestDirectory
);
return
_testFile
(
'test_async_utils_unguarded'
,
1
,
automatedTestsDirectory
,
flutterTestDirectory
);
});
});
testUsingContext
(
'Missing flutter_test dependency'
,
()
async
{
testUsingContext
(
'Missing flutter_test dependency'
,
()
async
{
final
String
missingDependencyTests
=
path
.
join
(
'..'
,
'..'
,
'dev'
,
'missing_dependency_tests'
);
final
String
missingDependencyTests
=
fs
.
path
.
join
(
'..'
,
'..'
,
'dev'
,
'missing_dependency_tests'
);
Cache
.
flutterRoot
=
'../..'
;
Cache
.
flutterRoot
=
'../..'
;
return
_testFile
(
'trivial'
,
1
,
missingDependencyTests
,
missingDependencyTests
);
return
_testFile
(
'trivial'
,
1
,
missingDependencyTests
,
missingDependencyTests
);
});
});
...
@@ -38,16 +37,16 @@ void main() {
...
@@ -38,16 +37,16 @@ void main() {
}
}
Future
<
Null
>
_testFile
(
String
testName
,
int
wantedExitCode
,
String
workingDirectory
,
String
testDirectory
)
async
{
Future
<
Null
>
_testFile
(
String
testName
,
int
wantedExitCode
,
String
workingDirectory
,
String
testDirectory
)
async
{
final
String
fullTestName
=
path
.
join
(
testDirectory
,
'
${testName}
_test.dart'
);
final
String
fullTestName
=
fs
.
path
.
join
(
testDirectory
,
'
${testName}
_test.dart'
);
final
File
testFile
=
fs
.
file
(
fullTestName
);
final
File
testFile
=
fs
.
file
(
fullTestName
);
expect
(
testFile
.
existsSync
(),
true
);
expect
(
testFile
.
existsSync
(),
true
);
final
String
fullTestExpectation
=
path
.
join
(
testDirectory
,
'
${testName}
_expectation.txt'
);
final
String
fullTestExpectation
=
fs
.
path
.
join
(
testDirectory
,
'
${testName}
_expectation.txt'
);
final
File
expectationFile
=
fs
.
file
(
fullTestExpectation
);
final
File
expectationFile
=
fs
.
file
(
fullTestExpectation
);
expect
(
expectationFile
.
existsSync
(),
true
);
expect
(
expectationFile
.
existsSync
(),
true
);
final
ProcessResult
exec
=
await
Process
.
run
(
final
ProcessResult
exec
=
await
Process
.
run
(
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
),
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'dart'
),
<
String
>[
<
String
>[
path
.
absolute
(
path
.
join
(
'bin'
,
'flutter_tools.dart'
)),
fs
.
path
.
absolute
(
fs
.
path
.
join
(
'bin'
,
'flutter_tools.dart'
)),
'test'
,
'test'
,
'--no-color'
,
'--no-color'
,
fullTestName
fullTestName
...
...
packages/flutter_tools/test/toolchain_test.dart
View file @
5e54fd54
...
@@ -6,7 +6,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
...
@@ -6,7 +6,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/toolchain.dart'
;
import
'package:flutter_tools/src/toolchain.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/context.dart'
;
import
'src/context.dart'
;
...
@@ -21,11 +20,11 @@ void main() {
...
@@ -21,11 +20,11 @@ void main() {
expect
(
expect
(
toolConfig
.
getEngineArtifactsDirectory
(
TargetPlatform
.
android_arm
,
BuildMode
.
debug
).
path
,
toolConfig
.
getEngineArtifactsDirectory
(
TargetPlatform
.
android_arm
,
BuildMode
.
debug
).
path
,
endsWith
(
path
.
join
(
'cache'
,
'artifacts'
,
'engine'
,
'android-arm'
))
endsWith
(
fs
.
path
.
join
(
'cache'
,
'artifacts'
,
'engine'
,
'android-arm'
))
);
);
expect
(
expect
(
toolConfig
.
getEngineArtifactsDirectory
(
TargetPlatform
.
android_arm
,
BuildMode
.
release
).
path
,
toolConfig
.
getEngineArtifactsDirectory
(
TargetPlatform
.
android_arm
,
BuildMode
.
release
).
path
,
endsWith
(
path
.
join
(
'cache'
,
'artifacts'
,
'engine'
,
'android-arm-release'
))
endsWith
(
fs
.
path
.
join
(
'cache'
,
'artifacts'
,
'engine'
,
'android-arm-release'
))
);
);
expect
(
tempDir
,
isNotNull
);
expect
(
tempDir
,
isNotNull
);
tempDir
.
deleteSync
(
recursive:
true
);
tempDir
.
deleteSync
(
recursive:
true
);
...
...
packages/flutter_tools/test/upgrade_test.dart
View file @
5e54fd54
...
@@ -10,7 +10,6 @@ import 'package:flutter_tools/src/base/os.dart';
...
@@ -10,7 +10,6 @@ import 'package:flutter_tools/src/base/os.dart';
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/commands/upgrade.dart'
;
import
'package:flutter_tools/src/commands/upgrade.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/common.dart'
;
...
@@ -58,11 +57,11 @@ void main() {
...
@@ -58,11 +57,11 @@ void main() {
String
proj
=
temp
.
path
;
String
proj
=
temp
.
path
;
expect
(
findProjectRoot
(
proj
),
proj
);
expect
(
findProjectRoot
(
proj
),
proj
);
expect
(
findProjectRoot
(
path
.
join
(
proj
,
'lib'
)),
proj
);
expect
(
findProjectRoot
(
fs
.
path
.
join
(
proj
,
'lib'
)),
proj
);
String
hello
=
path
.
join
(
Cache
.
flutterRoot
,
'examples'
,
'hello_world'
);
String
hello
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'examples'
,
'hello_world'
);
expect
(
findProjectRoot
(
hello
),
hello
);
expect
(
findProjectRoot
(
hello
),
hello
);
expect
(
findProjectRoot
(
path
.
join
(
hello
,
'lib'
)),
hello
);
expect
(
findProjectRoot
(
fs
.
path
.
join
(
hello
,
'lib'
)),
hello
);
});
});
testUsingContext
(
'outside project'
,
()
async
{
testUsingContext
(
'outside project'
,
()
async
{
...
...
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