-
Notifications
You must be signed in to change notification settings - Fork 1
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
#193: Drop support of Spark 2.4 #196
Conversation
* dropping Spark 2.4 support * strict use of sbt projectmatrix plugin, tohave cross-builds * basic settings moved to `project/Setup.scala` class * some move or project setup code to fall into logical areas
JaCoCo server module code coverage report - scala 2.13.11
|
|
||
ThisBuild / versionScheme := Some("early-semver") | ||
|
||
Global / onChangedBuildSource := ReloadOnSourceChanges | ||
|
||
publish / skip := true | ||
|
||
lazy val printSparkScalaVersion = taskKey[Unit]("Print Spark and Scala versions for atum-service is being built for.") | ||
lazy val printScalaVersion = taskKey[Unit]("Print Scala versions for atum-service is being built for.") | ||
initialize := { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the assignment necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I don't know. This code block is a remnant of my tries to keep Spakr 2.4 support. And I found it interesting, so kept it for now, with the intention to ask you what you think to have that information (of the active Java version) there.
Just forgot to comment accordingly.
So what do you think, should we keep the info (with the commented out cod removed)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's useful to have a log statement with the Java version in use. See an alternative implementation below.
val checkJavaVersion = taskKey[Unit]("Check Java version")
checkJavaVersion := {
val javaVersionUsed = VersionNumber(sys.props("java.specification.version"))
streams.value.log.info(s"Running on Java version $javaVersionUsed")
}
// Run the task when the project is loaded
Global / onLoad := (Global / onLoad).value.andThen(state => "checkJavaVersion" :: state)
(base) AB032LP@LFGQVV4V6D atum-service % sbt compile
[info] welcome to sbt 1.9.7 (Amazon.com Inc. Java 11.0.22)
[info] loading global plugins from /Users/AB032LP/.sbt/1.0/plugins
[info] loading settings for project atum-service-build-build-build from metals.sbt ...
[info] loading project definition from /Users/AB032LP/IdeaProjects/atum-service/project/project/project
[info] loading settings for project atum-service-build-build from metals.sbt ...
[info] loading project definition from /Users/AB032LP/IdeaProjects/atum-service/project/project
[success] Generated .bloop/atum-service-build-build.json
[success] Total time: 1 s, completed 16 May 2024, 10:05:28
[info] loading settings for project atum-service-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /Users/AB032LP/IdeaProjects/atum-service/project
[success] Generated .bloop/atum-service-build.json
[success] Total time: 1 s, completed 16 May 2024, 10:05:29
[info] loading settings for project atum-service from build.sbt,publish.sbt ...
[info] set current project to atum-service (in build file:/Users/AB032LP/IdeaProjects/atum-service/)
[info] Running on Java version 11
[success] Total time: 0 s, completed 16 May 2024, 10:05:38
[info] Executing in batch mode. For better performance use sbt's shell
[info] Building atum-database with Scala 2.13.11
[info] Building atum-model with Scala 2.12.18
[info] Building atum-server with Scala 2.13.11
[info] Building atum-model with Scala 2.13.11
[info] Building atum-agent with Spark 3.3.2, Scala 2.12.18
[info] Building atum-agent with Spark 3.3.2, Scala 2.13.11
[success] Total time: 4 s, completed 16 May 2024, 10:05:42
build.sbt
Outdated
val _ = initialize.value // Ensure previous initializations are run | ||
|
||
val requiredJavaVersion = VersionNumber("17") | ||
val current = VersionNumber(sys.props("java.specification.version")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming to something like javaVersion
or javaVersionInUse
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If code kept, will rename.
build.sbt
Outdated
initialize := { | ||
val _ = initialize.value // Ensure previous initializations are run | ||
|
||
val requiredJavaVersion = VersionNumber("17") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is currently not applied, but in general, can you explain the intended requirement for Java 17?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope the explanation above make it cleared. This would be removed for sure (or maybe used in the information 🤔 )
project/Setup.scala
Outdated
val scala212 = "2.12.18" | ||
val scala213 = "2.13.11" | ||
|
||
val serviceScalaVersion: String = scala213 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could align the naming as we sometimes use server and sometimes service. I would suggest to use server everywhere given it's a name of the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, the original idea had been) (discussed bakc than with @lsulak ) that:
server = REST server
service = all parts of the running service (REST server + database)
If it's not consistent somewhere though, definitely wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I comprehend the logic behind it. However, without prior knowledge, it might not be immediately clear. Hence, I would suggest being more descriptive, for instance, using a name like "serverAndDatabaseScalaVersion".
project/VersionAxes.scala
Outdated
) | ||
} | ||
|
||
def singleRow(scalaVersion: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another candidate for renaming as the method's name doesn't tell me anything about what it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a brilliant idea. I was following the projectmatrix name from examples and how it is used in other examples. But I admit, it took me a while to grasp the concept. A better name would make it much easier to understand 👍
project/VersionAxes.scala
Outdated
} | ||
} | ||
|
||
def scalasRow(scalaVersions: Seq[String], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As below, not sure what the name suggests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build.sbt file is definitely more readable and tidier. Apart from couple of suggested renamings I would argue that even the code in VersionAxis object could be enhanced by few comments so that one immediately knows what a given method does without looking at the implementation.
The CI file, i.e. build instructions, must be also changed I assume, with the current setup. Command [info] agent_spark3 I.e. there is no [info] agent_spark32_13 ❓ -- I think that 2.13 is default = |
Co-authored-by: Ladislav Sulak <[email protected]>
Yes, GitHub actions still need changes. I didn't want to hold this one back on that though. I am actually considering to make it a separate PR. |
project/Setup.scala
Outdated
// val clientScalacOptions: Seq[String] = Seq("-Ymacro-annotations") | ||
|
||
val serverMergeStrategy = assembly / assemblyMergeStrategy := { | ||
case PathList("META-INF", "services", xs @ _*) => MergeStrategy.filterDistinctLines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This xs @ _*
is marked by IntelliJ with warning. (I just blindly moved it from build.sbt
. What does it actually means @salamonpavel, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xs is an alias, it's not needed here as we do not reference the alias and could be removed and the _* expands the elements of the list
* enhanced README.md to describe possible Spark 2.4 build.sbt * increase version of sbt projectMatrix plugin
project/VersionAxes.scala
Outdated
} | ||
} | ||
|
||
def addScalaCrossBuild(scalaVersions: Seq[String], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addScalaCrossBuild
and addSingleScalaBuild
look the same. Why not use one in the other?
* cleared unused an commented out code from project setup files * moved publish related values into `publish.sbt`
* assembly plugin version upgraded * commonSettings moved to Setup.scala
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last thing I found about the license header, otherwise it looks good to me, even the sbt assembly
works! I'd prefer if CI is fixed in this step as it's not gonna be complicated, right? But up to you, good job!
Co-authored-by: Ladislav Sulak <[email protected]>
project/Setup.scala
classCloses #193