【问题标题】:Circular dependency on rake package taskrake包任务的循环依赖
【发布时间】:2014-05-29 08:45:45
【问题描述】:

我创建了自己的“gravaty”gem(请参阅 RubyGems),其中包含自己的 gravaty.gemspec 文件和包含主要任务的 Rakefile。

问题是:当我在运行 rake rdoc 后运行 rake package 时,我看到了这个错误

rake aborted!
Circular dependency detected: TOP => package => pkg/gravaty-3.3.1.tgz => pkg/gravaty-3.3.1 => html/index.html => html/index.html

Tasks: TOP => package => pkg/gravaty-3.3.1.tgz => pkg/gravaty-3.3.1 => html/index.html
(See full trace by running task with --trace)

相反,如果我在rake clean clobber 之后运行相同的命令,那么没有 RDoc html 文件夹,问题就不会出现。

这个http://hg.savannah.gnu.org/hgweb/gravaty/file/923b9133aefc/Rakefile 是 Rakefile。

这个http://hg.savannah.gnu.org/hgweb/gravaty/file/923b9133aefc/gravaty.gemspec 是gemspec。看来,如果我从第 34 行(a_gem.files = Dir.glob('{examples,html,lib,test}/**/*') + COMMON_FILES)中删除 html 文件夹,它可以工作......但是为什么我应该从包中删除 RDoc?我宁愿保留它。

而这个http://hg.savannah.gnu.org/hgweb/gravaty/file/923b9133aefc/Gemfile,即使不是那么有用,也是 Gemfile。

【问题讨论】:

    标签: rake rakefile gemspecs


    【解决方案1】:

    重提一个老问题,或许你已经有了解决办法;但我在更简单的Rakefile 中研究一个令人困惑的循环依赖错误时发现了你的问题,并认为这对其他人的搜索有帮助..

    不过,我无法提供准确的答案——

    10.x Rake 中存在任务命名空间/范围问题,see here。要告诉 Rake 返回顶层开始查找,请在前置任务名称前加上 ^,例如,task 'foo:bar' => '^bar' 以调用顶层任务“bar”,而不是再次调用“foo:bar”任务(圆形)。

    我猜这里的问题与 Rubygems package 任务有关,我会向 Rubygems 团队提交错误/查询,或者在他们的邮件列表上发帖。

    【讨论】:

      猜你喜欢
      • 2017-10-04
      • 2012-01-22
      • 2016-07-15
      • 1970-01-01
      • 2016-06-09
      • 1970-01-01
      • 2021-08-15
      • 1970-01-01
      • 2011-03-23
      相关资源
      最近更新 更多