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
44ffb6f4
Commit
44ffb6f4
authored
Feb 26, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2196 from abarth/update_packages
Move update_packages.dart to `flutter update-packages`
parents
09fb766c
357fbf8a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
49 deletions
+60
-49
update_packages.dart
dev/update_packages.dart
+0
-45
executable.dart
packages/flutter_tools/lib/executable.dart
+2
-0
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+51
-0
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+6
-3
setup.sh
travis/setup.sh
+1
-1
No files found.
dev/update_packages.dart
deleted
100755 → 0
View file @
09fb766c
#
!/
usr
/
bin
/
env
dart
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
;
final
String
binaryName
=
Platform
.
isWindows
?
'pub.bat'
:
'pub'
;
int
runPub
(
Directory
directory
,
List
<
String
>
pubArgs
)
{
int
updateCount
=
0
;
for
(
FileSystemEntity
dir
in
directory
.
listSync
())
{
if
(
dir
is
Directory
&&
FileSystemEntity
.
isFileSync
(
dir
.
path
+
Platform
.
pathSeparator
+
'pubspec.yaml'
))
{
updateCount
++;
Stopwatch
timer
=
new
Stopwatch
()..
start
();
stdout
.
write
(
"Updating
${dir.path}
..."
);
ProcessResult
result
=
Process
.
runSync
(
binaryName
,
pubArgs
,
workingDirectory:
dir
.
path
);
timer
.
stop
();
stdout
.
write
(
" (
${timer.elapsedMilliseconds}
ms)"
);
if
(
result
.
exitCode
!=
0
)
{
print
(
"... failed with exit code
${result.exitCode}
."
);
print
(
result
.
stdout
);
print
(
result
.
stderr
);
}
else
{
stdout
.
write
(
"
\n
"
);
}
}
}
return
updateCount
;
}
void
main
(
List
<
String
>
arguments
)
{
Stopwatch
timer
=
new
Stopwatch
()..
start
();
bool
upgrade
=
arguments
.
length
>
0
&&
arguments
[
0
]
==
'--upgrade'
;
String
FLUTTER_ROOT
=
new
File
(
Platform
.
script
.
toFilePath
()).
parent
.
parent
.
path
;
List
<
String
>
pubArgs
=
[
upgrade
?
'upgrade'
:
'get'
];
int
count
=
0
;
count
+=
runPub
(
new
Directory
(
"
$FLUTTER_ROOT
/packages"
),
pubArgs
);
count
+=
runPub
(
new
Directory
(
"
$FLUTTER_ROOT
/examples"
),
pubArgs
);
String
command
=
"
$binaryName
${pubArgs.join(' ')}
"
;
print
(
"Ran
\"
$command
\"
$count
times in
${timer.elapsedMilliseconds}
ms"
);
}
packages/flutter_tools/lib/executable.dart
View file @
44ffb6f4
...
...
@@ -28,6 +28,7 @@ import 'src/commands/run_mojo.dart';
import
'src/commands/stop.dart'
;
import
'src/commands/test.dart'
;
import
'src/commands/trace.dart'
;
import
'src/commands/update_packages.dart'
;
import
'src/commands/upgrade.dart'
;
import
'src/device.dart'
;
import
'src/doctor.dart'
;
...
...
@@ -60,6 +61,7 @@ Future main(List<String> args) async {
..
addCommand
(
new
StopCommand
())
..
addCommand
(
new
TestCommand
())
..
addCommand
(
new
TraceCommand
())
..
addCommand
(
new
UpdatePackagesCommand
(
hideCommand:
!
verboseHelp
))
..
addCommand
(
new
UpgradeCommand
());
return
Chain
.
capture
(()
async
{
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
0 → 100644
View file @
44ffb6f4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'../artifacts.dart'
;
import
'../dart/pub.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
;
Future
<
int
>
_runPub
(
Directory
directory
,
{
bool
upgrade:
false
})
async
{
int
updateCount
=
0
;
for
(
FileSystemEntity
dir
in
directory
.
listSync
())
{
if
(
dir
is
Directory
&&
FileSystemEntity
.
isFileSync
(
dir
.
path
+
Platform
.
pathSeparator
+
'pubspec.yaml'
))
{
updateCount
++;
await
pubGet
(
directory:
dir
.
path
,
upgrade:
upgrade
,
checkLastModified:
false
);
}
}
return
updateCount
;
}
class
UpdatePackagesCommand
extends
FlutterCommand
{
UpdatePackagesCommand
({
hideCommand:
false
})
:
_hideCommand
=
hideCommand
{
argParser
.
addFlag
(
'upgrade'
,
help:
'Run "pub upgrade" rather than "pub get".'
,
defaultsTo:
false
);
}
final
String
name
=
'update-packages'
;
final
String
description
=
'Update the packages inside the Flutter repo.'
;
bool
get
hidden
=>
_hideCommand
;
final
bool
_hideCommand
;
bool
get
requiresProjectRoot
=>
false
;
@override
Future
<
int
>
runInProject
()
async
{
Stopwatch
timer
=
new
Stopwatch
()..
start
();
int
count
=
0
;
bool
upgrade
=
argResults
[
'upgrade'
];
count
+=
await
_runPub
(
new
Directory
(
"
${ArtifactStore.flutterRoot}
/packages"
),
upgrade:
upgrade
);
count
+=
await
_runPub
(
new
Directory
(
"
${ArtifactStore.flutterRoot}
/examples"
),
upgrade:
upgrade
);
printStatus
(
'Ran "pub"
$count
time
${count == 1 ? "" : "s"}
in
${timer.elapsedMilliseconds}
ms'
);
return
0
;
}
}
packages/flutter_tools/lib/src/dart/pub.dart
View file @
44ffb6f4
...
...
@@ -12,7 +12,9 @@ import '../globals.dart';
Future
<
int
>
pubGet
({
String
directory
,
bool
skipIfAbsent:
false
bool
skipIfAbsent:
false
,
bool
upgrade:
false
,
bool
checkLastModified:
true
})
async
{
if
(
directory
==
null
)
directory
=
Directory
.
current
.
path
;
...
...
@@ -28,10 +30,11 @@ Future<int> pubGet({
return
1
;
}
if
(!
pubSpecLock
.
existsSync
()
||
pubSpecYaml
.
lastModifiedSync
().
isAfter
(
pubSpecLock
.
lastModifiedSync
()))
{
if
(!
checkLastModified
||
!
pubSpecLock
.
existsSync
()
||
pubSpecYaml
.
lastModifiedSync
().
isAfter
(
pubSpecLock
.
lastModifiedSync
()))
{
printStatus
(
"Running 'pub get' in
$directory${Platform.pathSeparator}
..."
);
String
command
=
upgrade
?
'upgrade'
:
'get'
;
int
code
=
await
runCommandAndStreamOutput
(
<
String
>[
sdkBinaryName
(
'pub'
),
'--verbosity=warning'
,
'get'
],
<
String
>[
sdkBinaryName
(
'pub'
),
'--verbosity=warning'
,
command
],
workingDirectory:
directory
);
if
(
code
!=
0
)
...
...
travis/setup.sh
View file @
44ffb6f4
...
...
@@ -9,7 +9,7 @@ set -x
# Download dependencies flutter
./bin/flutter
--version
./bin/
cache/dart-sdk/bin/dart ./dev/update_packages.dart
./bin/
flutter update-packages
if
[
$TRAVIS_PULL_REQUEST
=
"false"
]
;
then
export
CLOUDSDK_CORE_DISABLE_PROMPTS
=
1
...
...
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