set jna.nosys to true programmatically

Previously I was seeing the error upon the first scripted test. I thought it was because Main was somehow not early enough. It might just be because scripted technically runs as part of the build.

Ref sbt/io#110
This commit is contained in:
Eugene Yokota 2017-12-21 00:08:56 -05:00
parent d8609ced7f
commit 13e1862c2f
4 changed files with 8 additions and 2 deletions

View File

@ -20,4 +20,4 @@ install:
- SET PATH=C:\sbt\sbt\bin;%PATH%
- SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8
test_script:
- sbt "-Djna.nosys=true" "scripted actions/*"
- sbt "scripted actions/*"

View File

@ -572,7 +572,7 @@ def otherRootSettings =
scriptedUnpublished := scriptedUnpublishedTask.evaluated,
scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test",
// scriptedPrescripted := { addSbtAlternateResolver _ },
scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server", "-Djna.nosys=true"),
scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server"),
publishAll := { val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value },
publishLocalBinAll := { val _ = (publishLocalBin).all(ScopeFilter(inAnyProject)).value },
aggregate in bintrayRelease := false

View File

@ -128,6 +128,9 @@ object StandardMain {
def initialState(configuration: xsbti.AppConfiguration,
initialDefinitions: Seq[Command],
preCommands: Seq[String]): State = {
// This is to workaround https://github.com/sbt/io/issues/110
sys.props.put("jna.nosys", "true")
import BasicCommandStrings.isEarlyCommand
val userCommands = configuration.arguments.map(_.trim)
val (earlyCommands, normalCommands) = (preCommands ++ userCommands).partition(isEarlyCommand)

View File

@ -37,6 +37,9 @@ trait ScriptedKeys {
}
object Scripted {
// This is to workaround https://github.com/sbt/io/issues/110
sys.props.put("jna.nosys", "true")
lazy val MavenResolverPluginTest = config("mavenResolverPluginTest") extend Compile
lazy val RepoOverrideTest = config("repoOverrideTest") extend Compile