Created
July 27, 2021 05:15
-
-
Save xuwei-k/881590291d17606a14501e72909b0943 to your computer and use it in GitHub Desktop.
sbt taskAll command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commands += Command.args("taskAll", """<task name> <project id regex>""") { (s, args) => | |
val taskName = args.head | |
val projectRegexList = args.tail | |
val extracted = Project.extract(s) | |
val currentBuildUri = extracted.currentRef.build | |
val buildStructure = extracted.structure | |
val buildUnitsMap = buildStructure.units | |
val currentBuildUnit = buildUnitsMap(currentBuildUri) | |
val projectsMap = currentBuildUnit.defined | |
val projects = projectsMap.values.map(_.id).toVector.filter(id => projectRegexList.exists(id matches _)) | |
val result = projects.map(_ + "/" + taskName).mkString("all ", " ", "") | |
s.log.info(result) | |
result :: s | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment