https://kotlinlang.org logo
#amper
Title
# amper
c

christophsturm

12/05/2023, 8:33 AM
one feature that I would love to have is have tests and main source in the same directory (
src
) they would be distinguished by suffix, so User is compiled with the compileClasspath and UserTest is compiled with testCompileClasspath.
a

amakeev

12/05/2023, 8:44 AM
Thanks Christoph, that's an interesting idea, thanks. BTW, IntelliJ IDE has similar feature, though the classpath then becomes 'compile' for both main and test code. If there is such a feature in Amper. How would you work with the code, which is only needed for tests, like fixtures, utilities? I mean, would you need to be sure that such code doesn't end up in the final product?
c

christophsturm

12/05/2023, 8:50 AM
what idea feature do you mean? I know the feature where it shows tests and main in the same tree. (but that never worked 100% for me) for utility classes i would also stick to a suffix (TestUtil), and for resources I really don’t know. btw resources could also be colocated with sources (like idea jps did in the past) but thats a separate issue. for test resource, maybe put them in a directory? so if User is in the directory
model
there could be a user.yaml in
model/fixture
the whole main idea here is to make it all easy to navigate without much IDE support when viewing the tree.
I really don’t know whats the best solution for all the little issues that will come up but its an idea I had for a long time and now when you start working on a new build tool seems to be a good time to bring it up
a

amakeev

12/05/2023, 9:04 AM
what idea feature do you mean?
With IntelliJ project model (JPS) it's possible to place tests and main code in the same folder. But they need to have the same classpath in this case. Anyways, this is indeed something we have considered but don't have a good design so far. A simplistic approach would be pattern-based separation of the main and the test code, with a risk that certain test-only code would unintentionally end up in the production artifacts. We haven't yet ruled out this option, though. So thanks for the suggestion, it's kind of +1 to reconsider it in future.
c

christophsturm

12/05/2023, 9:05 AM
cool
I was thinking of writing a gradle plugin that just works by copying test and main sources to different directory.
3 Views