可以使用Ninja与环境变量吗?

huangapple go评论55阅读模式
英文:

Is there a way to use environment variables with Ninja?

问题

我有以下的 Ninja 文件,因为我找不到一种将环境变量传递给 Ninja 步骤的方法:

rule init
 command = sh init.sh

rule plan
 command = sh plan.sh

rule apply
 command = sh apply.sh


build plan: plan
build init: init
build apply: apply

default plan

我想要跳过使用 shell 脚本并在 Ninja 中捕获所有步骤。我不确定这是否完全支持。

英文:

I have the following ninja file because I could not find a way to pass environment variables to ninja steps:

rule init
 command = sh init.sh

rule plan
 command = sh plan.sh

rule apply
 command = sh apply.sh


build plan: plan
build init: init
build apply: apply

default plan

I would like to skip using shell scripts and capture all the steps in Ninja. I am not sure if this is supported at all.

答案1

得分: 0

这是Ninja的设计决策,不执行该操作。如果您需要向Ninja传递任何参数,支持的方式是使用构建生成器生成构建文件。

英文:

It is a design decision of Ninja not to do that. If you need to pass in any parameter to Ninja the supported way to generate the build file with a build generator.

huangapple
  • 本文由 发表于 2023年2月8日 18:35:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/75384513.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定