Skip to content

Fixes to CLI and version reporting. #2531

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

Merged
merged 8 commits into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/src/dotty/tools/dotc/config/CompilerCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ object CompilerCommand extends DotClass {
else if (settings.version.value) {
ctx.echo(versionMsg)
Nil
} else if (!Properties.isJavaAtLeast("1.8")) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think dotty is going to work out of the box on Java 9, so we should probably make this an equality check

Copy link
Contributor

Choose a reason for hiding this comment

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

@DarkDimius The CI shows this line doesn't work.

ctx.error("Dotty requires Java 8 or newer to run")
Nil
}
else if (shouldStopWithInfo) {
ctx.echo(infoMessage)
Expand Down
45 changes: 12 additions & 33 deletions compiler/src/dotty/tools/dotc/config/Properties.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.util.jar.Attributes.{ Name => AttributeName }

/** Loads `library.properties` from the jar. */
object Properties extends PropertiesTrait {
protected def propCategory = "library"
protected def propCategory = "compiler"
protected def pickJarBasedOn = classOf[Option[_]]

/** Scala manifest attributes.
Expand Down Expand Up @@ -56,36 +56,7 @@ trait PropertiesTrait {
def scalaPropOrElse(name: String, alt: String): String = scalaProps.getProperty(name, alt)
def scalaPropOrEmpty(name: String): String = scalaPropOrElse(name, "")
def scalaPropOrNone(name: String): Option[String] = Option(scalaProps.getProperty(name))

/** The numeric portion of the runtime Scala version, if this is a final
* release. If for instance the versionString says "version 2.9.0.final",
* this would return Some("2.9.0").
*
* @return Some(version) if this is a final release build, None if
* it is an RC, Beta, etc. or was built from source, or if the version
* cannot be read.
*/
val releaseVersion =
for {
v <- scalaPropOrNone("maven.version.number")
if !(v endsWith "-SNAPSHOT")
} yield v

/** The development Scala version, if this is not a final release.
* The precise contents are not guaranteed, but it aims to provide a
* unique repository identifier (currently the svn revision) in the
* fourth dotted segment if the running version was built from source.
*
* @return Some(version) if this is a non-final version, None if this
* is a final release or the version cannot be read.
*/
val developmentVersion =
for {
v <- scalaPropOrNone("maven.version.number")
if v endsWith "-SNAPSHOT"
ov <- scalaPropOrNone("version.number")
} yield ov


/** Either the development or release version if known, otherwise
* the empty string.
*/
Expand All @@ -94,8 +65,16 @@ trait PropertiesTrait {
/** The version number of the jar this was loaded from plus "version " prefix,
* or "version (unknown)" if it cannot be determined.
*/
val versionString = "version " + "0.01" //scalaPropOrElse("version.number", "(unknown)")" +
val copyrightString = "(c) 2013 LAMP/EPFL" // scalaPropOrElse("copyright.string", "(c) 2002-2011 LAMP/EPFL")
val versionString = {
val v = scalaPropOrElse("version.number", "(unknown)")
"version " + scalaPropOrElse("version.number", "(unknown)") + {
if (v.contains("SNAPSHOT") || v.contains("NIGHTLY")) {
"-git-" + scalaPropOrElse("git.hash", "(unknown)")
} else ""
}
}

val copyrightString = scalaPropOrElse("copyright.string", "(c) 2002-2017 LAMP/EPFL")

/** This is the encoding to use reading in source files, overridden with -encoding
* Note that it uses "prop" i.e. looks in the scala jar, not the system properties.
Expand Down