-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Git] Improve builder so that it runs only for requested platfor… (#240)
* [Git] Improve builder so that it runs only for requested platforms * Add fancy toys under the 🌳 tree
- Loading branch information
1 parent
d6436bc
commit e7bf1d2
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This is a collection of toys under the Yggdrasil tree for the good <s>kids</s> | ||
# developers. These utilities can be employed in builder files. | ||
|
||
using BinaryBuilder | ||
|
||
""" | ||
should_build_platform(platform) -> Bool | ||
Return whether the tarballs for the given `platform` should be built. | ||
This is useful when the builder has different platform-dependent elements | ||
(sources, script, products, etc...) that make it hard to have a single | ||
`build_tarballs` call. | ||
""" | ||
function should_build_platform(platform) | ||
# If you need inspiration for how to use this function, look at the builder | ||
# for Git. | ||
|
||
# Get the list of platforms requested from the command line. This should be | ||
# the only argument not prefixed with "--". | ||
requested_platforms = filter(arg -> !occursin(r"^--.*", arg), ARGS) | ||
|
||
if isone(length(requested_platforms)) | ||
# `requested_platforms` has only one element: the comma-separated list | ||
# of platform. We'll run the platform only if it's in the list | ||
return platform in split(requested_platforms[1], ",") | ||
else | ||
# `requested_platforms` doesn't have only one element: if its length is | ||
# zero, no platform has been explicitely passed from the command line | ||
# and we we'll run all platforms, otherwise we don't know what to do, so | ||
# let's return false to be safe. | ||
return iszero(length(requested_platforms)) | ||
end | ||
end |