Skip to content

Commit 4972b7c

Browse files
committed
CrossProject#in sets crossProjectBaseDirectory
1 parent a0a4236 commit 4972b7c

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

sbt-crossproject-test/src/sbt-test/new-api/detection/build.sbt

+25
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,28 @@ lazy val fullCross =
6464
doCheckBase(crossProjectBaseDirectory.value, file("fullCross"))
6565
}
6666
)
67+
68+
lazy val nonDefaultBase =
69+
crossProject(JVMPlatform, NativePlatform, JSPlatform)
70+
.in(file("non-default-base"))
71+
.jvmSettings(
72+
check := {
73+
doCheckPlatform(crossProjectPlatform.value, "jvm")
74+
doCheckType(crossProjectCrossType.value, CrossType.Full)
75+
doCheckBase(crossProjectBaseDirectory.value, file("non-default-base"))
76+
}
77+
)
78+
.jsSettings(
79+
check := {
80+
doCheckPlatform(crossProjectPlatform.value, "js")
81+
doCheckType(crossProjectCrossType.value, CrossType.Full)
82+
doCheckBase(crossProjectBaseDirectory.value, file("non-default-base"))
83+
}
84+
)
85+
.nativeSettings(
86+
check := {
87+
doCheckPlatform(crossProjectPlatform.value, "native")
88+
doCheckType(crossProjectCrossType.value, CrossType.Full)
89+
doCheckBase(crossProjectBaseDirectory.value, file("non-default-base"))
90+
}
91+
)

sbt-crossproject-test/src/sbt-test/new-api/detection/test

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
> fullCrossJVM/check
55
> fullCrossJS/check
66
> fullCrossNative/check
7+
> nonDefaultBaseJVM/check
8+
> nonDefaultBaseJS/check
9+
> nonDefaultBaseNative/check

sbt-crossproject/src/main/scala/sbtcrossproject/CrossProject.scala

+6-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ final class CrossProject private[sbtcrossproject] (
8484
configurePlatforms(platforms: _*)(_.enablePlugins(plugins: _*))
8585

8686
def in(dir: File): CrossProject =
87-
mapProjectsByPlatform(
88-
(platform, project) => project.in(crossType.platformDir(dir, platform)))
87+
settings(
88+
CrossPlugin.autoImport.crossProjectBaseDirectory :=
89+
IO.resolve((LocalRootProject / baseDirectory).value, dir)
90+
).mapProjectsByPlatform { (platform, project) =>
91+
project.in(crossType.platformDir(dir, platform))
92+
}
8993

9094
def overrideConfigs(cs: Configuration*): CrossProject =
9195
transform(_.overrideConfigs(cs: _*))

0 commit comments

Comments
 (0)