factor out config.sh script to update config files (VERSION, SYSCONFDIR)#7036
factor out config.sh script to update config files (VERSION, SYSCONFDIR)#7036dlang-bot merged 1 commit intodlang:masterfrom
Conversation
MartinNowak
commented
Jul 26, 2017
- use generated/dub as string import path for copied/generated config files
|
Thanks for your pull request, @MartinNowak! 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. |
|
FYI @jacob-carlborg |
9868a72 to
7ca9c4c
Compare
|
Could we first focus on re-enabling the Travis test? |
| // https://github.com/dlang/dub/issues/1199 | ||
| dflags "-J$PACKAGE_DIR" | ||
| preGenerateCommands "\"$${DUB_PACKAGE_DIR}config.sh\" \"$${DUB_PACKAGE_DIR}generated/dub\" VERSION /etc" | ||
| stringImportPaths "generated/dub" |
There was a problem hiding this comment.
Will this work when building a package that has DMD as a dependency? I had problems with this before, that's why I switch from -J. to -J$PACKAGE_DIR.
There was a problem hiding this comment.
Well there is a difference between passing raw paths directly to dmd and telling dub which subfolder to use in a package. And yes it will work since dub knows how to deal with relative paths for the latter.
There was a problem hiding this comment.
Aha, ok. Using . does not work (at least not in this project). But other paths seem work.
There was a problem hiding this comment.
No, . does exactly what you want.
I'm seeing a small issues with non-absolute arguments to dub --root=dmd build :lexer where dub tries to relate two relative paths.
There was a problem hiding this comment.
No, . does exactly what you want.
I don't know how, but I got this error Invalid variable: DFLAGS when using a dot .. As you can see in dlang/dub#1199. For some reason I don't get this error anymore today 😕.
dub.sdl
Outdated
| // stringImportPaths cannot be used because it will make Dub extremely slow | ||
| // https://github.com/dlang/dub/issues/1199 | ||
| dflags "-J$PACKAGE_DIR" | ||
| preGenerateCommands "\"$${DUB_PACKAGE_DIR}config.sh\" \"$${DUB_PACKAGE_DIR}generated/dub\" VERSION /etc" |
There was a problem hiding this comment.
You can use backticks instead of quotes to avoid the need to escape the quotes.
dub.sdl
Outdated
| // stringImportPaths cannot be used because it will make Dub extremely slow | ||
| // https://github.com/dlang/dub/issues/1199 | ||
| dflags "-J$PACKAGE_DIR" | ||
| preGenerateCommands "\"$${DUB_PACKAGE_DIR}config.sh\" \"$${DUB_PACKAGE_DIR}generated/dub\" VERSION /etc" |
There was a problem hiding this comment.
Interesting, you're using one of the few undocumented environment variables 😃.
There was a problem hiding this comment.
It's not documented, but quite accessible to anyone invoking env and using git grep (or just searching the project).
https://github.com/dlang/dub/blob/dafdc47d690c63d074e1b9ed57349fe2eaaabd2b/source/dub/generators/generator.d#L480-L519
There was a problem hiding this comment.
How about you update the documentation https://github.com/dlang/dub-registry/blob/7f4f2300b93d7ebfce06d1989ca4c1a4a1758c79/views/inc.package_format.envvars.dt ;)?
13674bc to
ab4a410
Compare
config.sh
Outdated
| @@ -0,0 +1,15 @@ | |||
| #/bin/sh | |||
There was a problem hiding this comment.
Missing the bang !.
There was a problem hiding this comment.
Interesting that it still worked when being invoked from make and dub.
There was a problem hiding this comment.
Yeah, but not from the shell. I got some really cryptic error message.
| @@ -0,0 +1,15 @@ | |||
| #/bin/sh | |||
|
|
|||
There was a problem hiding this comment.
Add some error handling, like set -e.
- use generated/dub as string import path for copied/generated config files
ab4a410 to
09cc628
Compare
|
LGTM 👌. |