April 26, 2022
On Wed, Apr 27, 2022 at 07:23:16AM +1200, rikki cattermole via Digitalmars-d wrote:
> 
> On 27/04/2022 7:15 AM, Alexandru Ermicioi wrote:
> > On Tuesday, 26 April 2022 at 18:47:44 UTC, H. S. Teoh wrote:
> > > Well, so it looks like the time is ripe to break dub out of its original limitations and extend its scope to other languages. (And other build-like tasks, in general. ;-))
> > 
> > Would be nice if it will use plugin based arch, so that even currently supported features could be extracted into plugins, just like gradle or maven if you're from java world, and be easy for the public to add additional custom functionality as plugins to it without messing the internals.

Totally.  A plugin-based system like gradle would work.


> Right now shared library support is simply not at the level required to do this.
[...]

But why does a plugin system need to be based on shared libraries?

Why not expand dub's DSL to be able to encode the kind of functionality needed to write external plugins, then rewrite existing functionality in terms of that DSL as a plugin?  Then others can also write plugins in the same DSL, and you wouldn't need to recompile dub just to add a plugin.  Just download the plugin description file into some standard dub directory, and dub would pick it up upon startup.

It's really not that complex.  At the core of it, dub has two main functions:

1) Package management.
2) Building packages.

I don't think (1) needs to be touched; aside from some performance optimizations and usage streamlining, dub does a decent enough job already; the core logic doesn't need to be changed.

For (2), currently there's a lot of hard-coded functionality that's
specific to D. But at the core of it, it essentially boils down to a
build graph consisting of sources (currently D source files) and targets
(currently D executables / libaries) as nodes, and commands that
transform sources into targets (currently invocations of the D compiler)
as edges.

All that's needed is to factor out this underlying build graph structure and make it a generic build graph resolution system, and rephrasing the D-specific parts in terms of this generic code in a built-in plugin. Then expose external interfaces for specifying build graph nodes and edges to external plugins.


T

-- 
GEEK = Gatherer of Extremely Enlightening Knowledge
April 26, 2022
On Tuesday, 26 April 2022 at 17:19:24 UTC, H. S. Teoh wrote:
> Can dub handle building multiple executables from different subsets of source files in the same source tree?

Yes, you can define them as subpackages in the config. See my terminal emulator for example:

https://github.com/adamdruppe/terminal-emulator/blob/master/dub.json

dub run adr-terminalemulator:mactabs

for example.

The makefile is in many ways simpler though

https://github.com/adamdruppe/terminal-emulator/blob/master/Makefile

(and that makefile precedes dmd -i, which is how i'd do it now)

April 26, 2022
On Tue, Apr 26, 2022 at 04:29:54PM -0400, Steven Schveighoffer via Digitalmars-d wrote: [...]
> Dub needs to play friendly with artifacts from other build systems. I have run into headaches with using other non-D projects also. But it doesn't have to play friendly with alternatives to building D code IMO.
> 
> But if you can all find a way to build dub projects in a way that's usable outside building with dub (e.g. `dub --produce-makefile` or whatnot), that's fine by me. Just don't make me change how I build my projects.
[...]

I'm really tempted to create a build tool that parses dub.sdl, et al, in the source tree and maps them internally to its own representation that replicates dub's actions, so existing dub projects would Just Work(tm), while exposing a different interface for more advanced use cases. Or perhaps extend dub.sdl for that purpose.


T

-- 
Never step over a puddle, always step around it. Chances are that whatever made it is still dripping.
April 27, 2022
On 27/04/2022 8:41 AM, H. S. Teoh wrote:
> On Tue, Apr 26, 2022 at 04:29:54PM -0400, Steven Schveighoffer via Digitalmars-d wrote:
> [...]
>> Dub needs to play friendly with artifacts from other build systems. I
>> have run into headaches with using other non-D projects also. But it
>> doesn't have to play friendly with alternatives to building D code
>> IMO.
>>
>> But if you can all find a way to build dub projects in a way that's
>> usable outside building with dub (e.g. `dub --produce-makefile` or
>> whatnot), that's fine by me. Just don't make me change how I build my
>> projects.
> [...]
> 
> I'm really tempted to create a build tool that parses dub.sdl, et al, in
> the source tree and maps them internally to its own representation that
> replicates dub's actions, so existing dub projects would Just Work(tm),
> while exposing a different interface for more advanced use cases. Or
> perhaps extend dub.sdl for that purpose.

Don't parse the files themselves.

Use $(dub describe) instead.

Note: dub is capable of generating for other build systems including make.
April 27, 2022
On 27/04/2022 8:52 AM, rikki cattermole wrote:
> Note: dub is capable of generating for other build systems including make.

Okay looks like it doesn't support make (oops).

What it does support:

visuald - VisualD project files
sublimetext - SublimeText project file
cmake - CMake build scripts
build - Builds the package directly
April 26, 2022

On Tuesday, 26 April 2022 at 20:29:54 UTC, Steven Schveighoffer wrote:

>

No amount of ImportC is going to encompass building all existing C projects.

Yes, I of course agree with this, but one could make it a goal to only require thin shims that require minimal amounts of maintenance. If you only require thin shims then some sort of collaborative effort could go a long way to keep it up to date (e.g. you create a partial shim for your project and I improve on it when I need it).

It does require some organizing efforts though.

>

But if you can all find a way to build dub projects in a way that's usable outside building with dub (e.g. dub --produce-makefile or whatnot), that's fine by me. Just don't make me change how I build my projects.

Ok, but the question is what the official strategy ought to be. Should official strategy be to roll-your-own (Dub etc), or should it be to build on what others have created.

Where do you get more bangs for the bucks? By pouring resources into your own corner of the universe or by enhancing an existing system to have solid D support (e.g. Conan, Cmake etc).

There is a marketing issue too. For newbies, Dub and "idiomatic" packages might be the best option. If you want to win over experienced developers, maybe Cmake/Conan or some other comparable setup focusing on brining in existing frameworks would be more convincing.

What is the target audience? People who want to stay in their own corner of the universe and build something unique and easy to use, or people who want to engage with the larger software field?

April 26, 2022
On Wed, Apr 27, 2022 at 08:52:06AM +1200, rikki cattermole via Digitalmars-d wrote:
> 
> On 27/04/2022 8:41 AM, H. S. Teoh wrote:
[...]
> > I'm really tempted to create a build tool that parses dub.sdl, et al, in the source tree and maps them internally to its own representation that replicates dub's actions, so existing dub projects would Just Work(tm), while exposing a different interface for more advanced use cases. Or perhaps extend dub.sdl for that purpose.
> 
> Don't parse the files themselves.
> 
> Use $(dub describe) instead.
[...]

I know `dub describe` can do it, but the point is for said tool to run on a dub project with zero additional effort from the user, and to do so even if dub is absent.  So even non-dub users can use dub packages directly.


T

-- 
It is not the employer who pays the wages. Employers only handle the money. It is the customer who pays the wages. -- Henry Ford
April 26, 2022

On Tuesday, 26 April 2022 at 19:29:31 UTC, Steven Schveighoffer wrote:

>

The solution is not to bring everyone down to your misery though. "If I can't have a good experience with what I want, nobody should" isn't the right answer.

-Steve

I'm not bringing anyone anywhere. You want to use make? Good. cmake/ninja? Good. Scons? Good. A custom build script? Good.

I really don't what you use.

I DO care about dub because dub doesn't provide me with a good way to work with it without dubifying everything.

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™.

April 26, 2022

On Tuesday, 26 April 2022 at 19:27:38 UTC, Ola Fosheim Grøstad wrote:

>

If the official strategy is to mix D with other languages then that has to be reflected in the official strategy for building the eco system.

Or change the strategy.

Ding ding ding!

April 26, 2022
On Tue, Apr 26, 2022 at 09:38:31PM +0000, deadalnix via Digitalmars-d wrote: [...]
> I *DO* care about dub because dub doesn't provide me with a good way to work with it without dubifying everything.
> 
> 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.
[...]

What dub needs is a way to integrate with other build systems that doesn't require "dubifying" everything turtles all the way down.

For the first time today, I decided to read the dub package format docs all the way from top to bottom without skipping anything.  I've thought of a few ideas of how the configuration file may be extended in a non-intrusive way to allow for better integration with other build tools.  I'm going to mull over it some more and then post some of my ideas.

We're gonna bust open this walled garden into something that plays nicer with its neighbours.


T

-- 
"The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts." -- Bertrand Russell. "How come he didn't put 'I think' at the end of it?" -- Anonymous