mikepenz / AboutLibraries

AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
http://mikepenz.github.io/AboutLibraries/
Apache License 2.0
3.65k stars 421 forks source link

Core module won't compile for ios_arm64 #766

Closed xoif closed 2 years ago

xoif commented 2 years ago

Hello, I'm using your library within a kotlin multiplatform mobile project. My Android module is planed to use the separate Jetpack compose functionality directly. For iOS however I planed to access my shared kotlin multiplatform module from my Swift code, to receive a list of the libraries/licences that are used in the common/shared kotlin native business layer. Once retrieved, I would simply pass this list of libraries/licences to my ios specific license library to generate a complete list of all the used libraries (KMM, Cocoapods, Swift Package Manager). Unfortunately building the kmm shared layer fails with the following message:

`Execution failed for task ':sharedDomainLayer:cinteropJWTDecodeIosSimulatorArm64'.

Could not resolve all files for configuration ':sharedDomainLayer:iosSimulatorArm64JWTDecodeCInterop'. Could not resolve com.mikepenz:aboutlibraries-core:10.3.0. Required by: project :sharedDomainLayer No matching variant of com.mikepenz:aboutlibraries-core:10.3.0 was found. The consumer was configured to find a usage of 'kotlin-cinterop' of a library, with the library elements 'cinterop-klib', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' but:

  • Variant 'commonMainMetadataElements' capability com.mikepenz:aboutlibraries-core:10.3.0 declares a usage of 'kotlin-api' of a library:
  • Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
  • Other compatible attributes:
  • Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
  • Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
  • Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
  • Variant 'debugApiElements-published' capability com.mikepenz:aboutlibraries-core:10.3.0 declares an API of a library:
  • Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
  • Other compatible attributes:
  • Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
  • Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
  • Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
  • Variant 'debugRuntimeElements-published' capability com.mikepenz:aboutlibraries-core:10.3.0 declares a runtime of a library:
  • Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
  • Other compatible attributes:
  • Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
  • Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
  • Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')`

As your documentation only mentions Android and app-desktop, I guess that as of now, kotlin native simply isn't supported. Another issue could be that I'm using Apple Silicon (M1) which is always a good guess for incompatibility issues.

used Version: val kotlinVersion = "1.7.0" val aboutLibsVersion = "10.3.0"

xoif commented 2 years ago

After realizing that /aboutlibraries-core/build.gradle indeed contains iOS targets, I was able to narrow down the issue to the iosSimulatorArm64() target. After removing this from the build.gradle.kts of my kmm module, the project builds as I'd expect. Ofc. this comes with the drawback, that the iOS project can't be build/tested on the (native) M1 simulator anymore.

mikepenz commented 2 years ago

@xoif added the additional simulator targets, if you could please check out if it works now?

xoif commented 2 years ago

@mikepenz it’s working now. Thanks for the fast response!