-
Notifications
You must be signed in to change notification settings - Fork 101
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
Cross build for sbt 1.0 #179
Conversation
@@ -88,9 +87,7 @@ val `scalajs-bundler` = | |||
commitNextVersion, | |||
pushChanges, | |||
releaseStepTask(GhPagesKeys.pushSite in manual) | |||
), | |||
scriptedLaunchOpts += "-Dplugin.version=" + version.value, | |||
scriptedBufferLog := false |
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.
Not sure why the top-level project contains settings for the scripted plugins, so I've removed them.
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 I remember correctly that was needed to run the scripted
command from the root project. But maybe that’s not needed anymore with your runScripted
task? Also, what would be the canonical way to run scripted tests for contributors, now?
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.
Completely missed this comment. I will update CONTRIBUTING.md to mention the new runScripted
task. A future improvement could be to run the supported scripted tests as part of the normal test target
test in Test := Def.sequential(
test in Test,
runScriptedTask
).value,
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.
Updated CONTRIBUTING.md to mention runScripted
.
I'm seeing a lot of library dependencies warnings, should the sbt-scalajs version be updated in the scripted tests?
|
@sjrd Not sure I understand. Are you saying that we should keep the sbt-scalajs plugin version as is? |
Yes, basically. Or at least that the reported warning is not a concern and should not itself be the cause to upgrade. |
1b716f8
to
2522d6d
Compare
Currently working on getting the scripted tests to run for sbt 1.0. I'll need some guidance from the maintainers on how to approach this. Some tests only support sbt 0.13 (for example those depending on the play sbt-plugin), other tests we want to run for sbt 1.0 needs to be upgraded to use Scala.js 0.6.19 (unless we remove the explicit declaration and rely on the version the scalajs-bundler plugin adds). In addition, we need to remove the Also, do I understand correctly that we want to keep the sbt 0.13 version of the plugin on Scala.js 0.6.18? I'll try to push a WIP branch later tonight. |
build.sbt
Outdated
def args = tests.map(Path.relativeTo(base)).flatten.mkString(" ") | ||
|
||
if (tests.nonEmpty) | ||
Def.task(scripted.toTask(" " + args).value) |
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 a super generic way to filter scripted tests based on @xuwei-k's amazing work on sbt/sbt-site#107. If necessary we can simplify it to filter only the last directory, e.g. under sbt/sbt-{,web}-scalajs-bundle
and include some defaults such as include tests matching *sbt-${sbtVersion}*
. Let me know what you think/
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.
Based on @julienrf 's comment we can make this filtering based on the content of project/build.properties
. If the file is missing, run for all sbt versions else parse the binary version and run it if it matches sbtBinaryVersion in pluginCrossBuild
.
df12481
to
5ddcabb
Compare
implicit class ProcessLoggerOps(val self: ProcessLogger) extends AnyVal { | ||
def out(msg: String) = self.info(msg) | ||
} | ||
} |
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.
Why not use scala.sys.Process
everywhere instead of introducing this abstraction over scala.sys.Process
and sbt.Process
?
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 will give it a try.
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.
Done in 8f2e318
@@ -1 +0,0 @@ | |||
sbt.version=0.13.15 |
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.
Why remove that? I think keeping it (and setting it to 1.0.1
) makes it possible to load the project whatever sbt version is installed.
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 we keep it, it will force the test to only work with that specific sbt version. Most tests I assume we want to run for both versions of sbt. Those we want to fix to a specific sbt version will have to be configured so the CI can filter them out. I've already added a mechanism to do this as pointed out elsewhere.
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.
OK I see! I didn’t notice that the tests were executed with both sbt 1.0 and 0.13. This is great actually :) We should not have to introduce a mechanism testing whether a test should be run with sbt 1.0 or 0.13 only.
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 mechanism is needed for sbt-web-scalajs-bundler/play
until the Play sbt plugin has been published for sbt 1.0 (playframework/playframework#7261). However, based on @sjrd's concern, we should probably also add tests that target the minimum version of sbt 0.13 and sbt 1.0 that scalajs-bundler supports to ensure documentation about those requirements stays up to date.
if (!installDir.exists()) { | ||
log.info(s"Installing jsdom in ${installDir.absolutePath}") | ||
IO.createDirectory(installDir) | ||
install(installDir, useYarn.value, log)(s"jsdom@$jsdomVersion") | ||
install(installDir, usingYarn, log)(s"jsdom@$jsdomVersion") |
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 wish sbt/sbt#3299 could be fixed soon so that we don’t have to introduce these redundant identifiers (ie usingYarn
instead of useYarn.value
)
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.
4b2d2f9 updates to newly released sbt 1.0.2 and allows to remove these workarounds.
build.sbt
Outdated
def runScriptedTask = Def.taskDyn { | ||
val sbtBinVersion = (sbtBinaryVersion in pluginCrossBuild).value | ||
val base = sbtTestDirectory.value | ||
val testDirectoryFinder = base * AllPassFilter * AllPassFilter filter { _.isDirectory } |
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.
Why does that find test directories?
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 works similar to the shell glob .../sbt-test/*/*
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 great, thanks! Could you squash the commits into a single one before we merge?
d4c9552
to
7b326d5
Compare
OK, squashed and added tests for minimum versions of sbt. |
7edf2cc
to
2cfe6f0
Compare
appveyor.yml
Outdated
@@ -7,8 +7,8 @@ install: | |||
build_script: | |||
- sbt clean compile | |||
test_script: | |||
- sbt test scripted | |||
- sbt test runScripted |
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.
Do you know if it’s possible to have the same matrix thing as we have with travis?
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.
Done in the latest version. Take note of the comment about special handling of ^
. It looks related with appveyor/ci#1500.
- Bump Scala.js to 0.6.19 which supports sbt 1.0.0-RC2+. - Fix error from the DSL checker when compiling with sbt 1.0.2. - Use scala.sys.process in both sbt versions instead of the sbt.Process API which has been removed in sbt 1.0. - Remove project/build.properties from scripted tests that should run for both sbt 0.13 and 1.0 and provide a new `runScripted` task to conditionally run tests supported by the configured sbt version. - Add tests for minimum required sbt versions: 0.13.9 and 1.0.0-RC2. - Configure build matrices in AppVeyor and Travis with sbt build versions.
2cfe6f0
to
9c8d490
Compare
Allows to more easily filter both sbt 0.13 and sbt 1.0 tests. Based on scalacenter/scalajs-bundler#179
This is great work, thanks a lot Jonas! |
Bumps dependencies and fixes warnings when compiling with sbt 1.0.
References #150