fastutil icon indicating copy to clipboard operation
fastutil copied to clipboard

Additional src folders?

Open techsy730 opened this issue 3 years ago • 5 comments

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.

techsy730 avatar Jan 03 '21 02:01 techsy730

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

incaseoftrouble avatar Jan 05 '21 11:01 incaseoftrouble

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

techsy730 avatar Jan 06 '21 19:01 techsy730

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.

incaseoftrouble avatar Jan 07 '21 09:01 incaseoftrouble

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

And, I hate Maven 😂

vigna avatar Jan 07 '21 11:01 vigna

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.

techsy730 avatar Dec 04 '23 00:12 techsy730