You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Kristof Jozsa <kr...@gmail.com> on 2010/07/05 12:06:05 UTC

subprojects and eclipse classpath generation

Hi,

assume I have a buildfile with the following projects structure:

Parent
|- Sub1
|- Sub2

where Sub2 also depends on Sub1. As this is an older project where I'm
trying to introduce Buildr, the directories are named like 'parent',
'sub1' and 'sub2' (all lowercase).

Once I execute the eclipse task of buildr, it generates an eclipse
classpath which makes Sub2 module depend on the Sub1 module
(correctly) but using the name "Parent-Sub1". Is there any way to
override this naming with our own somehow easily?

thanks,
K

Re: subprojects and eclipse classpath generation

Posted by Antoine Toulme <an...@lunar-ocean.com>.
OK with me!

On Tue, Jul 6, 2010 at 10:39, Alex Boisvert <al...@gmail.com> wrote:

> How about a configuration option so the Eclipse task generates only
> non-prefixed names?
> (not mutually exclusive with your suggestion)
>
> alex
>
>
>
> On Tue, Jul 6, 2010 at 10:25 AM, Antoine Toulme <an...@lunar-ocean.com>wrote:
>
>> Kristof, can you open an enhancement request so that people can override
>> Eclipse project names ?
>>
>> In general, I am also in favor of avoiding long names with dashes, but
>> they
>> are the only way to avoid collisions of namespaces.
>>
>> Something like eclipse.project_name should be made available if you want
>> to
>> override the name of the project name.
>>
>> On Tue, Jul 6, 2010 at 02:12, Kristof Jozsa <kr...@gmail.com>
>> wrote:
>>
>> > examining the buildr gem source, it seems that eclipse.rb:334 adds the
>> > classpath entries using the project ids which use the fully qualified
>> > name of subprojects in the Parent:Subproject form. I made it fix for
>> > my needs changing this short method to:
>> >
>> > def src_projects project_libs
>> >  project_libs.map(&:id).sort.uniq.each do |project_id|
>> >    stripped = project_id.gsub(/.*-/, '')
>> >    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
>> > :path=>"/#{stripped}"
>> >  end
>> > end
>> >
>> > so if anyone else bumps into this problem, something like this might
>> > help. I just wonder if anyone names it's Eclipse projects using the
>> > naming schema suggested by this Buildr behaviour at all.. :)
>> >
>> > cheers,
>> > K
>> >
>> > On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <kristof.jozsa@gmail.com
>> >
>> > wrote:
>> > > Hi,
>> > >
>> > > assume I have a buildfile with the following projects structure:
>> > >
>> > > Parent
>> > > |- Sub1
>> > > |- Sub2
>> > >
>> > > where Sub2 also depends on Sub1. As this is an older project where I'm
>> > > trying to introduce Buildr, the directories are named like 'parent',
>> > > 'sub1' and 'sub2' (all lowercase).
>> > >
>> > > Once I execute the eclipse task of buildr, it generates an eclipse
>> > > classpath which makes Sub2 module depend on the Sub1 module
>> > > (correctly) but using the name "Parent-Sub1". Is there any way to
>> > > override this naming with our own somehow easily?
>> > >
>> > > thanks,
>> > > K
>> > >
>> >
>>
>
>

Re: subprojects and eclipse classpath generation

Posted by Alex Boisvert <al...@gmail.com>.
How about a configuration option so the Eclipse task generates only
non-prefixed names?
(not mutually exclusive with your suggestion)

alex


On Tue, Jul 6, 2010 at 10:25 AM, Antoine Toulme <an...@lunar-ocean.com>wrote:

> Kristof, can you open an enhancement request so that people can override
> Eclipse project names ?
>
> In general, I am also in favor of avoiding long names with dashes, but they
> are the only way to avoid collisions of namespaces.
>
> Something like eclipse.project_name should be made available if you want to
> override the name of the project name.
>
> On Tue, Jul 6, 2010 at 02:12, Kristof Jozsa <kr...@gmail.com>
> wrote:
>
> > examining the buildr gem source, it seems that eclipse.rb:334 adds the
> > classpath entries using the project ids which use the fully qualified
> > name of subprojects in the Parent:Subproject form. I made it fix for
> > my needs changing this short method to:
> >
> > def src_projects project_libs
> >  project_libs.map(&:id).sort.uniq.each do |project_id|
> >    stripped = project_id.gsub(/.*-/, '')
> >    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
> > :path=>"/#{stripped}"
> >  end
> > end
> >
> > so if anyone else bumps into this problem, something like this might
> > help. I just wonder if anyone names it's Eclipse projects using the
> > naming schema suggested by this Buildr behaviour at all.. :)
> >
> > cheers,
> > K
> >
> > On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <kr...@gmail.com>
> > wrote:
> > > Hi,
> > >
> > > assume I have a buildfile with the following projects structure:
> > >
> > > Parent
> > > |- Sub1
> > > |- Sub2
> > >
> > > where Sub2 also depends on Sub1. As this is an older project where I'm
> > > trying to introduce Buildr, the directories are named like 'parent',
> > > 'sub1' and 'sub2' (all lowercase).
> > >
> > > Once I execute the eclipse task of buildr, it generates an eclipse
> > > classpath which makes Sub2 module depend on the Sub1 module
> > > (correctly) but using the name "Parent-Sub1". Is there any way to
> > > override this naming with our own somehow easily?
> > >
> > > thanks,
> > > K
> > >
> >
>

Re: subprojects and eclipse classpath generation

Posted by Alex Boisvert <al...@gmail.com>.
(Resending due to false-positive spam report)

Hi Kristof,

The patch was peachy so I committed it.  I also took the opportunity to add
an option to generate non-prefixed Eclipse project names (BUILDR-509), which
is the more common use-case I believe.

eclipse.options.short_names = true

thanks for your help!
alex

On Sat, Sep 18, 2010 at 4:15 AM, Kristof Jozsa <kr...@gmail.com>wrote:

> Hi guys,
>
> Alex, sorry I had to leave IRC yesterday but I really appreciate your help
> with my starting steps.
>
> I patched buildr source adding the functionality we discussed and the specs
> to cover it and attached the patch here:
> https://issues.apache.org/jira/browse/BUILDR-465. It was made against the
> latest commit yesterday (d442c606bd94e7ec27f248cfff37224702a5f557) but I
> was
> trying to do minimal changes so I hope it'll apply clean even later.
>
> The functionality in a nutshell: project.eclipse.name was introduced which
> defaults to project.id, so unless one overrides it the old behaviour is
> kept. If it's set however, it'll get used in .project and .classpath files
> to set the project name and dependent projects' classpath correctly.
>
> If you'd like to get this implemented in a different way, please tell me,
> I'd be happy to work on it. If I made any mistakes with the code, I'm also
> happy to learn.. so any suggestions are welcome.
>
> thanks,
> K
>

Re: subprojects and eclipse classpath generation

Posted by Kristof Jozsa <kr...@gmail.com>.
Hi guys,

Alex, sorry I had to leave IRC yesterday but I really appreciate your help
with my starting steps.

I patched buildr source adding the functionality we discussed and the specs
to cover it and attached the patch here:
https://issues.apache.org/jira/browse/BUILDR-465. It was made against the
latest commit yesterday (d442c606bd94e7ec27f248cfff37224702a5f557) but I was
trying to do minimal changes so I hope it'll apply clean even later.

The functionality in a nutshell: project.eclipse.name was introduced which
defaults to project.id, so unless one overrides it the old behaviour is
kept. If it's set however, it'll get used in .project and .classpath files
to set the project name and dependent projects' classpath correctly.

If you'd like to get this implemented in a different way, please tell me,
I'd be happy to work on it. If I made any mistakes with the code, I'm also
happy to learn.. so any suggestions are welcome.

thanks,
K


On Thu, Sep 9, 2010 at 3:16 PM, Antoine Toulme <an...@lunar-ocean.com>wrote:

> As the doc says, your patch is helpful if it fixes the problems, with
> specs.
>
> A first good patch would be a spec specifying exactly what you need.
>
>
> On Thu, Sep 9, 2010 at 06:22, Kristof Jozsa <kr...@gmail.com>wrote:
>
>> regarding this enhancement request - shall I try to patch it myself? (eg.
>> is there any chance to get my patch in the codebase once it's written? :))
>>
>> cheers,
>> K
>>
>>
>>
>> On Wed, Jul 7, 2010 at 8:25 AM, Kristof Jozsa <kr...@gmail.com>wrote:
>>
>>> Hi Antoine,
>>>
>>> it's at https://issues.apache.org/jira/browse/BUILDR-465
>>>
>>> cheers,
>>> K
>>>
>>> On Tue, Jul 6, 2010 at 5:25 PM, Antoine Toulme <an...@lunar-ocean.com>
>>> wrote:
>>> > Kristof, can you open an enhancement request so that people can
>>> override
>>> > Eclipse project names ?
>>> >
>>> > In general, I am also in favor of avoiding long names with dashes, but
>>> they
>>> > are the only way to avoid collisions of namespaces.
>>> >
>>> > Something like eclipse.project_name should be made available if you
>>> want to
>>> > override the name of the project name.
>>> >
>>> > On Tue, Jul 6, 2010 at 02:12, Kristof Jozsa <kr...@gmail.com>
>>> wrote:
>>> >
>>> >> examining the buildr gem source, it seems that eclipse.rb:334 adds the
>>> >> classpath entries using the project ids which use the fully qualified
>>> >> name of subprojects in the Parent:Subproject form. I made it fix for
>>> >> my needs changing this short method to:
>>> >>
>>> >> def src_projects project_libs
>>> >>  project_libs.map(&:id).sort.uniq.each do |project_id|
>>> >>    stripped = project_id.gsub(/.*-/, '')
>>> >>    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
>>> >> :path=>"/#{stripped}"
>>> >>  end
>>> >> end
>>> >>
>>> >> so if anyone else bumps into this problem, something like this might
>>> >> help. I just wonder if anyone names it's Eclipse projects using the
>>> >> naming schema suggested by this Buildr behaviour at all.. :)
>>> >>
>>> >> cheers,
>>> >> K
>>> >>
>>> >> On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <
>>> kristof.jozsa@gmail.com>
>>> >> wrote:
>>> >> > Hi,
>>> >> >
>>> >> > assume I have a buildfile with the following projects structure:
>>> >> >
>>> >> > Parent
>>> >> > |- Sub1
>>> >> > |- Sub2
>>> >> >
>>> >> > where Sub2 also depends on Sub1. As this is an older project where
>>> I'm
>>> >> > trying to introduce Buildr, the directories are named like 'parent',
>>> >> > 'sub1' and 'sub2' (all lowercase).
>>> >> >
>>> >> > Once I execute the eclipse task of buildr, it generates an eclipse
>>> >> > classpath which makes Sub2 module depend on the Sub1 module
>>> >> > (correctly) but using the name "Parent-Sub1". Is there any way to
>>> >> > override this naming with our own somehow easily?
>>> >> >
>>> >> > thanks,
>>> >> > K
>>> >> >
>>> >>
>>> >
>>>
>>
>>
>

Re: subprojects and eclipse classpath generation

Posted by Antoine Toulme <an...@lunar-ocean.com>.
As the doc says, your patch is helpful if it fixes the problems, with specs.

A first good patch would be a spec specifying exactly what you need.

On Thu, Sep 9, 2010 at 06:22, Kristof Jozsa <kr...@gmail.com> wrote:

> regarding this enhancement request - shall I try to patch it myself? (eg.
> is there any chance to get my patch in the codebase once it's written? :))
>
> cheers,
> K
>
>
>
> On Wed, Jul 7, 2010 at 8:25 AM, Kristof Jozsa <kr...@gmail.com>wrote:
>
>> Hi Antoine,
>>
>> it's at https://issues.apache.org/jira/browse/BUILDR-465
>>
>> cheers,
>> K
>>
>> On Tue, Jul 6, 2010 at 5:25 PM, Antoine Toulme <an...@lunar-ocean.com>
>> wrote:
>> > Kristof, can you open an enhancement request so that people can override
>> > Eclipse project names ?
>> >
>> > In general, I am also in favor of avoiding long names with dashes, but
>> they
>> > are the only way to avoid collisions of namespaces.
>> >
>> > Something like eclipse.project_name should be made available if you want
>> to
>> > override the name of the project name.
>> >
>> > On Tue, Jul 6, 2010 at 02:12, Kristof Jozsa <kr...@gmail.com>
>> wrote:
>> >
>> >> examining the buildr gem source, it seems that eclipse.rb:334 adds the
>> >> classpath entries using the project ids which use the fully qualified
>> >> name of subprojects in the Parent:Subproject form. I made it fix for
>> >> my needs changing this short method to:
>> >>
>> >> def src_projects project_libs
>> >>  project_libs.map(&:id).sort.uniq.each do |project_id|
>> >>    stripped = project_id.gsub(/.*-/, '')
>> >>    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
>> >> :path=>"/#{stripped}"
>> >>  end
>> >> end
>> >>
>> >> so if anyone else bumps into this problem, something like this might
>> >> help. I just wonder if anyone names it's Eclipse projects using the
>> >> naming schema suggested by this Buildr behaviour at all.. :)
>> >>
>> >> cheers,
>> >> K
>> >>
>> >> On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <
>> kristof.jozsa@gmail.com>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > assume I have a buildfile with the following projects structure:
>> >> >
>> >> > Parent
>> >> > |- Sub1
>> >> > |- Sub2
>> >> >
>> >> > where Sub2 also depends on Sub1. As this is an older project where
>> I'm
>> >> > trying to introduce Buildr, the directories are named like 'parent',
>> >> > 'sub1' and 'sub2' (all lowercase).
>> >> >
>> >> > Once I execute the eclipse task of buildr, it generates an eclipse
>> >> > classpath which makes Sub2 module depend on the Sub1 module
>> >> > (correctly) but using the name "Parent-Sub1". Is there any way to
>> >> > override this naming with our own somehow easily?
>> >> >
>> >> > thanks,
>> >> > K
>> >> >
>> >>
>> >
>>
>
>

Re: subprojects and eclipse classpath generation

Posted by Kristof Jozsa <kr...@gmail.com>.
regarding this enhancement request - shall I try to patch it myself? (eg. is
there any chance to get my patch in the codebase once it's written? :))

cheers,
K


On Wed, Jul 7, 2010 at 8:25 AM, Kristof Jozsa <kr...@gmail.com>wrote:

> Hi Antoine,
>
> it's at https://issues.apache.org/jira/browse/BUILDR-465
>
> cheers,
> K
>
> On Tue, Jul 6, 2010 at 5:25 PM, Antoine Toulme <an...@lunar-ocean.com>
> wrote:
> > Kristof, can you open an enhancement request so that people can override
> > Eclipse project names ?
> >
> > In general, I am also in favor of avoiding long names with dashes, but
> they
> > are the only way to avoid collisions of namespaces.
> >
> > Something like eclipse.project_name should be made available if you want
> to
> > override the name of the project name.
> >
> > On Tue, Jul 6, 2010 at 02:12, Kristof Jozsa <kr...@gmail.com>
> wrote:
> >
> >> examining the buildr gem source, it seems that eclipse.rb:334 adds the
> >> classpath entries using the project ids which use the fully qualified
> >> name of subprojects in the Parent:Subproject form. I made it fix for
> >> my needs changing this short method to:
> >>
> >> def src_projects project_libs
> >>  project_libs.map(&:id).sort.uniq.each do |project_id|
> >>    stripped = project_id.gsub(/.*-/, '')
> >>    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
> >> :path=>"/#{stripped}"
> >>  end
> >> end
> >>
> >> so if anyone else bumps into this problem, something like this might
> >> help. I just wonder if anyone names it's Eclipse projects using the
> >> naming schema suggested by this Buildr behaviour at all.. :)
> >>
> >> cheers,
> >> K
> >>
> >> On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <kristof.jozsa@gmail.com
> >
> >> wrote:
> >> > Hi,
> >> >
> >> > assume I have a buildfile with the following projects structure:
> >> >
> >> > Parent
> >> > |- Sub1
> >> > |- Sub2
> >> >
> >> > where Sub2 also depends on Sub1. As this is an older project where I'm
> >> > trying to introduce Buildr, the directories are named like 'parent',
> >> > 'sub1' and 'sub2' (all lowercase).
> >> >
> >> > Once I execute the eclipse task of buildr, it generates an eclipse
> >> > classpath which makes Sub2 module depend on the Sub1 module
> >> > (correctly) but using the name "Parent-Sub1". Is there any way to
> >> > override this naming with our own somehow easily?
> >> >
> >> > thanks,
> >> > K
> >> >
> >>
> >
>

Re: subprojects and eclipse classpath generation

Posted by Kristof Jozsa <kr...@gmail.com>.
Hi Antoine,

it's at https://issues.apache.org/jira/browse/BUILDR-465

cheers,
K

On Tue, Jul 6, 2010 at 5:25 PM, Antoine Toulme <an...@lunar-ocean.com> wrote:
> Kristof, can you open an enhancement request so that people can override
> Eclipse project names ?
>
> In general, I am also in favor of avoiding long names with dashes, but they
> are the only way to avoid collisions of namespaces.
>
> Something like eclipse.project_name should be made available if you want to
> override the name of the project name.
>
> On Tue, Jul 6, 2010 at 02:12, Kristof Jozsa <kr...@gmail.com> wrote:
>
>> examining the buildr gem source, it seems that eclipse.rb:334 adds the
>> classpath entries using the project ids which use the fully qualified
>> name of subprojects in the Parent:Subproject form. I made it fix for
>> my needs changing this short method to:
>>
>> def src_projects project_libs
>>  project_libs.map(&:id).sort.uniq.each do |project_id|
>>    stripped = project_id.gsub(/.*-/, '')
>>    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
>> :path=>"/#{stripped}"
>>  end
>> end
>>
>> so if anyone else bumps into this problem, something like this might
>> help. I just wonder if anyone names it's Eclipse projects using the
>> naming schema suggested by this Buildr behaviour at all.. :)
>>
>> cheers,
>> K
>>
>> On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <kr...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > assume I have a buildfile with the following projects structure:
>> >
>> > Parent
>> > |- Sub1
>> > |- Sub2
>> >
>> > where Sub2 also depends on Sub1. As this is an older project where I'm
>> > trying to introduce Buildr, the directories are named like 'parent',
>> > 'sub1' and 'sub2' (all lowercase).
>> >
>> > Once I execute the eclipse task of buildr, it generates an eclipse
>> > classpath which makes Sub2 module depend on the Sub1 module
>> > (correctly) but using the name "Parent-Sub1". Is there any way to
>> > override this naming with our own somehow easily?
>> >
>> > thanks,
>> > K
>> >
>>
>

Re: subprojects and eclipse classpath generation

Posted by Antoine Toulme <an...@lunar-ocean.com>.
Kristof, can you open an enhancement request so that people can override
Eclipse project names ?

In general, I am also in favor of avoiding long names with dashes, but they
are the only way to avoid collisions of namespaces.

Something like eclipse.project_name should be made available if you want to
override the name of the project name.

On Tue, Jul 6, 2010 at 02:12, Kristof Jozsa <kr...@gmail.com> wrote:

> examining the buildr gem source, it seems that eclipse.rb:334 adds the
> classpath entries using the project ids which use the fully qualified
> name of subprojects in the Parent:Subproject form. I made it fix for
> my needs changing this short method to:
>
> def src_projects project_libs
>  project_libs.map(&:id).sort.uniq.each do |project_id|
>    stripped = project_id.gsub(/.*-/, '')
>    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
> :path=>"/#{stripped}"
>  end
> end
>
> so if anyone else bumps into this problem, something like this might
> help. I just wonder if anyone names it's Eclipse projects using the
> naming schema suggested by this Buildr behaviour at all.. :)
>
> cheers,
> K
>
> On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <kr...@gmail.com>
> wrote:
> > Hi,
> >
> > assume I have a buildfile with the following projects structure:
> >
> > Parent
> > |- Sub1
> > |- Sub2
> >
> > where Sub2 also depends on Sub1. As this is an older project where I'm
> > trying to introduce Buildr, the directories are named like 'parent',
> > 'sub1' and 'sub2' (all lowercase).
> >
> > Once I execute the eclipse task of buildr, it generates an eclipse
> > classpath which makes Sub2 module depend on the Sub1 module
> > (correctly) but using the name "Parent-Sub1". Is there any way to
> > override this naming with our own somehow easily?
> >
> > thanks,
> > K
> >
>

Re: subprojects and eclipse classpath generation

Posted by Kristof Jozsa <kr...@gmail.com>.
examining the buildr gem source, it seems that eclipse.rb:334 adds the
classpath entries using the project ids which use the fully qualified
name of subprojects in the Parent:Subproject form. I made it fix for
my needs changing this short method to:

def src_projects project_libs
  project_libs.map(&:id).sort.uniq.each do |project_id|
    stripped = project_id.gsub(/.*-/, '')
    @xml.classpathentry :kind=>'src', :combineaccessrules=>'false',
:path=>"/#{stripped}"
  end
end

so if anyone else bumps into this problem, something like this might
help. I just wonder if anyone names it's Eclipse projects using the
naming schema suggested by this Buildr behaviour at all.. :)

cheers,
K

On Mon, Jul 5, 2010 at 10:06 AM, Kristof Jozsa <kr...@gmail.com> wrote:
> Hi,
>
> assume I have a buildfile with the following projects structure:
>
> Parent
> |- Sub1
> |- Sub2
>
> where Sub2 also depends on Sub1. As this is an older project where I'm
> trying to introduce Buildr, the directories are named like 'parent',
> 'sub1' and 'sub2' (all lowercase).
>
> Once I execute the eclipse task of buildr, it generates an eclipse
> classpath which makes Sub2 module depend on the Sub1 module
> (correctly) but using the name "Parent-Sub1". Is there any way to
> override this naming with our own somehow easily?
>
> thanks,
> K
>