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

ArtefactResolution: Fix resolution of test modules #85

Merged
merged 1 commit into from
Feb 25, 2020
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
42 changes: 23 additions & 19 deletions src/main/scala/seed/artefact/ArtefactResolution.scala
Original file line number Diff line number Diff line change
Expand Up @@ -377,28 +377,32 @@ object ArtefactResolution {
log: Log
): RuntimeResolution = {
val all = allRuntimeLibs(build)
all.map {
all.flatMap {
case (path, libs) =>
val (n, p, t) = path
val m = build(n).module
val pm = (if (t == Regular) BuildConfig.platformModule(m, p)
else
m.test match {
case None => BuildConfig.platformModule(m, p)
case Some(t) => BuildConfig.platformModule(t, p)
}).get
val (scalaOrg, scalaVer) =
(pm.scalaOrganisation.get, pm.scalaVersion.get)

path -> resolution(
seedConfig,
resolvers,
packageConfig,
libs ++ (if (t == Regular) Set() else all((n, p, Regular))),
(scalaOrg, scalaVer),
optionalArtefacts,
log
)
val pm =
if (t == Regular) BuildConfig.platformModule(m, p)
else
m.test match {
case None => BuildConfig.platformModule(m, p)
case Some(t) => BuildConfig.platformModule(t, p)
}

pm.map { pm =>
val (scalaOrg, scalaVer) =
(pm.scalaOrganisation.get, pm.scalaVersion.get)

path -> resolution(
seedConfig,
resolvers,
packageConfig,
libs ++ (if (t == Regular) Set() else all((n, p, Regular))),
(scalaOrg, scalaVer),
optionalArtefacts,
log
)
}.toList
}
}

Expand Down
19 changes: 19 additions & 0 deletions src/test/scala/seed/generation/BloopIntegrationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,23 @@ object BloopIntegrationSpec extends TestSuite[Unit] {
)
)
}

test("Override target platforms in test module") { _ =>
val config =
BuildConfig
.load(Paths.get("test", "test-module-override-targets"), Log.urgent)
.get
import config._
val buildPath = tempPath.resolve("test-module-override-targets")
Files.createDirectory(buildPath)
cli.Generate.ui(
Config(),
projectPath,
buildPath,
resolvers,
build,
Command.Bloop(packageConfig),
Log.urgent
)
}
}
15 changes: 15 additions & 0 deletions test/test-module-override-targets/build.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
scalaVersion = "2.11.11"
scalaJsVersion = "0.6.28"
scalaNativeVersion = "0.3.7"

[module.example]
root = "src/"
sources = ["src/"]
targets = ["js", "jvm", "native"]

[module.example.test]
sources = ["test/"]

# override targets, excluding Scala Native
targets = ["js", "jvm"]