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
cada8b3f
Commit
cada8b3f
authored
Nov 18, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import path.dart as path rather than p
Fixes #311
parent
b065036a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
33 deletions
+33
-33
init.dart
packages/flutter_tools/lib/src/commands/init.dart
+14
-14
loader.dart
packages/flutter_tools/lib/src/test/loader.dart
+13
-13
init_test.dart
packages/flutter_tools/test/init_test.dart
+4
-4
os_utils_test.dart
packages/flutter_tools/test/os_utils_test.dart
+2
-2
No files found.
packages/flutter_tools/lib/src/commands/init.dart
View file @
cada8b3f
...
...
@@ -8,7 +8,7 @@ import 'dart:io';
import
'package:args/command_runner.dart'
;
import
'package:logging/logging.dart'
;
import
'package:mustache4dart/mustache4dart.dart'
as
mustache
;
import
'package:path/path.dart'
as
p
;
import
'package:path/path.dart'
as
p
ath
;
import
'../artifacts.dart'
;
import
'../process.dart'
;
...
...
@@ -39,10 +39,10 @@ class InitCommand extends Command {
stderr
.
writeln
(
'variable was specified. Unable to find package:flutter.'
);
return
2
;
}
String
flutterRoot
=
p
.
absolute
(
ArtifactStore
.
flutterRoot
);
String
flutterRoot
=
p
ath
.
absolute
(
ArtifactStore
.
flutterRoot
);
String
flutterPackagePath
=
p
.
join
(
flutterRoot
,
'packages'
,
'flutter'
);
if
(!
FileSystemEntity
.
isFileSync
(
p
.
join
(
flutterPackagePath
,
'pubspec.yaml'
)))
{
String
flutterPackagePath
=
p
ath
.
join
(
flutterRoot
,
'packages'
,
'flutter'
);
if
(!
FileSystemEntity
.
isFileSync
(
p
ath
.
join
(
flutterPackagePath
,
'pubspec.yaml'
)))
{
print
(
'Unable to find package:flutter in
$flutterPackagePath
'
);
return
2
;
}
...
...
@@ -75,9 +75,9 @@ class InitCommand extends Command {
bool
skipIfAbsent:
false
,
bool
verbose:
true
})
async
{
File
pubSpecYaml
=
new
File
(
p
.
join
(
directory
,
'pubspec.yaml'
));
File
pubSpecLock
=
new
File
(
p
.
join
(
directory
,
'pubspec.lock'
));
File
dotPackages
=
new
File
(
p
.
join
(
directory
,
'.packages'
));
File
pubSpecYaml
=
new
File
(
p
ath
.
join
(
directory
,
'pubspec.yaml'
));
File
pubSpecLock
=
new
File
(
p
ath
.
join
(
directory
,
'pubspec.lock'
));
File
dotPackages
=
new
File
(
p
ath
.
join
(
directory
,
'.packages'
));
if
(!
pubSpecYaml
.
existsSync
())
{
if
(
skipIfAbsent
)
...
...
@@ -115,18 +115,18 @@ abstract class Template {
Template
(
this
.
name
,
this
.
description
);
void
generateInto
(
Directory
dir
,
String
flutterPackagePath
)
{
String
dirPath
=
p
.
normalize
(
dir
.
absolute
.
path
);
String
projectName
=
_normalizeProjectName
(
p
.
basename
(
dirPath
));
print
(
'Creating
${p.basename(projectName)}
...'
);
String
dirPath
=
p
ath
.
normalize
(
dir
.
absolute
.
path
);
String
projectName
=
_normalizeProjectName
(
p
ath
.
basename
(
dirPath
));
print
(
'Creating
${p
ath
.basename(projectName)}
...'
);
dir
.
createSync
(
recursive:
true
);
String
relativeFlutterPackagePath
=
p
.
relative
(
flutterPackagePath
,
from:
dirPath
);
String
relativeFlutterPackagePath
=
p
ath
.
relative
(
flutterPackagePath
,
from:
dirPath
);
files
.
forEach
((
String
p
ath
,
String
contents
)
{
files
.
forEach
((
String
fileP
ath
,
String
contents
)
{
Map
m
=
{
'projectName'
:
projectName
,
'description'
:
description
,
'flutterPackagePath'
:
relativeFlutterPackagePath
};
contents
=
mustache
.
render
(
contents
,
m
);
path
=
p
ath
.
replaceAll
(
'/'
,
Platform
.
pathSeparator
);
File
file
=
new
File
(
p
.
join
(
dir
.
path
,
p
ath
));
filePath
=
fileP
ath
.
replaceAll
(
'/'
,
Platform
.
pathSeparator
);
File
file
=
new
File
(
p
ath
.
join
(
dir
.
path
,
fileP
ath
));
file
.
parent
.
createSync
();
file
.
writeAsStringSync
(
contents
);
print
(
file
.
path
);
...
...
packages/flutter_tools/lib/src/test/loader.dart
View file @
cada8b3f
...
...
@@ -6,7 +6,7 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
p
;
import
'package:path/path.dart'
as
p
ath
;
import
'package:flutter_tools/src/test/json_socket.dart'
;
import
'package:flutter_tools/src/test/remote_test.dart'
;
import
'package:stack_trace/stack_trace.dart'
;
...
...
@@ -55,17 +55,17 @@ Future<_ServerInfo> _createServer() async {
return
new
_ServerInfo
(
server
,
'ws://
$_kHost
:
${server.port}$_kPath
'
,
socket
.
future
);
}
Future
<
Process
>
_startProcess
(
String
p
ath
,
{
String
packageRoot
})
{
Future
<
Process
>
_startProcess
(
String
mainP
ath
,
{
String
packageRoot
})
{
assert
(
shellPath
!=
null
||
_kSkyShell
!=
null
);
// Please provide the path to the shell in the SKY_SHELL environment variable.
return
Process
.
start
(
shellPath
??
_kSkyShell
,
[
'--enable-checked-mode'
,
'--non-interactive'
,
'--package-root=
$packageRoot
'
,
p
ath
,
mainP
ath
,
]);
}
Future
<
RunnerSuite
>
_loadVMFile
(
String
p
ath
,
Future
<
RunnerSuite
>
_loadVMFile
(
String
mainP
ath
,
Metadata
metadata
,
Configuration
config
)
async
{
String
encodedMetadata
=
Uri
.
encodeComponent
(
JSON
.
encode
(
...
...
@@ -81,7 +81,7 @@ import 'dart:convert';
import '
package:
test
/
src
/
backend
/
metadata
.
dart
';
import '
package:
flutter_tools
/
src
/
test
/
remote_listener
.
dart
';
import '
$
{
p
.
toUri
(
p
.
absolute
(
p
ath
))}
' as test;
import '
$
{
p
ath
.
toUri
(
path
.
absolute
(
mainP
ath
))}
' as test;
void main() {
String server = Uri.decodeComponent('
$
{
Uri
.
encodeComponent
(
info
.
url
)}
');
...
...
@@ -96,7 +96,7 @@ void main() {
Process
process
=
await
_startProcess
(
listenerFile
.
path
,
packageRoot:
p
.
absolute
(
config
.
packageRoot
)
packageRoot:
p
ath
.
absolute
(
config
.
packageRoot
)
);
Future
cleanupTempDirectory
()
async
{
...
...
@@ -118,13 +118,13 @@ void main() {
case
-
0x0f
:
// ProcessSignal.SIGTERM
break
;
// we probably killed it ourselves
case
-
0x0b
:
// ProcessSignal.SIGSEGV
output
+=
'Segmentation fault in subprocess for:
$
p
ath
\n
'
;
output
+=
'Segmentation fault in subprocess for:
$
mainP
ath
\n
'
;
break
;
case
-
0x06
:
// ProcessSignal.SIGABRT
output
+=
'Aborted while running:
$
p
ath
\n
'
;
output
+=
'Aborted while running:
$
mainP
ath
\n
'
;
break
;
default
:
output
+=
'Unexpected exit code
$exitCode
from subprocess for:
$
p
ath
\n
'
;
output
+=
'Unexpected exit code
$exitCode
from subprocess for:
$
mainP
ath
\n
'
;
}
}
String
stdout
=
await
process
.
stdout
.
transform
(
UTF8
.
decoder
).
join
(
'
\n
'
);
...
...
@@ -137,7 +137,7 @@ void main() {
if
(
output
==
''
)
output
=
'No output.'
;
completer
.
completeError
(
new
LoadException
(
p
ath
,
output
),
new
LoadException
(
mainP
ath
,
output
),
new
Trace
.
current
()
);
}
else
{
...
...
@@ -163,13 +163,13 @@ void main() {
}
else
if
(
response
[
"type"
]
==
"loadException"
)
{
process
.
kill
(
ProcessSignal
.
SIGTERM
);
completer
.
completeError
(
new
LoadException
(
p
ath
,
response
[
"message"
]),
new
LoadException
(
mainP
ath
,
response
[
"message"
]),
new
Trace
.
current
());
}
else
if
(
response
[
"type"
]
==
"error"
)
{
process
.
kill
(
ProcessSignal
.
SIGTERM
);
AsyncError
asyncError
=
RemoteException
.
deserialize
(
response
[
"error"
]);
completer
.
completeError
(
new
LoadException
(
p
ath
,
asyncError
.
error
),
new
LoadException
(
mainP
ath
,
asyncError
.
error
),
asyncError
.
stackTrace
);
}
else
{
assert
(
response
[
"type"
]
==
"success"
);
...
...
@@ -186,7 +186,7 @@ void main() {
return
new
RunnerSuite
(
const
VMEnvironment
(),
new
Group
.
root
(
entries
,
metadata:
metadata
),
path:
p
ath
,
path:
mainP
ath
,
platform:
TestPlatform
.
vm
,
os:
currentOS
,
onClose:
()
{
process
.
kill
(
ProcessSignal
.
SIGTERM
);
}
...
...
packages/flutter_tools/test/init_test.dart
View file @
cada8b3f
...
...
@@ -5,7 +5,7 @@
import
'dart:io'
;
import
'package:args/command_runner.dart'
;
import
'package:path/path.dart'
as
p
;
import
'package:path/path.dart'
as
p
ath
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/commands/init.dart'
;
import
'package:flutter_tools/src/process.dart'
;
...
...
@@ -37,10 +37,10 @@ defineTests() {
await
runner
.
run
([
'init'
,
'--out'
,
temp
.
path
])
.
then
((
int
code
)
=>
expect
(
code
,
equals
(
0
)));
String
path
=
p
.
join
(
temp
.
path
,
'lib'
,
'main.dart'
);
expect
(
new
File
(
p
ath
).
existsSync
(),
true
);
String
mainPath
=
path
.
join
(
temp
.
path
,
'lib'
,
'main.dart'
);
expect
(
new
File
(
mainP
ath
).
existsSync
(),
true
);
ProcessResult
exec
=
Process
.
runSync
(
sdkBinaryName
(
'dartanalyzer'
),
[
'--fatal-warnings'
,
p
ath
],
sdkBinaryName
(
'dartanalyzer'
),
[
'--fatal-warnings'
,
mainP
ath
],
workingDirectory:
temp
.
path
);
if
(
exec
.
exitCode
!=
0
)
{
print
(
exec
.
stdout
);
...
...
packages/flutter_tools/test/os_utils_test.dart
View file @
cada8b3f
...
...
@@ -6,7 +6,7 @@ import 'dart:io';
import
'package:flutter_tools/src/os_utils.dart'
;
import
'package:test/test.dart'
;
import
'package:path/path.dart'
as
p
;
import
'package:path/path.dart'
as
p
ath
;
main
()
=>
defineTests
();
...
...
@@ -23,7 +23,7 @@ defineTests() {
});
test
(
'makeExecutable'
,
()
{
File
file
=
new
File
(
p
.
join
(
temp
.
path
,
'foo.script'
));
File
file
=
new
File
(
p
ath
.
join
(
temp
.
path
,
'foo.script'
));
file
.
writeAsStringSync
(
'hello world'
);
osUtils
.
makeExecutable
(
file
);
...
...
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