buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: adding LinkedResources to .project when calling the eclipse task
Date Mon, 01 Feb 2010 16:15:45 GMT
On Mon, Feb 1, 2010 at 5:10 AM, Carl-Gustaf Harroch <charroch@gmail.com>wrote:

> Hello,
>
> I need to add an external source to the .project file when generating
> an eclipse project. This is a requirement for my android project which
> would fail upon testing otherwise. My aim would be to do something
> along the following lines:
>
> in buildfile:
> eclipse.external_sources = project('RESTProvider')
>
> and overriding the Eclipse module with:
> ---
> module Buildr
>  module Eclipse
>    include Extension
>    class Eclipse
>      def external_sources=(var)
>        @external_sources = arrayfy(var)
>      end
>
>      def external_sources(*values)
>        if values.size > 0
>          @external_sources ||= []
>          @external_sources += values
>        else
>          @external_sources || (@project.parent ?
> @project.parent.eclipse.external_sources : [])
>        end
>      end
>    end
>  end
> end
>
> class Buildr::Project
>  include Buildr::Eclipse::Android
> end
> ---
>
> From here I am not sure how to overwrite the after_define method as it
> seems to only call if the .project does not exist. As such if the base
> Eclipe module creates the file, my implementation will not be called
> and vice versa. I am not a rubyist per say so any guidance would be
> appreciated.
>


Hmmm... the Eclipse after_define is a prime example of a method in need of
refactoring.

If you want to do it yourself, you can enhance the .project FileTask so your
code gets called after the file has been created and its contents produced.

And/or if you file a bug in Jira, I'll add external_sources to the Eclipse
task and try to refactor it so it's easier to extend in the future.   If you
do so, could you specify what you're expecting to be generated in the
.project file?

thanks,
alex

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message