You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@buildr.apache.org by Ittay Dror <it...@tikalk.com> on 2008/11/09 08:33:34 UTC
Re: svn commit: r711954 - in /incubator/buildr/trunk: CHANGELOG lib/buildr/core/project.rb
spec/core/project_spec.rb
assaf@apache.org wrote:
> Author: assaf
> Date: Thu Nov 6 12:02:51 2008
> New Revision: 711954
>
> URL: http://svn.apache.org/viewvc?rev=711954&view=rev
> Log:
> Fixed: BUILDR-175 Fail to find child project when calling project method inside project definition.
>
> Modified:
> incubator/buildr/trunk/CHANGELOG
> incubator/buildr/trunk/lib/buildr/core/project.rb
> incubator/buildr/trunk/spec/core/project_spec.rb
>
> Modified: incubator/buildr/trunk/CHANGELOG
> URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=711954&r1=711953&r2=711954&view=diff
> ==============================================================================
> --- incubator/buildr/trunk/CHANGELOG (original)
> +++ incubator/buildr/trunk/CHANGELOG Thu Nov 6 12:02:51 2008
> @@ -15,6 +15,7 @@
> * Fixed: Removed double complete/fail messages showing up on console.
> * Fixed: BUILDR-158 Nailgun is now a delegate for buildr/drb (a pure-ruby dRuby server)
> * Fixed: BUILDR-172 Scala compiler not loaded by default.
> +* Fixed: BUILDR-175 Fail to find child project when calling project method inside project definition.
> * Fixed: BUILDR-192 TestNG report results are overwritten (Alexis Midon).
> * Fixed: BUILDR-193 TestNG uses project name for suite name (not valid file
> name on Windows).
>
> Modified: incubator/buildr/trunk/lib/buildr/core/project.rb
> URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/project.rb?rev=711954&r1=711953&r2=711954&view=diff
> ==============================================================================
> --- incubator/buildr/trunk/lib/buildr/core/project.rb (original)
> +++ incubator/buildr/trunk/lib/buildr/core/project.rb Thu Nov 6 12:02:51 2008
> @@ -241,17 +241,18 @@
> raise ArgumentError, 'Only one project name at a time' unless args.size == 1
> @projects ||= {}
> name = args.first
> + # Make sure parent project is evaluated (e.g. if looking for foo:bar, find foo first)
> + unless @projects[name]
>
shouldn't the condition use scope also?
ittay
> + parts = name.split(':')
> + project(parts.first, options || {}) if parts.size > 1
> + end
> if options && options[:scope]
> # We assume parent project is evaluated.
> project = options[:scope].split(':').inject([[]]) { |scopes, scope| scopes << (scopes.last + [scope]) }.
> map { |scope| @projects[(scope + [name]).join(':')] }.
> select { |project| project }.last
> end
> - unless project
> - # Parent project not evaluated.
> - name.split(':').tap { |parts| @projects[parts.first].invoke if parts.size > 1 }
> - project = @projects[name]
> - end
> + project ||= @projects[name] # Not found in scope.
> raise "No such project #{name}" unless project
> project.invoke
> project
>
> Modified: incubator/buildr/trunk/spec/core/project_spec.rb
> URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/core/project_spec.rb?rev=711954&r1=711953&r2=711954&view=diff
> ==============================================================================
> --- incubator/buildr/trunk/spec/core/project_spec.rb (original)
> +++ incubator/buildr/trunk/spec/core/project_spec.rb Thu Nov 6 12:02:51 2008
> @@ -432,6 +432,19 @@
> project('foo').projects.map(&:name).should include('foo:bar')
> end
>
> + it 'should be findable during project definition' do
> + define 'foo' do
> + bar = define 'bar' do
> + baz = define 'baz'
> + project('baz').should eql(baz)
> + end
> + # Note: evaluating bar:baz first unearthed a bug that doesn't happen
> + # if we evaluate bar, then bar:baz.
> + project('bar:baz').should be(bar.project('baz'))
> + project('bar').should be(bar)
> + end
> + end
> +
> it 'should be findable only if exists' do
> define('foo') { define 'bar' }
> lambda { project('foo').project('baz') }.should raise_error(RuntimeError, /No such project/)
>
>
>
>
--
Ittay Dror <it...@tikalk.com>
Tikal <http://www.tikalk.com>
Tikal Project <http://tikal.sourceforge.net>