8000 SI-6963 Add version to -Xmigration by JamesIry · Pull Request #1998 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

SI-6963 Add version to -Xmigration #1998

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 1 commit into from
Feb 1, 2013
Merged

Conversation

JamesIry
Copy link
Contributor

Adds an optional version parameter to the -Xmigration compiler setting.
Doing -Xmigration without version number behaves as it used to by
dumping every possible migration warning.

This commit adds a ScalaVersion class (plus ancillary stuff), and a
ScalaVersionSetting.

Since @adriaanm convinced me to add a version number, I'll give this to him for review.

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1661/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2392/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1661/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2394/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2396/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Failed - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2394/
sad kitty

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2396/

* final, release candidate, milestone, and development builds. The build argument is used
* to segregate builds
*/
case class ActualScalaVersion(major: Int, minor: Int, rev: Int, build: ScalaBuild) extends ScalaVersion {
Copy link
Contributor

Choose a reason for hiding this comment

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

I find "actual" to be highly unrevealing as to what something is - what is "actual" is different for different people. Ideas I would like better:

  • PreciseScalaVersion
  • UniversalScalaVersion
  • BuiltScalaVersion

I can come up with more if we don't like any of those.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SpecificScalaVersion?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that came to mind too. I had some reservation about it but I can't think of it now. It's good with me.

@soc
Copy link
Contributor
soc commented Jan 28, 2013

So what was the decision on how to handle external code? How can people who use their own version scheme for their libraries benefit from migration-from?

I think it would be a far cleaner approach to make migration work with and without an argument (and adopting a sane default) instead of adding another option.

@JamesIry
Copy link
Contributor Author

@soc Supporting 3rd party libraries means figuring out version schemas. If you have a proposal I'm all ears.

Making migration work with and without an argument leads to an ambiguity. scalac -migration X. What is X? Is it a file or a version argument? I could try to parse it as a version argument and if that fails leave it on the queue to be parsed as a file argument. But then innocent typos turn into bizarre errors. Further, and more subtly, there's nothing that says a scala file can't be called "2" right now but making migration slurp up anything that it can parse as a version would lead to a different error.

Note, I'm not "adding another option." I'm removing an option and putting in a replacement. It's just that I can't remove immediately, I have to deprecate.

@soc
Copy link
Contributor
soc commented Jan 29, 2013

Supporting 3rd party libraries means figuring out version schemas. If you have a proposal I'm all ears.

No, but that's why exactly the changes proposed here have been abandoned more than a year ago.
https://groups.google.com/d/topic/scala-internals/SPxf0gPPtvs/discussion

scalac -migration X

If X is meant to be an argument to migration, then it is just the wrong syntax. Syntax for arguments is and has always been migration:X.

Look here: #49

@soc
Copy link
Contributor
soc commented Jan 29, 2013

Idea: Let's use the information from the MANIFEST.MF file. This will work for 95% of the people who don't compile every third-party library from scratch.

There are multiple ways to handle the remaining 5%:

  • Don't show any migration warnings for their code
  • Show all migration warnings for their code
  • Have SBT pass the version info from its build file to the compiler
  • Have the compiler look into the SBT build file

Opinions?

@JamesIry
Copy link
Contributor Author

@soc, I'm making the changes now to go with -Xmigration:version where version is optional.

MANIFEST.MF tells you what the current version of the library is, it doesn't tell you what version the user wrote the code for. To have any hope of working the migration annotation would look like "@migration(artifactid, versionChangedIn, info about the change)" and the user would type something like scalac -Xmigration:artifactId=versionWrittenFor. And we'd have to insist that version numbers be in number[.number]* so we could parse and compare them.

That change would have to wait for 2.11 because it breaks the migration annotation's compatibility. In the meantime I can make -Xmigration substantially more useful without precluding that design later by going with -Xmigration:version in 2.10.

< 8000 a href="/scala/scala/pull/1998/commits/1de399d3c655807465c6369f77d08e57743e7eaa" class="Link--secondary">1de399d
Adds an optional version parameter to the -Xmigration compiler setting.
Doing -Xmigration without version number behaves as it used to by
dumping every possible migration warning.

This commit adds a ScalaVersion class (plus ancillary stuff), and a
ScalaVersionSetting.
@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1704/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2439/

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1708/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2443/

@soc
Copy link
Contributor
soc commented Jan 29, 2013

Ok, thanks! Looks a lot better that way.

Considering the MANIFEST.MF stuff: I don't think it has to be that complicated. The version in an migration annotation is compared to the version in the MANIFEST file of the jar file to which the class belongs. If that version is in the not so far future, a warning is emitted.

I think that way we would have a sane default, which would also make the version stuff less important.

But let's go forward with what we have now. :-)

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2443/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1704/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1708/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2439/

@JamesIry
Copy link
Contributor Author

ping @adriaanm for review

@adriaanm
Copy link
Contributor
adriaanm commented Feb 1, 2013

LGTM, noice!

adriaanm added a commit that referenced this pull request Feb 1, 2013
SI-6963 Add version to -Xmigration
@adriaanm adriaanm merged commit b403234 into scala:2.10.x Feb 1, 2013
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.

5 participants
0