RejectedSoftware Forums

Sign up

files generated by preBuildCommands not included in build

I wanted to use preBuildCommands to generate some .d files to add to my project, but dub doesn't include those files in the build. You have to build the project a second time. I don't see a good reason for this behavior, so I'd argue it's a bug. preGenerateCommands has the same limitation.

Re: files generated by preBuildCommands not included in build

Am 22.03.2018 um 22:36 schrieb Luís Marques:

I wanted to use preBuildCommands to generate some .d files to add to my project, but dub doesn't include those files in the build. You have to build the project a second time. I don't see a good reason for this behavior, so I'd argue it's a bug. preGenerateCommands has the same limitation.

The case of preGenerateCommands can definitely be argued, but
preBuildCommands are simply executing in a logical step after the
build description has already assembled. This can be best seen when
generating a VisualD or CMake project. The commands will still be run as
part of the build, but the list of files has long been generated at that
point, and DUB is not in the game anymore.

However, as long as the generated file name is known, it can simply be
added explicitly with sourceFiles. There should be no missing file
errors, as long as it is present just before the compiler gets invoked.

Re: files generated by preBuildCommands not included in build

On Tue, 27 Mar 2018 15:40:28 +0200, Sönke Ludwig wrote:

The case of preGenerateCommands can definitely be argued, but
preBuildCommands are simply executing in a logical step after the
build description has already assembled. This can be best seen when
generating a VisualD or CMake project. The commands will still be run as
part of the build, but the list of files has long been generated at that
point, and DUB is not in the game anymore.

The documentation on what "build" and "generate" are is minimal, so I was left to guess what they meant. For instance: "A list of shell commands that is executed always before the project is built". For me a straightforward interpretation of that is 1) it executes the commands and; 2) does a dub build. Therefore, the dub build would include any files generated by the commands.

However, as long as the generated file name is known, it can simply be
added explicitly with sourceFiles. There should be no missing file
errors, as long as it is present just before the compiler gets invoked.

That's really inconvenient. IMO there should be a way to run commands that allows the generated files to be included in the build. If that is preGenerateCommands that's fine by me.