serve-d icon indicating copy to clipboard operation
serve-d copied to clipboard

Cannot use dub with invalid configuration

Open webloft opened this issue 3 years ago • 8 comments

I have a dub.sdl looking like this:

name "abc"
license "proprietary"
targetType "none"
importPaths "code"

subPackage {
    name "xyz"
    targetType "dynamicLibrary"
    targetPath "../../build/$BUILD_TYPE"
    importPaths "code"
    sourcePaths "packages/lib-common"
    versions "common"
    dflags "-i"
    copyFiles "..." platform="windows"
}
...

That file is valid, no problems running it via dub but serve-d yells about an invalid configuration without further information:

serve-d v0.7.4 with workspace-d v3.7.0
Included features: "d", "workspaces"
Built: Sat Jan  8 02:43:14 2022
...
[error] source\served\extension.d:792:delayedProjectActivation Exception starting dub: object.Exception@C:\Users\runneradmin\AppData\Local\dub\packages\workspace-d-3.7.0\workspace-d\source\workspaced\com\dub.d(242): Cannot use dub with invalid configuration

The folder code is in the same directory as dub.sdl.

webloft avatar Feb 02 '22 20:02 webloft

the targetType "none" means your package doesn't (shouldn't) have code, so it isn't loaded.

The subpackage should be loaded though when you open a file in it, and auto completion should work.

WebFreak001 avatar Feb 02 '22 20:02 WebFreak001

No, it doesn't. It only works if I change the targetType to something other. However, "none" is a valid value and should be respected.

webloft avatar Feb 02 '22 20:02 webloft

the exception is actually to prevent a harder crash that occurs when you try to use a package like this.

The root package definitely shouldn't be loaded for code editing, but the subpackage should be loaded and needs to be checked why it isn't loaded right now.

WebFreak001 avatar Feb 02 '22 20:02 WebFreak001

And If I load a common file that is used in package A and B but not within the sub-directory structure of any package, how it is supposed to load a package then? Is loading the package required to make auto-completion working? The specs says "none" is not generate an output file, nothing about there should be no code.

webloft avatar Feb 02 '22 20:02 webloft

you can't have common files in a none subpackage, use sourceLibrary instead

WebFreak001 avatar Feb 02 '22 20:02 WebFreak001

I tried that. The error disappears at startup but auto-completion works not with import. At least not for the last hour. And dcd-server stays open at exit of serve-d. I don't know if it's supposed to be re-used but it also spawns new instances.

It still logs: [error] serverbase\source\served\serverbase.d:338:__lambda2 Failed processing notification: object.Exception@C:\Users\runneradmin\AppData\Local\dub\packages\workspace-d-3.7.0\workspace-d\source\workspaced\com\dub.d(253): Cannot build with dub with targetType == sourceLibrary

webloft avatar Feb 02 '22 21:02 webloft

name "test"
targetType "none"

subPackage {
    name "mycode"
    sourcePaths "source"
    importPaths "source"
    targetType "executable"
}
dependency ":mycode" version="*"

dub builds fine, makes serve-d error though

Dub Error: No configuration available
2022-06-05T22:09:40.057 [error] extension.d:792:delayedProjectActivation Exception starting dub: [email protected]/workspace-d/source/workspaced/com/dub.d(242): Cannot use dub with invalid configuration

0xEAB avatar Jun 05 '22 20:06 0xEAB

stacktrace on latest commit:

Dub Error: No configuration available
2022-06-06T02:23:17.657 [error] extension.d:793:delayedProjectActivation Exception starting dub: object.Exception@workspace-d/source/workspaced/com/dub.d(246): Cannot use dub with invalid configuration
----------------
??:?
??:?
??:?
workspace-d/source/workspaced/com/dub.d:246
source/served/extension.d:782
source/served/extension.d:694
source/served/backend/lazy_workspaced.d:137
source/served/backend/lazy_workspaced.d:79
workspace-d/source/workspaced/backend.d:180
workspace-d/source/workspaced/backend.d:429
source/served/extension.d:168
source/served/extension.d:276
source/served/extension.d:225
serverbase/source/served/utils/events.d:136
serverbase/source/served/serverbase.d:291
serverbase/source/served/utils/events.d:150
serverbase/source/served/utils/events.d:297
serverbase/source/served/utils/events.d:121
serverbase/source/served/serverbase.d:288
serverbase/source/served/serverbase.d:334
??:?
??:?

(unspectacular, not sure what I was expecting)

0xEAB avatar Jun 06 '22 00:06 0xEAB

tracking targetType none + subPackage issue in #304 now

WebFreak001 avatar Feb 24 '23 23:02 WebFreak001