Skip to content

Commit f232f87

Browse files
authored
[Docs] Document platform-dependent dependencies (#1146)
1 parent 5ebad46 commit f232f87

File tree

4 files changed

+67
-13
lines changed

4 files changed

+67
-13
lines changed

.github/workflows/documentation.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,9 @@ jobs:
1818
- uses: julia-actions/setup-julia@latest
1919
with:
2020
version: "1.6"
21-
- name: Cache artifacts
22-
uses: actions/cache@v1
23-
env:
24-
cache-name: cache-artifacts
21+
- uses: julia-actions/cache@v1
2522
with:
26-
path: ~/.julia/artifacts
27-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/docs/Project.toml') }}
28-
restore-keys: |
29-
${{ runner.os }}-test-${{ env.cache-name }}-
30-
${{ runner.os }}-test-
31-
${{ runner.os }}-
23+
cache-registries: "true"
3224
- name: Install dependencies
3325
shell: julia --color=yes --project=docs/ {0}
3426
run: |

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ghr_jll = "07c12ed4-43bc-5495-8a2a-d5838ef8d533"
3333

3434
[compat]
3535
ArgParse = "1.1"
36-
BinaryBuilderBase = "1.1"
36+
BinaryBuilderBase = "1.2"
3737
GitHub = "5.1"
3838
HTTP = "0.8, 0.9"
3939
JLD2 = "0.1.6, 0.2, 0.3, 0.4"

azure-pipelines.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
# Trigger on pushes to `master`
22
trigger:
3-
- master
3+
branches:
4+
include:
5+
- master
6+
paths:
7+
include:
8+
- contrib
9+
- src
10+
- test
11+
- Manifest.toml
412

513
# Trigger on PRs against `master`
614
pr:
7-
- master
15+
branches:
16+
include:
17+
- master
18+
paths:
19+
include:
20+
- contrib
21+
- src
22+
- test
23+
- Manifest.toml
824

925
# By default, use the `Native` pool of agents
1026
pool: BinaryBuilder

docs/src/building.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,52 @@ Examples of builders that depend on other binaries include:
358358
depends on `Xorg_libxcb_jll`, and `Xorg_xtrans_jll` at build- and run-time,
359359
and on `Xorg_xorgproto_jll` and `Xorg_util_macros_jll` only at build-time.
360360

361+
### Platform-dependent dependencies
362+
363+
By default, all dependencies are used for all platforms, but there are some
364+
cases where a package requires some dependencies only on some platforms. You
365+
can specify the platforms where a dependency is needed by passing the
366+
`platforms` keyword argument to the dependency constructor, which is the vector
367+
of `AbstractPlatforms` where the dependency should be used.
368+
369+
For example, assuming that the variable `platforms` holds the vector of the
370+
platforms for which to build your package, you can specify that `Package_jl` is
371+
required on all platforms excluding Windows one with
372+
373+
```julia
374+
Dependency("Package_jll"; platforms=filter(!Sys.iswindows, platforms))
375+
```
376+
377+
The information that a dependency is only needed on some platforms is
378+
transferred to the JLL package as well: the wrappers will load the
379+
platform-dependent JLL dependencies only when needed.
380+
381+
!!! warning
382+
383+
Julia's package manager doesn't have the concept of optional (or
384+
platform-dependent) dependencies: this means that when installing a JLL
385+
package in your environment, all of its dependencies will always be
386+
installed as well in any case. It's only at runtime that platform-specific
387+
dependencies will be loaded where necessary.
388+
389+
For the same reason, even if you specify a dependency to be not needed on
390+
for a platform, the build recipe may still pull it in if that's also an
391+
indirect dependency required by some other dependencies. At the moment
392+
`BinaryBuilder.jl` isn't able to propagate the information that a dependency
393+
is platform-dependent when installing the artifacts of the dependencies.
394+
395+
Examples:
396+
397+
* [`ADIOS2`](https://github.com/JuliaPackaging/Yggdrasil/blob/0528e0f31b55355df632c79a2784621583443d9c/A/ADIOS2/build_tarballs.jl#L122-L123)
398+
uses `MPICH_jll` to provide an MPI implementations on all platforms excluding
399+
Windows, and `MicrosoftMPI_jll` for Windows.
400+
* [`GTK3`](https://github.com/JuliaPackaging/Yggdrasil/blob/0528e0f31b55355df632c79a2784621583443d9c/G/GTK3/build_tarballs.jl#L70-L104)
401+
uses the X11 software stack only on Linux and FreeBSD platforms, and Wayland
402+
only on Linux.
403+
* [`NativeFileDialog`](https://github.com/JuliaPackaging/Yggdrasil/blob/0528e0f31b55355df632c79a2784621583443d9c/N/NativeFileDialog/build_tarballs.jl#L40-L44)
404+
uses GTK3 only on Linux and FreeBSD, on all other platforms it uses system
405+
libraries, so no other packages are needed in those cases.
406+
361407
### Version number of dependencies
362408

363409
There are two different ways to specify the version of a dependency, with two

0 commit comments

Comments
 (0)