vigna / fastutil

fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues.
Apache License 2.0
1.78k stars 196 forks source link

Additional src folders? #213

Open techsy730 opened 3 years ago

techsy730 commented 3 years ago

Although we have no need for it now, in a future version it may be useful to have additional src folders. The .gitignores are setup to ignore any strict subfolders of src/it/unimi/dsi/fastutil. But sometimes it may be useful to have non-generated classes for specific cases. For example, specifically tuned implementation of boolean collections abusing the minuscule element state space (2). Or non-type specific code that we don't want to be public api could be in a it.unimi.dsi.fastutil.internal package. We can't put those in the existing src folder as the .gitignore would exclude them.

I think the cleanest solution to this would be to have a separate source folder for non-generated classes. Ant supports multiple source folders, so they would all live in the same classpath. Something like src-nongen or something (terrible name but I can't think of anything better at the moment). With some sort of ABOUT.txt or something describing why it is there.

incaseoftrouble commented 3 years ago

I think a more canonical approach would be to move to the src/main/java / src/test/java and src/main/generated etc. structure. This then also would be understood by IDEs I think

techsy730 commented 3 years ago

I like that idea better, but I wonder if src/main/java for handwritten code and src/generated/java for the generated code would be even more canonical

incaseoftrouble commented 3 years ago

IIRC, canonical is src/main and src/test for different source / compilation sets (main is everything that is part of the distribution, test is part of testing, you could have src/test-fixtures or similar for, well, fixtures). So the first level basically refers to where the code belongs to, second level to its type. So we could have src/main/c for the generated c code, src/main/generated for the generated java code and src/main/java for the actual implementations.

This is at least the structure that gradle, IntelliJ, and (I think) maven generates by default.

vigna commented 3 years ago

This is at least the structure that gradle, IntelliJ, and (I think) maven generates by default.

And, I hate Maven 😂

techsy730 commented 9 months ago

Well, we don't have to strictly follow "canonical" layout. We already aren't using a "conventional" folder structure for the code generation.

We can convince, forcefully if needed, Ant to accept whatever folder structure we want. 😆 (Ant being the current build system used for Java file compilation and jar creation) That said, something resembling conventional would still be a good idea.