On Monday, 4 November 2019 at 13:37:47 UTC, Sebastiaan Koppe wrote:
Does anyone know a reliable way of having a dub package that contains git submodules and is to be used as a dependency?

I am looking for a way to ensure the submodules are initialised before a build.

You can use the "preGenerateCommands" to launch the adequate git commands. The submodule needs to be indicated using the "path" property :

"preGenerateCommands" : ["git submodule update --init --recursive"],
      "dependencies" : {
        "theGitSubModule" : {
          "path" : "./theGitSubModulePath"
        },

I have done this before and while it worked I had to "dub build" twice because the project needed to be read a second time to discover new source files generated by the commands.

There's a PR that is supposed to fix that: https://github.com/dlang/dub/pull/1708 But more likely at some point git submodules will be supported natively.

Reply via email to