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
c6fd4249
Unverified
Commit
c6fd4249
authored
Jul 09, 2020
by
Dan Field
Committed by
GitHub
Jul 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test update_packages for git packages (#61127)
parent
debb3a5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
1 deletion
+65
-1
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+3
-0
update_packages_test.dart
...lutter_tools/test/general.shard/update_packages_test.dart
+62
-1
No files found.
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
c6fd4249
...
...
@@ -662,6 +662,9 @@ class PubspecYaml {
lastDependency
.
_lockIsOverride
=
section
==
Section
.
dependencyOverrides
;
do
{
index
+=
1
;
if
(
index
==
lines
.
length
)
{
throw
StateError
(
'Invalid pubspec.yaml: a "git" dependency section terminated early.'
);
}
line
=
lines
[
index
];
lastDependency
.
_lockLine
+=
'
\n
$line
'
;
}
while
(
line
.
startsWith
(
' '
));
...
...
packages/flutter_tools/test/general.shard/update_packages_test.dart
View file @
c6fd4249
...
...
@@ -30,6 +30,11 @@ dependencies:
sky_engine:
sdk: flutter
gallery:
git:
url: https://github.com/flutter/gallery.git
ref: d00362e6bdd0f9b30bba337c358b9e4a6e4ca950
dev_dependencies:
flutter_test:
sdk: flutter
...
...
@@ -42,11 +47,35 @@ dev_dependencies:
# PUBSPEC CHECKSUM: 1437
'''
;
const
String
kInvalidGitPubspec
=
'''
name: flutter
author: Flutter Authors <flutter-dev@googlegroups.com>
description: A framework for writing Flutter applications
homepage: http://flutter.dev
environment:
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
sdk: ">=2.2.2 <3.0.0"
dependencies:
# To update these, use "flutter update-packages --force-upgrade".
collection: 1.14.11
meta: 1.1.8
typed_data: 1.1.6
vector_math: 2.0.8
sky_engine:
sdk: flutter
gallery:
git:
'''
;
void
main
(
)
{
testWithoutContext
(
'createTemporaryFlutterSdk creates an unpinned flutter SDK'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
// Setup simplified F
L
utter SDK.
// Setup simplified F
l
utter SDK.
final
Directory
flutterSdk
=
fileSystem
.
directory
(
'flutter'
)
..
createSync
();
// Create version file
...
...
@@ -63,6 +92,15 @@ void main() {
// Create already parsed pubspecs.
final
PubspecYaml
flutterPubspec
=
PubspecYaml
(
flutter
);
final
PubspecDependency
gitDependency
=
flutterPubspec
.
dependencies
.
whereType
<
PubspecDependency
>().
firstWhere
((
PubspecDependency
dep
)
=>
dep
.
kind
==
DependencyKind
.
git
);
expect
(
gitDependency
.
lockLine
,
'''
git:
url: https://github.com/flutter/gallery.git
ref: d00362e6bdd0f9b30bba337c358b9e4a6e4ca950
'''
,
);
final
Directory
result
=
createTemporaryFlutterSdk
(
fileSystem
,
flutterSdk
,
...
...
@@ -88,4 +126,27 @@ void main() {
expect
(
outputPubspec
.
dependencies
.
first
.
name
,
'collection'
);
expect
(
outputPubspec
.
dependencies
.
first
.
version
,
'any'
);
});
testWithoutContext
(
'Throws a StateError on a malformed git: reference'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
// Setup simplified Flutter SDK.
final
Directory
flutterSdk
=
fileSystem
.
directory
(
'flutter'
)
..
createSync
();
// Create version file
flutterSdk
.
childFile
(
'version'
).
writeAsStringSync
(
'1.2.3'
);
// Create a pubspec file
final
Directory
flutter
=
flutterSdk
.
childDirectory
(
'packages'
)
.
childDirectory
(
'flutter'
)
..
createSync
(
recursive:
true
);
flutter
.
childFile
(
'pubspec.yaml'
)
.
writeAsStringSync
(
kInvalidGitPubspec
);
expect
(
()
=>
PubspecYaml
(
flutter
),
throwsStateError
,
);
});
}
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