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

Issue 243683002: Refactor Source. (Closed)

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

Description

Patch Set 1 #

Total comments: 30

Patch Set 2 : Revise all the things. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+349 lines, -345 lines) Patch
M sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart View 2 chunks +2 lines, -1 line 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/cache_add.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/cache_list.dart View 2 chunks +3 lines, -1 line 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/cache_repair.dart View 2 chunks +2 lines, -1 line 0 comments Download
M sdk/lib/_internal/pub/lib/src/entrypoint.dart View 5 chunks +6 lines, -15 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/lock_file.dart View 1 chunk +4 lines, -6 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/pubspec.dart View 1 1 chunk +12 lines, -14 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart View 1 2 chunks +2 lines, -1 line 0 comments Download
M sdk/lib/_internal/pub/lib/src/solver/solve_report.dart View 1 chunk +3 lines, -14 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source.dart View 1 7 chunks +31 lines, -188 lines 0 comments Download
A sdk/lib/_internal/pub/lib/src/source/cached.dart View 1 1 chunk +101 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source/git.dart View 1 6 chunks +18 lines, -9 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source/hosted.dart View 1 4 chunks +42 lines, -19 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source/path.dart View 2 chunks +7 lines, -12 lines 0 comments Download
A sdk/lib/_internal/pub/lib/src/source/unknown.dart View 1 1 chunk +47 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source_registry.dart View 2 chunks +14 lines, -18 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/system_cache.dart View 1 3 chunks +4 lines, -35 lines 0 comments Download
M sdk/lib/_internal/pub/test/lock_file_test.dart View 3 chunks +15 lines, -1 line 0 comments Download
M sdk/lib/_internal/pub/test/pubspec_test.dart View 2 chunks +17 lines, -1 line 0 comments Download
M sdk/lib/_internal/pub/test/version_solver_test.dart View 1 5 chunks +18 lines, -8 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Bob Nystrom
This has two main changes: 1. Define an UnknownSource that gets returned by SourceRegistry. That ...
6 years, 8 months ago (2014-04-18 20:07:26 UTC) #1
nweiz
https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/src/pubspec.dart File sdk/lib/_internal/pub/lib/src/pubspec.dart (right): https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/src/pubspec.dart#newcode383 sdk/lib/_internal/pub/lib/src/pubspec.dart:383: var source = _sources[sourceName]; Nit: it's a little weird ...
6 years, 8 months ago (2014-04-21 21:18:19 UTC) #2
Bob Nystrom
https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/src/pubspec.dart File sdk/lib/_internal/pub/lib/src/pubspec.dart (right): https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/src/pubspec.dart#newcode383 sdk/lib/_internal/pub/lib/src/pubspec.dart:383: var source = _sources[sourceName]; On 2014/04/21 21:18:19, nweiz wrote: ...
6 years, 8 months ago (2014-04-22 21:35:08 UTC) #3
nweiz
lgtm https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/src/source.dart File sdk/lib/_internal/pub/lib/src/source.dart (right): https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/src/source.dart#newcode73 sdk/lib/_internal/pub/lib/src/source.dart:73: return onDescribe(id); On 2014/04/22 21:35:08, Bob Nystrom wrote: ...
6 years, 8 months ago (2014-04-22 23:50:03 UTC) #4
Bob Nystrom
Committed patchset #2 manually as r35344 (presubmit successful).
6 years, 8 months ago (2014-04-23 23:48:01 UTC) #5
Bob Nystrom
6 years, 8 months ago (2014-04-24 00:27:14 UTC) #6
Message was sent while issue was closed.
Thanks!

https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/sr...
File sdk/lib/_internal/pub/lib/src/source.dart (right):

https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/sr...
sdk/lib/_internal/pub/lib/src/source.dart:73: return onDescribe(id);
On 2014/04/22 23:50:03, nweiz wrote:
> On 2014/04/22 21:35:08, Bob Nystrom wrote:
> > On 2014/04/21 21:18:19, nweiz wrote:
> > > We should come up with a more consistent naming convention for the pattern
> of
> > > "the version of a method you're supposed to actually override." We use
"onX"
> > > here, "doX" elsewhere, and other idiosyncratic formulations in other
places.
> > 
> > Yeah, we should be more consistent.
> > 
> > > What do you think about "X_"? The underscore mirrors "_X", which may help
> > > communicate that it's not supposed to be called by external classes, and
it
> > > won't conflict with any other naming conventions.
> > 
> > Hmm, I'm not a fan of using punctuation for this.  Way back in the day, I
> worked
> > on projects in C++ that used "on___" for virtual methods, which is why I'm
> doing
> > that here. I like this convention but I would be up for something else too.
> > 
> > We could do something very explicit: derivedDescribe() or
> overriddenDescribe()?
> > Or maybe just try to come up with a name that distinguishes it from the base
> > method. For example, here it could be something like "describeValidPackage"
> > since describe() has done the validation.
> > 
> > Here's a discussion about it:
> >
>
http://stackoverflow.com/questions/2597556/naming-convention-for-non-virtual-...
> > 
> > Herb Sutter uses a "Do" prefix.
> > 
> > Thoughts?
> > 
> 
> Of these alternatives, I think I like "DoX" or choosing a new name best.

Done. DoX it is.

https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/sr...
File sdk/lib/_internal/pub/lib/src/source/cached.dart (right):

https://codereview.chromium.org/243683002/diff/1/sdk/lib/_internal/pub/lib/sr...
sdk/lib/_internal/pub/lib/src/source/cached.dart:95: ///   * It has an empty
"lib" directory.
On 2014/04/22 23:50:03, nweiz wrote:
> On 2014/04/22 21:35:08, Bob Nystrom wrote:
> > On 2014/04/21 21:18:19, nweiz wrote:
> > > Currently we don't validate that a package has a lib/ directory on
publish,
> > > because we considered a package valid if it had assets. We don't really
> > support
> > > that use-case anymore, but soon we'll support a package that just has Dart
> > files
> > > in bin/, so it seems like maybe we shouldn't look for lib/ here anymore.
> > > 
> > > If we keep looking for lib/, we should re-add the validation, since
> publishing
> > a
> > > package that will constantly look corrupted is no good.
> > 
> > Yeah, I noticed that but didn't want to touch it in this patch. Now that we
> have
> > "pub cache repair" how do you feel about tearing the auto-repair out
> completely?
> > I don't know how many correct cases it actually catches.
> 
> I don't mind tearing out the auto-repair, but if we catch something really
> egregious (e.g. a missing pubspec), we should at least print something to the
> effect of "you should try running pub cache repair".

I don't know if the missing pubspec case even happens in practice now. I think
the only time things get broken is when users walk into their package symlink,
which will skip past the pubspect and go into lib.

I'll just delete this completely for now and if we hear complaints about missing
pubspecs, I'm totally up for adding checking back in. Until then, I like the
idea of simplifying the codebase.

Powered by Google App Engine
This is Rietveld 408576698