Created
June 19, 2018 18:58
-
-
Save coreyoconnor/2ff338041ae377203c20a090304fac49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy val stage = taskKey[File]("stage") | |
val allProjectCompiles = ScopeFilter(inAnyProject, inConfigurations(Compile)) | |
lazy val dev = crossProject(JVMPlatform, NativePlatform) | |
.crossType(CrossType.Full) | |
.withoutSuffixFor(JVMPlatform) | |
.settings( | |
scalaVersion := "2.11.12", | |
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.5", | |
libraryDependencies += "com.outr" %%% "scribe" % "2.5.0", | |
libraryDependencies += "com.lihaoyi" %%% "fastparse" % "1.0.0", | |
logBuffered in Test := false | |
).jvmSettings( | |
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % Test, | |
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.14.0" % Test | |
).nativeSettings( | |
nativeLinkStubs := true | |
) | |
lazy val devJvm = dev.jvm | |
lazy val devNative = dev.native | |
lazy val root = (project in file(".")) | |
.aggregate(devJvm, devNative) | |
.settings( | |
aggregate in run := false, | |
aggregate in test := false, | |
run := { | |
(run in (devNative, Compile)).evaluated | |
}, | |
test := { | |
(test in (devJvm, Test)).value | |
}, | |
stage := { | |
import java.nio.file._ | |
test.value | |
val allNativeBins = (nativeLink in (devNative, Compile)).all(allProjectCompiles).value | |
val stageDir = target.value / "universal" / "stage" / "bin" | |
IO.createDirectory(stageDir) | |
allNativeBins foreach { nativeBin => | |
val src = nativeBin | |
val dst = stageDir / nativeBin.base | |
Files.copy(src.toPath, | |
dst.toPath, | |
StandardCopyOption.REPLACE_EXISTING) | |
} | |
stageDir | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment