6 ms·
Show HN: Beast – A Build System
Beast is a build system built for speed and power - a tool for all your build needs.
GitHub: https://github.com/GauravDawra/Beast https://github.com/GauravDawra/Beast
Docs: https://gauravdawra.github.io/Beast-docs/ https://gauravdawra.github.io/Beast-docs/
As a project grows larger, it becomes difficult to keep track of all the build and compilation procedures that need to be followed. So what should we do???
Not to worry! Beast helps you build your projects with minimal effort and high efficiency, bringing more power to you. In addition, it is super easy to use and syntactically easy to understand, making it suitable for both: beginners and highly experienced programmers.
With its new release: Nimble (v1.1.0), Beast has become much faster and stronger than before. Its build times are now overtaking or matching those of current community standards!!!
In contrast to other such build systems, Beast focusses on both: ease of usability and speed!!!
- nittanymount 4y agowhat languages it is for ? seems only for c/c++ ? or it can be for any language, just put the build command line in beast file? thanks.
- gaurav1804 4y agoHi! It is not only for C/C++, but it can be used for any project in general. This is a low level build system which runs your commands in a shell depending on the rules you define in the beast.build file. Think of it as a faster and more user-friendly replacement to Make. It's 'pythonic' syntax makes it very easy to use and it's build speeds are matching/overtaking those of community standards! You are right in saying that since any command can be put in the beast file, it is suitable for building a project in any language. It is a general purpose build system, with focus on speed and usability!
- pbackup12345 4y agoHi there, it might be a good idea to clear this up early on the github page itself. This is a good idea, but I would not read on after the first page if I don't see that it checks my boxes for what I need. And as I can see it is still not really defining it.
- gaurav1804 4y agoThanks! Noted... I will take care of it! Thanks again
- nittanymount 4y agothanks for reply, - examples for using it for android or iOS, or java project, and some numbers showing its better performance? - how to use it for an android project? gradle handles it all with target(sub targets tree structure of the build tasks...), if use Beast, will still be using gradle? or the build tools gradles is calling for different things (compile, packaging,signing...)
- gaurav1804 4y ago1. Since Beast is new, there are not a lot of examples. Benchmarking is going on and it will take some time. In the mean time, you can take a look at how to write beast build files. 2. You can use it for any project you want if you know what are components of your project depend upon what other components. So as I see it, gradle is a build system for Java project in itself. Beast will not be using gradle if you are trying to compile a Java project. BUT.... you can for sure call `gradle` command from inside the beast.build file. Wherever build.gradle file is stored. So that in this case, beast provides you with an easier to use build system. Let us see an example: In your beast file, you can have something like: build hello: ! gradle -q hello and inside your gradle file: task hello { doLast { println 'tutorialspoint' } } Hope that helps
- prvnsmpth 4y agoIt doesn’t make sense to have your build tool call another build tool to actually perform the build. In that case, why I would not just use Gradle directly?
- hiyer 4y agoTrue. This seems more like a general-purpose task-runner like Task [1] than a self-contained build system. 1. https://taskfile.dev/#/ https://taskfile.dev/#/
- gaurav1804 4y agoHi! Task runner would not be an appropriate term for this. Since it also defines target based on their modification times. This is what we call a general purpose build system, just like we call Make and Ninja build system. It can do anything you want if you can provide it with proper shell commands and define targets. This can not only be used for tasks but also for physical building targets that can be built on the machine. I believe that the project you linked here is itself also a build system and not just a task runner. But again, it uses yaml, which might not be best while defining custom things related to a build system
- jitl 4y agoWhy would I use this instead of make? I read a bit of the guide to “beast files” here and haven’t seen anything different from make other than some slight syntax differences. https://gauravdawra.github.io/Beast-docs/mainDocs/writingABeastFile https://gauravdawra.github.io/Beast-docs/mainDocs/writingABe... You should make your value proposition clear in your project README, especially if your syntax and overall model appear to be quite similar to an existing tool. Saying you focus on “ease of usability and speed” doesn’t tell me much.
- rkangel 4y agoI haven't used Beast, but I have used make a lot. One answer might be "just in case someone wants to put a space in a filename, or in any parent folder of where my code is". Make does not cope with this at all. Yes I'm aware of all the workarounds and they all fall over at some point. Make works perfectly well on Windows for instance, except for the whole generation of Windows that had the users under "Documents and settings". Was almost always impossible to build code in the user home directory.
- gaurav1804 4y agoHi! I know I haven't supported my claims in the readme. But if you see the syntax for beast build files, you will see that indeed syntax in beast is much simpler and intuitive. For example, you have strings and integers for variables. You can dereference them easily and even create new variables of any type from other variables. You can declare variables inside a build rule. All in all, the syntax is inspired from python, since everyone loves it so much. This is not all, I'm currently benchmarking Beast. The new release: Nimble is turning out to be way faster than Make and even matching/overtaking Ninja (currently one of the the fastest build systems in the community) But you are right in saying that I should include this in the readme. I will surely post this after the benchmarks
- Rochus 4y agoLooks conceptually quite similar to make, or did I miss something? Did you use other build systems like e.g. cmake, meson or gn? What makes beast more usable or faster than e.g. meson? What always amazes me: shouldn't the build system itself be as easy as possible to build (low requirements on the compiler, minimal dependencies, platform agnostic, etc.), e.g. just like "gcc -O2 buildsystem.c"? Also almost all of these systems seem to suffer from the same problems that were discussed (and solved) in the early years of software engineering, and e.g. hardly support modularization/encapsulation or static type checking. Cmake and meson are huge and complex, with a peculiar dynamic language each, not easy to install and use, and usually a factor ten bigger than what I want to build; also beast itself requires make, a recent gcc version and even flex and bison (so it doesn't e.g. run on windows, does it?).
- rjsw 4y agoThe ultimate build system should be written in a language with no implementations at all, failing this it should only be buildable using itself, examples of best practice being Bazel and Gradle /s.
- Rochus 4y agoWell, you can expect that there is at least a compiler and runtime available compatible with the software you want to build; if your software is e.g. written in Java, then a build system also implemented in Java looks like a good fit. I usually develop in C++, so my preferred approach is to have a lean build system written in C89 which has only standard dependencies and compiles like "gcc buildsystem.c". I don't know how you would write and deploy a build system when there is no implementation for the language it uses; this looks like an unsolvable bootstrap problem to me; you would need a precompiled build system to build the build system, and that on all platforms you want to build; and anyway I don't think that a build system language should be Turing complete (or otherwise the language should at least support modularization and static typing). Bazel is certainly great for a lot of use cases, but it is one of those Google colossi where you have to hire a specialized team to manage and run your build. GN has a similar issue in that in practice there is an insurmountable dependency of a gazillion of Python scripts (depot tools and the like), even if GN and Ninja are written in C++ and only have standard dependencies.
- mariuolo 4y agoWhat are the advantages over cmake or meson?
- gaurav1804 4y agoHi! I would like to point out as I have pointed out in comments above, that Beast and CMake (though might look similar) are different tools. Beast is an actual build system, that looks at your beast file and carries out the tasks you have specified. It runs at the very base level executing whatever you tell it to. CMake and Meson on the other hand are Meta build systems. They do not run any build commands on their own. They use other build systems like Make, Ninja to carry out everything. Think of them as a fancy wrapper around build systems. Beast is here as an alternative to Make and Ninja.
- rkangel 4y agoIncreasingly, my view is that there is only room for two quite separate things: * Task runners (rake, simple Make rules, shell scripts) etc. Basically convenience scripts for devs. * Hermetic build systems Hermetic build systems (Bazel, Nix package manager) can be 100% confident that there aren't any secret implicit dependencies and this unlocks some really great stuff such as: * Complete confidence in incremental builds at all time. It isn't possible for something secret to have changed * Excellent build caching, because you know all the inputs match the cache The classic example of this is C or C++. The build step is `gcc -c main.c -o main.o`, but that build command depends on a load of header files included by main.c. Both system ones and ones local to your project. If you change a header and rerun your build rule, it only knows about main.c, knows that it hasn't changed (by hash or timestamp) and doesn't do anything. You end up having to rebuild a load of stuff just in case. Your usual system (e.g. make) has no idea about this. Various solutions exist - Beast talks about the 'get gcc to tell you about the dependencies' approach but now you've got another file to generate and manage and have in your build system, and you still can't be sure it's right. There is a (good) argument to be made that these are problems that are only unmanageable in big software projects, and the rest of us should just take advantage of the simplicity of make (or newer better solutions like Beast). This is a similar argument to the one being made in another post about K8s and 'early optimisation'. But this is why every time someone posts a new build tool, I always hope it's going to be about 'power and reliability of Bazel' but as friendly to get going with a basic make rule.
- JonChesterfield 4y agoIf determined, the system headers can be elided. Bundle parts of musl with the application or work in -ffreestanding. Then it's self contained except for the compiler, which I believe some embedded systems commit to the repo along with the source.
- specialist 4y ago> Hermetic build systems Wanting to know more, I found this: "Hermeticity: This page covers hermeticity, the benefits of using hermetic builds, and strategies for identifying non-hermetic behavior in your builds." https://docs.bazel.build/versions/main/hermeticity.html https://docs.bazel.build/versions/main/hermeticity.html Sounds great. Ages ago, my teams had a policy of "one button build". Install VS C++ on a new box, open the project (from source repo), hit "Build". Tada. We could rebuild any revision on demand. Terrific for reproducing regressions and delta-debugging. In the Java world, with (misuse of) maven, gradle, jenkins, etc. attaining reproducible one button builds is quixotic. For hermetic builds, everything would be digitally signed (SHA256), right? There's a spec for signing Linux kernels, which I can't quickly refind. But the idea is to apply that strategy to everything, right? That sounds perfect.
- dale_glass 4y agoThe style looks extremely similar to make, in which case it needs a good explanation of what makes it better. It even seems to copy make's syntax, which IMO is a missed opportunity. One of the issues with Make is that the syntax is clever until you need to invoke multiple lines of shell script, like a loop. Then the tab-based cleverness becomes a pain.
- gaurav1804 4y agoHi! Basically it is supposed to do what Make does... but in a faster and more user-friendly way. Note that Make doesn't have the best syntax. But Beast has sort of a 'python' syntax. It supports strings and integers. Variable modification assignment. It even supports scoping (within and outside beast build rules). Plus, it is an order of a magnitude faster than Make. All in all, I don't agree with the fact that it's syntax is similar to Make. Well for one thing it has legible special variable names like 'out' and 'dep'. So yes, while it is a low level build system, it is an improvement over Make in terms of syntax and speed.
- dale_glass 4y agoHow is it faster? And faster at what?
- gaurav1804 4y agoBy 'faster' I mean better build times than Make for a project of particular size. Benchmarking is going on right now, and the difference in performance is clearly visible.
- dale_glass 4y agoOkay, but what specifically is faster? Make is rarely a big bottleneck, except in very pathologically written projects, and when doing incremental builds. I think the main problem with big make setups is recursive make, which prevents it from having a global view on the project, and forces the main make to execute many sub-makes recursively, all of which has overhead.
- onion2k 4y agoAs a project grows larger, it becomes difficult to keep track of all the build and compilation procedures that need to be followed. Anecdotally I've worked on projects that have thousands of scripts that could be built with a 5 line make file, and other projects that have a few tens of files that needed a 200 line Webpack config. I don't think build complexity is a function of project size.
- gaurav1804 4y agoHi! The reason why you can compile such large amounts of files with only a few lines in a Makefile, is because most of these files might be carrying a pattern in their build rules (like for example most of them are to be compiled in an object file). But this is not always the case. Plus, note that I (and many others I have worked with) are of the opinion that Make may be popular but it is surely not user friendly. The syntax involved in writing a Makefile can get very messy very quickly with all the $<, $@ and what not... Beast's syntax is much more simpler and intuitive, so that everyone... (beginners or experienced) can use it
- evmar 4y agoCongrats on making the release! I glanced through the docs and it seems Beast works via a graph over targets and mtimes? I recently wrote some retrospective notes about build system design in this area that seem like they might be useful for someone in exactly your place: https://neugierig.org/software/blog/2022/03/n2.html https://neugierig.org/software/blog/2022/03/n2.html
- deleted 4y ago[deleted]
- gaurav1804 4y agoHi! Thanks a lot!! These are valuable and I am excited to take a look!! Interestingly, some of the things that you mentioned here are things that I discovered while using Make and Ninja purely through experimentation!!! Great work!!
- deleted 4y ago[deleted]
- kdumont 4y agoLooks like a pretty neat extension of make syntax. Having better/simpler control of variables sounds great!
- gaurav1804 4y agoThanks! That was the idea yeah!... to have more user-friendly syntax :)
- bjourne 4y agoAwesome project! I'll use it for my next C++ project.
- gaurav1804 4y agoThanks a ton :)