Thread
#multiplatform
    qlitzler

    qlitzler

    4 years ago
    Yes it is possible
    Evgeniy Zaharov

    Evgeniy Zaharov

    4 years ago
    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)?
    qlitzler

    qlitzler

    4 years ago
    Try adding
    implementation project(':module1')
    in module 3
    Evgeniy Zaharov

    Evgeniy Zaharov

    4 years ago
    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.
    ilya.gorbunov

    ilya.gorbunov

    4 years ago
    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.
    Evgeniy Zaharov

    Evgeniy Zaharov

    4 years ago
    @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?
    ilya.gorbunov

    ilya.gorbunov

    4 years ago
    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
    ?
    Evgeniy Zaharov

    Evgeniy Zaharov

    4 years ago
    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
    ilya.gorbunov

    ilya.gorbunov

    4 years ago
    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.
    Evgeniy Zaharov

    Evgeniy Zaharov

    4 years ago
    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
    ?
    wow, it works 🙂 at least it’s compiled.