Thread overview
DUB: can I fully control the output file name?
Aug 09, 2016
timepp
Aug 09, 2016
rikki cattermole
Aug 10, 2016
lobo
Aug 10, 2016
lobo
August 09, 2016
I'm writing a Total Commander plugin, which has the "wdx" file extension, so I wish to let dub generate xxx.wdx directly but not xxx.dll.

How can I write my file to achieve this goal?

---

my dub.json:


{
    "name": "tckeyex",
    "targetType": "dynamicLibrary",
    "description": "A minimal D application.",
    "copyright": "Copyright 2016, idtong",
    "authors": ["idtong"],
    "sourceFiles": ["source/app.def"],
    "dependencies": {
        "wind": { "path": "thirdparty/wind" }
    }
}


and my build script:

@echo off

call makeversion.bat

dub build -b release
copy /y tckeyex.dll tckeyex.wdx

dub build -b release -a x86_64
copy /y tckeyex.dll tckeyex.wdx64
August 09, 2016
On 09/08/2016 8:49 PM, timepp wrote:
> I'm writing a Total Commander plugin, which has the "wdx" file
> extension, so I wish to let dub generate xxx.wdx directly but not xxx.dll.
>
> How can I write my file to achieve this goal?
>
> ---
>
> my dub.json:
>
>
> {
>     "name": "tckeyex",
>     "targetType": "dynamicLibrary",
>     "description": "A minimal D application.",
>     "copyright": "Copyright 2016, idtong",
>     "authors": ["idtong"],
>     "sourceFiles": ["source/app.def"],
>     "dependencies": {
>         "wind": { "path": "thirdparty/wind" }
>     }
> }
>
>
> and my build script:
>
> @echo off
>
> call makeversion.bat
>
> dub build -b release
> copy /y tckeyex.dll tckeyex.wdx
>
> dub build -b release -a x86_64
> copy /y tckeyex.dll tckeyex.wdx64

Sadly you can't set the extension, just the name.
I'm afraid you're stuck with postBuildCommands to change it.
August 10, 2016
On Tuesday, 9 August 2016 at 08:49:43 UTC, timepp wrote:
> I'm writing a Total Commander plugin, which has the "wdx" file extension, so I wish to let dub generate xxx.wdx directly but not xxx.dll.
>
> How can I write my file to achieve this goal?
>
> ---
>
> my dub.json:
>
>
> {
>     "name": "tckeyex",
>     "targetType": "dynamicLibrary",
>     "description": "A minimal D application.",
>     "copyright": "Copyright 2016, idtong",
>     "authors": ["idtong"],
>     "sourceFiles": ["source/app.def"],
>     "dependencies": {
>         "wind": { "path": "thirdparty/wind" }
>     }
> }
>
>
> and my build script:
>
> @echo off
>
> call makeversion.bat
>
> dub build -b release
> copy /y tckeyex.dll tckeyex.wdx
>
> dub build -b release -a x86_64
> copy /y tckeyex.dll tckeyex.wdx64

Have you tried "targetName":"tckeyex.wdx" ?

To get a different name for 32/64 bit you may require a configuration for each and run

$ dub build -cx86 release
$ dub build -cx86_64 release

in your dub you'd have something like:

"configuration":"x86" {
  "targetName":"tcleyex.wdx"
}

"configuration":"x86_64" {
  "targetName":"tcleyex.wdx64"
}

Sorry I'm in a hurry and cannot remember the exact dub syntax but this approach is working OK for me on Linux & BSD.

I have not tried this on Windows

bye,
lobo
August 10, 2016
On Wednesday, 10 August 2016 at 00:27:44 UTC, lobo wrote:
> On Tuesday, 9 August 2016 at 08:49:43 UTC, timepp wrote:
>> [...]
>
> Have you tried "targetName":"tckeyex.wdx" ?
>
> To get a different name for 32/64 bit you may require a configuration for each and run
>
> $ dub build -cx86 release
> $ dub build -cx86_64 release
>
> in your dub you'd have something like:
>
> "configuration":"x86" {
>   "targetName":"tcleyex.wdx"
> }
>
> "configuration":"x86_64" {
>   "targetName":"tcleyex.wdx64"
> }
>
> Sorry I'm in a hurry and cannot remember the exact dub syntax but this approach is working OK for me on Linux & BSD.
>
> I have not tried this on Windows
>
> bye,
> lobo

Rikki's right the extension doesn't change on windows for targetName. The postBuildCommands is pretty trivial though:

"postBuildCommands:"copy /y tckeyex.dll tckeyex.wdx64"

(again, not sure on the correct dub JSON format)