Thread overview
dub run subPackage by default
Sep 01, 2020
ParticlePeter
Sep 01, 2020
Andre Pany
Sep 01, 2020
ParticlePeter
Sep 02, 2020
Andre Pany
September 01, 2020
Hello,

I have a targetType sourceLibrary and demonstrate its usage through a subPackage. For the library itself 'dub run' is meaningless, but not for the subPackage.
Is there a way to tell dub through dub.sdl or dub.json to build and run a specific subPackage by default, without having to call:
'dub run mySourceLib:myPackage' ?

Why do I want this? Because I use Sublime Text build systems to execute a dub build/run. As far as I can see I would have to set up a build version for any package:subPackeg combination.

- PP
September 01, 2020
On Tuesday, 1 September 2020 at 11:45:34 UTC, ParticlePeter wrote:
> Hello,
>
> I have a targetType sourceLibrary and demonstrate its usage through a subPackage. For the library itself 'dub run' is meaningless, but not for the subPackage.
> Is there a way to tell dub through dub.sdl or dub.json to build and run a specific subPackage by default, without having to call:
> 'dub run mySourceLib:myPackage' ?
>
> Why do I want this? Because I use Sublime Text build systems to execute a dub build/run. As far as I can see I would have to set up a build version for any package:subPackeg combination.
>
> - PP

I have a enhancement for dub in my mind, which would also solve your issue. Similiar to setup.py in python you would be able to define an entry point in dub.json.
"entryPoints": {"foo":"subPackageName"}

Command `dub install mypackage` would create a batch file/bash script with name foo containing the command `dub run mypackage:subPackageName -- %*`.

Unfortunately I do not have any time to work on this.

Kind regards
Andre
September 01, 2020
On Tuesday, 1 September 2020 at 14:45:43 UTC, Andre Pany wrote:
> On Tuesday, 1 September 2020 at 11:45:34 UTC, ParticlePeter wrote:
[snip]
>
> I have a enhancement for dub in my mind, which would also solve your issue. Similiar to setup.py in python you would be able to define an entry point in dub.json.
> "entryPoints": {"foo":"subPackageName"}
>
> Command `dub install mypackage` would create a batch file/bash script with name foo containing the command `dub run mypackage:subPackageName -- %*`.
>
> Unfortunately I do not have any time to work on this.
>
> Kind regards
> Andre

So, I take it that such a feature does not exist already.
Your suggestion sounds nice, but why do you think it would be necessary to go through a batch file or script? I think it should be possible from within dub, to feed the chosen compiler backend with the proper commands to either build or run the appropriate entryPoint.

- PP
September 02, 2020
On Tuesday, 1 September 2020 at 19:38:39 UTC, ParticlePeter wrote:
> On Tuesday, 1 September 2020 at 14:45:43 UTC, Andre Pany wrote:
>> On Tuesday, 1 September 2020 at 11:45:34 UTC, ParticlePeter wrote:
> [snip]
>>
>> I have a enhancement for dub in my mind, which would also solve your issue. Similiar to setup.py in python you would be able to define an entry point in dub.json.
>> "entryPoints": {"foo":"subPackageName"}
>>
>> Command `dub install mypackage` would create a batch file/bash script with name foo containing the command `dub run mypackage:subPackageName -- %*`.
>>
>> Unfortunately I do not have any time to work on this.
>>
>> Kind regards
>> Andre
>
> So, I take it that such a feature does not exist already.
> Your suggestion sounds nice, but why do you think it would be necessary to go through a batch file or script? I think it should be possible from within dub, to feed the chosen compiler backend with the proper commands to either build or run the appropriate entryPoint.
>
> - PP

The idea is, you add the folder containing the bash / batch files to your PATH environment variable. By executing e.g. `dub install dscanner` you can now execute in your shell/terminal `dscanner`.

Kind regards
Andre