# "Double" build when adding unregistered dependency

**URL:** <https://discourse.julialang.org/t/double-build-when-adding-unregistered-dependency/32851>\
**Category:** Tooling\
**Tags:** ci\
**Created:** [January 1, 2020, 6:15pm UTC](https://discourse.julialang.org/t/double-build-when-adding-unregistered-dependency/32851 "2020-01-01T18:15:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crown421](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crown421/32/9984_2.png) [@Crown421](https://discourse.julialang.org/u/Crown421)\
**Post date:** [January 1, 2020, 6:15pm UTC](https://discourse.julialang.org/t/double-build-when-adding-unregistered-dependency/32851/1 "2020-01-01T18:15:41Z")

</div>

Happy new year,

which I so far have spent with moving my tests from Travis to GitHub Actions. After finally getting it somewhere, I ran into a problem which I already had on Travis.

When using a unregistered package, in my case MKL.jl, the [documentation](https://docs.travis-ci.com/user/languages/julia/#dependency-management) suggest running

```julia
 - julia --project --color=yes --check-bounds=yes -e 'using Pkg; Pkg.develop(PackageSpec(path="/home/travis/build/path_to_private_Dependency")); Pkg.instantiate()'

```

where I run

```julia
- julia --project --color=yes --check-bounds=yes -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/JuliaComputing/MKL.jl"));'

```

which takes \>10 min usually, which by itself is fine.

However, the problem is that the default build command for the tested package itself builds MKL.jl once more, again taking 10 min.  
I tried to address this by only prompting for the package itself

```julia
  - julia --color=yes -e "if VERSION < v\"0.7.0-DEV.5183\"; Pkg.clone(pwd()); Pkg.build(\"IntelVectorMath\"); else using Pkg; if VERSION >= v\"1.1.0-rc1\"; Pkg.build(\"IntelVectorMath\"; verbose=true); else Pkg.build(\"IntelVectorMath\"); end; end"

```

but MKL still gets rebuild.

This means that my testing takes \>20 minutes before running the actual tests which take less than a minute.  
For some examples see  
[WIP GitHub Action](https://github.com/Crown421/VML.jl/commit/38f3a65d20c66f40e922722c059aac8caf387b25/checks?check_suite_id=380692845)  
[Old Travis](https://travis-ci.com/Crown421/VML.jl/jobs/260356098)

I expect that this specific problem will soon be solved as MKL.jl nears proper registration. But in principle I think there should be a way to avoid something like this.  
Maybe a `Pkg.add(..., build=false)` or so? Or maybe there is a trick that I haven’t found yet that would help here.  
Any input would be appreciated.

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [January 1, 2020, 9:32pm UTC](https://discourse.julialang.org/t/double-build-when-adding-unregistered-dependency/32851/2 "2020-01-01T21:32:38Z")

</div>

I don’t see a spurious build happening in the GitHub Actions log. MKL gets automatically built when you call `develop` then it gets built the second time when you explicitly call `build`. Why are you calling `build` a second time?

---

<div class="post-metadata">

**Author:** ![Crown421](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/crown421/32/9984_2.png) [@Crown421](https://discourse.julialang.org/u/Crown421)\
**Post date:** [January 1, 2020, 11:52pm UTC](https://discourse.julialang.org/t/double-build-when-adding-unregistered-dependency/32851/3 "2020-01-01T23:52:52Z")

</div>

My goal is to test the package IntelVectorMath (formerly VML), for which the normal workflow would be

1. setup julia
2. build package (the “second” build)
3. run tests

However, VML depends optionally on MKL, which is unregistered and not part of the dependencies. Even worse, even if it was part of the dependencies, unregistered packages are currently not properly resolved (I can’t find the issue that explained this best, [here](https://github.com/JuliaLang/Pkg.jl/issues/810) is one that comes close).  
Another example is [this CI run](https://github.com/Crown421/VML.jl/runs/370040169) , where I messed up properly adding MKL to the project. When running the tests, despite MKL being part of a Manifest.toml in the `test/` directory, MKL is not being found or automatically added.

This forces me to add MKL manually before the three steps mentioned above, causing the “first” build.

Now the issue is that whether I use a name-specific `build` instruction as on Travis, or the generic `build` [action](https://github.com/julia-actions/julia-buildpkg) on GitHub actions, the “second” build action rebuilds everything, including MKL.

I feel this should not be the case. Calling name-specific build for a package should not rebuild anything else that it does not explicitly depend on, and it doesn’t when I try to reproduce in my own REPL, where I get this: (The name change of to `IntelVectorMath` is very new)

```julia
(v1.1) pkg> build VML
  Building SpecialFunctions → `~/.julia/packages/SpecialFunctions/ne2iw/deps/build.log`
  Building VML ─────────────→ `~/.julia/dev/VML/deps/build.log`
 Resolving package versions...

```

There is nothing with MKL.jl, it only gets rebuild in CI, which just increases my puzzlement.
