@@ -21,10 +21,12 @@ lazy val sbtPluginFilePath: String =
21
21
def log (msg : String ) = println(Console .GREEN + msg + Console .RESET )
22
22
23
23
/** Executes shell command, returns false in case of error. */
24
- def exec (projectDir : Path , binary : String , arguments : String * ): Int =
24
+ def exec (projectDir : Path , binary : String , arguments : Seq [String ], environment : Map [String , String ]): Int =
25
+ import collection .JavaConverters ._
25
26
val command = binary +: arguments
26
27
log(command.mkString(" " ))
27
28
val builder = new ProcessBuilder (command : _* ).directory(projectDir.toFile).inheritIO()
29
+ builder.environment.putAll(environment.asJava)
28
30
val process = builder.start()
29
31
val exitCode = process.waitFor()
30
32
exitCode
@@ -41,6 +43,7 @@ sealed trait CommunityProject:
41
43
val binaryName : String
42
44
val runCommandsArgs : List [String ] = Nil
43
45
val requiresExperimental : Boolean
46
+ val environment : Map [String , String ] = Map .empty
44
47
45
48
final val projectDir = communitybuildDir.resolve(" community-projects" ).resolve(project)
46
49
@@ -55,7 +58,7 @@ sealed trait CommunityProject:
55
58
log(s " Publishing $project" )
56
59
if publishCommand eq null then
57
60
throw RuntimeException (s " Publish command is not specified for $project. Project details: \n $this" )
58
- val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand): _* )
61
+ val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand), environment )
59
62
if exitCode != 0 then
60
63
throw RuntimeException (s " Publish command exited with code $exitCode for project $project. Project details: \n $this" )
61
64
published = true
@@ -70,11 +73,11 @@ sealed trait CommunityProject:
70
73
log(s " Documenting $project" )
71
74
if docCommand eq null then
72
75
throw RuntimeException (s " Doc command is not specified for $project. Project details: \n $this" )
73
- val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ docCommand): _* )
76
+ val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ docCommand), environment )
74
77
if exitCode != 0 then
75
78
throw RuntimeException (s " Doc command exited with code $exitCode for project $project. Project details: \n $this" )
76
79
77
- final def build (): Int = exec(projectDir, binaryName, buildCommands : _* )
80
+ final def build (): Int = exec(projectDir, binaryName, buildCommands, environment )
78
81
79
82
final def buildCommands = runCommandsArgs :+ testCommand
80
83
@@ -94,6 +97,7 @@ final case class MillCommunityProject(
94
97
// uncomment once mill is released
95
98
// if ignoreDocs then null else s"$baseCommand.docJar"
96
99
override val runCommandsArgs = List (" -i" , " -D" , s " dottyVersion= $compilerVersion" )
100
+ override val environment = Map (" MILL_VERSION" -> " 0.9.6-16-a5da34" )
97
101
98
102
final case class SbtCommunityProject (
99
103
project : String ,
0 commit comments