dart-archive / dev_compiler

DEPRECATED - Moved to main SDK
https://github.com/dart-lang/sdk/tree/master/pkg/dev_compiler
Other
133 stars 27 forks source link

Allow source files and summaries to come from anywhere #612

Closed nex3 closed 8 years ago

nex3 commented 8 years ago

Currently, all source files and module summaries must be within the build root and module root, respectively. This seems like an unnecessary limitation, and it's contrary to how other Dart implementations work.

This is blocking dart-lang/test#414. The test runner needs to synthesize an entrypoint in a temp directory, which isn't in the default build or module root. We can't even use the filesystem root, because on Windows the temp directory may be on a different drive than the Dart sources.

jmesserly commented 8 years ago

@vsmenon - would you mind taking this one? I think you're likely most familiar with the "build root" "module root" options.

@nex3 - if this is blocking, does marking it P1 sound right to you?

nex3 commented 8 years ago

@nex3 - if this is blocking, does marking it P1 sound right to you?

I'd appreciate it, yeah!

vsmenon commented 8 years ago

@nex3 The build root and module root affect the generated code - the library names and module names in the generated code.

But those could point elsewhere. E.g.,

 dart ~/git/ddc/bin/dartdevc.dart compile --library-root /Users/vsm/tmp/ -o hello.js /Users/vsm/tmp/hello.dart

Is that sufficient or are you compiling multiple Dart sources from different directories in the same compile command?

If the latter, we could allow these to be a list of paths instead. E.g., something like:

dart ~/git/ddc/bin/dartdevc.dart compile --library-root /Users/vsm/working:/Users/vsm/tmp/ -o hello.js /Users/vsm/tmp/hello.dart /Users/vsm/working/world.dart
nex3 commented 8 years ago

Is that sufficient or are you compiling multiple Dart sources from different directories in the same compile command?

I am, yeah—and in general it seems like this is a thing we should support.

If the latter, we could allow these to be a list of paths instead. E.g., something like:

dart ~/git/ddc/bin/dartdevc.dart compile --library-root /Users/vsm/working:/Users/vsm/tmp/ -o hello.js > /Users/vsm/tmp/hello.dart /Users/vsm/working/world.dart

This would work (although colon-separated reads weird to me; I'd prefer comma-separated or just being able to pass multiple --library-root flags).

How would this work if multiple sources had the same paths relative to their respective roots?

vsmenon commented 8 years ago

This would work (although colon-separated reads weird to me; I'd prefer comma-separated or just being able to pass multiple --library-root flags).

Yeah, using comma's elsewhere already.

How would this work if multiple sources had the same paths relative to their respective roots?

It could take the first match it finds (in the listed order a la PATH). Or the tightest match I suppose.

nex3 commented 8 years ago

In #619, I wrote up a description of what my preferred replacement for --module-root and --library-root would be. I think if that lands it would obviate the need for this, but it's not the only way to solve this.

vsmenon commented 8 years ago

This issue was moved to dart-lang/sdk#27264