DOIT: Yet Another Build Script

flamewave000 - Oct 2 - - Dev Community

So I hate most build tools. Makefile is waaay too complex and finicky, Gradle is slow and also not very intuitive. NPM suuuper slow, and lacking any decent features. Gulp is as slow or slower than NPM, but does have a lot of features... if you want all the dependencies.

Don't get me wrong! Makefile, Gradle, NPM and Gulp all have their uses. But sometimes I'm making a simple little side project, and I just want to quickly write a super basic build script that runs super fast to put all my commands into. I recently ran into this using Docker, where I was sticking all of my compose commands into the scripts field of an NPM package.json just so I could avoid typing things out all the time.

I googled around and couldn't find a decent alternative that wasn't just "Make a shell script".

So I Made My Own: DOIT

Find it on GitHub: DOIT

I used it as an opportunity to learn Rust for the first time, and created the scripting language called DOIT. You can add targets and variables, and the CLI is super easy to use. The interesting part is that it is not an interpreter. Instead it locally Transpiles the script to C++ and then compiles that to an executable with the GCC, before cleaning up. Then subsequent calls just execute the executable directly, unless a change is made to the DOIT script. This makes the DOIT tool execute in milliseconds, compared to NPM's seconds.

Why C++?

Well I wanted to transpile to Rust, but I also didn't want people to HAVE to install Rust in order to use the tool, and pretty much everyone already has GCC preinstalled.

How Does it Work?

The DOIT tool detects a local script (or the path to one can be provided) and then looks for a local DOIT build directory. If the script is new, or has been changed, DOIT transpiles it to C++ and then runs the GCC. It then immediately runs the newly minted executable. If the script is not new, and has not been changed since the last time DOIT ran, then it simply runs the executable immediately and exits.

The CLI is simply: $ doit my_target "John" "Smith", and the local script is a single file named do.it. Which looks like this:

my_target {
    @ My silly target help documentation
    $ echo "Hows it going! $1 $2"
    # It's really that simple
}
Enter fullscreen mode Exit fullscreen mode

Help!

I also added some fun extras, like customizable Help Documentation. I often times will leave a project for a month or two and then come back and not remember what any of my scripts do. So I waste time reading them to figure it out. With this, you can run

Open Source

I made the whole thing open-source and my motto for it is truly KISS. If you want it to do more, then you probably should be using something better suited. The script can do quite a lot, but I don't want it to grow in complexity like Make or Gradle.

Instead it has a basic feature-set and is super fast and easy to write and maintain a script.

GitHub logo flamewave000 / doit

A simple transpiler that creates an executable program from a basic script

DOIT

The DOIT scripting language is a very simple and basic script for doing common tasks in a project folder. It has built in --help support that is generated from the script itself. Good for quick and simple tasks that aren't complicated and don't need something more complicated like a Makefile.

Why?

So I know you can just use something like a Makefile to build things, but I get quickly frustrated with Makefiles and their crazy complexity. Most of the time I just want something I can put my simple CLI commands in that's easy to modify and maintain. I've previously used NPM for this, but it is painfully slow to run. So instead I built my own basic scripting language that gets transpiled to C++ and then compiled by the GCC to a very fast executable file.

Install

Self Build

  1. Build the project following Build
  2. Link the executable to…




.
Terabox Video Player