dlang / dub Goto Github PK
View Code? Open in Web Editor NEWPackage and build management system for D
License: MIT License
Package and build management system for D
License: MIT License
Using the init
sub-command without an optional <directory>
parameter does not correctly deduce the project location.
Example:
$ mkdir my_project
$ cd my_project
$ dub init
Successfully created an empty project in ''.
I think the parent directory name should be used in place of the empty string. And also in the package's name field.
Hello, I'm trying to build using dub configurations to run unittests of my library automatically when I don't specify it to be the release configuration. It picks the correct configuration, but it gives me a really odd error:
dub
Checking dependencies in '/home/isak/src/d/two.d'
Building configuration default, build type debug
Running dmd...
Error: /tmp/dub/1877056096: Directory not empty
Run 'dub help' for usage information.
My package.json looks like the following:
{
"name": "two.d",
"description": "2d game library for D",
"homepage": "https://github.com/BitPuffin/two.d",
"copyright": "Copyright © 2013, Isak Andersson ([email protected])",
"license": "Zlib",
"authors": ["Isak Andersson"],
"libs": ["dallegro5", "allegro"],
"configurations": [
{
"name": "default",
"targetType": "executable",
"dflags": ["-w", "-unittest"]
},
{
"name": "release",
"targetType": "library",
"dflags": ["-w", "-O", "-release"]
}
]
}
Is it my fault or is it an issue with dub?
Particularly for non-public libs/projects or projects needing a specific alternate fork of a dependency, DUB needs a way to specify a dependency on an arbitrary Git repo URL (Whether local, online, login-protected, etc.)
A dependency that is specified as optional is used/available only if it is manually installed. The user should get an informational message stating that these optional packages can be installed to extend the functionality of the package.
A -version=Have_...
flag will indicate at compile time which packages are available.
For 0.9.12:
$ cat package.json
{
(... snip ...)
"dependencies": {
"vibe-d": "~master"
}
}
$ dub upgrade
Upgrading project in <folder>
Triggering update of package vibe-d
Could not write .dub/dub.json.
Could not write .dub/dub.json.
The following changes could be performed:
Install vibe-d ~master, systemWide
Package vibe-d ~master (systemWide) is already installed with the latest version, skipping upgrade.
(...)
$ ls /var/lib/dub/packages/vibe-d/
0.7.13 tmp
$ sudo dub install "vibe-d" --version "~master" --system
Package vibe-d ~master (systemWide) is already installed with the latest version, skipping upgrade.
I have installed dub, and installed vibe-d as a system wide package.
I can still run the examples normally using vibe on the command line, but if try and use dub for the same purpose, I get the link error below. The temp.o file is being created.
I am running on windows 7 with dmd version 2.062.
C:\ProgramData\dub\packages\vibe-d\master\examples\daytime>dub build
Checking dependencies in 'C:\ProgramData\dub\packages\vibe-d\master\examples\daytime'
Building configuration "application", build type debug
Running dmd (compile)...
Linking...
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
LINK : fatal error LNK1181: cannot open input file 'temp.o,C:\ProgramData\dub\packages\vibe-d\master\examples\daytime\daytime-example.exe,,....\lib\win-i386\eay.lib+....\lib\win-i386\ssl.lib+....\lib\win-i386\event2.lib+wsock32.lib+ws2_32.lib/co/noi.obj'
Error: Link command failed with exit code 1181
Run 'dub help' for usage information.
.. to run code coverage.
Currently configurations implicitly reach from the bottom of the dependency hiearchy to the top. Instead only the main package's configurations should be visible to the user of the package. For that to work, there has to be a way to select the configuration of the dependencies in the build flags of package.json. Any conflicting configuration specifications should cause an error.
It would be nice if you could set the registry location at the command line. This makes it possible to use for testing purposes and private repos (good for companies).
Seems like a quick fix, but I'm not sure what you think as you haven't made that option available.
Ref. https://github.com/rejectedsoftware/dub/blob/master/source/app.d#L98
If I have the time I'll try implementing this, eventually.
Some systems have limits on number of characters supported on the command line. To avoid this limit, dmd has a method of reading the commands (files) from a file instead of the command line. This is what rdmd does to avoid issues with larger programs, and dub should too.
Currently the master branch gets some special handling. Instead, all branches should be specifyable. The upgrade procedure should also take into account the HEAD commit of the branch and not always update.
(Specifically, I am talking about https://github.com/denizzzka/dpq2 , it depends from libpq library )
I like the fact that you can let the registry automatically upgrade packages from github. Is it a lot of work to support the same for bitbucket?
I was expecting a help string to pop-up when I first ran dub:
dub.exe
There was no 'package.json' found for the application in 'D:\Apps\Dub'.
Checking dependencies in '/D:/Apps/Dub'
Building default configuration, build type debug
Running rdmd -g -debug --force --build-only -ofC:\DOCUME~1\Andrej\LOCALS~1\Temp\.rdmd\so
urce\1144519932-app.exe -w -property source\app.d
Error: cannot read file source\app.d
Failed: "dmd" "-g" "-debug" "-w" "-property" "-v" "-o-" "source\app.d" "-Isource"
Error: Build command failed with exit code 1
Run 'dub help' for usage information.
It's listed at the end, but dub should probably skip trying to build anything if nothing is found.
The generation of command line flags should be abstracted away in a Compiler
class so that alternative compilers can be supported.
vibe.d includes it's own main, and dub always build all files. If you don't want to use vibes main, you're out of luck.
See details here: aBothe/Mono-D#220 (comment)
This is regarding dub 0.9.12
Great that you print warnings for projects, but there's a couple of issues.
So rather than this:
Warning
=======
The following compiler flags have been specified in pegged's
package description file. They are handled by DUB and direct use in packages is
discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:
-wi: Managed by DUB, do not specify in package.json
-property: Managed by DUB, do not specify in package.json
Warning
=======
The following compiler flags have been specified in pegged's
package description file. They are handled by DUB and direct use in packages is
discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:
-ggdb: Call dub with --build=debug
( and it goes on and on and on .. )
I wold like something like this:
Warning [project = pegged]
=======
The following compiler flags have been specified in the projects
package description file. They are handled by DUB and direct use in packages is
discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:
-wi: Managed by DUB, do not specify in package.json
-property: Managed by DUB, do not specify in package.json
-ggdb: Call dub with --build=debug
I tried to run Hello World
example, but get this:
Log says:
Error: Program exited with code -1073741521
0.9.7 version. I added vibe-d
package as described in this comment.
[simendsjo@simendsjo-laptop tmp]$ dub init t4
Successfully created an empty project in '/home/simendsjo/code/tmp/t4'.
[simendsjo@simendsjo-laptop tmp]$ cd t4
[simendsjo@simendsjo-laptop t4]$ dub -v run
[7F71AAE21071:00000000 dbg] Using dub registry url 'http://registry.vibed.org/'
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry dyaml
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry vibe-d
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry ddox
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry pegged
[7F71AAE21071:00000000 dbg] Looking for local package map at /var/lib/dub/packages/
[7F71AAE21071:00000000 dbg] Looking for local package map at /home/simendsjo/.dub/packages/
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry dyaml
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry vibe-d
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry ddox
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry pegged
[7F71AAE21071:00000000 dbg] Looking for local package map at /var/lib/dub/packages/
[7F71AAE21071:00000000 dbg] Looking for local package map at /home/simendsjo/.dub/packages/
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry dyaml
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry vibe-d
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry ddox
[7F71AAE21071:00000000 dbg] iterating dir /var/lib/dub/packages/ entry pegged
[7F71AAE21071:00000000 dbg] Looking for local package map at /var/lib/dub/packages/
[7F71AAE21071:00000000 dbg] Looking for local package map at /home/simendsjo/.dub/packages/
[7F71AAE21071:00000000 dbg] Collecting dependencies for t4
[7F71AAE21071:00000000 INF] Checking dependencies in '/home/simendsjo/code/tmp/t4'
[7F71AAE21071:00000000 dbg] dub initialized
[7F71AAE21071:00000000 dbg] Generating using build
[7F71AAE21071:00000000 dbg] Using config application for t4
[7F71AAE21071:00000000 INF] Building configuration application, build type debug
[7F71AAE21071:00000000 dbg] Application output name is '/tmp/dub/1389674440/t4'
[7F71AAE21071:00000000 dbg] Trying to use pkg-config to resolve library flags for [].
[7F71AAE21071:00000000 dbg] pkg-config failed: pkg-config exited with error code 1
[7F71AAE21071:00000000 dbg] Falling back to direct -lxyz flags.
[7F71AAE21071:00000000 INF] Running dmd...
[7F71AAE21071:00000000 dbg] dmd -w -g -debug -of/tmp/dub/1389674440/t4 -I/home/simendsjo/code/tmp/t4/source -J/home/simendsjo/code/tmp/t4/views source/app.d
[7F71AAE21071:00000000 dbg] Running /tmp/dub/1389674440/t4...
Edit source/app.d to start your project.
[7F71AAE21071:00000000 ERR] Error: /tmp/dub/1389674440: Directory not empty
[7F71AAE21071:00000000 dbg] Full exception: std.file.FileException@std/file.d(1318): /tmp/dub/1389674440: Directory not empty
----------------
dub(void std.file.rmdir(const(char[]))+0x64) [0x62ef5c]
dub(void dub.generators.build.BuildGenerator.generateProject(dub.generators.generator.GeneratorSettings)+0x11e6) [0x557cae]
dub(void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings)+0xa7) [0x607eab]
dub(_Dmain+0x17a7) [0x547a7b]
dub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x18) [0x612880]
dub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x6123be]
dub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()+0x3b) [0x6128c7]
dub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x6123be]
dub(_d_run_main+0x1a8) [0x612378]
dub(main+0x17) [0x6121cb]
/usr/lib/libc.so.6(__libc_start_main+0xf5) [0x7f71aa035a15]
[7F71AAE21071:00000000 INF] Run 'dub help' for usage information.
Uninstalling currently only works during "dub upgrade", but should also be available as a manual command line action.
This module would contain the version of all dependencies to make it possible to have compile time decisions based on versions (e.g. for improved backwards compatibility). It could also contain the path of each used package so that their "public" (or "resources") folder can be accessed (or rather, they know where their own "public/" folder is).
targetName seems to not change the name of the output. Example can be found here:
SiegeLord/DAllegro5#13
Many command line switches, such as -of, -unittest, -debug etc. are managed by dub and should not occur directly in the package description. This should be detected and a message stating the alternative fields or dub command line switches that can be used to achieve the desired effect.
I have a project specifying "vibe-d": "~master" an a dependency.
When I try to dub upgrade
this project, it just states I'm "up to date" even if my vibe master install if from feb 27.
Is it possible to remove this?
.. As the "-of" dub adds overrides the user supplied.
.. To allow installing system packages.
$ dub install "vibe-d" --version "~master" --system
There was no 'package.json' found for the application in 'blah'
import std.stdio;
void main()
{
writeln("Edit source/app.d to start your project.");
}
dub build
produces following error:
.dub\packages\vibe-d\source\vibe\appmain.d(36): Error: only one main/WinMain/DllMain allowed
Error: Build command failed with exit code 1
May be better to replace this code with Hello World
example?
I think this could be useful in many cases, particularly when dealing with unstable or pre-1.0 stuff.
It would be very helpful during development to be able specify, on DUB's command line, compiler switches to be added/removed, without having to edit package.json and then remember to revert the changes.
See SiegeLord/DAllegro5#13. Building a static library currently uses the same separate compile/link steps as for normal builds. It should just use -lib
instead and drop the linking stage.
Tools will often expand ~ to your home folder. Trying to reference the package directory will then expand to something like this:
/usr/lib/dub/packages/vibe-d//home/simendsjo/master/source
An automatically generated package signature that is checked in to the repository would make it possible to detect malicious modification of security relevant packages.
A signed git tag would serve a similar purpose, so if git would be elevated to the one-and-only SCM, maybe this could also be employed somehow.
It can be very useful to map e.g. {"vibe.d": "~master"}
to a local git workspace where vibe.d master has been cloned when working on the dependency in the context of another project. This would probably be a user or system wide configuration setting.
$ dub install ddox --system
Package ddox 0.9.8 (systemWide) is already installed with the latest version, skipping upgrade.
$ dub --build=ddox
Checking dependencies in '/home/simendsjo/code/tmp/cli'
Building configuration application, build type ddox
Running dmd...
DDOX in /var/lib/dub/packages/ddox/0.9.8 is not built, performing build now.
Error: Invliad configuration "" for ddox
I couldn't find any option to set the output type of a package. It always builds the package_name.exe. If not yet done, would be nice to have the direction defined, so that somebody could implement it.
Seems like "dub upgrade" always installs locally even if a package is installed with --system. Should dub just create a symlink to the system package instead of downloading and installing locally if a system package exsits?
A central folder (e.g. ~/.dub/modules or /usr/local/share/modules) should be used to store and manage dependencies, with possibly multiple versions of each package. This would reduce the amount of disk space, time and download bandwith used when many projects share dependencies.
Sometimes this is necessary due to OPTLINK terminations, strange linker errors or out-of-memory errors during the build.
ddox 0.9.9 isn't visible in the registry yet. The error message is a bit cryptic though.
$ sudo dub install ddox --version="0.9.9" --system
Error: Trying to access JSON field of type Undefined as Json[string].
I tried to run Hello World
example, but get this:
Log says:
Error: Program exited with code -1073741521
0.9.7 version. I added vibe-d
package as described in this comment.
d:\sigod\dev\app>dub init
Successfully created an empty project in ''.
d:\sigod\dev\app>dub install --verbose vibe-d
[02750F80:00000000 dbg] Using dub registry url 'http://registry.vibed.org/'
[02750F80:00000000 dbg] Looking for local package map at C:\ProgramData\dub\packages\
[02750F80:00000000 dbg] Looking for local package map at C:\Users\sigod\AppData\Roaming\dub\packages\
[02750F80:00000000 dbg] creating new HttpClient connection, all 0 are in use
[02750F80:00000000 dbg] ... 2753640
[02750F80:00000000 dbg] Now got 1 connections
[02750F80:00000000 dbg] dnsresolve
[02750F80:00000000 dbg] dnsresolve yield
[02750F80:00000000 dbg] dnsresolve ret 0
[02750F80:00000000 dbg] Socket event on fd 432: 128 (375A94 vs 375A94)
[02750F80:00000000 dbg] Create FreeListAlloc 8
[02750F80:00000000 dbg] Create FreeListAlloc 16
[02750F80:00000000 dbg] Create FreeListAlloc 32
[02750F80:00000000 dbg] Create FreeListAlloc 64
[02750F80:00000000 dbg] Create FreeListAlloc 128
[02750F80:00000000 dbg] Create FreeListAlloc 256
[02750F80:00000000 dbg] Create FreeListAlloc 512
[02750F80:00000000 dbg] Create FreeListAlloc 1024
[02750F80:00000000 dbg] Create FreeListAlloc 2048
[02750F80:00000000 dbg] Create FreeListAlloc 65540
[02750F80:00000000 dbg] Warning: dropping unread body.
[02750F80:00000000 INF] Installing vibe-d 0.7.12...
[02750F80:00000000 dbg] Aquiring package zip file
[02750F80:00000000 dbg] Found download URL: 'http://registry.vibed.org/packages/vibe-d/0.7.12.zip'
[02750F80:00000000 dbg] dnsresolve
[02750F80:00000000 dbg] dnsresolve yield
[02750F80:00000000 dbg] dnsresolve ret 0
[02750F80:00000000 dbg] Socket event on fd 436: 128 (8F12A4 vs 8F12A4)
[02750F80:00000000 dbg] Redirect to 'https://github.com/rejectedsoftware/vibe.d/archive/v0.7.12.zip'
[02750F80:00000000 dbg] Warning: dropping unread body.
[02750F80:00000000 dbg] dnsresolve
[02750F80:00000000 dbg] dnsresolve yield
[02750F80:00000000 dbg] dnsresolve ret 0
[02750F80:00000000 dbg] Socket event on fd 484: 128 (8F16C4 vs 8F16C4)
[02750F80:00000000 dbg] Redirect to 'https://nodeload.github.com/rejectedsoftware/vibe.d/zip/v0.7.12'
[02750F80:00000000 dbg] Warning: dropping unread body.
[02750F80:00000000 dbg] dnsresolve
[02750F80:00000000 dbg] dnsresolve yield
[02750F80:00000000 dbg] dnsresolve ret 0
[02750F80:00000000 dbg] Socket event on fd 472: 128 (8F1A44 vs 8F1A44)
[02750F80:00000000 dbg] opened file C:\Users\sigod\AppData\Local\Temp\dub-download-vibe-d-0.7.12.zip with 0 bytes as 3
[02750F80:00000000 dbg] Warning: dropping unread body.
[02750F80:00000000 dbg] opened file C:\Users\sigod\AppData\Local\Temp\dub-download-vibe-d-0.7.12.zip with 1765985 bytes as 3
And then nothing happens. Windows Task Manager shows that dub.exe *32
uses 13% CPU.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.