@@ -21,10 +21,12 @@ lazy val sbtPluginFilePath: String =
2121def log (msg : String ) = println(Console .GREEN + msg + Console .RESET )
2222
2323/** 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 ._
2526 val command = binary +: arguments
2627 log(command.mkString(" " ))
2728 val builder = new ProcessBuilder (command : _* ).directory(projectDir.toFile).inheritIO()
29+ builder.environment.putAll(environment.asJava)
2830 val process = builder.start()
2931 val exitCode = process.waitFor()
3032 exitCode
@@ -40,6 +42,7 @@ sealed trait CommunityProject:
4042 val dependencies : List [CommunityProject ]
4143 val binaryName : String
4244 val runCommandsArgs : List [String ] = Nil
45+ val environment : Map [String , String ] = Map .empty
4346
4447 final val projectDir = communitybuildDir.resolve(" community-projects" ).resolve(project)
4548
@@ -53,7 +56,7 @@ sealed trait CommunityProject:
5356 log(s " Publishing $project" )
5457 if publishCommand eq null then
5558 throw RuntimeException (s " Publish command is not specified for $project. Project details: \n $this" )
56- val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand): _* )
59+ val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand), environment )
5760 if exitCode != 0 then
5861 throw RuntimeException (s " Publish command exited with code $exitCode for project $project. Project details: \n $this" )
5962 published = true
@@ -63,11 +66,11 @@ sealed trait CommunityProject:
6366 log(s " Documenting $project" )
6467 if docCommand eq null then
6568 throw RuntimeException (s " Doc command is not specified for $project. Project details: \n $this" )
66- val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ docCommand): _* )
69+ val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ docCommand), environment )
6770 if exitCode != 0 then
6871 throw RuntimeException (s " Doc command exited with code $exitCode for project $project. Project details: \n $this" )
6972
70- final def build (): Int = exec(projectDir, binaryName, buildCommands : _* )
73+ final def build (): Int = exec(projectDir, binaryName, buildCommands, environment )
7174
7275 final def buildCommands = runCommandsArgs :+ testCommand
7376
@@ -86,6 +89,7 @@ final case class MillCommunityProject(
8689 // uncomment once mill is released
8790 // if ignoreDocs then null else s"$baseCommand.docJar"
8891 override val runCommandsArgs = List (" -i" , " -D" , s " dottyVersion= $compilerVersion" )
92+ override val environment = Map (" MILL_VERSION" -> " 0.9.6-16-a5da34" )
8993
9094final case class SbtCommunityProject (
9195 project : String ,
0 commit comments