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

Scaffold: Set correct root path when only one platform was selected #65

Merged
merged 1 commit into from
Nov 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/scala/seed/cli/Scaffold.scala
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ class Scaffold(log: Log, silent: Boolean = false) {
(if (scalaJsVersion.isEmpty) List() else List(
NamedTable(
List("module", moduleName, "js"),
Map("root" -> Str("js")) ++
Map("root" -> (if (platforms.size == 1) Str(".") else Str("js"))) ++
(if (
jsScalaVersion.isDefined && !jsScalaVersion.contains(jvmScalaVersion)
) Map("scalaVersion" -> Str(jsScalaVersion.get)) else Map()
Expand Down Expand Up @@ -622,7 +622,7 @@ class Scaffold(log: Log, silent: Boolean = false) {
NamedTable(
List("module", moduleName, "jvm"),
Map(
"root" -> Str("jvm"),
"root" -> (if (platforms.size == 1) Str(".") else Str("jvm")),
"sources" -> Arr(List(
if (platforms.size == 1) Str("src") else Str("jvm/src")
))
Expand All @@ -644,7 +644,7 @@ class Scaffold(log: Log, silent: Boolean = false) {
(if (scalaNativeVersion.isEmpty) List() else List(
NamedTable(
List("module", moduleName, "native"),
Map("root" -> Str("native")) ++
Map("root" -> (if (platforms.size == 1) Str(".") else Str("native"))) ++
(if (
nativeScalaVersion.isDefined &&
!nativeScalaVersion.contains(jvmScalaVersion)
Expand Down
8 changes: 6 additions & 2 deletions src/test/scala/seed/cli/ScaffoldSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import minitest.SimpleTestSuite
import seed.Log
import seed.model.{Organisation, Platform}
import toml.Node.NamedTable
import toml.Value.Str
import toml.Value.{Arr, Str}

object ScaffoldSpec extends SimpleTestSuite {
private val scaffold = new Scaffold(Log.urgent, silent = true)

test("Create build file one non-JVM platform") {
test("Create build file for one non-JVM platform") {
val result = scaffold.generateBuildFile(
"example",
stable = true,
Expand All @@ -27,6 +27,10 @@ object ScaffoldSpec extends SimpleTestSuite {

val module = result.nodes(1).asInstanceOf[NamedTable]
assertEquals(module.ref, List("module", "example", "native"))
assertEquals(
module.values,
Map("root" -> Str("."), "sources" -> Arr(List(Str("src"))))
)

assertEquals(result.nodes.length, 2)
}
Expand Down