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

Issue 2614063007: Use URIs rather than paths in front end API. (Closed)

Created:
3 years, 11 months ago by Paul Berry
Modified:
3 years, 11 months ago
CC:
reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Use URIs rather than paths in front end API. This carries a number of benefits: - It allows the front end to trivially support schemes other than "file:" (e.g. "http:") by allowing the client to supply a FileSystem implementation that handles them. - It is more consistent with the functionality of the ".packages" file (which allows packages to map to any kind of URI). - It allows the "bazel root" feature to be rewritten to use a magic scheme rather than a magic path. (This eliminates concerns about the magic path overlapping with a user's use case). Note that this feature has been renamed to "multi root" since it is sufficiently generic to be applicable to build systems other than Bazel. - It reduces the risk of forgetting to use the front end's FileSystem abstraction to access the file system, since the native file system interfaces do not accept URIs. R=danrubel@google.com Committed: https://github.com/dart-lang/sdk/commit/ba241c0c8d23b22717eb0de99dcbf1b53591a42d

Patch Set 1 #

Patch Set 2 : Minor fixes #

Total comments: 5

Patch Set 3 : Renames and comment clean-up #

Patch Set 4 : Run dartfmt #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+248 lines, -245 lines) Patch
M pkg/front_end/lib/compiler_options.dart View 1 2 3 chunks +32 lines, -30 lines 0 comments Download
M pkg/front_end/lib/file_system.dart View 1 2 2 chunks +9 lines, -16 lines 0 comments Download
M pkg/front_end/lib/kernel_generator.dart View 1 2 4 chunks +15 lines, -5 lines 0 comments Download
M pkg/front_end/lib/memory_file_system.dart View 1 2 3 4 chunks +23 lines, -20 lines 0 comments Download
M pkg/front_end/lib/physical_file_system.dart View 1 chunk +15 lines, -13 lines 2 comments Download
M pkg/front_end/lib/src/base/processed_options.dart View 1 2 3 3 chunks +8 lines, -10 lines 0 comments Download
M pkg/front_end/lib/src/base/uri_resolver.dart View 1 2 3 chunks +27 lines, -34 lines 0 comments Download
M pkg/front_end/lib/src/dependency_grapher_impl.dart View 1 2 3 1 chunk +4 lines, -3 lines 0 comments Download
M pkg/front_end/test/dependency_grapher_test.dart View 1 2 1 chunk +5 lines, -3 lines 0 comments Download
M pkg/front_end/test/memory_file_system_test.dart View 7 chunks +48 lines, -40 lines 0 comments Download
M pkg/front_end/test/physical_file_system_test.dart View 5 chunks +26 lines, -48 lines 0 comments Download
M pkg/front_end/test/src/base/processed_options_test.dart View 1 2 2 chunks +15 lines, -12 lines 0 comments Download
M pkg/front_end/test/src/base/uri_resolver_test.dart View 1 2 4 chunks +11 lines, -4 lines 0 comments Download
M pkg/front_end/tool/example.dart View 1 2 3 1 chunk +6 lines, -4 lines 0 comments Download
M pkg/front_end/tool/perf.dart View 1 2 1 chunk +4 lines, -3 lines 2 comments Download

Messages

Total messages: 10 (3 generated)
Paul Berry
3 years, 11 months ago (2017-01-06 23:04:07 UTC) #3
danrubel
LGTM There are several places where locals are named "path" but hold a Uri. IMO ...
3 years, 11 months ago (2017-01-08 17:07:38 UTC) #4
Paul Berry
https://codereview.chromium.org/2614063007/diff/20001/pkg/front_end/lib/compiler_options.dart File pkg/front_end/lib/compiler_options.dart (right): https://codereview.chromium.org/2614063007/diff/20001/pkg/front_end/lib/compiler_options.dart#newcode27 pkg/front_end/lib/compiler_options.dart:27: Uri sdkPath; On 2017/01/08 17:07:38, danrubel wrote: > Since ...
3 years, 11 months ago (2017-01-09 17:24:42 UTC) #5
danrubel
LGTM
3 years, 11 months ago (2017-01-09 18:33:13 UTC) #6
Paul Berry
Committed patchset #4 (id:60001) manually as ba241c0c8d23b22717eb0de99dcbf1b53591a42d (presubmit successful).
3 years, 11 months ago (2017-01-09 19:19:44 UTC) #8
Siggi Cherem (dart-lang)
lgtm https://codereview.chromium.org/2614063007/diff/60001/pkg/front_end/lib/physical_file_system.dart File pkg/front_end/lib/physical_file_system.dart (right): https://codereview.chromium.org/2614063007/diff/60001/pkg/front_end/lib/physical_file_system.dart#newcode57 pkg/front_end/lib/physical_file_system.dart:57: Future<List<int>> readAsBytes() => new io.File(_path).readAsBytes(); would `new io.File.fromUri` ...
3 years, 11 months ago (2017-01-11 22:59:53 UTC) #9
Paul Berry
3 years, 11 months ago (2017-01-12 23:10:04 UTC) #10
Message was sent while issue was closed.
https://codereview.chromium.org/2614063007/diff/60001/pkg/front_end/lib/physi...
File pkg/front_end/lib/physical_file_system.dart (right):

https://codereview.chromium.org/2614063007/diff/60001/pkg/front_end/lib/physi...
pkg/front_end/lib/physical_file_system.dart:57: Future<List<int>> readAsBytes()
=> new io.File(_path).readAsBytes();
On 2017/01/11 22:59:53, Siggi Cherem (dart-lang) wrote:
> would `new io.File.fromUri` work as well (and no need to convert to a path
> altogether)?

Yes, that simplifies things.  Thanks.

https://codereview.chromium.org/2614063007/diff/60001/pkg/front_end/tool/perf...
File pkg/front_end/tool/perf.dart (right):

https://codereview.chromium.org/2614063007/diff/60001/pkg/front_end/tool/perf...
pkg/front_end/tool/perf.dart:118: ..packagesFileUri = new Uri.file('.packages')
On 2017/01/11 22:59:53, Siggi Cherem (dart-lang) wrote:
> probably doesn't matter, but another option here would be to make it absolute
> right away by doing `Uri.base.resolve('relative-path')`.

One of the goals of the FileSystem abstraction is to make it unnecessary for
client code to deal with stuff like converting paths to absolute.  So I'd prefer
to leave it as is.

Powered by Google App Engine
This is Rietveld 408576698