-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'dub describe --data=' #572
Conversation
…nd --data=lib-files (for dependency libs) This is needed because compilers/linkers often expect the two types of libs to be passed in differently: System/installed libs (--data=libs) must be provided like "-Lname" which the linker automatically converts to "path/lib*.a". Non-installed libs, such as dub dependencies, are passed with full filepath just like an object file. Your linker may vary.
…ectly for a compiler's commandline. Use --data-format=list to get the old list-style output.
Pinging, just to point out that automatically formatting for the requested (or default) compiler is now included in this PR. |
Working example: $ cd /home/nick/proj/dub
$ dub describe --data=main-source-file --data=options \
--data=versions --data=import-paths
'/home/nick/proj/dub/source/app.d' -debug -g -w -version=DubUseCurl -version=Have_dub '-I/home/nick/proj/dub/source/'
$ dub describe --compiler=ldc --data=options --data=versions
-d-debug -g -w -oq -od=.dub/obj -oq -od=.dub/obj -d-version=DubUseCurl -d-version=Have_dub
$ dub describe --data-list --data=options --data=versions
debugMode
debugInfo
warningsAsErrors
DubUseCurl
Have_dub |
…rary or a staticLibrary, then --data=libs never emits any output.
Example of CSV feature: $ dub describe --data=options,versions
-debug -g -w -version=DubUseCurl -version=Have_dub
$ dub describe '--data=options, versions'
-debug -g -w -version=DubUseCurl -version=Have_dub |
Didn't make it yesterday due to sickness. Generally looks good AFAICT. These are the things that caught my eye:
|
I'll have a look at the failing Travis-CI build later, so that the refactor1 branch passes and this can be rebased. |
I agree, --data=linker-files sounds more useful, and more in line with my intent. Will fix.
Sounds good. Will fix.
I would've thought that a
But sticking with existing dub convention is probably better regardless. Will fix. |
Nevermind, I see what you mean now. BTW, |
Actually, I still need to use build(Normalized)Path because I'm relying on it's ability to do this:
Ie, an absolute path automatically overrides any prefixes, which is very handy. But I am changing Also, due to the |
Okay, I'm just gonna trust you on the |
Interesting point. Essentially this. I don't think it matters in this PR because absolute paths need to be supported regardless. More generally though, it's an interesting point. My gut feeling is that if you're trying to restrict directory paths, you really should be enforcing that at the "output" end anyway, after all path operations (ie, when you're actually using the resulting path) rather than purely relying on intermediate path operations to maintain the desired restrictions. But I guess that's a topic for a separate forum. |
Unfortunately, Should I adjust |
I just re-read this part. I think this is somewhat of an issue. CLI users (ie, users of |
Another interesting thing may be the possible distinction between source files of different languages. My current plan is to support language selection in a per-package basis*, so "sourceFiles" and an additional "language" field would already be sufficient (as opposed to separate "dFiles", "cppFiles" etc.). So my proposal is to generally split up the Maybe it makes most sense at this point to already model the * Any arguments for or against this approach or other proposals would be very welcome at this point. The other obvious alternative would be to offer separate "dFiles"/"cppFiles"/... fields, but that would not be compatible with most IDE project representations and would complicate the implementation of any "generator", as well as any tool that currently uses the "dub describe" output. |
I completely agree with moving the linker files out of I don't have a problem with |
With the one language per package approach, also each "target" would be comprised of files of single programming language, so with the current approach to list only the build settings of the root target, it would still result in a uniform list of source files (the external script/tool would just have to test the output of A propos targets - we'll also need a |
Right. That's pretty much why I'm fine leaving it up as as "meh, we can wait and see if it even ends up needed at all" instead of actually doing a As per your suggestions, I'll remove the
I'm not sure I understand your
By "targets" do you mean a package's dependencies? What would be the need of BTW, speaking of future enhancements: After this all gets merged into master, I'd like to expand on the changes in my #593 PR by utilizing all this work for |
No my idea was to have a "language" field in the package description that just defaults to "D". So you'd always have to specify the language and DUB would just stupidly pass all source files to the corresponding compiler, regardless of their extension.
Target means a binary target (.lib/.exe/.so/..). Usually a target corresponds to a package, but multiple packages may be combined into a single target when
Sounds good. This is one of the things I always wanted to do but never got around to. |
Ok, done. Ready for another round of reviewing. |
I would just have left |
Not sure what you mean, can you clarify?
Note that Supporting |
I mean the
Yeah right, it's just that this has the risk of introducing code that fails in various places (i.e. someone adds code that adds to |
They get added right here, in
Ahh, I see. I can prep a PR for that once this one gets merged. |
I mean linker files that are defined directly within the package description as source files (e.g. |
Oh, ok I see. I wasn't aware of that possibility as I haven't needed to do that yet. Now fixed.
Fixed. |
LGTM |
I'll open a PR for the refactor1 branch now. |
Expands on the recent
dub describe --[string-]import-paths
by adding a generalizeddub describe --data=...
which supports all fields of BuildSettings, not just importPaths and stringImportPaths. Multiple --data= flags can be used in one invocation of dub, and the results will be in the order requested on the cmd line.This was discussed in #562. The "recursive vs non-recursive" distinction turned out to be both unnecessary and a bad approach, so that aspect was omitted here.
I'll add optional alternate output formatting (ie, theThis PR includes the ability to automatically format for --data output for the default compiler, or the compiler specified by--format=(dmd|list)
, or possibly using--compiler=
, described in #562) in a separate pull request.--compiler
. This is the default behavior for--data
.If
--data-list
is used, then instead of formatting the output for a particular compiler, all data will be output line-by-line (just like--[string-]import-paths
) and each set of--data=
items will be separated by a blank line. Note that not all --data= fields are directly accepted by compilers (such as "pre-build-commands" or "working-directory"), so these fields are only allowed when using--data-list
.This pull replaces the defunct #566.
As discussed in #562, I'm considering reusing --compiler= instead of introducing --data-format=. The "list" mode could simply be enabled with a separate flag like --list-format. Actually, I'll likely do that within the next day or two.Now done.