Skip to content

Conversation

@zielinsky
Copy link
Member

Fixes #22144


// If available in the same jar as the stdlib classes, overlay Scala 3
// runtime properties contained in `library3.properties` (e.g., version.number).
val lib3Stream = pickJarBasedOn.getResourceAsStream(lib3Filename)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming we're searching for properties based on classpath of Option[?] since 3.8 we're probably never going to find /library.properties, so it seems like we might just start to emit it directly without a fallback.

Comment on lines 1922 to 1924
s"""version.number=${version.value}
|maven.version.number=${version.value}
|""".stripMargin
Copy link
Contributor

@WojciechMazur WojciechMazur Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scala 2.13 library.properties content:

copyright.string=Copyright 2002-2025, LAMP/EPFL and Lightbend, Inc. dba Akka
maven.version.number=2.13.17
osgi.version.number=2.13.17.v20250930-055830-VFINAL-05169c7
shell.banner=%n     ________ ___   / /  ___%n    / __/ __// _ | / /  / _ |%n  __\\ \\/ /__/ __ |/ /__/ __ |%n /____/\\___/_/ |_/____/_/ | |%n                          |/  %s
version.number=2.13.17

We might consider emitting these as well (maybe with exception of osgi.version.number) and updated copyright

Also seems like a good case to refactor to common task/function due to duplicates of code

lazy val generateLibrary3Properties: Def.Initialize[Task[Seq[File]]] = generatePropertiesFile(
contents = s"""version.number=${version.value}
|maven.version.number=${version.value}
|copyright.string=Copyright 2002-$currentYear, LAMP/EPFL and Lightbend, Inc. dba Akka
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be only LAMP/EPFL according to compiler.properties from scala3-compiler jar

contents = s"""version.number=${version.value}
|maven.version.number=${version.value}
|copyright.string=Copyright 2002-$currentYear, LAMP/EPFL and Lightbend, Inc. dba Akka
|shell.banner=%n ________ ___ / / ___%n / __/ __// _ | / / / _ |%n __\\ \\/ /__/ __ |/ /__/ __ |%n /____/\\___/_/ |_/____/_/ | |%n |/ %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potentatially we could move it variable and interpolate so that it's readable for us

@som-snytt
Copy link
Contributor

It's been a while since I used the old shell banner, but when I did, it inspired me with community spirit!

@@ -0,0 +1,7 @@
object Test {
def main(args: Array[String]): Unit = {
val v = scala.util.Properties.versionNumberString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add 1 more test when using scala3-compiler artifact, whcih contains support for detecting Scala version of compiler? It would be useful for me, as I need to detect version of compiler in compiler plugin, see https://github.com/scala-native/scala-native/blob/6ddaf5554a0ea5fdcacfced34bea36856f4c58f2/nscplugin/src/main/scala-3/scala/scalanative/nscplugin/AdaptLazyVals.scala#L27-L31

@zielinsky zielinsky force-pushed the i22144 branch 2 times, most recently from 0322a9b to 4a17857 Compare November 5, 2025 00:40
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

Successfully merging this pull request may close these issues.

Show correct version when using util.Properties.versionNumberString

3 participants