12 releases

0.2.19 Nov 26, 2024
0.2.17 Aug 30, 2024
0.2.15 Jul 3, 2024
0.2.9 Mar 26, 2024
0.0.4 Nov 30, 2023

#45 in Build Utils

Download history 9/week @ 2024-08-16 125/week @ 2024-08-30 1/week @ 2024-09-06 31/week @ 2024-09-13 18/week @ 2024-09-20 4/week @ 2024-09-27 89/week @ 2024-10-18 40/week @ 2024-10-25 7/week @ 2024-11-01 3/week @ 2024-11-08 146/week @ 2024-11-22 19/week @ 2024-11-29

169 downloads per month

GPL-3.0-only

275KB
5K SLoC

invil

Latest version

A Rust implementation of amboso, a simple build tool wrapping make.

Table of Contents

What is this thing?

This is a Rust port of amboso, a basic build tool wrapping make and supporting git tags.

Invil can be used to:

  • Automate building a repo-curated list of git tagged versions (or also basic tagged versions with a full directory copy).
    • Ideally, the build command should be as short as invil build.
  • Run tests for a repo-curated directory with output comparison.
  • Generate new projects supporting the build tool using invil init <DIR>
  • Generate a basic header+impl containing project info, such as time of current commit

It's (*) on par with the original implementation, as of amboso 2.0.9. Check the next section for more support info. Check this section for info about extensions to amboso 2.0.4.

At the moment, only C projects are supported. - Check this section for info about the WIP python support. - The README still mostly refers only to the ambosoC kern usage. Different build modes are provided internally, depending on how full your autotool build support is:

  • Basic mode: a single gcc call. This may be expanded in a future version, to at least provide support for passing arguments to the compiler.
  • Make mode: for all tags higher than the version specified as providing make support, invil will expect a ready Makefile that correctly builds the target binary when make is called.
  • Automake mode: for all tags higher than the version specified as providing automake support, invil will expect a Makefile.am and a configure.ac, so that a Makefile with the same assumptions as Make mode can be generated.

For more information on the stego.lock file, see the amboso info about it. For more information on the anvil tool, see the amboso wiki. Work in progress.

Supported amboso features

  • Basic arguments parsing that complies with the bash implementation

  • Same default for amboso directory (./bin).

  • Parse stego.lock with compatible logic to bash implementation

  • Base mode: full support

    • The original implementation itself does not expect autotools prep for base mode, but it can be done trivially.
  • Git mode: full support

    • The original implementation itself expects git mode tags to contain a Makefile in repo root.
  • C header gen: complete support (*)

    • The original implementation print time as a pre-formatted string.
  • Test mode: complete support (*)

    • Run executable found in test directories
    • Handle test macro flag to run on all valid queries
    • Record test output with -b
      • Not compliant with amboso <1.9.7 expectations: missing trailing $.
  • Passing configure arguments: complete support

    • Not compliant with amboso <1.9.9 expectations: -C flag was passing the arguments directly, not by reading a file.
  • Subcommands:

    • build Quickly build latest version for current mode
    • init Prepare new project with amboso
    • version Print invil version
  • Note:

    • As of version 0.1.6, by default make rebuild is called on build operation. This is the expected behaviour of amboso 2.x. To revert to 1.x original behaviour and call just make, run with -R or --no-rebuild.

Flags support status:

  • Basic env flags: -D, -K, -M, -S, -E
  • Clock flag: -Y <startTime>
  • Linter mode: -x
    • Lint only: -l
    • Report lex: -L
  • C header gen mode: -G (detailed info is empty)
  • Verbose flag: -V
  • Test macro: -t
  • Test mode: -T
  • Git mode: -g
  • Base mode: -B
  • Build: -b
  • Run: -r
  • Init: -i
  • Delete: -d
  • Purge: -p
  • Help: -h
  • Big Help: -H
  • Version: -v
  • List tags for current mode: -l
  • List tags for git/base mode: -L
  • Quiet flag: -q
  • Watch flag: -w
  • Warranty flag: -W
  • Ignore gitcheck flag: -X
  • Silent: -s
  • Pass config argument: -C
  • Run make pack: -z
  • No rebuild: -R
  • Logged run: -J
    • Outputs to ./anvil.log. Not backwards compatible with repos not ignoring the file explicitly.
  • No color: -P
  • Force build: -F
  • Turn off extensions: -e (Only relative to 2.0.0)
  • Pass CFLAGS to single file build mode: -Z
  • Run make when no arguments are provided

Extensions, relative to amboso 1.9.9

  • When in make build mode, call make rebuild by default
    • --no-rebuild to disable make rebuild and run just make
  • --logged to output full log to file
    • Outputs to ./anvil.log. Not backwards compatible with repos not ignoring the file explicitly.
  • -G flag also includes:
    • a string for build OS (from env::consts::OS)
    • HEAD commit message
  • --no-color to disable color output
  • --force to overwrite ready targets

Extensions to amboso 2.0

  • Turn off extensions with -e, --strict
  • Ignore missing repo in current work dir
  • -a to set compatibility level
  • -k to set project type
  • -O to set stego.lock dir (defaults to working directory)
  • Retrocompatible stego.lock parsing, up to 1.7.x
  • Init subcommand uses passed directory's basename for generated flags
  • Read global config file from $HOME/.anvil/anvil.toml
  • -Z to pass CFLAGS to single file build mode

Extended amboso features

Experimental 2.1 version

These features are experimental and subject to change. To enable them, add --features="anvilPy" to your build/install command.

  • Use "anvilPy" kern to support python projects
    • Expects a suitable pyproject.toml is present alongside stego.lock
    • Experimental support for almost all flags
    • Only supported when provided from stego.lock itself
    • Example usage (make sure this is in your stego.lock):
      [ anvil ]
      version = "2.1.0"
      kern = "anvilPy"
      
  • Refuse the experimental kern when running with --strict
    • The original implementation is not ready to support this extension.

See how it behaves

To see how this marvelous work of art works, run:

  cd try-anvil
  ./try_anvil_auto

Refer to amboso info about this test script: link

Our version was slightly modified to actually make cargo build the release version of the binary we want to symlink to anvil.

Basic benchmark

Check out this page for a very basic benchmark of runtime, relative to bash amboso implementation.

Todo

  • Extend original impl by handling autotools in base mode
  • Improve logging with a custom format
  • Improve horrendous git mode command chain
    • The current implementation is naive and just calls a bunch of Command to pipeline the git operations in a ugly iper-indented mess.
    • Resorting to shell commands is bad and defeats the purpose of this rewrite.
    • We have git2 crate to handle the git commands and should be able to reduce the amount of command wrapping.

Dependencies

~13–25MB
~420K SLoC