https://kotlinlang.org logo
q

qlitzler

03/06/2018, 10:03 AM
Yes it is possible
e

Evgeniy Zaharov

03/06/2018, 10:26 AM
but it looks that it does’t work (if I don’t have any mistake) I have 3 modules, two common and one platform (jvm target).
build.gradle
dependencies example: module1(common): -
empty dependencies
module2(common): -
compile project(':module1')
module3(jvm target) -
expectedBy project('module2')
As a result in module 3 there is no classes from module 1. Do I have any mistakes (gradle 4.6, java 1.8_144)?
q

qlitzler

03/06/2018, 10:29 AM
Try adding
implementation project(':module1')
in module 3
e

Evgeniy Zaharov

03/06/2018, 10:55 AM
it helps to remove red highlighting in IDEA, but problem not solved. I looked more closely at the errors and seemed a bit wrong pointed out errors. The
module 2
is not compiled, because not find classes from
module 1
, but in IDEA all not highlighting by red, but also not compile. I have try to change
compile
in module 2 to
implementation
, but it doesn’t help. Also I try to add both
implementation
and
compile
to module 2, but it doesn’t help.
i

ilya.gorbunov

03/06/2018, 1:07 PM
If you want to implement both
module1
and
module2
with
module3
, you need to declare two
expectedBy
dependencies. This is prohibited now to have more than one
expectedBy
, but soon this restriction will be lifted.
e

Evgeniy Zaharov

03/06/2018, 1:31 PM
@ilya.gorbunov thanks!
@ilya.gorbunov will it be possible also in future to have common module dependent from another common module with
expect
classes? Or
expect
classes may be only in “top” common module?
i

ilya.gorbunov

03/06/2018, 2:12 PM
expect
classes can be in each common module, but every common module must be implemented by a platform module.
So now your
module1
must be implemented by some jvm module too. However just compiling common
module2
that has a compile dependency on common
module1
should be fine. Are you sure these errors occur when compiling
module2
and not
module3
?
e

Evgeniy Zaharov

03/07/2018, 8:00 AM
yes, the error still occurs in the
module3
. I was confused by the error that there classes from
module2
that do not find classes from
module1
. But the error appears at the compilation stage of
module3
a real example you can see here https://github.com/alfa-laboratory/kgen-doc-tools/tree/0.0.1 - common_nodes - module1 - common_parser - module2 - jvm_parser - module3
i

ilya.gorbunov

03/07/2018, 1:27 PM
Yes, it seems that you want to implement both
common_nodes
and
common_parser
with
jvm_parser
on JVM. There's no way to do that in 1.2.30, but you can try the nightly build 1.2.40-dev-754 (https://bintray.com/kotlin/kotlin-dev/kotlin/1.2.40-dev-754) where multiple
expectedBy
dependencies are supported.
👍🏻 1
e

Evgeniy Zaharov

03/07/2018, 1:33 PM
thanks! I will try it. Do I understand right, that I need only to add
compile project(':common_nodes')
to
common_parser
and add both
expectedBy
from
common_nodes
and
common_parser
to
jvm_parser
?
👌 1
wow, it works 🙂 at least it’s compiled.