Skip to content

Commit

Permalink
Scope Scala Native's tasks to Compile and Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Duhemm committed May 8, 2017
1 parent 834affa commit f74e043
Showing 1 changed file with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,27 @@ object ScalaNativePluginInternal {
}

lazy val projectSettings =
unscopedSettings ++
inConfig(Compile)(externalDependenciesTask(compile)) ++
inConfig(Test)(externalDependenciesTask(compile in Test)) ++
inConfig(Compile)(availableDependenciesTask(compile)) ++
inConfig(Test)(availableDependenciesTask(compile in Test)) ++
inConfig(Compile)(nativeMissingDependenciesTask) ++
inConfig(Test)(nativeMissingDependenciesTask)

lazy val unscopedSettings = Seq(
dependencies ++
inConfig(Compile)(scalaNativeSettings) ++
inConfig(Test)(scalaNativeSettings)

lazy val scalaNativeSettings =
scopedSettings ++
externalDependenciesTask(compile) ++
availableDependenciesTask(compile) ++
nativeMissingDependenciesTask

lazy val dependencies = Seq(
libraryDependencies ++= Seq(
"org.scala-native" %%% "nativelib" % nativeVersion,
"org.scala-native" %%% "javalib" % nativeVersion,
"org.scala-native" %%% "scalalib" % nativeVersion
),
addCompilerPlugin(
"org.scala-native" % "nscplugin" % nativeVersion cross CrossVersion.full),
"org.scala-native" % "nscplugin" % nativeVersion cross CrossVersion.full)
)

lazy val scopedSettings = Seq(
nativeWarnOldJVM := {
val logger = nativeLogger.value
Try(Class.forName("java.util.function.Function")).toOption match {
Expand Down Expand Up @@ -174,13 +179,13 @@ object ScalaNativePluginInternal {
},
nativeMode := "debug",
artifactPath in nativeLink := {
(crossTarget in Compile).value / (moduleName.value + "-out")
crossTarget.value / (moduleName.value + "-out")
},
nativeLinkerReporter := tools.LinkerReporter.empty,
nativeOptimizerReporter := tools.OptimizerReporter.empty,
nativeOptimizerDriver := tools.OptimizerDriver(nativeConfig.value),
nativeWorkdir := {
val workdir = (Keys.crossTarget in Compile).value / "native"
val workdir = crossTarget.value / "native"
IO.delete(workdir)
IO.createDirectory(workdir)
workdir
Expand Down Expand Up @@ -243,10 +248,10 @@ object ScalaNativePluginInternal {
lib
},
nativeConfig := {
val mainClass = (selectMainClass in Compile).value.getOrElse(
val mainClass = selectMainClass.value.getOrElse(
throw new MessageOnlyException("No main class detected.")
)
val classpath = (fullClasspath in Compile).value.map(_.data)
val classpath = fullClasspath.value.map(_.data)
val entry = nir.Global.Top(mainClass.toString + "$")
val cwd = nativeWorkdir.value

Expand Down Expand Up @@ -365,7 +370,7 @@ object ScalaNativePluginInternal {
nativeWarnOldJVM.value
// We explicitly mention all of the steps in the pipeline
// although only the last one is strictly necessary.
(compile in Compile).value
compile.value
nativeLinkNIR.value
nativeOptimizeNIR.value
nativeGenerateLL.value
Expand Down

0 comments on commit f74e043

Please sign in to comment.