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';
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
/// 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
(
' '
));
String
executable
=
cmd
[
0
];
List
<
String
>
arguments
=
cmd
.
length
>
1
?
cmd
.
sublist
(
1
)
:
<
String
>[];
Process
process
=
await
Process
.
start
(
executable
,
arguments
,
workingDirectory:
workingDirectory
workingDirectory:
workingDirectory
,
environment:
_environment
(
allowReentrantFlutter
)
);
return
process
;
}
...
...
@@ -28,12 +38,17 @@ Future<Process> runCommand(List<String> cmd, { String workingDirectory }) async
/// this process' stdout/stderr. Completes with the process's exit code.
Future
<
int
>
runCommandAndStreamOutput
(
List
<
String
>
cmd
,
{
String
workingDirectory
,
bool
allowReentrantFlutter:
false
,
String
prefix:
''
,
bool
trace:
false
,
RegExp
filter
,
StringConverter
mapFunction
})
async
{
Process
process
=
await
runCommand
(
cmd
,
workingDirectory:
workingDirectory
);
Process
process
=
await
runCommand
(
cmd
,
workingDirectory:
workingDirectory
,
allowReentrantFlutter:
allowReentrantFlutter
);
process
.
stdout
.
transform
(
UTF8
.
decoder
)
.
transform
(
const
LineSplitter
())
...
...
@@ -73,42 +88,30 @@ Future<Null> runAndKill(List<String> cmd, Duration timeout) {
Future
<
Process
>
runDetached
(
List
<
String
>
cmd
)
{
printTrace
(
cmd
.
join
(
' '
));
Future
<
Process
>
proc
=
Process
.
start
(
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
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
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
mode:
ProcessStartMode
.
DETACHED
);
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
(
' '
));
ProcessResult
results
=
await
Process
.
run
(
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
workingDirectory:
workingDirectory
workingDirectory:
workingDirectory
,
environment:
_environment
(
allowReentrantFlutter
)
);
RunResult
runResults
=
new
RunResult
(
results
);
printTrace
(
runResults
.
toString
());
return
runResults
;
}
/// Run cmd and return stdout.
String
runSync
(
List
<
String
>
cmd
,
{
String
workingDirectory
})
{
return
_runWithLoggingSync
(
cmd
,
workingDirectory:
workingDirectory
);
}
bool
exitsHappy
(
List
<
String
>
cli
)
{
printTrace
(
cli
.
join
(
' '
));
try
{
return
Process
.
runSync
(
cli
.
first
,
cli
.
sublist
(
1
)).
exitCode
==
0
;
}
catch
(
error
)
{
...
...
@@ -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
,
{
bool
checked:
false
,
bool
noisyErrors:
false
,
String
workingDirectory
,
bool
allowReentrantFlutter:
false
,
bool
truncateCommand:
false
})
{
String
cmdText
=
cmd
.
join
(
' '
);
if
(
truncateCommand
&&
cmdText
.
length
>
160
)
cmdText
=
cmdText
.
substring
(
0
,
160
)
+
'…'
;
printTrace
(
cmdText
);
ProcessResult
results
=
Process
.
runSync
(
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
workingDirectory:
workingDirectory
);
ProcessResult
results
=
Process
.
runSync
(
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
workingDirectory:
workingDirectory
,
environment:
_environment
(
allowReentrantFlutter
)
);
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 {
// if necessary.
printStatus
(
''
);
printStatus
(
'Upgrading engine...'
);
code
=
await
runCommandAndStreamOutput
(<
String
>[
'bin/flutter'
,
'--no-lock'
,
'--no-color'
,
'precache'
],
workingDirectory:
Cache
.
flutterRoot
);
code
=
await
runCommandAndStreamOutput
(
<
String
>[
'bin/flutter'
,
'--no-color'
,
'precache'
],
workingDirectory:
Cache
.
flutterRoot
,
allowReentrantFlutter:
true
);
printStatus
(
''
);
printStatus
(
FlutterVersion
.
getVersion
(
Cache
.
flutterRoot
).
toString
());
...
...
packages/flutter_tools/lib/src/ios/mac.dart
View file @
0d21e69b
...
...
@@ -150,7 +150,11 @@ Future<XcodeBuildResult> buildXcodeProject({
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
.
stderr
.
isNotEmpty
)
...
...
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
0d21e69b
...
...
@@ -48,11 +48,6 @@ class FlutterCommandRunner extends CommandRunner {
negatable:
true
,
hide:
!
verboseHelp
,
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'
,
negatable:
false
,
hide:
!
verboseHelp
,
...
...
@@ -147,7 +142,7 @@ class FlutterCommandRunner extends CommandRunner {
// enginePath's initialiser uses it).
Cache
.
flutterRoot
=
path
.
normalize
(
path
.
absolute
(
globalResults
[
'flutter-root'
]));
if
(
globalResults
[
'lock'
]);
if
(
Platform
.
environment
[
'FLUTTER_ALREADY_LOCKED'
]
!=
'true'
)
await
Cache
.
lock
();
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