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

Publish a Version Built by Java 8 #26

Closed
jGleitz opened this issue Jan 27, 2020 · 11 comments
Closed

Publish a Version Built by Java 8 #26

jGleitz opened this issue Jan 27, 2020 · 11 comments

Comments

@jGleitz
Copy link

jGleitz commented Jan 27, 2020

The latest version of kbox (0.14.1) was built using Java 9. This means that Gradle 6 will not accept the dependency when run on a version 8 JVM.

Please publish a version of kbox built by Java 8.

@jGleitz
Copy link
Author

jGleitz commented Jan 27, 2020

See https://travis-ci.org/robstoll/atrium/jobs/642307833 for an example of the error this causes.

@robstoll
Copy link
Owner

hm... I don't thinks this is really necessary for kbox. The error of gradle can also be suppressed. But if we want separate releases, then we probably need a build for:

  • jdk8
  • jdk9
  • jdk11

And since this sucks, I would say we drop jdk9 at least

@jGleitz
Copy link
Author

jGleitz commented Jan 27, 2020

Why would we need different builds? Gradle accepts packages built on older JVMs for newer JVMs. Just not the other way around.

@robstoll
Copy link
Owner

https://docs.gradle.org/current/userguide/upgrading_version_5.html#automatic_target_jvm_version
We could disable the check, yet it seems it can only be turned off in general and not for single dependencies.

@jGleitz
Copy link
Author

jGleitz commented Jan 27, 2020

I still don’t understand why publishing this library built by JDK 8 would not fix the problem. From my understanding, it could then be used from any JVM >= 8. The link does not indicate anything else!

Further Proof: robstoll/atrium#331 only fails on JVM 8, even though it is being tested on JVM 10 & 12. This shows that more recent JVM can still use gradle dependencies built by an older JVM.

So why can’t we just publish a version 0.14.2 which was built on a JDK 8?

@robstoll
Copy link
Owner

robstoll commented Jan 27, 2020

I still don’t understand why publishing this library built by JDK 8 would not fix the problem.

Sorry, I have confused you. It would fix the problem gradle mentions. What I meant is that it is actually not a problem because KBox is using only jdk6 API with the exception of module-info.java, a jdk9 feature. Or in other words, it's totally fine to use it in a jdk8 project as long as there is not a classpath scrapper which cannot handle module-info.java

So we would need to release two versions if we want to use module-info.java.

@jGleitz
Copy link
Author

jGleitz commented Jan 27, 2020

Ah, now I see the problem. Thanks for explaining!

There is a StackOverflow thread that explains how to achieve a single release that both uses a modules-info.java and is compatible with Java 8. I think we would need to implement this in the tutteli plugins or make the tutteli plugins use the Gradle Modules Plugin, which already provides the functionality.

How does atrium do this? I thought that it was compatible with Java 8, but also uses modules-info.java. I haven’t seen different artefacts for different versions of Java.

I feel that we should fix this properly in kbox, because we will propagate the problem to users of atrium, won’t we? And if we want to stay compatible with JVM 8, we don’t want to tell all users to disable Gradle dependency version checking.

@robstoll
Copy link
Owner

robstoll commented Jan 27, 2020

You are right, the same problems applies to Atrium as well (it is also released with jdk9) so user using Gradle 6 + jdk8 + Atrium already see this problem today.

jdk8 can handle modules-info.java that's why it's not really a problem but gradle thinks differently. It makes sense what gradle tells in other circumstances and I agree with you that we need a solution so that users are not blocked/run into this issue.

Atrium provides an android artefact as the d8-compiler cannot (could not) handle module-info.class files.

I suggest we:

  • we drop support for jdk8 for the jvm module and only build against jdk9 and newer
  • people sticking on jdk8 can use the -android artefact (not sure if we have set the android target to use jdk8, maybe we need to fix this)

Alternatively, we could first switch to the new MPP plugin of Kotlin (needs to be done in tutteli pl). With this we can easily introduce several JVM targets without much boilerplate (the current approach is not ideal). I would then suggest that we have:

  • jdk11 -> can use kotlin-stdlib-jdk8
  • jdk7 without module-info.java
  • drop android target as it is then the same as jdk8 (re-introduce it if we have android specific assertion functions)

@jGleitz
Copy link
Author

jGleitz commented Jan 27, 2020

If you want to, I can look into how we could adapt the tutteli plugins to support this. I would try to create an artifact that contains a module-info.java but can also be used on JVM 8.

@robstoll
Copy link
Owner

Go for it.
One note on https://github.com/java9-modularity/gradle-modules-plugin in case you were referring to this plugin above and would like to use it. As far as I remember we cannot use it due to https://youtrack.jetbrains.com/issue/KT-21266 => it would fail with something like kotlin.stdlib could not be found in the module graph.

@robstoll
Copy link
Owner

robstoll commented Feb 4, 2020

v0.14.2 released

@robstoll robstoll closed this as completed Feb 4, 2020
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

2 participants