Revisión | 7535f35d6a3609be92c5bdff7169d4b10f8bc745 (tree) |
---|---|
Tiempo | 2021-05-05 12:42:34 |
Autor | Remilia Scarlet <remilia@post...> |
Commiter | Remilia Scarlet |
Allow --target to be specified more than once
@@ -36,10 +36,9 @@ | ||
36 | 36 | # Initialize command line arguments |
37 | 37 | DBuildPK3.args.addFlag("new", 'N', help: "Create a skeleton pk3build.yaml and exit. Will not overwrite an existing file.") |
38 | 38 | DBuildPK3.args.addString("file", 'f', help: "Read this project file instead of pk3build.yaml.") |
39 | - DBuildPK3.args.addString("target", 't', help: "The target to build, or 'all' to build all targets.") | |
39 | + DBuildPK3.args.addMultiString("target", 't', help: "The target to build, or 'all' to build all targets. Can be used more than once.") | |
40 | 40 | DBuildPK3.args.addString("run", 'r', help: "Runs a run-target.") |
41 | 41 | |
42 | - | |
43 | 42 | DBuildPK3.args.addMultiString("ignore", 'i', "Target Options", "Ignore a specific file for this build. Can be used multiple times.") |
44 | 43 | DBuildPK3.args.addString("ignore-file", 'I', "Target Options", "Read filenames to ignore from the given file.") |
45 | 44 | DBuildPK3.args.addFlag("force", 'F', "Target Options", "Always build the target even if it doesn't need building.") |
@@ -140,19 +139,23 @@ | ||
140 | 139 | |
141 | 140 | # Build |
142 | 141 | if DBuildPK3.args["target"].called |
143 | - if DBuildPK3.args["target"].str == "all" | |
142 | + targets = DBuildPK3.args["target"].as(RemiArgParser::MultiStringArgument) | |
143 | + | |
144 | + if targets.values.includes?("all") | |
144 | 145 | # Build all targets |
145 | 146 | @project.targets.each do |name, _| |
146 | 147 | @project.build(name, ignores, DBuildPK3.args["force"].called) |
147 | 148 | end |
148 | 149 | else |
149 | - # Build a specific target | |
150 | - tgt = @project.targets[DBuildPK3.args["target"].str]? | |
150 | + # Build specific target(s) | |
151 | + targets.values.each do |tgtName| | |
152 | + tgt = @project.targets[tgtName]? | |
151 | 153 | |
152 | - if tgt | |
153 | - @project.build(DBuildPK3.args["target"].str, ignores, DBuildPK3.args["force"].called) | |
154 | - else | |
155 | - RemiLog.log.fatal("Unknown target: #{DBuildPK3.args["target"].str}") | |
154 | + if tgt | |
155 | + @project.build(tgtName, ignores, DBuildPK3.args["force"].called) | |
156 | + else | |
157 | + RemiLog.log.fatal("Unknown target: #{tgtName}") | |
158 | + end | |
156 | 159 | end |
157 | 160 | end |
158 | 161 | else |