-
-
Notifications
You must be signed in to change notification settings - Fork 668
Add ddoc for -i #7777
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 ddoc for -i #7777
Conversation
|
Thanks for your pull request and interest in making D better, @marler8997! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
src/dmd/cli.d
Outdated
| Option("i=[-]<pattern>,[-]<pattern>,...", | ||
| "include/exclude imported modules whose name matches one of <pattern>" | ||
| "include/exclude imported modules whose name matches one of <pattern>", | ||
| `this option enables "include import" mode, where the compiler will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the dlang.org script will capitalize the first word automatically, I think it's still good to do here too (to avoid confusion etc.).
src/dmd/cli.d
Outdated
| Determining which modules to include is based on a set of "module patterns". | ||
| These patterns are optionally included after the "-i=" option as a comma | ||
| separated list. A pattern matches any module whose fully qualified name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double whitespace
src/dmd/cli.d
Outdated
| "foo.bar" would not match a module named "foo.barx". | ||
| The presence of the "-" prefix in a module pattern indicates that matching-modules | ||
| should be excluded from compilation. Patterns without this indicate that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double ws
src/dmd/cli.d
Outdated
| want to override this behavior, they can use the special "." pattern to "include by | ||
| default" or "-." to "exclude by default". | ||
| Note: multiple "-i=..." options is allowed, each one just adds more patterns.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid "just" as it colloquial.
src/dmd/cli.d
Outdated
| on the command line. | ||
| Determining which modules to include is based on a set of "module patterns". | ||
| These patterns are optionally included after the "-i=" option as a comma |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using a delimited string and use back-ticks for command line things like -i=?
src/dmd/cli.d
Outdated
| Note that along with the module patterns given by the user, there is a standard | ||
| set of exclusionary module patterns that are always used, namely: | ||
| "-std,-core,-etc,-object" | ||
| Note that these can be overriden (i.e. -i=std,core,etc,object). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double "Note", maybe "However" ?
src/dmd/cli.d
Outdated
| Note that these can be overriden (i.e. -i=std,core,etc,object). | ||
| Since module patterns can either be inclusionary or exclusionary, a priority | ||
| must be established to handle the case where a module matches multiple patterns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think typically the motivation for a feature isn't stated in its CLI docs.
@ others agree or disagree?
src/dmd/cli.d
Outdated
| should be excluded from compilation. Patterns without this indicate that | ||
| matching-modules should be included in compilation. | ||
| Note that along with the module patterns given by the user, there is a standard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The style of addressing the user as "the user" is completely new and doesn't appear anywhere at https://dlang.org/dmd.html
I think sth. like this would fit better with the existing style:
The standard set of exclusionary module patterns is "-std,-core,-etc,-object" and can be overridden with i.e. -i=std,core,etc,object).
src/dmd/cli.d
Outdated
| by default. However, if at least one "inclusionary" module pattern is given, then | ||
| modules that don't match any pattern will be excluded by default. Should the user | ||
| want to override this behavior, they can use the special "." pattern to "include by | ||
| default" or "-." to "exclude by default". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph is a bit too complicated for what it tries to tell. How about:
By default modules that don't match any pattern will be included.
However, if at least one inclusionary module pattern is given, then modules that don't match any pattern will be excluded.
This can be overridden by-i=-.(exclude by default) or-i=.(include by default).
|
Oh and congrats to submitting 7777 🍀 🥇 |
f3e8ee0 to
b241573
Compare
src/dmd/cli.d
Outdated
| "include/exclude imported modules whose name matches one of <pattern>" | ||
| "include/exclude imported modules whose name matches one of <pattern>", | ||
| q"{$(P Enables "include imports" mode, where the compiler will include imported | ||
| modules in the compilation, as if they were given on the command line.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as if they were given on the command line
there seems to be subtle differences: are these a feature or a bug? should they be documented here?
main.d:
import foo.fun;
foo/fun.d:
dmd -i -o- main.d
#ok
dmd -o- main.d foo/fun.d
Error: module fun from file foo/fun.d must be imported with 'import fun;'
NOTE: if we add module foo.fun; to foo/fun.d the problem goes away
NOTE: if we add module asdf.fun; to foo/fun.d, dmd -i accepts the code but should not. This one is a clear bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix here: #7778
src/dmd/cli.d
Outdated
| "include/exclude imported modules whose name matches one of <pattern>", | ||
| q"{$(P Enables "include imports" mode, where the compiler will include imported | ||
| modules in the compilation, as if they were given on the command line.) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another subtle difference, again not clear if feature or bug but should be documented: behavior is different with -op with and without -i
dmd -od=generated -op -c -Ifoo foo/fun1.d foo/bar/fun4.d foo/main.d
dmd -od=generated_i -op -c -i -Ifoo foo/main.d
foo/main.d: void main(){import bar.fun4; import fun1;}
foo/fun1.d:
foo/bar/fun4.d:module bar.fun4;
├── generated
│ └── foo
│ ├── bar
│ │ └── fun4.o
│ ├── fun1.o
│ └── main.o
├── generated_i
│ ├── bar
│ │ └── fun4.o
│ ├── foo
│ │ └── main.o
│ └── fun1.o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah looks like a bug, I"ll see if I can fix this one
timotheecour
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bugs or features? need doc
5c80d51 to
71fe41e
Compare
wilzbach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still a bit of an inconsistency between backticks and quotes which I assume to look a bit weird on the rendered docs, apart from that it looks really good. Thanks!
src/dmd/cli.d
Outdated
| These patterns are optionally included after `-i=` as a comma separated list. | ||
| A pattern matches any module whose fully qualified name starts with the pattern. | ||
| The pattern "foo.bar" matches all modules in the `foo.bar` package, such as | ||
| "foo.bar" itself, "foo.bar.baz" or even "foo.bar.package". Note that each component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you escape package names below, I would do it here too for the sake of consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was attempting to escape package names, but not module patterns...there are other places in the help where module patterns are quoted, but I thought that package names themselves should definitely be escaped. looking at the final generated docs will likely indicate which method looks the best.
src/dmd/cli.d
Outdated
| $(P The presence of the "-" prefix in a module pattern indicates that matching-modules | ||
| should be excluded from compilation. Patterns without this indicate that | ||
| matching-modules should be included in compilation.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why so you use a hyphen here?
src/dmd/cli.d
Outdated
| $(P Along with the module patterns supplied, there is a standard set of exclusionary | ||
| patterns that are always included: | ||
| "-std,-core,-etc,-object" | ||
| Note that these can be overriden (i.e. -i=std,core,etc,object).) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency: use backticks
src/dmd/cli.d
Outdated
| $(P Along with the module patterns supplied, there is a standard set of exclusionary | ||
| patterns that are always included: | ||
| "-std,-core,-etc,-object" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use backticks for CLI arguments above.
71fe41e to
606eb8c
Compare
|
@wilzbach Why isn't this showing up in DAutoTest's rendered docs? |
|
I think we're waiting on this: dlang/dlang.org#2068 |
606eb8c to
a7461f5
Compare
|
As dlang/dlang.org#2068 is in, I rebased this PR to restart DAutoTest. |
|
Hmmm, the |
|
Yeah I think it's the comma. I think the dlang.org generator needs to be modified to handle commas in the |
a7461f5 to
90c4b8a
Compare
|
Looks like dlang/dlang.org#2188 did the trick. This PR should be ready for merge. |
src/dmd/cli.d
Outdated
| $(P Along with the module patterns supplied, there is a standard set of exclusionary | ||
| patterns that are always included: | ||
| `-std,-core,-etc,-object` | ||
| Note that these can be overriden (i.e. `-i=std,core,etc,object`).) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wilzbach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM module nits.
e960b7a to
baf1586
Compare
|
Wait for #7857 before merging this one. If that one gets accepted then it will change this one a bit. |
baf1586 to
874361b
Compare
|
Walter has merged #7857 so I've reworded this one a bit... |
src/dmd/cli.d
Outdated
| be excluded. This behavior can be overriden by usig `-i=.` to include by default or `-i=-.` to | ||
| exclude by default.) | ||
| $(P Note that multiple `-i=...` options are allowed, each one adds more patterns.)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about: each one adds a pattern?
Though, I think now you can even remove this last paragraph completely as you have a few examples of multiple arguments in the paragraphs before.
src/dmd/cli.d
Outdated
| $(P The default behavior of excluding druntime/phobos is accomplished by internally adding a | ||
| set of standard exclusions, namely, `-i=-std -i=-core -i=-etc -i=-object`. Note that these | ||
| can be overriden with `-i=std -i=core -i=etc -i=object`.) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file 'dmd/cli.d' contains trailing whitespace at line 329
faf1e78 to
3bf4958
Compare
|
It looks like this is causing the semaphore failure:
I don't understand why this wasn't caught by the test suite in #7342. Furthermore, that block of code is in a I don't understand. |
|
Are you sure that's the cause of the failure? It looks like it was a unit test failure in |
Sorry, maybe my mistake. I was looking at the |
| The option -i by itself is equivalent to: | ||
|
|
||
| $(CONSOLE dmd -i=-std,-core,-etc,-object) | ||
| $(CONSOLE dmd -i=-std -i=-core -i=-etc -i=-object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need to cherry-pick this to stable.
3bf4958 to
988c7ce
Compare

No description provided.