-
Notifications
You must be signed in to change notification settings - Fork 39
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
Please update dub package #24
Comments
Yep, good stuff, but maybe someone more familiar with writing dub configs could do it. What needs to be updated in the dub config? |
I think you just need to change the import path to |
@MartinNowak @Paxa I updated |
I tried setting |
Hi Vladimir, If you create a new subdirectory 'ae' and move:
Plus these changes to sub.sdl diff --git a/dub.sdl b/dub.sdl
index 3975006..40edbe9 100644
--- a/dub.sdl
+++ b/dub.sdl
@@ -3,55 +3,55 @@ description "CyberShadow's ArmageddonEngine utilites for almost everything"
authors "Vladimir Panteleev <[email protected]>"
homepage "https://github.com/CyberShadow/ae"
license "MPL-2.0"
-targetType "sourceLibrary"
+targetType "library"
---------------------------
# The main package has no special dependencies.
-sourcePaths "sys" "utils" "net"
-importPaths "sys" "utils" "net"
+sourcePaths "ae/sys" "ae/utils" "ae/net"
+importPaths "."
# In ae:sqlite
-excludedSourceFiles "sys/sqlite3.d"
-excludedSourceFiles "sys/persistence/keyvalue.d"
+excludedSourceFiles "ae/sys/sqlite3.d"
+excludedSourceFiles "ae/sys/persistence/keyvalue.d"
# In ae:openssl
-excludedSourceFiles "net/ssl/openssl.d"
-excludedSourceFiles "sys/net/system.d"
+excludedSourceFiles "ae/net/ssl/openssl.d"
+excludedSourceFiles "ae/sys/net/system.d"
# In ae:sdl2
-excludedSourceFiles "utils/graphics/sdl2image.d"
+excludedSourceFiles "ae/utils/graphics/sdl2image.d"
# Needs SDL
-excludedSourceFiles "utils/graphics/sdlimage.d"
+excludedSourceFiles "ae/utils/graphics/sdlimage.d"
# Needs X11
-excludedSourceFiles "sys/sendinput.d"
+excludedSourceFiles "ae/sys/sendinput.d"
# In ae:windows
-excludedSourceFiles "sys/windows/pe/package.d"
-excludedSourceFiles "sys/windows/pe/pe.d"
-excludedSourceFiles "sys/windows/pe/resources.d"
-excludedSourceFiles "sys/windows/pe/versioninfo.d"
+excludedSourceFiles "ae/sys/windows/pe/package.d"
+excludedSourceFiles "ae/sys/windows/pe/pe.d"
+excludedSourceFiles "ae/sys/windows/pe/resources.d"
+excludedSourceFiles "ae/sys/windows/pe/versioninfo.d"
# Triggers on import
-excludedSourceFiles "sys/benchmark.d"
+excludedSourceFiles "ae/sys/benchmark.d"
# Deprecated
-excludedSourceFiles "sys/vfs_curl.d"
-excludedSourceFiles "utils/meta/misc.d"
+excludedSourceFiles "ae/sys/vfs_curl.d"
+excludedSourceFiles "ae/utils/meta/misc.d"
# Triggers on import
-excludedSourceFiles "sys/benchmak.d"
+excludedSourceFiles "ae/sys/benchmak.d"
# Requires non-standard compiler features
-excludedSourceFiles "utils/alloc.d"
-excludedSourceFiles "utils/container/hashtable.d"
-excludedSourceFiles "utils/container/list.d"
-excludedSourceFiles "utils/container/package.d"
-excludedSourceFiles "utils/serialization/*.d"
-excludedSourceFiles "utils/xmldom.d"
+excludedSourceFiles "ae/utils/alloc.d"
+excludedSourceFiles "ae/utils/container/hashtable.d"
+excludedSourceFiles "ae/utils/container/list.d"
+excludedSourceFiles "ae/utils/container/package.d"
+excludedSourceFiles "ae/utils/serialization/*.d"
+excludedSourceFiles "ae/utils/xmldom.d"
---------------------------
Then everything should still work (even without the side-effect you were experiencing with importPaths ".." on your local system). Added benefit, ae is now exported as a library instead of a sourceLibrary. So when I import/include ae into my project and run the unittests, it will only run my local unittests and not include ae unittests as well. If you would like a pull request for this change, just let me know. The change should not have a negative side effect when ae is used by another project (either via git clone or dub dependency), as far as i can tell. It does however fix the targetType "library" and gitsubmodule issues. |
Sorry, that's out of the question - it would break using |
The importpaths ".." method would work for everyone else, but only require a change on your local system. Another option would be to create a link/shortcut "./ae/ -> ." (pretty ugly), which would be similary to include a git submodule for on subdirectory "./ae". Your original dub.sdl can remain and would only need this change: Unrelated: |
Well, okay, but I really don't want to work around a Dub deficiency in such an ugly way as to break the convention I use for my machines.
Unfortunately symlinks are still an issue on Windows.
Not sure what this would achieve.
I think there was at least one other. |
True
It would replicate the symlink situation where 'ae' is available in the root directory from the perspective of the dub.sdl. And replicates the intended use of 'ae' via git submodule. I would however separate the dub.sdl (root directory) and 'ae' as a git submodule (yuck):
All the potential solutions are messy and ugly. Not sure if any of this was any help (Sorry). Other projects like dfmt and libdpart don't seem to have this problem. I guess this has to do with them using 'src' or 'source' from the beginning. |
The root of the problem is that Dub is not a very good build tool. D is designed with a module system from the very beginning, and its module system is designed to map to a filesystem hierarchy: one file is one module, and one directory is one package. The correct way to build D programs is to discover dependencies through module imports, and map the module names to filesystem paths through the directory include list. This is the approach used by rdmd and the new Dub eschews all that and uses dumb globbing. The result is bloated binaries containing irrelevant code, slower than necessary build times, and problems like those seen here. Essentially, I really don't think that library authors need to bend over backwards to satisfy a broken design. Let's please fix Dub instead. |
Now that dub-0.9.25 will be compatible with packages used as gitsubmodules, it's time to update the dub config and tag a new release :).
dlang/dub#735
The text was updated successfully, but these errors were encountered: