Skip to content

Commit

Permalink
Fixed handling of missing artifact selection file
Browse files Browse the repository at this point in the history
  • Loading branch information
lefou committed Oct 17, 2022
1 parent 2ed3c54 commit d98ae75
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,16 @@ def publishToSonatype(
artifactsFile: Option[String] = None
): Command[Unit] = {

val pubTasks: Seq[String] = artifactsFile match {
val pubTasks: Seq[String] = artifactsFile.map(f => os.Path(f, os.pwd)).filter(os.exists) match {
case None => Seq("__.publishArtifacts")
case Some(f) =>
val tasks = Seq(os.Path(f, os.pwd))
.filter(os.exists)
.flatMap(p => os.read.lines(p))
val tasks = os.read.lines(f)
.map(_.trim())
.filter(_.nonEmpty)
.filter(l => l.nonEmpty && !l.startsWith("#"))
if (tasks.isEmpty) sys.error(s"No artifacts tasks selected. File ${f} cannot be empty.")
tasks
}


val Right(tasks) = RunScript.resolveTasks(
mill.main.ResolveTasks,
Evaluator.currentEvaluator.get,
Expand Down

0 comments on commit d98ae75

Please sign in to comment.