spotify / ruler

Gradle plugin which helps you analyze the size of your Android apps.
Apache License 2.0
1.14k stars 58 forks source link

`2.0.0-beta-1` forces consumers to target JDK 17+ #165

Closed SimonMarquis closed 8 months ago

SimonMarquis commented 8 months ago

Current behavior

Using this plugin while targetting Java 11 will lead to this error:

Execution failed for task ':plugins:compileKotlin'.
> Could not resolve all files for configuration ':plugins:compileClasspath'.
   > Could not resolve com.spotify.ruler:ruler-gradle-plugin:2.0.0-beta-1.
     Required by:
         project :plugins
      > No matching variant of com.spotify.ruler:ruler-gradle-plugin:2.0.0-beta-1 was found. The consumer was configured to find a library for use during compile-time, compatible with Java 11, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.6', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
          - Variant 'apiElements' capability com.spotify.ruler:ruler-gradle-plugin:2.0.0-beta-1 declares a library for use during compile-time, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
              - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'runtimeElements' capability com.spotify.ruler:ruler-gradle-plugin:2.0.0-beta-1 declares a library for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
              - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'sourcesElements' capability com.spotify.ruler:ruler-gradle-plugin:2.0.0-beta-1 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - 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 11)
                  - Doesn't say anything about its elements (required them preferably in the form of class files)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')

Version 2.0.0-alpha-16 was not enforcing this.

Expected behavior

The minimum version requirement should be imposed on consumers. Do you think this is something that can be reverted? Or is it using specific features that requires Java 17?

Steps to reproduce

java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
    }
}

Versions

No response

Anything else?

No response

SimonMarquis commented 8 months ago

Sorry for the duplicated issue. Had a network error and refreshed/reposted the form 🙈.