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

Error in dub.json on ~0.5.0 branch #32

Closed
growlercab opened this Issue Mar 8, 2015 · 8 comments

Comments

Projects
None yet
2 participants
@growlercab
Contributor

growlercab commented Mar 8, 2015

When I try to build any app using Dgame 0.5.0 I get this error message:

Failed to parse package description for dgame ~0.5.0 in remote location.
Package dgame ~0.5.0 could not be loaded either locally, or from the configured package registries.
Fetching dgame ~0.5.0 (getting selected version)...
Placing dgame ~0.5.0 to $HOME/.dub/packages/...
Failed to parse package description for dgame ~0.5.0 in $HOME/.dub/packages/dgame-0.5.0.
Error executing command build:
TargetType does not have a member named 'lib'

Looking at the dub.json, the "targetType" needs to be either "sourceLibrary" or just "library" but not "lib".

@growlercab

This comment has been minimized.

Contributor

growlercab commented Mar 8, 2015

I might be all wrong about this because you're clearly building on this branch. Maybe my dub is out of date (it's Feb 17 2015)?

If so feel free to close this and I'll figure out what I'm doing wrong.

@Dgame

This comment has been minimized.

Owner

Dgame commented Mar 8, 2015

Currently, I'm using the test directory only, so it could be my fault. I will change it to 'library'.

Dgame added a commit that referenced this issue Mar 8, 2015

@Dgame

This comment has been minimized.

Owner

Dgame commented Mar 8, 2015

I believe 'library' could bring some trouble since Dgame isn't like other DUB packages; there is no src/Dgame path. If 'sourceLibrary' works better than 'library, I have to change the structure to src/Dgame.

@growlercab

This comment has been minimized.

Contributor

growlercab commented Mar 9, 2015

Thanks, I'll give it a try.

I think sourceLibrary should work OK because you have "sourcePaths":["."] in your dub.json.

@growlercab

This comment has been minimized.

Contributor

growlercab commented Mar 9, 2015

OK, the dub.json bug is now fixed but as a library target it fails because it picks up main() in test/main.d and I get this error.

../../../../.dub/packages/dgame-0.5.0/test/main.d(35): Error: only one main allowed

The fix is trivial and requires changing the "excludedSourceFiles" field in the "lib" target to:

"excludedSourceFiles": ["main.d", "test/main.d"].

Whenever you around to this is cool, 0.5.0 is WIP after all.

@Dgame

This comment has been minimized.

Owner

Dgame commented Mar 9, 2015

After tomorrow I have plenty of time. ;) But I will fix this small bug in the next hour.
How do you import Dgame if you build it as a library?

Dgame added a commit that referenced this issue Mar 9, 2015

@Dgame Dgame closed this Mar 9, 2015

@growlercab

This comment has been minimized.

Contributor

growlercab commented Mar 9, 2015

Ah, sorry my bad. When I look now I see that I had Dgame building as a sourceLibrary.

WIth the last commit and Dgame targetType as sourceLibrary I can compile and run the "tut.d" as a completely separate dub project.
(I get a run time error from Derelict about invalid fonts but that is unrelated to this issue)

Build with Dgame as a "library" target I get the import path error:

source/testdgame.d(4): Error: module Window is in file 'Dgame/Window/Window.d' which cannot be read

Sorry for the confusion. I'll also look into dub and how to get Dgame prefix to import paths for a library target. If I stumble across anything I'll let you know .

@Dgame

This comment has been minimized.

Owner

Dgame commented Mar 9, 2015

The whole test folder will disappear, so it's only a temporal fix. ;) Don't worry.

source/testdgame.d(4): Error: module Window is in file 'Dgame/Window/Window.d' which cannot be read

It's because Dgame is not built like DUB wants to. Maybe I should change it to 'source/Dgame'. DUB will automatically accept source as import path and the error should disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment