Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the library in two modules: logcat and logger #5

Open
BraisGabin opened this issue Sep 24, 2021 · 3 comments
Open

Split the library in two modules: logcat and logger #5

BraisGabin opened this issue Sep 24, 2021 · 3 comments

Comments

@BraisGabin
Copy link

It would be nice to have a pure jvm module with the logcat function so you don't need to pay the compilation time of an Android module only because you want to log something. The AndroidLogcatLogger would be moved to a "logger module" .

This way you just depend on the "logger module" in the :app module. The "logger module" could include the other one as an api dependency so if someone doesn't care about this can only use this dependency everywhere.

@pyricau
Copy link
Member

pyricau commented Oct 1, 2021

Interesting. I thought about this, but the thing is, the logcat dependency doesn't actually declare any dependency on Android, so you can totally use it from a JVM only module, it should work, even if there's a class that references unknown symbols. Of course you shouldn't load the AndroidLogcatLogger class on a JVM. Am I missing something?

@JcMinarro
Copy link

@pyricau
As far as you are using com.android.library Plugin the artifact result will be an .aar files that needs to be consumed by an Android Application or Android LIbrary, but can't be consumed by a pure JVM module.
Here the error you get if you try to use logcat into a pure JVM module:

Execution failed for task ':stream-chat-android-core:compileKotlin'.
> Error while evaluating property 'filteredArgumentsMap' of task ':stream-chat-android-core:compileKotlin'
   > Could not resolve all files for configuration ':stream-chat-android-core:compileClasspath'.
      > Could not resolve com.squareup.logcat:logcat:0.1.
        Required by:
            project :stream-chat-android-core
         > No matching variant of com.squareup.logcat:logcat:0.1 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
             - Variant 'releaseApiPublication' capability com.squareup.logcat:logcat:0.1 declares an API of a library, and its dependencies declared externally:
                 - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
                 - Other compatible attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                     - Doesn't say anything about its target Java version (required compatibility with Java 8)
                     - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
             - Variant 'releaseRuntimePublication' capability com.squareup.logcat:logcat:0.1 declares a runtime of a library, and its dependencies declared externally:
                 - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
                 - Other compatible attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                     - Doesn't say anything about its target Java version (required compatibility with Java 8)
                     - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')

@pyricau
Copy link
Member

pyricau commented Dec 14, 2021

ah, good point, should look at whether we can release a jar instead then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants