about summary refs log tree commit diff
path: root/tools/magrathea (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-06-01 r/4199 feat(tools/magrathea): add repl commandsterni1-0/+5
`mg repl` is essentially a shortcut for nix repl $(mg path //) which comes up often enough for me. Launching a repl only really makes sense in the repository root with how readTree works at the moment, so I think this is a convenient addition. Change-Id: I32b695885c2e6eaecdcc656c7249afa504439913 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5822 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-05-01 r/3994 feat(magrathea): add flag passthru for arguments to nix-buildVincent Ambo1-13/+56
in some cases, users might want to pass through flags for nix-build (such as `-j`). magrathea now accepts these as arguments to `mg build`, as long as they are separated by `--`. the arguments passed to `mg build` are parsed into a proper record, which enables us to show users very clear error messages in case they forget to use the `--` separator and keeping us future-compatible with more potential arguments to magrathea itself. Change-Id: I81f5d9db52779a5cc3b8bbdd975316274fffe5fc Reviewed-on: https://cl.tvl.fyi/c/depot/+/5507 Tested-by: BuildkiteCI Reviewed-by: ezemtsov <eugene.zemtsov@gmail.com> Reviewed-by: asmundo <asmundo@gmail.com>
2022-02-18 r/3857 feat(tools/magrathea): implement run commandsterni1-0/+48
This command builds the desired target and runs the executable produced by it. If a directory is produced, it looks for a single (!) executable in the bin directory. Dot files are ignored, so wrappers should generally work. In the future we could provide a flag to select one of multiple executables. All arguments following the target are passed to the executable as is. Examples: mg run ops/mq_cli ls mg run web/bubblegum:examples Change-Id: I6490668af68e028520973196d9daa5f1d58969ee Reviewed-on: https://cl.tvl.fyi/c/depot/+/5277 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-02-13 r/3813 fix(magrathea): print [mg] messages to stderrsterni1-2/+2
I want to add a shortcut to build and run e.g. scripts that are depot targets - for which it would be useful to not have stdout polluted by magrathea itself. Change-Id: Ic58fe28eafb4d0715e53beae041bfaa5d1745812 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5276 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2021-12-18 r/3294 fix(tools/magrathea): prevent trailing slash for // in pathsterni1-6/+7
All targets would have no trailing slash, so it was at least ugly that // had one as the only legal target. Change-Id: I1b60850ac86d8c550f262841694fb00c518413b8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4404 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-12-18 r/3292 feat(tools/magrathea): let users override the repository rootVincent Ambo1-3/+4
for global installations of magrathea, setting MG_ROOT can be a way to switch quickly between different repositories (esp. in combination with `cd (mg path)`). Change-Id: I4627fe78b7cc112b75ab57e7806ffd85c6d38aee Reviewed-on: https://cl.tvl.fyi/c/depot/+/4396 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
2021-12-18 r/3291 feat(tools/magrathea): add a path commandVincent Ambo1-4/+19
this command prints the absolute directory for a given target. it can be combined with shell aliases to add quick navigation commands. unfortunately due to the nature of computers implementing something like `mg cd` directly is not possible. Change-Id: Icc88eb97384812c620c49fe2de8fa331f4d7153b Reviewed-on: https://cl.tvl.fyi/c/depot/+/4395 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
2021-12-18 r/3290 feat(tools/magrathea): wire up parsed targets with commandsVincent Ambo1-24/+61
magrathea now does what it says on the tin - build and shell commands can be used with the targets specified on the command line. implementation notes: * string representation of target has been changed to look like the target spec format, this is now used in user-facing messages * errors returned by the target parser make the program exit with status 1 * normalisation could be done better (for example, maybe it makes sense to always do it) but it's good enough for now Change-Id: Ib85f389a5cec92b3c2f3b9c0b40764435bbcc68b Reviewed-on: https://cl.tvl.fyi/c/depot/+/4394 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
2021-12-17 r/3287 feat(tools/magrathea): add weirdly overengineered target spec parserVincent Ambo1-1/+105
i'm not sure what happened here, but it works (yes, the fancy target printing is completely unnecessary, but oh well): #;152> (parse-target "foo") #target(foo) #;153> (parse-target "//foo") #target(//foo) #;154> (parse-target "//foo/bar") #target(//foo/bar) #;155> (parse-target "//foo/bar/") #target(//foo/bar) #;156> (parse-target "//foo/bar:baz") #target(//foo/bar:baz) #;157> (parse-target "//foo/bar/:baz") #target(//foo/bar:baz) #;158> (parse-target "//foo/bar:") (error . "unexpected end of input while parsing virtual target") #;159> (parse-target "//foo//") (error . "unexpected root-anchor while parsing normal target") the most notable thing is that trailing slashes are allowed in the physical targets, since people may be autocompleting these on the shell from folder names. Change-Id: I32975ad77fe2a327130dc9574011fe92cce49f84 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4393 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: wpcarro <wpcarro@gmail.com>
2021-12-17 r/3286 feat(tools/magrathea): bootstrap a tool for working with depotVincent Ambo2-0/+133
this is going to be a serious version of //tools/depot-build. right now it doesn't support parsing any target specs yet, so only shells and builds for the physical project of the current folder work. Change-Id: I4308e29da940571622ff9e539fbb8ededd27aca7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4335 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: grfn <grfn@gws.fyi>