-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Could not initialize dub … for no (obvious) reason #459
Comments
problem might be |
seems so. though if I change it to library, it goes completely rogue:
Like there’s not a single mention of |
From my perception, code-d seems to come with the assumption that the main package will not be target "none" and depend on all of its subpackages. code-d does not seem to bother resolving dependencies of subpackages (unless the main package depends on them). |
code-d can find the subpackages and initialize them like the main package by searching for dub.json and dub.sdl files inside the folder, and should do so by default, did you change anything in your user settings? |
{
"d.dubCompiler": "ldc2",
"d.stdlibPath": "/opt/ldc2/import",
"d.dubPath": "/usr/bin/dub",
"d.servedPath": "/home/elias/.local/share/code-d/bin/serve-d",
"d.servedReleaseChannel": "beta",
"d.dcdClientPath": "/home/elias/.local/share/code-d/bin/dcd-client",
"d.dcdServerPath": "/home/elias/.local/share/code-d/bin/dcd-server",
} |
Fails to resolve/locate a bunch of things:
|
might be related to #458 – as it seems like code-d has no clue where modules of the subpackage are actually located |
After some severe experimenting, I came to the conclusion, that DUB and/or serve-d starts acting weird when your root package doesn’t have any source files. Weird in terms of picking up only some dependencies/subpackages/imports. |
Also it certainly doesn’t like subpackages with a target type of |
I’ve worked around all these issues by adding configurations in addition to the subpackages. |
My case is a main dub.json at root folder that serving as a collection of subpackages with source files in subfolders, they all depend on a core package with basic declarations, but everything else is implemented by other subpackages, the goal is to have single place to build which by default achieved by targetType none in the presence of subpackages. Thanks to @0xEAB for an example, as it seems code-d can't work with main dub recipe if targetType set to none, but seems to work if I remove target type and instead just add an empty configuration with targetType none. With this approach I can still build as simple as dub.json: {
"authors": [
"Superbelko"
],
"copyright": "Copyright © 2023, Superbelko",
"description": "Core game library",
"license": "proprietary",
"name": "game",
"targetPath": ".junk", // just in case some intermediate files generated, I absolutely don't want to publish them
"subPackages": [
{
"name": "core",
"sourcePaths": ["coregame/source"],
// ...
}
],
"dependencies": {
"game:core": "*"
},
"configurations": [
{
"name": "default",
"targetType": "none"
}
]
} |
Error details
dub.json
But it builds just fine:
The text was updated successfully, but these errors were encountered: