cianru / rustore-publish-gradle-plugin

RuStore Gradle Plugin that allows you to publish the android APK build file to the RuStore.
Apache License 2.0
28 stars 5 forks source link

Crash when applying both publish plugins #4

Closed nesterov-n closed 9 months ago

nesterov-n commented 10 months ago

Hello.

I've found an error when using this plugin and the Huawei plugin simultaneously. A sample project to reproduce it: https://github.com/nesterov-n/publish-sample

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("ru.cian.rustore-publish-gradle-plugin") version "0.2.1"
    id("ru.cian.huawei-publish-gradle-plugin") version "1.4.0"
}

Error stack trace at gradle sync:

Caused by: org.gradle.api.UnknownTaskException: Task with name 'assembleDebug' not found in project ':app'.
        at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:102)
        at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:46)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection.named(DefaultNamedDomainObjectCollection.java:360)
        at org.gradle.api.internal.tasks.DefaultTaskCollection.named(DefaultTaskCollection.java:112)
        at ru.cian.huawei.publish.HuaweiPublishPlugin$createTask$1.execute(HuaweiPublishPlugin.kt:41)
        at ru.cian.huawei.publish.HuaweiPublishPlugin$createTask$1.execute(HuaweiPublishPlugin.kt:38)
        at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        ...

I tried to fix this crash, here's the commit that addresses it: https://github.com/nesterov-n/rustore-publish-gradle-plugin/commit/96663740db58f551d4422e3d8b5f3fa0d2ff0032

Made task setup similar to the Huawei plugin.

I can create a pull request, if needed.

cosic commented 10 months ago

@nesterov-n Hi! Please check 0.2.2 plugin version for Gradle 7 or 0.3.0 for Gradle 8+

nesterov-n commented 9 months ago

@cosic Hi, sorry for delay.

Have tried version 0.3.0 in sample project and my real project. Both fails with errror:

> Could not resolve all files for configuration ':app:classpath'.
   > Could not resolve ru.cian.rustore-plugin:plugin:0.3.0.
     Required by:
         project :app > ru.cian.rustore-publish-gradle-plugin:ru.cian.rustore-publish-gradle-plugin.gradle.plugin:0.3.0
      > No matching variant of ru.cian.rustore-plugin:plugin:0.3.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 17, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but:
          - Variant 'apiElements' capability ru.cian.rustore-plugin:plugin:0.3.0 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 19 and the consumer needed a component for use during runtime, compatible with Java 17
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')

I haven't figured out the reason yet. Will try again in couple of days

cosic commented 9 months ago

@nesterov-n Hi! That's my fault. I forgot to switch on jdk17 when published plugin. Please try a new 0.3.1 plugin version. It's the same version but built with jdk17 intead of jdk19.

nesterov-n commented 9 months ago

@cosic 0.3.1works fine. Thank you very much!