@@ -6,27 +6,38 @@ lazy val scala3 = "3.0.0"
6
6
7
7
ThisBuild / scalaVersion := scala213
8
8
9
- lazy val scalapyVersion = sys.props(" plugin.scalapy.version " )
9
+ def getProp ( p : String ) = Option ( sys.props(p)).map(_.trim).filter(_.nonEmpty )
10
10
11
- lazy val python = Python (
12
- Option (sys.props(" plugin.python.executable" )).filter(_.trim.nonEmpty)
13
- )
11
+ def getProps (prop : String * ) =
12
+ prop
13
+ .map(p => p -> getProp(p))
14
+ .collect { case (k, Some (v)) => s """ -D $k= $v""" }
15
+
16
+ lazy val scalapyVersion = getProp(" plugin.scalapy.version" ).get
17
+
18
+ lazy val python = Python (getProp(" plugin.python.executable" ))
14
19
15
20
lazy val pythonLdFlags = python.ldflags.get
16
21
17
22
lazy val javaOpts = python.scalapyProperties.get.map { case (k, v) =>
18
23
s """ -D $k= $v"""
19
24
}.toSeq
20
25
26
+ val checkModule = taskKey[Unit ](" Check loading a dummy module" )
27
+
21
28
lazy val root = crossProject(JVMPlatform , NativePlatform )
22
29
.in(file(" ." ))
23
30
.settings(
24
- crossScalaVersions := Seq (scala212, scala213)
31
+ crossScalaVersions := Seq (scala212, scala213),
32
+ Compile / mainClass := Some (" project.Main" )
25
33
)
26
34
.jvmSettings(
27
35
fork := true ,
28
- javaOptions ++= javaOpts,
29
- libraryDependencies += " me.shadaj" %% " scalapy-core" % scalapyVersion
36
+ javaOptions ++= javaOpts ++ getProps(" plugin.virtualenv" ),
37
+ libraryDependencies += " me.shadaj" %% " scalapy-core" % scalapyVersion,
38
+ checkModule := {
39
+ (Compile / runMain).toTask(" project.Module" ).value
40
+ }
30
41
)
31
42
.nativeSettings(
32
43
libraryDependencies += " me.shadaj" %%% " scalapy-core" % scalapyVersion,
0 commit comments