Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilerOptions.rootDirs - folder list order should define the copying order. #30497

Closed
moccaplusplus opened this issue Mar 19, 2019 · 7 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@moccaplusplus
Copy link

Folder list order in rootDirs should define the copying order (e.g. which file overwrites which, in case the same filename exists in more than one of rootDirs folder).

"rootDirs": ["src/gen/ts", "src/main/ts"], 
src
├── gen/ts     
   └── other.ts
├── main/ts              
   └── index.ts   # imports ./other.ts
   └── other.ts

now, no matter the order in which rootDirs folders are provided, the import "prefers" the file in the same folder.

Why its important? Consider we have some decorator based generator which enhances the source classes (like java's lombok). In this case we need to impose higher precedence on generated classes.

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Mar 19, 2019
@RyanCavanaugh
Copy link
Member

Debates about which behavior constitutes "correct" aside, this would be an extremely confusing and disruptive breaking change to roll out after the fact.

@moccaplusplus
Copy link
Author

moccaplusplus commented Mar 19, 2019

@RyanCavanaugh
So maybe an addditional option like rootDirsResolveStrategy = DEFAULT | ORDERED could do the job? When not set it would default to current behavior.
This feature is really needed by "annotation" based generators.

@moccaplusplus
Copy link
Author

moccaplusplus commented Mar 20, 2019

@RyanCavanaugh
Should I create a new issue (feature request) for option like rootDirsResolveStrategy = DEFAULT | ORDERED?
At first glimpse it seems I would be able to provide a patch for this.

@RyanCavanaugh
Copy link
Member

We can start with a suggestion if you like. Just to set expectations, I don't think we'd be inclined to complicate file resolution even further unless it was very often-requested.

@moccaplusplus
Copy link
Author

Hi,

The name of the option (or if there is an additional option at all) does not matter. We just need something like java's compiletime classpath (with possibilty to impose resolve order to make generated files obscure the sources).

Of course, we could copy the files accordingly before build, but doing this manually we could drive IDE like vscode into confusion (the IDE should follow the settings of actual build). For this reason the "standard" classpath behavior would be appreciated.

To make sure I understood You properly, Should I create a new feature request?

@RyanCavanaugh
Copy link
Member

A new issue clearly outlining the suggestion would be the next step, yes

@moccaplusplus
Copy link
Author

@RyanCavanaugh
Thanks for the information, I finally found time to write a proper feature request.
Suggestion: Introduce possibility to control rootDirs resolve order

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants