Julia Project.toml中的[extras]和[targets]有什么作用?

7
在下面的示例中(代码复制自Flux project.toml),[extras]和[targets]部分的目的是什么?
[compat]
Adapt = "3.0"
ArrayInterface = "3.1, 4, 5, 6"
CUDA = "3"
.
.
.
Zygote = "0.6.34"
julia = "1.6"

[extras]
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
.
.
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Documenter", "IterTools", "LinearAlgebra", "FillArrays", "ComponentArrays"]

3
https://pkgdocs.julialang.org/v1/creating-packages/#Test-specific-dependencies-in-Julia-1.0-and-1.1 - Bogumił Kamiński
1个回答

1

它用于为子目录指定依赖项,但同时这些依赖项不被包使用。

具有

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

表示目标 test/ 使用依赖项 Test。 而 Test 依赖项是额外的,这意味着它不会被包使用。

这相当于具有内容为 test/Project.toml 的文件:

[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

请注意,与第二种方法不同,第一种方法适用于所有的 Julia 1.x 版本。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接