Slackbot
04/22/2022, 12:11 PMGurvan LG
04/22/2022, 12:25 PMVampire
04/22/2022, 12:28 PMmodule-info.java in the tests I think they should run on the class path and thus not require the modules to be together.Gurvan LG
04/22/2022, 12:31 PMVampire
04/22/2022, 12:32 PMtest/java does not contain one the tests are run on the class path and thus modules should not be relevantGurvan LG
04/22/2022, 12:33 PMGurvan LG
04/22/2022, 12:36 PMVampire
04/22/2022, 12:39 PMmodule-info.java in the src/test/java it should not run on the module path but on the class path as documented here: https://docs.gradle.org/current/userguide/java_testing.html#sec:java_testing_modular
If this is no longer the case it is probably a regression and you should report it.Gurvan LG
04/22/2022, 12:56 PMVampire
04/22/2022, 12:56 PMGurvan LG
04/22/2022, 12:56 PMVampire
04/22/2022, 12:57 PMVampire
04/22/2022, 12:57 PMGurvan LG
04/22/2022, 12:57 PMVampire
04/22/2022, 12:58 PMVampire
04/22/2022, 1:24 PM./gradlew test the production Java code does not even compileGurvan LG
04/22/2022, 1:28 PM./gradlew clean test compiles (there are some code quality warning warnings so) and fails at task "Coretest". What special setting could I have ?Vampire
04/22/2022, 1:28 PMGurvan LG
04/22/2022, 1:28 PM./gradlew --version returns "Gradle 7.4.2"Gurvan LG
04/22/2022, 1:40 PMgit clone --branch Modularization <https://gitlab.com/sosl/sosl.git> (which was created a bit late and is expected to replace master)Vampire
04/22/2022, 1:56 PMGurvan LG
04/22/2022, 2:00 PM./gradlew clean test compiles and only fails on task "CoreTest". I do not see what to test that would be specific to my system. Any idea?Vampire
04/22/2022, 2:04 PMclean, this is Gradle, not Maven where it was more or less mandatory to get reliable buils, I have no idea.Vampire
04/22/2022, 2:08 PMVampire
04/22/2022, 2:08 PM--class-path D:\Sourcecode\other\others\sosl\Core\build\classes\java\main:D:\Sourcecode\other\others\sosl\Core\build\classes\scala\main:D:\Sourcecode\other\others\sosl\Core\build\resources\main:D:\Sourcecode\other\others\sosl\Core\build\classes\java\test:D:\Sourcecode\other\others\sosl\Core\build\classes\scala\test:D:\Sourcecode\other\others\sosl\Core\build\resources\test
It does not use the proper path separatorVampire
04/22/2022, 2:11 PMbuildSrcVampire
04/22/2022, 2:13 PMFile.pathSeparator instead of a hard-coded ':'Vampire
04/22/2022, 2:16 PM--class-path /home/gleguern/office/atelier[...]Gurvan LG
04/22/2022, 2:47 PMGurvan LG
04/22/2022, 2:50 PMVampire
04/22/2022, 3:04 PMVampire
04/22/2022, 3:04 PMVampire
04/22/2022, 3:04 PMVampire
04/22/2022, 3:04 PMVampire
04/22/2022, 3:05 PMVampire
04/22/2022, 3:07 PMGurvan LG
04/27/2022, 4:44 PMgit clone --branch JPMS <https://gitlab.com/mko-mcve/mcve-gradle-junit-scala-jpms.git>). There is indeed probably something broken in my build. There are however 2 points that were "incorrectly" handled by Gradle natively: inverting the dependency between scala and java sources; adding the scala classes to the classpath and "reading" them. Plus a non-obvious constraint of not sharing packages between java and scala which is linked to the fact that scala and java classes are not in the same repository.Gurvan LG
04/27/2022, 5:03 PMVampire
04/27/2022, 6:28 PMconf.java-depends-on-scala.gradle, actually everytime you write dependsOn you are doing something wrong, or at least it is a code smell.
Explicit task dependencies via dependsOn are almost always just a work-around or at least non-idiomatic.
It is always better to for example configure outputs of one task as inputs for another task and get implicit task dependencies or similar.
In case of language dependencies / order, the plugins by default just assume a certain order / dependency direction,
in the common convention-over-configuration tactic of Gradle, nothing "to be fixed" there.
But the documentation also shows how to chang this order properly at https://docs.gradle.org/current/userguide/building_java_projects.html#sub:compile_deps_jvm_lang
You actually almost got it properly, you just make an unnecessary filecollection of a filecollection, it works properly, it is just unnecessary.
Regarding "Do not declare Scala and Java sources in the same packages" and fix.jpms.gradle, both is totally unnecessary if you do JPMS properly.
What you need is javac argument --patch-module mcve.gradle_junit_scala_jpms=${sourceSets.main.scala.classesDirectory.get()} so that the classes already compiled from Scala
are seen by the compiler as part of the module, this way it even works when the Java and Scala classes are in the same package.
Btw. the project as is does not compile here, with replacing the whole fix.jpms.gradle with just adding the --patch-module it compiles and even works if I put the Scala file to the same package as the Java file.Gurvan LG
05/03/2022, 6:24 PM