-
-
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
[REG] $PACKAGE_DIR broken for sourceLibrary
packages.
#2229
Comments
hm according to the dub documentation the $PACKAGE_DIR shouldn't exist in commands at all:
|
I have been using The documentation you referenced doesn't speak with confidence to me: the first two sections start with exactly the same words, "Inside of build setting values..." so what is the difference between those sections? The custom command directives are in the Build Settings table and in those two sections there is nothing that says that the commands are excluded. It is only the prelude to the last table that says "different set", so one has to read past the information that says you can use the variable in commands to learn that you can't. I just checked and that sentence used to read as "Inside of custom commands directives a number of additional variables is available:" (emphasis added). It was changed by @pbackus in dlang/dub-docs@58d8fa3. If we decide that the variables in the first two tables really should not be used in command directives then they should not be defined for them at all, and an error should be produced if you try to use them like that. And, this should be announced in big letters in the changelog, IMO. I just hope I am the only one that runs into this problem... |
I don't think I can. If you have commands in a
I honestly think |
this seems not easy to fix without introducing an issue of environment variables mismatching with the direct substitution variables, which was also an issue before. I think it would be possible to store variables along with the commands, but I'm currently still looking into how well that would fit into the dub architecture. An alternative would be substituting the variables before execution at build/generate time, but there environment variables on execution are lost. |
Understood. Variables are quite flaky. Dub 1.27.0 also has the issue that for a I think the main reason why I need It is a shame that recipes that needed strange constructions to make them work will break when you try to fix things. Maybe Dub 2.0 is needed? Thank you for your clean-up efforts! |
Since #2217 made it into D 2.100.0, this has turned into a blocker for us, meaning we are stuck at 2.099 :-( If this issue cannot be resolved, and dlang/dub-docs#26 indeed reflects the intended design, then the corresponding variables must be undefined, so they won't be used with wrong values. And, in order to make Can we please get a discussion going of how we are going to move forward? |
I would recommend bringing this up at beerconf if it is not fixed soon. |
Note that I am not alone in using |
the variables work, just not under |
Then dlang/dub-docs#26 should be reverted, no? |
yes |
I don't think so. I've looked at this a bit more thoroughly. Here is the code that handles PACKAGE_DIR https://github.com/WebFreak001/dub/blob/fa8186cd317e7dbce1e5e7233bd15d2a33cad7f7/source/dub/project.d#L1421 It's in a weird spot. I think the variable substitution needs its own module. Split into early and late substitutions. Most substitutions should occur where they do so now. |
I have updated code on that and reworked the architecture of that to be more sane, it's just missing the final few pieces to complete, but I can push it already and make a draft PR |
Environment variables are now consistent with custom command variables and are properly substituted at command run time to match with the recipe variables. Additionally this fixes issue dlang#2229 where sourceLibrary variables would get expanded later with wrong package dir, etc.
Needed to circumvent the regression as documented here: dlang/dub#2229
I would really appreciate if this regression can be fixed before the next release. It is holding us back from compiler upgrades. |
@WebFreak001 @Geod24 This is the issue Bastiaan brought to us in the January meeting. Any chance on getting this to the finish line soon? |
Environment variables are now consistent with custom command variables and are properly substituted at command run time to match with the recipe variables. Additionally this fixes issue dlang#2229 where sourceLibrary variables would get expanded later with wrong package dir, etc.
Environment variables are now consistent with custom command variables and are properly substituted at command run time to match with the recipe variables. Additionally this fixes issue dlang#2229 where sourceLibrary variables would get expanded later with wrong package dir, etc.
things of concern right now:
current workarounds:
variable naming rules:
We need to be discussing a better solution here I think. The approach in my rework PR there also does not feel like it's the most scalable one. Things we need to take into account with the variables:
One idea I have right now, which I haven't investigated too much yet, how we could change here is that we introduce a new
|
I have been thinking more about the environment variables and think something like the special scoped syntax is something that we could greatly benefit from in the future. In the meantime, @veelo did using |
Thank you for this suggestion, that might work. I changed it into a dummy (ordinary) library a while ago, to get on: #2251 (comment) I'll let you know when I find time to try this out. |
System information
Bug Description
Since cb290e1 in #2217
$PACKAGE_DIR
insidepreBuildCommands
of asourceLibrary
dependency returns the name of the package that has the dependency, not the name that is in thedub.json
.How to reproduce?
sub1\source\app.d
:sub1\dub.json
:sub2\dub.json
:This produces the following output:
Expected Behavior
This should be the output:
The text was updated successfully, but these errors were encountered: