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
ac7954c1
Commit
ac7954c1
authored
Feb 21, 2017
by
Michael Goderbauer
Committed by
GitHub
Feb 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate from touch cmd to dart's built-in API (#8313)
This enables us to run more tests on Windows.
parent
e9a775bf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
21 deletions
+12
-21
file_system.dart
packages/flutter_tools/lib/src/base/file_system.dart
+1
-1
dependency_checker_test.dart
packages/flutter_tools/test/dependency_checker_test.dart
+8
-7
devfs_test.dart
packages/flutter_tools/test/devfs_test.dart
+1
-2
common.dart
packages/flutter_tools/test/src/common.dart
+2
-11
No files found.
packages/flutter_tools/lib/src/base/file_system.dart
View file @
ac7954c1
...
...
@@ -77,7 +77,7 @@ void copyDirectorySync(Directory srcDir, Directory destDir) {
destDir
.
createSync
(
recursive:
true
);
srcDir
.
listSync
().
forEach
((
FileSystemEntity
entity
)
{
String
newPath
=
fs
.
path
.
join
(
destDir
.
path
,
fs
.
path
.
basename
(
entity
.
path
)
);
String
newPath
=
destDir
.
fileSystem
.
path
.
join
(
destDir
.
path
,
entity
.
basename
);
if
(
entity
is
File
)
{
File
newFile
=
destDir
.
fileSystem
.
file
(
newPath
);
newFile
.
writeAsBytesSync
(
entity
.
readAsBytesSync
());
...
...
packages/flutter_tools/test/dependency_checker_test.dart
View file @
ac7954c1
...
...
@@ -19,7 +19,7 @@ void main() {
group
(
'DependencyChecker'
,
()
{
final
String
basePath
=
fs
.
path
.
dirname
(
fs
.
path
.
fromUri
(
platform
.
script
));
final
String
dataPath
=
fs
.
path
.
join
(
basePath
,
'data'
,
'dart_dependencies_test'
);
Memory
FileSystem
testFileSystem
;
FileSystem
testFileSystem
;
setUp
(()
{
Cache
.
disableLocking
();
...
...
@@ -56,7 +56,8 @@ void main() {
// Set 'package:self/bar.dart' file modification time to be in the future.
updateFileModificationTime
(
barPath
,
baseTime
,
10
);
expect
(
dependencyChecker
.
check
(
baseTime
),
isTrue
);
});
},
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when sky_snapshot is ready on Windows
testUsingContext
(
'syntax error'
,
()
{
final
String
testPath
=
fs
.
path
.
join
(
dataPath
,
'syntax_error'
);
final
String
mainPath
=
fs
.
path
.
join
(
testPath
,
'main.dart'
);
...
...
@@ -85,11 +86,11 @@ void main() {
/// Tests that the flutter tool doesn't crash and displays a warning when its own location
/// changed since it was last referenced to in a package's .packages file.
testUsingContext
(
'moved flutter sdk'
,
()
async
{
String
destinationPath
=
'/some/test/location'
;
Directory
destinationPath
=
fs
.
systemTempDirectory
.
createTempSync
(
'dependency_checker_test_'
)
;
// Copy the golden input and let the test run in an isolated temporary in-memory file system.
copyDirectorySync
(
const
LocalFileSystem
().
directory
(
fs
.
path
.
join
(
dataPath
,
'changed_sdk_location'
)),
fs
.
directory
(
destinationPath
)
);
LocalFileSystem
localFileSystem
=
const
LocalFileSystem
();
Directory
sourcePath
=
localFileSystem
.
directory
(
localFileSystem
.
path
.
join
(
dataPath
,
'changed_sdk_location'
));
copyDirectorySync
(
sourcePath
,
destinationPath
);
fs
.
currentDirectory
=
destinationPath
;
// Doesn't matter what commands we run. Arbitrarily list devices here.
...
...
@@ -98,5 +99,5 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
testFileSystem
,
});
}
,
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): Migrate test away from 'touch' bash command.
}
);
}
packages/flutter_tools/test/devfs_test.dart
View file @
ac7954c1
...
...
@@ -4,7 +4,6 @@
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:io'
as
io
;
import
'package:flutter_tools/src/asset.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
...
...
@@ -115,7 +114,7 @@ void main() {
]);
expect
(
devFS
.
assetPathsToEvict
,
isEmpty
);
expect
(
bytes
,
6
);
}
,
skip:
io
.
Platform
.
isWindows
);
// TODO(goderbauer): enable when updateFileModificationTime is ported to Windows
}
);
testUsingContext
(
'delete a file from the local file system'
,
()
async
{
File
file
=
fs
.
file
(
fs
.
path
.
join
(
basePath
,
filePath
));
await
file
.
delete
();
...
...
packages/flutter_tools/test/src/common.dart
View file @
ac7954c1
...
...
@@ -3,11 +3,10 @@
// found in the LICENSE file.
import
'package:args/command_runner.dart'
;
import
'package:process/process.dart'
;
import
'package:test/test.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/
context
.dart'
;
import
'package:flutter_tools/src/base/
file_system
.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
...
...
@@ -23,15 +22,7 @@ void updateFileModificationTime(String path,
DateTime
baseTime
,
int
seconds
)
{
DateTime
modificationTime
=
baseTime
.
add
(
new
Duration
(
seconds:
seconds
));
String
argument
=
'
${modificationTime.year}
'
'
${modificationTime.month.toString().padLeft(2, "0")}
'
'
${modificationTime.day.toString().padLeft(2, "0")}
'
'
${modificationTime.hour.toString().padLeft(2, "0")}
'
'
${modificationTime.minute.toString().padLeft(2, "0")}
'
'.
${modificationTime.second.toString().padLeft(2, "0")}
'
;
ProcessManager
processManager
=
context
[
ProcessManager
];
processManager
.
runSync
(<
String
>[
'touch'
,
'-t'
,
argument
,
path
]);
fs
.
file
(
path
).
setLastModifiedSync
(
modificationTime
);
}
/// Matcher for functions that throw ToolExit.
...
...
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