Been playing a bit with toolchain (converting an e...
# kotlin-toolchain
p
Been playing a bit with toolchain (converting an existing Maven project) and had few challenges: • There is no maven local option as a repo (have some libs that are not available in regular maven repos’s and can only be downloaded). • There is no way to include the test-jar scope from another module. It this correct or am i overlooking some config options? P.S Not a real challenge but an observation: seems there is a lot of out-of-the-box support for very specific type of projects (ktor, spring, etc). Would a more modular approach not be preferable? P.P.S Like the easy yaml format, really cleans up the build files.
e
Looks like maven local is not supported yet kotlin-toolchain.org/dev/user-guide/dependencies#…
a
Built-in repository with Id
mavenLocal
should work. Could you please try it?
🎉 1
a
Thanks for the feedback! > There is no way to include the test-jar scope from another module. Could you please elaborate what is your need that you're trying to cover by that?
j
Not a real challenge but an observation: seems there is a lot of out-of-the-box support for very specific type of projects (ktor, spring, etc). Would a more modular approach not be preferable?
You can consider the
ktor
or
spring
support as "presets". The vast majority of what they do is just configuring some things that are available in
module.yaml
. It's just a way to provide better defaults in this context. So the modular version exists, it's the rest of the
module.yaml
, but we just added convenience on top. Those could eventually be turned into plugins to really separate the "core" features from these convenience features, but plugins are not quite ready yet, and maybe pragmatically it's still better to provide them out-of-the-box.
👍 1
@alexey.barsov I realize now that
mavenLocal
is not documented. Is it on purpose or we just forgot?
a
It is definitly not on purpose - forgotten.
p
Can confirm that indeed just include the following works:
Copy code
repositories:
  - mavenLocal
🙏 2
What I try to achieve with test-jar is reuse some testing logic. So I have a “base” module that has some testing classes I want also to use in other modules. Maven supports this with their test-jar construct. So in the base module:
Copy code
<execution>
  <goals>
    <goal>test-jar</goal>
  </goals>
  <phase>test-compile</phase>
</execution>
and in all the “consumers”:
Copy code
<dependency>
            <artifactId>roboquant</artifactId>
            <groupId>org.roboquant</groupId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
a
do I get correctly your "base" module contains main code and test code and you depend on
test-jar
at some places and use it as a normal dependency in other? could your problem be solved other ways? like having separate module with test fixtures which depend on this base and then where it's needed in
test-dependencies
you could depend on this test module also this ticket might be somehow relevant, but probably it's not directly what you're trying to achieve here
➕ 1
p
Didn’t really investigate other approaches, but in worse case could duplicate some code. Not sure a special test-fixture-module would work, depends on how “Amper life-cycle” works. The test-fixture-module would depend on the base-module. But the base-module test classes would depend on the test-fixture-module. Would this still work?
u
> The test-fixture-module would depend on the base-module. But the base-module test classes would depend on the test-fixture-module. Would this still work? > Yeah, that works 🙂 In this scenario there are three tasks: • base-main code compilation • base-test code compilation • test-fixture-main code compilation As long as there is no loop, everything is fine. The dependency chain
base-main -> test-fixture-main -> base-test
is a valid one.
👍 1
🙏 1
a