Skip to content
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

[2.8.x] Calling setScalaVersionFromSbtVersion in test-scripted is totally useless #10720

Closed
mkurz opened this issue Feb 25, 2021 · 0 comments
Closed

Comments

@mkurz
Copy link
Member

mkurz commented Feb 25, 2021

In the 2.8.x branch we run scripted tests against sbt 0.13.x and 1.2.x:

name: "Run scripted tests (a) for sbt 0.13.x"
script: scripts/test-scripted 0.13.x 'play-sbt-plugin/*1of3'

- name: "Run scripted tests (a) for sbt 1.x"
script: scripts/test-scripted 1.x 'play-sbt-plugin/*1of3'

test-scripted calls setScalaVersionFromSbtVersion:

SBT_VERSION="${1:-1.x}"
shift
setScalaVersionFromSbtVersion
cd "$BASEDIR"
start scripted "RUNNING SCRIPTED TESTS FOR SBT $SBT_VERSION"
runSbt "++$SCALA_VERSION" "Sbt-Plugin/scripted $@"
end scripted "ALL SCRIPTED TESTS PASSED"

setScalaVersionFromSbtVersion() {
case "$SBT_VERSION" in
1*) SCALA_VERSION="2.12.10" ;;
0.13*) SCALA_VERSION="2.10.7" ;;
*) echo "Aborting: Failed to determine scala version for sbt $SBT_VERSION" >&2; exit 1 ;;
esac
}

So this ends up in either

  • runSbt "++2.12.10" "Sbt-Plugin/scripted $@" when passed 1.x to the script, or
  • runSbt "++2.10.7" "Sbt-Plugin/scripted $@" when passed 0.13.x to the script

Turns out this is totally useless. I mean, yes sbt will start with the scala version specified... BUT all, absolutly all, scripted test projects define their own scala version by setting it via the scala.version property:


Means that all sbt scripted projects launch with the scala version which gets set here:
s"-Dscala.version=$scala212",

which is the value from interplay...

Also... of course Play 2.8.x is not even published for Scala 2.10, so if 2.10.7, really would get used it would fail badly...

I am pretty sure this is a left over from the Play 2.7.x branch, because back then the "test-scripted" script, which actually were 2 scripts, did also run publishLocal and of course for this it had to publish the Play sbt plugin for Scala 2.10 as well to support sbt 0.13.x:

SCALA_VERSION="2.10.6"
SBT_VERSION="0.13"
cd "$BASEDIR"
printMessage "PUBLISHING PLAY LOCALLY FOR SBT ${SBT_VERSION}"
runSbt ++${SCALA_VERSION} quickPublish publishLocal

SCALA_VERSION="2.12.9"
SBT_VERSION="1.2.8"
cd "$BASEDIR"
printMessage "PUBLISHING PLAY LOCALLY FOR SBT ${SBT_VERSION}"
runSbt ++${SCALA_VERSION} quickPublish publishLocal

So now that's why in #10655 I added a very stupid scripted test which just prints the scala and sbt version to the console so we can easily check in Travis which versions were actually used to run the scripted tests:
https://github.com/playframework/playframework/pull/10655/files#diff-660cf244988ca8b1705f1b3cb675d9e0750c7f5c86c7fecb2274f0deb842b36d

BTW: In master branch this setScalaVersionFromSbtVersion does not exist anymore... (because we dropped sbt 0.13.x)

@mkurz mkurz closed this as completed Mar 15, 2021
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

No branches or pull requests

1 participant