www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to pre build vibe-d dub package

reply Andre Pany <andre s-e-a-p.de> writes:
Hi,

I have a docker image in which a vibe-d application is build from 
source code. Every time a file is changed, unfortunately the 
whole vibe-d dub packages are retrieved again from dub registry 
and compiled again (which takes ages).

In my app.json I have these dependency declaration:
``` json
"dependencies": {
     "vibe-d:core": "0.9.0-alpha.5",
     "vibe-d:http": "0.9.0-alpha.5",
     "vibe-d:tls": "0.9.0-alpha.5"
},
"subConfigurations": {
     "vibe-d:tls": "notls"
},
```

and it would be great if could do s.th. like
RUN dub build vibe-d -y --override-config=vibe-d/notls
to fetch and prebuild the dub package. Therefore, if a file
is changed, only the application itself is compiled
but it just not works. It does not build all dependencies of 
vibe-d and
also notls is ignored. I tried a lot of variations but nothing 
has the effect
I need.

My workaround is for the moment to create a dummy dub application 
and compile it:

``` dockerfile

RUN mkdir -p /tmp/foo/source && echo 'void main(){}' > 
/tmp/foo/source/app.d \
     && echo '{"name":"bla", "dependencies": {"vibe-d": 
"0.9.0-alpha.5", "vibe-d:tls": 
"0.9.0-alpha.5"},"subConfigurations": {"vibe-d:tls": "notls"}}' > 
/tmp/foo/dub.json \
     && dub build --root /tmp/foo/
```

Do I miss something here?

Kind regards
André
May 29 2020
parent reply kookman <thekookman gmail.com> writes:
On Friday, 29 May 2020 at 11:45:24 UTC, Andre Pany wrote:
 André
I do it by defining a configuration “build-deps” in my dub.sdl with target type “none” and then doing the build as two steps in the dockerfile: ``` dockerfile ... WORKDIR /build COPY dub.s* ./ RUN dub build -v —config=build-deps COPY src ./src RUN dub build -v —config=executable ...
May 29 2020
parent Andre Pany <andre s-e-a-p.de> writes:
On Saturday, 30 May 2020 at 00:12:20 UTC, kookman wrote:
 On Friday, 29 May 2020 at 11:45:24 UTC, Andre Pany wrote:
 André
I do it by defining a configuration “build-deps” in my dub.sdl with target type “none” and then doing the build as two steps in the dockerfile: ``` dockerfile ... WORKDIR /build COPY dub.s* ./ RUN dub build -v —config=build-deps COPY src ./src RUN dub build -v —config=executable ...
Fantastic, thanks a lot. Kind regards Andre
May 30 2020