1
1
import Dependencies ._
2
- import com .typesafe .sbt .SbtGit .git
3
- import java .nio .file .{Files , Paths }
4
- import java .io .File
5
2
6
3
inThisBuild(
7
4
List (
@@ -23,7 +20,9 @@ lazy val scala212 = "2.12.14"
23
20
lazy val scala213 = " 2.13.6"
24
21
lazy val scala3 = " 3.0.0"
25
22
26
- ThisBuild / scalaVersion := scala213
23
+ lazy val enableScripted = Option (sys.props(" plugin.ci" )).map(_.trim.nonEmpty).getOrElse(false )
24
+
25
+ ThisBuild / scalaVersion := (if (enableScripted) scala212 else scala213)
27
26
28
27
ThisBuild / scalafixDependencies += organizeImports
29
28
@@ -33,7 +32,27 @@ def warnUnusedImports(scalaVersion: String) =
33
32
case _ => Nil
34
33
}
35
34
35
+ def scriptedPlugin = if (enableScripted) Seq (ScriptedPlugin ) else Nil
36
+
37
+ def scriptedSettings = if (enableScripted) {
38
+ Seq (
39
+ scriptedLaunchOpts := {
40
+ scriptedLaunchOpts.value ++ {
41
+ Seq (s " -Dplugin.scalapy.version= $scalapyVersion" ) ++
42
+ Option (sys.props(" plugin.python.executable" ))
43
+ .map(" -Dplugin.python.executable=" + _)
44
+ .toSeq ++
45
+ Seq (" -Xmx1024M" , " -Dplugin.version=" + version.value)
46
+ }
47
+ },
48
+ scriptedBufferLog := false
49
+ )
50
+ } else Nil
51
+
52
+ lazy val scalapyVersion = Option (sys.props(" plugin.scalapy.version" )).map(_.trim).getOrElse(" 0.5.0" )
53
+
36
54
lazy val root = (project in file(" ." ))
55
+ .enablePlugins(scriptedPlugin : _* )
37
56
.settings(
38
57
name := " Python Native Libs" ,
39
58
crossScalaVersions := Seq (scala212, scala213, scala3),
@@ -48,13 +67,14 @@ lazy val root = (project in file("."))
48
67
semanticdbVersion := scalafixSemanticdb.revision,
49
68
scalacOptions ++= warnUnusedImports(scalaVersion.value)
50
69
)
70
+ .settings(scriptedSettings)
51
71
52
72
lazy val docs = project
53
73
.in(file(" python-docs" ))
54
74
.settings(
55
75
mdocVariables := Map (
56
76
" VERSION" -> " 0.1.3" ,
57
- " SCALAPY_VERSION" -> " 0.5.0 " ,
77
+ " SCALAPY_VERSION" -> scalapyVersion ,
58
78
" PYTHON" -> " /usr/bin/python3"
59
79
)
60
80
)
0 commit comments