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
0d21e69b
Commit
0d21e69b
authored
Jun 15, 2016
by
Ian Hickson
Committed by
GitHub
Jun 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flutter upgrade and flutter build ios (#4564)
* Fix `flutter upgrade` * Fix builds on iOS
parent
0f1132f9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
36 deletions
+77
-36
process.dart
packages/flutter_tools/lib/src/base/process.dart
+64
-26
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+7
-3
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+5
-1
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+1
-6
No files found.
packages/flutter_tools/lib/src/base/process.dart
View file @
0d21e69b
...
@@ -10,16 +10,26 @@ import '../globals.dart';
...
@@ -10,16 +10,26 @@ import '../globals.dart';
typedef
String
StringConverter
(
String
string
);
typedef
String
StringConverter
(
String
string
);
// TODO(ianh): We have way too many ways to run subprocesses in this project.
Map
<
String
,
String
>
_environment
(
bool
allowReentrantFlutter
)
{
return
allowReentrantFlutter
?
<
String
,
String
>{
'FLUTTER_ALREADY_LOCKED'
:
'true'
}
:
null
;
}
/// This runs the command in the background from the specified working
/// This runs the command in the background from the specified working
/// directory. Completes when the process has been started.
/// directory. Completes when the process has been started.
Future
<
Process
>
runCommand
(
List
<
String
>
cmd
,
{
String
workingDirectory
})
async
{
Future
<
Process
>
runCommand
(
List
<
String
>
cmd
,
{
String
workingDirectory
,
bool
allowReentrantFlutter:
false
})
async
{
printTrace
(
cmd
.
join
(
' '
));
printTrace
(
cmd
.
join
(
' '
));
String
executable
=
cmd
[
0
];
String
executable
=
cmd
[
0
];
List
<
String
>
arguments
=
cmd
.
length
>
1
?
cmd
.
sublist
(
1
)
:
<
String
>[];
List
<
String
>
arguments
=
cmd
.
length
>
1
?
cmd
.
sublist
(
1
)
:
<
String
>[];
Process
process
=
await
Process
.
start
(
Process
process
=
await
Process
.
start
(
executable
,
executable
,
arguments
,
arguments
,
workingDirectory:
workingDirectory
workingDirectory:
workingDirectory
,
environment:
_environment
(
allowReentrantFlutter
)
);
);
return
process
;
return
process
;
}
}
...
@@ -28,12 +38,17 @@ Future<Process> runCommand(List<String> cmd, { String workingDirectory }) async
...
@@ -28,12 +38,17 @@ Future<Process> runCommand(List<String> cmd, { String workingDirectory }) async
/// this process' stdout/stderr. Completes with the process's exit code.
/// this process' stdout/stderr. Completes with the process's exit code.
Future
<
int
>
runCommandAndStreamOutput
(
List
<
String
>
cmd
,
{
Future
<
int
>
runCommandAndStreamOutput
(
List
<
String
>
cmd
,
{
String
workingDirectory
,
String
workingDirectory
,
bool
allowReentrantFlutter:
false
,
String
prefix:
''
,
String
prefix:
''
,
bool
trace:
false
,
bool
trace:
false
,
RegExp
filter
,
RegExp
filter
,
StringConverter
mapFunction
StringConverter
mapFunction
})
async
{
})
async
{
Process
process
=
await
runCommand
(
cmd
,
workingDirectory:
workingDirectory
);
Process
process
=
await
runCommand
(
cmd
,
workingDirectory:
workingDirectory
,
allowReentrantFlutter:
allowReentrantFlutter
);
process
.
stdout
process
.
stdout
.
transform
(
UTF8
.
decoder
)
.
transform
(
UTF8
.
decoder
)
.
transform
(
const
LineSplitter
())
.
transform
(
const
LineSplitter
())
...
@@ -73,42 +88,30 @@ Future<Null> runAndKill(List<String> cmd, Duration timeout) {
...
@@ -73,42 +88,30 @@ Future<Null> runAndKill(List<String> cmd, Duration timeout) {
Future
<
Process
>
runDetached
(
List
<
String
>
cmd
)
{
Future
<
Process
>
runDetached
(
List
<
String
>
cmd
)
{
printTrace
(
cmd
.
join
(
' '
));
printTrace
(
cmd
.
join
(
' '
));
Future
<
Process
>
proc
=
Process
.
start
(
Future
<
Process
>
proc
=
Process
.
start
(
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
mode:
ProcessStartMode
.
DETACHED
);
mode:
ProcessStartMode
.
DETACHED
return
proc
;
}
/// Run cmd and return stdout.
///
/// Throws an error if cmd exits with a non-zero value.
String
runCheckedSync
(
List
<
String
>
cmd
,
{
String
workingDirectory
,
bool
truncateCommand:
false
})
{
return
_runWithLoggingSync
(
cmd
,
workingDirectory:
workingDirectory
,
checked:
true
,
noisyErrors:
true
,
truncateCommand:
truncateCommand
);
);
return
proc
;
}
}
Future
<
RunResult
>
runAsync
(
List
<
String
>
cmd
,
{
String
workingDirectory
})
async
{
Future
<
RunResult
>
runAsync
(
List
<
String
>
cmd
,
{
String
workingDirectory
,
bool
allowReentrantFlutter:
false
})
async
{
printTrace
(
cmd
.
join
(
' '
));
printTrace
(
cmd
.
join
(
' '
));
ProcessResult
results
=
await
Process
.
run
(
ProcessResult
results
=
await
Process
.
run
(
cmd
[
0
],
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
workingDirectory:
workingDirectory
workingDirectory:
workingDirectory
,
environment:
_environment
(
allowReentrantFlutter
)
);
);
RunResult
runResults
=
new
RunResult
(
results
);
RunResult
runResults
=
new
RunResult
(
results
);
printTrace
(
runResults
.
toString
());
printTrace
(
runResults
.
toString
());
return
runResults
;
return
runResults
;
}
}
/// Run cmd and return stdout.
String
runSync
(
List
<
String
>
cmd
,
{
String
workingDirectory
})
{
return
_runWithLoggingSync
(
cmd
,
workingDirectory:
workingDirectory
);
}
bool
exitsHappy
(
List
<
String
>
cli
)
{
bool
exitsHappy
(
List
<
String
>
cli
)
{
printTrace
(
cli
.
join
(
' '
));
printTrace
(
cli
.
join
(
' '
));
try
{
try
{
return
Process
.
runSync
(
cli
.
first
,
cli
.
sublist
(
1
)).
exitCode
==
0
;
return
Process
.
runSync
(
cli
.
first
,
cli
.
sublist
(
1
)).
exitCode
==
0
;
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -116,18 +119,53 @@ bool exitsHappy(List<String> cli) {
...
@@ -116,18 +119,53 @@ bool exitsHappy(List<String> cli) {
}
}
}
}
/// Run cmd and return stdout.
///
/// Throws an error if cmd exits with a non-zero value.
String
runCheckedSync
(
List
<
String
>
cmd
,
{
String
workingDirectory
,
bool
allowReentrantFlutter:
false
,
bool
truncateCommand:
false
})
{
return
_runWithLoggingSync
(
cmd
,
workingDirectory:
workingDirectory
,
allowReentrantFlutter:
allowReentrantFlutter
,
checked:
true
,
noisyErrors:
true
,
truncateCommand:
truncateCommand
);
}
/// Run cmd and return stdout.
String
runSync
(
List
<
String
>
cmd
,
{
String
workingDirectory
,
bool
allowReentrantFlutter:
false
})
{
return
_runWithLoggingSync
(
cmd
,
workingDirectory:
workingDirectory
,
allowReentrantFlutter:
allowReentrantFlutter
);
}
String
_runWithLoggingSync
(
List
<
String
>
cmd
,
{
String
_runWithLoggingSync
(
List
<
String
>
cmd
,
{
bool
checked:
false
,
bool
checked:
false
,
bool
noisyErrors:
false
,
bool
noisyErrors:
false
,
String
workingDirectory
,
String
workingDirectory
,
bool
allowReentrantFlutter:
false
,
bool
truncateCommand:
false
bool
truncateCommand:
false
})
{
})
{
String
cmdText
=
cmd
.
join
(
' '
);
String
cmdText
=
cmd
.
join
(
' '
);
if
(
truncateCommand
&&
cmdText
.
length
>
160
)
if
(
truncateCommand
&&
cmdText
.
length
>
160
)
cmdText
=
cmdText
.
substring
(
0
,
160
)
+
'…'
;
cmdText
=
cmdText
.
substring
(
0
,
160
)
+
'…'
;
printTrace
(
cmdText
);
printTrace
(
cmdText
);
ProcessResult
results
=
ProcessResult
results
=
Process
.
runSync
(
Process
.
runSync
(
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
workingDirectory:
workingDirectory
);
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
workingDirectory:
workingDirectory
,
environment:
_environment
(
allowReentrantFlutter
)
);
printTrace
(
'Exit code
${results.exitCode}
from:
${cmd.join(' ')}
'
);
printTrace
(
'Exit code
${results.exitCode}
from:
${cmd.join(' ')}
'
);
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
0d21e69b
...
@@ -50,9 +50,13 @@ class UpgradeCommand extends FlutterCommand {
...
@@ -50,9 +50,13 @@ class UpgradeCommand extends FlutterCommand {
// if necessary.
// if necessary.
printStatus
(
''
);
printStatus
(
''
);
printStatus
(
'Upgrading engine...'
);
printStatus
(
'Upgrading engine...'
);
code
=
await
runCommandAndStreamOutput
(<
String
>[
code
=
await
runCommandAndStreamOutput
(
'bin/flutter'
,
'--no-lock'
,
'--no-color'
,
'precache'
<
String
>[
],
workingDirectory:
Cache
.
flutterRoot
);
'bin/flutter'
,
'--no-color'
,
'precache'
],
workingDirectory:
Cache
.
flutterRoot
,
allowReentrantFlutter:
true
);
printStatus
(
''
);
printStatus
(
''
);
printStatus
(
FlutterVersion
.
getVersion
(
Cache
.
flutterRoot
).
toString
());
printStatus
(
FlutterVersion
.
getVersion
(
Cache
.
flutterRoot
).
toString
());
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
0d21e69b
...
@@ -150,7 +150,11 @@ Future<XcodeBuildResult> buildXcodeProject({
...
@@ -150,7 +150,11 @@ Future<XcodeBuildResult> buildXcodeProject({
commands
.
addAll
(<
String
>[
'-sdk'
,
'iphonesimulator'
,
'-arch'
,
'x86_64'
]);
commands
.
addAll
(<
String
>[
'-sdk'
,
'iphonesimulator'
,
'-arch'
,
'x86_64'
]);
}
}
RunResult
result
=
await
runAsync
(
commands
,
workingDirectory:
app
.
rootPath
);
RunResult
result
=
await
runAsync
(
commands
,
workingDirectory:
app
.
rootPath
,
allowReentrantFlutter:
true
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
stderr
.
isNotEmpty
)
if
(
result
.
stderr
.
isNotEmpty
)
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
0d21e69b
...
@@ -48,11 +48,6 @@ class FlutterCommandRunner extends CommandRunner {
...
@@ -48,11 +48,6 @@ class FlutterCommandRunner extends CommandRunner {
negatable:
true
,
negatable:
true
,
hide:
!
verboseHelp
,
hide:
!
verboseHelp
,
help:
'Whether to use terminal colors.'
);
help:
'Whether to use terminal colors.'
);
argParser
.
addFlag
(
'lock'
,
negatable:
true
,
hide:
!
verboseHelp
,
help:
'Whether to lock the Flutter binary artifacts directory while running. (This prevents multiple simultaneous Flutter instances from colliding.)'
,
defaultsTo:
true
);
argParser
.
addFlag
(
'suppress-analytics'
,
argParser
.
addFlag
(
'suppress-analytics'
,
negatable:
false
,
negatable:
false
,
hide:
!
verboseHelp
,
hide:
!
verboseHelp
,
...
@@ -147,7 +142,7 @@ class FlutterCommandRunner extends CommandRunner {
...
@@ -147,7 +142,7 @@ class FlutterCommandRunner extends CommandRunner {
// enginePath's initialiser uses it).
// enginePath's initialiser uses it).
Cache
.
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
globalResults
[
'flutter-root'
]));
Cache
.
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
globalResults
[
'flutter-root'
]));
if
(
globalResults
[
'lock'
]);
if
(
Platform
.
environment
[
'FLUTTER_ALREADY_LOCKED'
]
!=
'true'
)
await
Cache
.
lock
();
await
Cache
.
lock
();
if
(
globalResults
[
'suppress-analytics'
])
if
(
globalResults
[
'suppress-analytics'
])
...
...
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