Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Issue 10542015: Start adding support for lock files. (Closed)

Created:
8 years, 6 months ago by Bob Nystrom
Modified:
8 years, 6 months ago
Reviewers:
Jennifer Messerly
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Start adding support for lock files. Lock files can be parsed (from strings) with tests. Committed: https://code.google.com/p/dart/source/detail?r=8362

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -2 lines) Patch
A utils/pub/lock_file.dart View 1 chunk +79 lines, -0 lines 2 comments Download
M utils/pub/pubspec.dart View 1 chunk +0 lines, -1 line 0 comments Download
M utils/pub/source_registry.dart View 1 chunk +5 lines, -0 lines 0 comments Download
A utils/tests/pub/lock_file_test.dart View 1 chunk +171 lines, -0 lines 0 comments Download
M utils/tests/pub/pubspec_test.dart View 1 chunk +1 line, -1 line 2 comments Download

Messages

Total messages: 3 (0 generated)
Bob Nystrom
Nathan is out, so you're my pub code review "volunteer" for the day. :)
8 years, 6 months ago (2012-06-05 23:58:29 UTC) #1
Jennifer Messerly
lgtm https://chromiumcodereview.appspot.com/10542015/diff/1/utils/pub/lock_file.dart File utils/pub/lock_file.dart (right): https://chromiumcodereview.appspot.com/10542015/diff/1/utils/pub/lock_file.dart#newcode68 utils/pub/lock_file.dart:68: if (name != id.name) { How could this ...
8 years, 6 months ago (2012-06-06 00:23:52 UTC) #2
Bob Nystrom
8 years, 6 months ago (2012-06-06 20:44:48 UTC) #3
Thanks!

https://chromiumcodereview.appspot.com/10542015/diff/1/utils/pub/lock_file.dart
File utils/pub/lock_file.dart (right):

https://chromiumcodereview.appspot.com/10542015/diff/1/utils/pub/lock_file.da...
utils/pub/lock_file.dart:68: if (name != id.name) {
On 2012/06/06 00:23:52, John Messerly wrote:
> How could this happen? It sounds like this means description got mismatched
from the name?

Exactly right. This shouldn't occur in practice, but it doesn't hurt to sanity
check it. The "description" is a source-specific string that the source
interprets to uniquely identify a package. For example, it will be a git URL if
the source is git. Given that, the source is also responsible for yielding a
nice short package name.

The lock file lists the packages by the short name and includes the description.
So this just sanity checks that those aren't out of sync.

> 
> Might be worth giving more information in the exception message, if the
message
> is intended for end users, so they know what went wrong and how to fix it.

This shouldn't happen much in practice. The lock file will be generated
automatically by pub (it's the result of solving the version constraints) and
then parsed back in by it. But users could always hand-edit it or do something
weird, so it's good to validate it.

If we find that people hit this error, I'll definitely do better
error-reporting. I consider error-reporting a core piece of pub's UI, given that
it's a command line app that heavily works with files users hand-edit.

https://chromiumcodereview.appspot.com/10542015/diff/1/utils/tests/pub/pubspe...
File utils/tests/pub/pubspec_test.dart (right):

https://chromiumcodereview.appspot.com/10542015/diff/1/utils/tests/pub/pubspe...
utils/tests/pub/pubspec_test.dart:5: #library('pubspec_test');
On 2012/06/06 00:23:52, John Messerly wrote:
> Why not empty string? Random characters? Shakespeare sonnet?
> 
> kidding ;)

Changed to:

#library("""Let those who are in favour with their stars
Of public honour and proud titles boast,
Whilst I, whom fortune of such triumph bars
Unlook'd for joy in that I honour most.
Great princes' favourites their fair leaves spread
But as the marigold at the sun's eye,
And in themselves their pride lies buried,
For at a frown they in their glory die.
The painful warrior famoused for fight,
After a thousand victories once foiled,
Is from the book of honour razed quite,
And all the rest forgot for which he toiled:
Then happy I, that love and am beloved,
Where I may not remove nor be removed.""");

Powered by Google App Engine
This is Rietveld 408576698