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

Issue 11871028: Clean up code that locates SDK and SDK version. (Closed)

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

Description

Clean up code that locates SDK and SDK version. This is prep work for SDK constraints. It moves the SDK version-related code out of SdkSource (which will go away at some point) into its own library. I also removed the need for the DART_SDK env variable. It will still be used if set (which the tests need), but if not set, Pub will locate the SDK. Clean up a few static warnings. Committed: https://code.google.com/p/dart/source/detail?r=17433

Patch Set 1 #

Total comments: 10

Patch Set 2 : Revise. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+80 lines, -112 lines) Patch
pkg/path/lib/path.dart View 1 3 chunks +24 lines, -12 lines 0 comments Download
utils/pub/pub.dart View 4 chunks +3 lines, -6 lines 0 comments Download
utils/pub/root_source.dart View 1 chunk +1 line, -0 lines 0 comments Download
utils/pub/sdk.dart View 1 chunk +38 lines, -0 lines 0 comments Download
utils/pub/sdk/pub View 1 chunk +1 line, -1 line 0 comments Download
utils/pub/sdk/pub.bat View 1 chunk +0 lines, -3 lines 0 comments Download
utils/pub/sdk_source.dart View 3 chunks +7 lines, -32 lines 0 comments Download
utils/pub/system_cache.dart View 1 chunk +2 lines, -2 lines 0 comments Download
utils/tests/pub/install/hosted/check_out_test.dart View 1 chunk +0 lines, -23 lines 0 comments Download
utils/tests/pub/install/hosted/check_out_transitive_test.dart View 1 chunk +0 lines, -28 lines 0 comments Download
utils/tests/pub/install/hosted/install_test.dart View 1 chunk +1 line, -1 line 0 comments Download
utils/tests/pub/install/hosted/install_transitive_test.dart View 1 chunk +1 line, -1 line 0 comments Download
utils/tests/pub/test_pub.dart View 1 2 chunks +2 lines, -3 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Bob Nystrom
7 years, 11 months ago (2013-01-19 00:00:56 UTC) #1
nweiz
lgtm https://codereview.chromium.org/11871028/diff/1/pkg/path/lib/path.dart File pkg/path/lib/path.dart (right): https://codereview.chromium.org/11871028/diff/1/pkg/path/lib/path.dart#newcode170 pkg/path/lib/path.dart:170: if (args[i] != null && args[i - 1] ...
7 years, 11 months ago (2013-01-19 00:35:47 UTC) #2
Bob Nystrom
7 years, 11 months ago (2013-01-22 23:53:18 UTC) #3
Message was sent while issue was closed.
Thanks!

https://codereview.chromium.org/11871028/diff/1/pkg/path/lib/path.dart
File pkg/path/lib/path.dart (right):

https://codereview.chromium.org/11871028/diff/1/pkg/path/lib/path.dart#newcod...
pkg/path/lib/path.dart:170: if (args[i] != null && args[i - 1] == null) {
On 2013/01/19 00:35:47, nweiz wrote:
> Short-circuit?

Done.

https://codereview.chromium.org/11871028/diff/1/pkg/path/lib/path.dart#newcod...
pkg/path/lib/path.dart:181: .mappedBy((arg) => arg == null ? "null" : '"$arg"')
On 2013/01/19 00:35:47, nweiz wrote:
> I really wish we had a better way of dumping strings than '"$arg"'. That's so
> hard to read if it contains a newline or a quote or anything.

Agreed. But until then, this should cover most cases.

https://codereview.chromium.org/11871028/diff/1/utils/pub/sdk.dart
File utils/pub/sdk.dart (right):

https://codereview.chromium.org/11871028/diff/1/utils/pub/sdk.dart#newcode27
utils/pub/sdk.dart:27: return dir;
On 2013/01/19 00:35:47, nweiz wrote:
> I wonder if we should do some sanity checks here so that we can throw a
> reasonable error message if the directory we think contains the SDK actually
> doesn't.

I don't think we've hit issues with this in the wild, at least not yet, so I'm
not too worried here.

https://codereview.chromium.org/11871028/diff/1/utils/pub/sdk.dart#newcode36
utils/pub/sdk.dart:36: var revision = new File(revisionPath).readAsStringSync();
On 2013/01/19 00:35:47, nweiz wrote:
> Oh synchronous file IO, how lovely you are...

Oh yeah. I thought about making this async and then remembered that I don't
completely hate myself.

https://codereview.chromium.org/11871028/diff/1/utils/pub/sdk.dart#newcode37
utils/pub/sdk.dart:37: return new Version.parse("0.0.0-r.${revision.trim()}");
On 2013/01/19 00:35:47, nweiz wrote:
> Another place it would be good to do some validation. We could even print some
> instructions on what to do if we've found the SDK but it didn't contain a
> revision file.

Ditto previous comment. I don't mind making this more robust over time but we
haven't seen too many issues here so far.

Powered by Google App Engine
This is Rietveld 408576698