[
https://issues.apache.org/jira/browse/THRIFT-5577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17531661#comment-17531661
]
Jens Geyer commented on THRIFT-5577:
------------------------------------
{quote}In C#/.NET it is conventional for the default namespace of a project to
match the project name,
and the default namespace of any files contained therein to match the folder
structure,
so if my project is call MyCompany.MyFeature.XYZ the default namespace used by
files
in the root folder of the project have namespace MyCompany.MyFeature.XYZ.
{quote}
Right. But there is no such concept as "surrounding project namespace" in
Thrift IDL. The Thrift compiler will not search and parse your C# project file
and check any folder names to find out what you possibly could mean. Not to
mention the fact that this would require you to provide a *.csproj file and
also add certain extra complexity - all of this for the only sake of trying to
heuristically optimize namespace folders?
{quote}If I add a folder 'Thrift' and add files to that I expect them to have
namespace MyCompany.MyFeature.XYZ.Thrift. [...] if I use the thrift compiler
against a thrift file with namespace MyCompany.MyFeature.XYZ.Thrift it's my
expectation to be able to put the generated files in sub-folder 'Thrift'.
{quote}
If the outcome does not match your personal preferences, proposed workaround
would be to copy the generated files around as you like, e.g. in an extra
prebuild step.
{quote}Other C# developers will be somewhat surprised to see the folder
structure that is actually generated.
{quote}
Absolutely. :D
{quote}Also it's my expectation of a tool to put output where I ask it to not
generate an unnecessary folder structure.
{quote}
That depends on the definition of "unnecessary". But since I see your point, if
you decide to come up with a pull request to add an *option* to the netstd
generator like {{-gen:no_folders}} that supresses any subfolders inside the out
folder, I will happily review it.
> netstd namespace directive creates matching subfolders
> ------------------------------------------------------
>
> Key: THRIFT-5577
> URL: https://issues.apache.org/jira/browse/THRIFT-5577
> Project: Thrift
> Issue Type: Improvement
> Components: netstd - Compiler
> Affects Versions: 0.16.0
> Reporter: Philip Lee
> Assignee: Jens Geyer
> Priority: Major
> Fix For: 0.17.0
>
>
> If I add a namespace directive to the .thrift file, and I specify the output
> folder, the thrift compiler creates a set of sub-folders matching the
> namespace which is not useful.
> e.g. I have a project called
> MyCompany.MyFeature.Xyz
> and I have a .thrift file with
> namespace netstd MyCompany.MyFeature.Xyz.Thrift
> and I use
> thrift-0.16.0.exe --gen netstd --out .\thrift rpc.thrift
> Then I get sub-folders
> MyCompany.MyFeature.Xyz\Thrift\MyCompany\MyFeature\Xyz\Thrift\<files.cs>
> What I expect is for the generated files to be placed in folder Thrift, e.g.
> MyCompany.MyFeature.Xyz\Thrift\<files.cs>
> to match the namespace.
>
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)