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
7ad1e38e
Commit
7ad1e38e
authored
Apr 11, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix windows crash (#3236)
* better messaging about windows support * fix lints
parent
26906240
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
23 deletions
+74
-23
flutter.bat
bin/flutter.bat
+1
-1
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+4
-3
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+9
-5
os.dart
packages/flutter_tools/lib/src/base/os.dart
+35
-2
cache.dart
packages/flutter_tools/lib/src/cache.dart
+1
-3
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+3
-2
device.dart
packages/flutter_tools/lib/src/device.dart
+2
-2
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+19
-5
No files found.
bin/flutter.bat
View file @
7ad1e38e
...
...
@@ -34,7 +34,7 @@ GOTO :after_snapshot
CD "%flutter_tools_dir%"
ECHO Updating flutter tool...
CALL pub.bat get
CD "%flutter_dir"
CD "%flutter_dir
%
"
REM Allows us to check if sky_engine's REVISION is correct
CALL pub.bat get
CD "%flutter_root%"
...
...
packages/flutter_tools/lib/src/artifacts.dart
View file @
7ad1e38e
...
...
@@ -6,7 +6,6 @@ import 'dart:io';
import
'package:path/path.dart'
as
path
;
import
'base/process.dart'
;
import
'build_configuration.dart'
;
import
'globals.dart'
;
...
...
@@ -216,10 +215,12 @@ class ArtifactStore {
File
cachedFile
=
new
File
(
path
.
join
(
_getBaseCacheDir
().
path
,
'engine'
,
artifact
.
platform
,
artifact
.
fileName
)
);
if
(!
cachedFile
.
existsSync
())
{
printError
(
'File not found in the platform artifacts:
${cachedFile.path}
'
);
throw
new
ProcessExit
(
2
);
return
null
;
}
else
{
return
cachedFile
.
path
;
}
return
cachedFile
.
path
;
}
}
packages/flutter_tools/lib/src/base/logger.dart
View file @
7ad1e38e
...
...
@@ -6,10 +6,13 @@ import 'dart:async';
import
'dart:io'
;
final
_AnsiTerminal
_terminal
=
new
_AnsiTerminal
();
final
String
_sep
=
Platform
.
isWindows
?
'-'
:
'•'
;
abstract
class
Logger
{
bool
get
isVerbose
=>
false
;
String
get
separator
=>
_sep
;
/// Display an error level message to the user. Commands should use this if they
/// fail in some way.
void
printError
(
String
message
,
[
StackTrace
stackTrace
]);
...
...
@@ -34,7 +37,7 @@ class Status {
void
cancel
()
{
}
}
class
StdoutLogger
implement
s
Logger
{
class
StdoutLogger
extend
s
Logger
{
Status
_status
;
@override
...
...
@@ -79,7 +82,7 @@ class StdoutLogger implements Logger {
void
flush
()
{
}
}
class
BufferLogger
implement
s
Logger
{
class
BufferLogger
extend
s
Logger
{
@override
bool
get
isVerbose
=>
false
;
...
...
@@ -110,7 +113,7 @@ class BufferLogger implements Logger {
void
flush
()
{
}
}
class
VerboseLogger
implement
s
Logger
{
class
VerboseLogger
extend
s
Logger
{
_LogMessage
lastMessage
;
@override
...
...
@@ -170,10 +173,10 @@ class _LogMessage {
stopwatch
.
stop
();
int
millis
=
stopwatch
.
elapsedMilliseconds
;
String
prefix
=
'
${millis.toString().padLeft(4)}
ms
•
'
;
String
prefix
=
'
${millis.toString().padLeft(4)}
ms
$_sep
'
;
String
indent
=
''
.
padLeft
(
prefix
.
length
);
if
(
millis
>=
100
)
prefix
=
_terminal
.
writeBold
(
prefix
.
substring
(
0
,
prefix
.
length
-
3
))
+
'
•
'
;
prefix
=
_terminal
.
writeBold
(
prefix
.
substring
(
0
,
prefix
.
length
-
3
))
+
'
$_sep
'
;
String
indentMessage
=
message
.
replaceAll
(
'
\n
'
,
'
\n
$indent
'
);
if
(
type
==
_LogType
.
error
)
{
...
...
@@ -190,6 +193,7 @@ class _LogMessage {
class
_AnsiTerminal
{
_AnsiTerminal
()
{
// TODO(devoncarew): This detection does not work for Windows.
String
term
=
Platform
.
environment
[
'TERM'
];
_supportsColor
=
term
!=
null
&&
term
!=
'dumb'
;
}
...
...
packages/flutter_tools/lib/src/base/os.dart
View file @
7ad1e38e
...
...
@@ -5,10 +5,16 @@
import
'dart:async'
;
import
'dart:io'
;
import
'package:archive/archive.dart'
;
import
'package:path/path.dart'
as
path
;
import
'context.dart'
;
import
'process.dart'
;
/// Returns [OperatingSystemUtils] active in the current app context (i.e. zone).
OperatingSystemUtils
get
os
=>
context
[
OperatingSystemUtils
]
??
(
context
[
OperatingSystemUtils
]
=
new
OperatingSystemUtils
.
_
());
OperatingSystemUtils
get
os
{
return
context
[
OperatingSystemUtils
]
??
(
context
[
OperatingSystemUtils
]
=
new
OperatingSystemUtils
.
_
());
}
abstract
class
OperatingSystemUtils
{
factory
OperatingSystemUtils
.
_
()
{
...
...
@@ -33,6 +39,8 @@ abstract class OperatingSystemUtils {
/// Return the path (with symlinks resolved) to the given executable, or `null`
/// if `which` was not able to locate the binary.
File
which
(
String
execName
);
void
unzip
(
File
file
,
Directory
targetDirectory
);
}
class
_PosixUtils
extends
OperatingSystemUtils
{
...
...
@@ -53,6 +61,12 @@ class _PosixUtils extends OperatingSystemUtils {
String
path
=
result
.
stdout
.
trim
().
split
(
'
\n
'
).
first
.
trim
();
return
new
File
(
new
File
(
path
).
resolveSymbolicLinksSync
());
}
// unzip -o -q zipfile -d dest
@override
void
unzip
(
File
file
,
Directory
targetDirectory
)
{
runSync
(<
String
>[
'unzip'
,
'-o'
,
'-q'
,
file
.
path
,
'-d'
,
targetDirectory
.
path
]);
}
}
class
_WindowsUtils
extends
OperatingSystemUtils
{
...
...
@@ -66,7 +80,26 @@ class _WindowsUtils extends OperatingSystemUtils {
@override
File
which
(
String
execName
)
{
throw
new
UnimplementedError
(
'_WindowsUtils.which'
);
ProcessResult
result
=
Process
.
runSync
(
'where'
,
<
String
>[
execName
]);
if
(
result
.
exitCode
!=
0
)
return
null
;
return
new
File
(
result
.
stdout
.
trim
().
split
(
'
\n
'
).
first
.
trim
());
}
@override
void
unzip
(
File
file
,
Directory
targetDirectory
)
{
Archive
archive
=
new
ZipDecoder
().
decodeBytes
(
file
.
readAsBytesSync
());
for
(
ArchiveFile
archiveFile
in
archive
.
files
)
{
// The archive package doesn't correctly set isFile.
if
(!
archiveFile
.
isFile
||
archiveFile
.
name
.
endsWith
(
'/'
))
continue
;
File
destFile
=
new
File
(
path
.
join
(
targetDirectory
.
path
,
archiveFile
.
name
));
if
(!
destFile
.
parent
.
existsSync
())
destFile
.
parent
.
createSync
(
recursive:
true
);
destFile
.
writeAsBytesSync
(
archiveFile
.
content
);
}
}
}
...
...
packages/flutter_tools/lib/src/cache.dart
View file @
7ad1e38e
...
...
@@ -11,7 +11,6 @@ import 'artifacts.dart';
import
'base/context.dart'
;
import
'base/logger.dart'
;
import
'base/os.dart'
;
import
'base/process.dart'
;
import
'globals.dart'
;
/// A warpper around the `bin/cache/` directory.
...
...
@@ -129,8 +128,7 @@ class Cache {
File
tempFile
=
new
File
(
path
.
join
(
Directory
.
systemTemp
.
path
,
'
${url.toString().hashCode}
.zip'
));
tempFile
.
writeAsBytesSync
(
fileBytes
,
flush:
true
);
// unzip -o -q zipfile -d dest
runSync
(<
String
>[
'unzip'
,
'-o'
,
'-q'
,
tempFile
.
path
,
'-d'
,
location
.
path
]);
os
.
unzip
(
tempFile
,
location
);
tempFile
.
deleteSync
();
}
else
{
(
location
as
File
).
writeAsBytesSync
(
fileBytes
,
flush:
true
);
...
...
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
7ad1e38e
...
...
@@ -527,7 +527,7 @@ class AnalyzeCommand extends FlutterCommand {
String
files
=
'
${analyzedPaths.length}
${pluralize('file', analyzedPaths.length)}
'
;
String
seconds
=
(
analysisTimer
.
elapsedMilliseconds
/
1000.0
).
toStringAsFixed
(
2
);
printStatus
(
'
$errorsMessage
•
analyzed
$files
,
$seconds
seconds'
);
printStatus
(
'
$errorsMessage
${logger.separator}
analyzed
$files
,
$seconds
seconds'
);
firstAnalysis
=
false
;
}
...
...
@@ -807,6 +807,7 @@ class AnalysisError implements Comparable<AnalysisError> {
@override
String
toString
()
{
String
relativePath
=
path
.
relative
(
file
);
return
'
${severity.toLowerCase().padLeft(7)}
•
$message
•
$relativePath
:
$startLine
:
$startColumn
'
;
String
sep
=
logger
.
separator
;
return
'
${severity.toLowerCase().padLeft(7)}
$sep
$message
$sep
$relativePath
:
$startLine
:
$startColumn
'
;
}
}
packages/flutter_tools/lib/src/device.dart
View file @
7ad1e38e
...
...
@@ -223,8 +223,8 @@ abstract class Device {
for
(
Device
device
in
devices
)
{
String
supportIndicator
=
device
.
isSupported
()
?
''
:
' (unsupported)'
;
printStatus
(
'
${device.name.padRight(nameWidth)}
•
'
'
${device.id.padRight(idWidth)}
•
'
printStatus
(
'
${device.name.padRight(nameWidth)}
${logger.separator}
'
'
${device.id.padRight(idWidth)}
${logger.separator}
'
'
${getNameForTargetPlatform(device.platform)}$supportIndicator
'
);
}
}
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
7ad1e38e
...
...
@@ -109,11 +109,13 @@ class Doctor {
else
printStatus
(
'
${result.leadingBox}
${validator.title}
'
);
final
String
separator
=
Platform
.
isWindows
?
' '
:
logger
.
separator
;
for
(
ValidationMessage
message
in
result
.
messages
)
{
if
(
message
.
isError
)
{
printStatus
(
' x
${message.message.replaceAll('\n', '\n ')}
'
);
}
else
{
printStatus
(
'
•
${message.message.replaceAll('\n', '\n ')}
'
);
printStatus
(
'
$separator
${message.message.replaceAll('\n', '\n ')}
'
);
}
}
}
...
...
@@ -160,9 +162,9 @@ class ValidationResult {
String
get
leadingBox
{
if
(
type
==
ValidationType
.
missing
)
return
'[
]'
;
return
'[
x
]'
;
else
if
(
type
==
ValidationType
.
installed
)
return
'[✓]'
;
return
Platform
.
isWindows
?
'[+]'
:
'[✓]'
;
else
return
'[-]'
;
}
...
...
@@ -185,6 +187,7 @@ class _FlutterValidator extends DoctorValidator {
@override
ValidationResult
validate
()
{
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
ValidationType
valid
=
ValidationType
.
installed
;
FlutterVersion
version
=
FlutterVersion
.
getVersion
();
...
...
@@ -195,7 +198,16 @@ class _FlutterValidator extends DoctorValidator {
'engine revision
${version.engineRevisionShort}
'
));
return
new
ValidationResult
(
ValidationType
.
installed
,
messages
,
if
(
Platform
.
isWindows
)
{
valid
=
ValidationType
.
missing
;
messages
.
add
(
new
ValidationMessage
.
error
(
'Flutter tools are not (yet) supported on Windows: '
'https://github.com/flutter/flutter/issues/138.'
));
}
return
new
ValidationResult
(
valid
,
messages
,
statusInfo:
'on
${osName()}
, channel
${version.channel}
'
);
}
}
...
...
@@ -247,7 +259,9 @@ class _AtomValidator extends DoctorValidator {
}
return
new
ValidationResult
(
installCount
==
2
?
ValidationType
.
installed
:
installCount
==
1
?
ValidationType
.
partial
:
ValidationType
.
missing
,
installCount
==
2
?
ValidationType
.
installed
:
installCount
==
1
?
ValidationType
.
partial
:
ValidationType
.
missing
,
messages
);
}
...
...
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