[
https://issues.apache.org/jira/browse/THRIFT-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639134#action_12639134
]
David Simpson commented on THRIFT-57:
-------------------------------------
This change is actually causing me some troubles in my installation. In
particular, I think it's problematic for thrift projects that include types
from other projects. Here's a simplified version of what I'm doing:
Package A defines a type (A_Type) that is used by packages B and C.
I have a ruby app this uses both B and C.
When I generate the ruby runtime files for B and C, it includes the types for A
in the same same directory... okay, so in the past, the generated files simply
said require 'A_types'. When the ruby script requires 'B', it gets the
'A_types' as well (and I setup my $: so that it can be found). When 'C' is
required, 'A_types' doesn't need to be loaded again since it was previously
required.
Now that paths are hardcoded, B requires 'B_Path/A_types' and C requires
'C_Path/A_types'. When both B and C are required, A_types is loaded twice
(once from each location), and I of course get warnings about redefined FIELDS.
Also, in general, I don't even have to put A_types into the B and C directories
and can keep it living elsewhere and just make sure my library paths are setup
to find it. Are there any solutions to this (absent backing out the change)?
If I could get rid of the "redefined constant" warning then I could live with
this change.
Right now I'm working around this by actually removing the hardcoded paths from
my ruby files during my build process using some perl hackery.
> Generated thrift code relies on gen-rb being in $:
> --------------------------------------------------
>
> Key: THRIFT-57
> URL: https://issues.apache.org/jira/browse/THRIFT-57
> Project: Thrift
> Issue Type: Bug
> Components: Library (Ruby)
> Reporter: Kevin Ballard
> Priority: Minor
> Attachments:
> 0001-rb-Use-File.dirname-__FILE__-in-generated-requires.patch
>
>
> The generated thrift code for ruby relies on the gen-rb folder being in $:.
> The generated service definition and _constants file both have a bare require
> 'Name_types', which can't find the Name_types.rb file unless it's in $:. The
> generated code should be using File.dirname(__FILE__) to specify the path as
> relative to itself.
> The only problem here is any clients of the library which put gen-rb into $:
> and then require the Name_types file themselves will end up with warnings
> about redefining the FIELDS constant. This should be treated as a deprecation
> warning.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.