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
DUB_PACKAGE/DUB_PACKAGE_DIR is wrong for (pre|post)BuildCommands #658
Comments
Oh, I see what's going on. DUB combines all (pre|post)BuildCommands into one big (pre|post)BuildCommands list (well, one "pre" and one "post") as part of the BuildSettings for the root package. Then it makes one call to I'm not sure what to do about that. |
This makes sense b/c building many small libraries is just one strategy, another one would be to build everything at once. |
Regardless of why BuildCommands should or shouldn't be batched together, DUB_PACKAGE/DUB_PACKAGE_DIR still need to be correct. Currently, they are often incorrect. |
I'm trying to use $DUB_PACKAGE in both preGenerateCommands and preBuildCommands, but in both places, I get this error:
I have this in a library project:
When I build this library directly, the above command runs fine. If I use the same project as a dependency, get an error because dub tries to run that command in the directory of the dependant project.
Paths in dub.json should not change meaning depending on whether the project is compiled directly or as a dependency. |
Within (pre|post)BuildCommands, the DUB_PACKAGE/DUB_PACKAGE_DIR envvars are set to the root package instead of the current package. But they do work correctly within (pre|post)GenerateCommands.
The cause appears to be
BuildGenerator.buildTarget()
,BuildGenerator.performCachedBuild()
andBuildGenerator.performDirectBuild()
passing the wrongPackage
intorunBuildCommands()
. Still looking into this further.The text was updated successfully, but these errors were encountered: