April 28, 2022

On Wednesday, 27 April 2022 at 23:22:23 UTC, norm wrote:

>

Afaik vckg is tied to CMake so if you want to use GNU make it may require some wrangling.

I am no expert on build systems, make does what I need most of the time, but CMake is becoming the de facto standard in the C/C++ world and displacing other autoconfig solutions, so I am not sure if there is another viable path that is future proof?

I understand the ease-of-use argument for Dub and pure D projects. The problem is that small languages are more likely to be incorporated as part of a multi-language project and then dealing with many different package/build systems become a liability and not an advantage. You might end up being forced to embed the Dub source into your project… and that is just way too clunky. It is not the kind of resistance you want people to face when evaluating language options.

So you got me thinking that you are onto something with your initial comment about Conan. Since it is possible to set up private servers for Conan and vcpkg, I would assume that one could fork either one of those and create a D version that also access the central C/C++ hub. Then lobby for the D version to be merged into upstream over time, that would give you full integration with C/C++ build strategies…

People could still use Dub, what you want is some sort of "syndication" solution so that Dub converts Dub packages and uploads them to other systems. (Kinda like blogging solutions that allows you to publish the same message to Twitter, Facebook, SMS and your own website at the push of one button).

April 28, 2022

On Thursday, 28 April 2022 at 08:21:41 UTC, FeepingCreature wrote:

>

On Tuesday, 26 April 2022 at 21:38:31 UTC, deadalnix wrote:

>

See I lead a project that uses cmake/ninja. It has dependencies using autotools, cmake, qmake, and even some that uses their own thing. None of that causes any significant problems.

But dub don't just want to build the thing or do dependency management. Dub is the true way to enlightenment. You have to do it all the dub way or be in a world of pain.

All I'm asking is that you sub guy recognize for other the same thing as you are now requesting for yourself: don't impose a way of doing things on me because it is the one true way™.

We use a non-dub build flow. But integrating dub packages work fine. We just grab dub.selections.json, and run dub build for every dependency, then grab the library path from dub describe and add it into our DMD build command. I don't understand why people say dub is all-or-nothing.

I think the problem is that he's providing his stuff to the dub ecosystem, not integrating other packages from it, forcing him to use dub's versioning scheme and build system since dub insists on being the package manager and build system both for any library that wants to get published on code.dlang.org

I may be wrong though

April 28, 2022
On Wednesday, 27 April 2022 at 14:37:35 UTC, H. S. Teoh wrote:
>> Dub is more like maven from java world. I.e. it uses declarative approach to define a project and how to build it.
>
> Why can't a plugin DSL be declarative too?

It can, I was just thinking that dub is more like maven in java world, and for some reason was thinking that you'd extend config syntax to plugins (which is wrong).

It would be worth to check if existing language can be employed instead of custom dsl. It should lessen the need of maintenance then. Perhaps interpreter for D, or javascript?

>> Code based config build systems in D are more like gradle, since gradle dsl is just plain groovy with some ast macros.
> [...]
>
> IMO, it's better to have a declarative language for writing plugins, so that you do not have to recompile dub to install a plugin.

That's where shared library jumps in, to avoid dub recompilation.
The idea is that dub once seeing that a project requires plugin x, will download it from official repo, and load it and let it run at right events. This though, means shared lib use should be without hiccups in D.

If shared lib hiccups are not fixed or avoided in dub, then following can be done for a plugin based system:
1. Complete recompile of dub for each project combination of plugins, in order to run them.
2. Some form of microservices where each plugin is a standalone process.
3. Use of a interpreted language, declarative or imperative (your proposal).

Personally I'd prefer plugins as shared libs, and a well defined api for dub core through which plugins could interact and perform their job, while for configuration being done through existing sdl and json formats.

It would still be interesting to see what you can come up with custom DSL :)


April 28, 2022
On Thu, Apr 28, 2022 at 10:06:37PM +0000, Alexandru Ermicioi via Digitalmars-d wrote:
> On Wednesday, 27 April 2022 at 14:37:35 UTC, H. S. Teoh wrote:
> > > Dub is more like maven from java world. I.e. it uses declarative approach to define a project and how to build it.
> > 
> > Why can't a plugin DSL be declarative too?
> 
> It can, I was just thinking that dub is more like maven in java world, and for some reason was thinking that you'd extend config syntax to plugins (which is wrong).

Config syntax could be extended in such a way that plugins use a different subtree in the config.


> It would be worth to check if existing language can be employed instead of custom dsl. It should lessen the need of maintenance then. Perhaps interpreter for D, or javascript?

I don't like the idea of an embedded interpreter. If you really need code-based plugins, might as well just use dynamic libraries, or build the core primitives into dub and expose some kind of external declarative API for it.


[...]
> > IMO, it's better to have a declarative language for writing plugins, so that you do not have to recompile dub to install a plugin.
> 
> That's where shared library jumps in, to avoid dub recompilation. The idea is that dub once seeing that a project requires plugin x, will download it from official repo, and load it and let it run at right events.  This though, means shared lib use should be without hiccups in D.

I don't like the idea of using binary plugins for several reasons.

First, do we *really* need code-based plugins?  If the user really, absolutely needs a programmatic way to express what he wants (and I have my doubts about this), why can't we expose, say, some hooks that he can run shell scripts (or full-fledged D programs if he insists) from?

Second, we will have to precompile and distribute plugins per platform, which adds maintenance burden on our already thin manpower.

Third, we will need some kind of cryptographic signature mechanism for ensuring the authenticity of plugins (we don't want dub to be the vehicle for a security exploit by, e.g., a MITM attack that replaces plugin code with malicious code).

Fourth, ongoing maintenance will be much harder than a declarative DSL for plugins because of Turing completeness.  It will also be harder to tell what exactly a plugin is doing. Anyone could write a dub plugin that does who-knows-what when you run it. A declarative plugin is much easier to review and understand/maintain.


> If shared lib hiccups are not fixed or avoided in dub, then following
> can be done for a plugin based system:
> 1. Complete recompile of dub for each project combination of plugins,
> in order to run them.

Or use a DSL and avoid recompilation / cross-platform / security issues altogether. ;-)


> 2. Some form of microservices where each plugin is a standalone process.

I think this is total overkill. At least for the initial plan of making dub support non-D builds.


> 3. Use of a interpreted language, declarative or imperative (your
> proposal).
[...]

Actually, my proposal is far less ambitious than an interpreted language. :-D  The main idea is to refactor dub into some generic primitives for dependency resolution / building, and use config directives to customize these primitives such that they do the right thing for non-D builds.

I may be a little too optimistic here, though. :-D


T

-- 
My program has no bugs! Only undocumented features...
April 29, 2022

On Thursday, 28 April 2022 at 08:21:41 UTC, FeepingCreature wrote:

>

On Tuesday, 26 April 2022 at 21:38:31 UTC, deadalnix wrote:

We use a non-dub build flow. But integrating dub packages work fine. We just grab dub.selections.json, and run dub build for every dependency, then grab the library path from dub describe and add it into our DMD build command. I don't understand why people say dub is all-or-nothing.

Do you do this for every build or per compiler? dub describe doesn't work that well if you use multiple compilers.

April 30, 2022
On 30/04/2022 12:52 AM, Tobias Pankrath wrote:
> Do you do this for every build or per compiler? `dub describe` doesn't work that well if you use multiple compilers.

How can ``dub describe`` be improved for multiple compilers?
April 29, 2022
On Friday, 29 April 2022 at 16:33:57 UTC, rikki cattermole wrote:
>
> On 30/04/2022 12:52 AM, Tobias Pankrath wrote:
>> Do you do this for every build or per compiler? `dub describe` doesn't work that well if you use multiple compilers.
>
> How can ``dub describe`` be improved for multiple compilers?

`dub describe` specifically should provide paths to the actual artifacts
instead of the symlinked locations, which are the same for all
build configurations.

While integrating it with nix, I have wished for:

1. Better control over where dub places and searches for stuff, although `HOME=. dub ..` works.

2. A way to just download a projects and all it's dependencies and place it somewhere.

3. That dub describe points to the actual build artifacts instead of symlinked locations
used by differnet locations.

If you look at the dub integration code of meson, 3/4 of it is finding stuff that dub is supposed to have already built after it parsed the output of `dub describe`.


April 30, 2022
On 30/04/2022 4:50 AM, Tobias Pankrath wrote:
> On Friday, 29 April 2022 at 16:33:57 UTC, rikki cattermole wrote:
>>
>> On 30/04/2022 12:52 AM, Tobias Pankrath wrote:
>>> Do you do this for every build or per compiler? `dub describe` doesn't work that well if you use multiple compilers.
>>
>> How can ``dub describe`` be improved for multiple compilers?
> 
> `dub describe` specifically should provide paths to the actual artifacts
> instead of the symlinked locations, which are the same for all
> build configurations.
> 
> While integrating it with nix, I have wished for:
> 
> 1. Better control over where dub places and searches for stuff, although `HOME=. dub ..` works.
> 
> 2. A way to just download a projects and all it's dependencies and place it somewhere.

$ dub fetch vibelog --cache=local
$ dub build vibelog --cache=local

That'll do it, but you shouldn't need to build to do all the dependencies...

https://github.com/dlang/dub/issues/1930

Okay so:

$ dub describe vibelog --cache=local

Will also do the job.

> 3. That dub describe points to the actual build artifacts instead of symlinked locations
> used by differnet locations.

targetPath	string	The destination path of the output binary - this setting does not support platform suffixes

That needs to support platform suffixes for what you are wanting.
Describe would just follow suit.

On Windows the artifacts are copied not symlinked. So the paths are correct (even if not desirable).
April 29, 2022
On Friday, 29 April 2022 at 17:02:55 UTC, rikki cattermole wrote:
> On 30/04/2022 4:50 AM, Tobias Pankrath wrote:
>> On Friday, 29 April 2022 at 16:33:57 UTC, rikki cattermole wrote:
>>>
>>> On 30/04/2022 12:52 AM, Tobias Pankrath wrote:
>>>> Do you do this for every build or per compiler? `dub describe` doesn't work that well if you use multiple compilers.
>>>
>>> How can ``dub describe`` be improved for multiple compilers?
>> 
>> `dub describe` specifically should provide paths to the actual artifacts
>> instead of the symlinked locations, which are the same for all
>> build configurations.
>> 
>> While integrating it with nix, I have wished for:
>> 
>> 1. Better control over where dub places and searches for stuff, although `HOME=. dub ..` works.
>> 
>> 2. A way to just download a projects and all it's dependencies and place it somewhere.
>
> $ dub fetch vibelog --cache=local
> $ dub build vibelog --cache=local

That doesn't really work, you need `HOME=.`.

> That'll do it, but you shouldn't need to build to do all the dependencies...
>
> https://github.com/dlang/dub/issues/1930

I've started a PR for that some years ago, but gave up https://github.com/dlang/dub/pull/1898

> Okay so:
>
> $ dub describe vibelog --cache=local
>
> Will also do the job.
>
>> 3. That dub describe points to the actual build artifacts instead of symlinked locations
>> used by differnet locations.
>
> targetPath	string	The destination path of the output binary - this setting does not support platform suffixes
>
> That needs to support platform suffixes for what you are wanting.
> Describe would just follow suit.
>
> On Windows the artifacts are copied not symlinked. So the paths are correct (even if not desirable).

That doesn't change the issue that `dub describe --compiler=ldc` says that a file it at <path/to/file>, but then you do `dub build --compiler=dmd` and suddenly <path/to/file> is something different.


May 02, 2022

On Tuesday, 26 April 2022 at 01:21:58 UTC, Mike Parker wrote:

>

On Monday, 25 April 2022 at 20:12:19 UTC, deadalnix wrote:

>

The least power for the job definitively implies not inserting a build system in the package manager.

I'm posting in reply to deadalnix, but my comments are not directed at him specifically.

dub exists because it filled a huge, gaping hole in the D ecosystem.

Go back far enough and you'll find "build", later renamed "bud", by Derek Parnell. This was the first D build tool the community rallied around. Several D users adopted it.

https://www.digitalmars.com/d/archives/digitalmars/D/40914.html

Gregor Richards wasn't happy with bud, so he created "Rebuild" as an alternative build tool, but added a package manager on top of it called "DSSS" (D Shared Software System). Rebuild actually parsed source files looking for custom pragmas, and IIRC DSSS could install packages from multiple locations (svn, git, etc). Several D libraries users adopted it.

https://forum.dlang.org/thread/f06hsi$ng1$2@digitalmars.com

So let me tell you, this sounds but it was also a serious PITA as a library maintainer. You had the bud crowd demanding support for bud, the dsss crowd demanding support for dsss, and the crowd who refused to use either because make was good enough. At one point I had three platform-specific make files, a dsss.conf, and a forbud.txt (I eventually replaced some of that with a buildme.d file).

There was no standard way of building D projects, and it sucked. Then Derek and Gregor disappeared, and suddenly these build systems everyone is using are no longer supported. No one takes them over, so we're in the Dark Ages again. Then dub comes along and saves the day.

It caught on quickly. Then people start thinking: "What happens if Sönke disappears? This should be an official D thing." So dub gets added to the installation. And here we are.

Without dub, we would not have the ecosystem that we do have. Personally, I love it. It makes using dependencies a snap. I'm happy with the default source tree expectations, and I don't mind compiling C libraries separately when I need them.

But I understand that no everyone is going to be happy with it (I don't understand the level of hatred some people direct at it, but I just chalk it up as "they aren't happy with it" and move on).

The question is, what exactly is dub missing and how can it be improved? Which perceived shortcomings are reasonable to address and which are not? And assuming we can answer those questions, who is going to address them?

dub misses a good tutorial and good example files for different scenarios. I tried to integrate it in my C project (granted, which is very oddly structured). I managed to get quite far but the issue was that I had to check a lot of projects on github to see examples of different options. One thing for example I didn't manage to get to work correctly was to specify separate directory for the object files (in the C project we have debug and optimized builds and to avoid rebuilding each time, the .o files are in their own directory). dub always put them where it did the linking. I'm sure dub allows to set it up somehow but the documentation is very unclear on that.