Gradle subprojects and different VM version targets #770
denis-fokin
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have recently switched to Java 11. Good news, because overwise we could not use new IntelliJ platform features and new upgraded libraries and frameworks.
Problem
Here is the problem that the transition solved: a library built with Java 8 target cannot execute code of library that is built with Java 11 target, but new IntelliJ platform is built with Java 11 bytecode target and some new libraries are built with Java 11 bytecode target (sure there are even newer libraries built with even more recent versions of bytecode but the most popular target now is 11).
Assume that we switched all our implementation to Java 11 target. In that case we can run IntelliJ platform libraries which are built with Java 11 target. This approach fails with some concrete executor scenario. If we analyze classes for an IntelliJ project with Java 8 SDK, we want to bootstrap a concrete executor process with Java 8. Concrete executor uses libraries of utbot-framework-api and it in turn uses utbot-framework, so all these dependences must be compiled with Java 8 target.
Solution: 11
This problem seems rather easy to solve. We are allowed to use target 8 from target 11 but not vice versa. Let’s compile with target 8 only specific modules that are not dependencies for the concrete executor, for instance, utbot-intellij.
Solution: 811
This solution worked well until we decided to upgrade some libraries, namely TestNG. The version of TestNG is compiled with target 11. We use it to compile tests for framework, but framework is compiled with target 8 because of the reasons explained above. Therefor we failed to use them the target of dependency is higher than target of the tests.
An obvious solution is to distinguish targets for the framework and for the tests of framework. From the perspective of Gradle it is possible. You can specify different targets, but Gradle starts dropping warnings. It is difficult to disagree that target of tests should be the same or lower than target of project.
What seems correct from the Gradle perspective is not true from our perspective, because we are developing a tool that should support target 11, so we need to compile the results in our tests with target 11.
Solution: Divide and rule
A possible solution, that we are going to stick to, is extraction the tests in a separate subproject with higher VM version target.
Beta Was this translation helpful? Give feedback.
All reactions