https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

drofwarcs

02/04/2019, 12:10 AM
how do we expose dependencies brought in with cinterops to a test configuration?
In my MPP project I'm bringing in ocmockito this way:
Copy code
fromPreset(iosPreset, 'ios') {
            binaries {
                framework()
            }
            compilations.main {
                def productsDir = new File("").absolutePath
                linkerOpts "-F${productsDir}/common/libs"
                cinterops{
                    ocmockito {
                        includeDirs "${productsDir}/common/libs/OCMockitoIOS.framework/Headers"
                    }
                }
            }
        }
But I keep getting
error: unresolved reference: ocmockito
when I go to build the project
I had this working before updating to 1.3.20
o

orangy

02/04/2019, 5:49 AM
@ilya.matveev
d

drofwarcs

02/04/2019, 6:23 AM
found a fix. Changing
compilations.main
to
compilations.all
seem to get me pass that issue.
👍 1
r

russhwolf

02/04/2019, 12:52 PM
I think
compilations.test
would work if you only need it for tests
i

ilya.matveev

02/04/2019, 2:25 PM
I think
compilations.test
would work if you only need it for tests
This is right. Also the
linkerOpts
property of a compilation affects only binaries created using the
compilation.outputKinds
method. If you declare a binary using the binaries DSL, you need to use
linkerOpts
of this binary:
Copy code
binaries {
    framework {
        linkerOpts += ["-F${productsDir}/common/libs"]
    }
}
d

drofwarcs

02/04/2019, 2:32 PM
Sorry all, I found the steam of my issue. While updating to 1.3.20, I accidentally deleted the
packageName
of ocmockito under cinterops. Yesterday I had started out with
compilations.test
but when that failed I went to
compilations.main
thinking that the test compilations was wrong. the error
error: unresolved reference: ocmockito
was right all alone, I had just overlooked a simple detail. Thanks again for all of your help @svyatoslav.scherbina @russhwolf
👍 1
4 Views