[Module] Amie: Amalgamation Made Insanely Easy!
Amie: Amalgamation Made Insanely Easy!
I'd like to share a project I'm currently working on!
Amie is a module I just started (two days ago) and that I'd like to see evolve in a sane and good way!
First of all, here is the link to the repo: https://github.com/Telokis/Amie
If you are not familiar with this word, no problem.
Amalgamation is when you take multiple things and put them together.
For example, in a random C++ project, you could have a file
main.cppthat includes a file
Amalgamation would combine those two files to create a single file in output: it would insert the whole content of
fun.hppat the line where you include it inside
Why on earth would I want to do that?
The answer is simple: ease of integration.
If I am a developer using the above project, I don't have to care about the number of files anymore!
I just have to take the amalgamated file, throw it among my own sources and it will be treated as if I made it.
Magic: everybody's happy!
Sharing a single all-in-one file is way easier than a whole project!
When used in a browser, you don't have to include every file the library uses. You don't have to do so because it is amalgamated. (Even though we call if minification, it's a two way process: amalgamation then minification)
With that last example, I'll leave you there with this post.
Feel free to give me feedback/suggestions. I'd be really glad to hear what you think about this! (Even if you don't plan on ever using it!)
Just updated to
- Added some unit tests to provide a more robust tool
- Updated the README.md with additional details
- Added a CLI version to ease usage
- Added default options system and new options
- A cache system to avoid reading the same file twice
- Possibility to output directly to a file
- Possibility to specify include paths to look into
Once again, I'm open to any feedback/suggestion/comment you could make!
Have a nice day!
Hey, I like your enthusiasm! I took a look at the code, great style too :)
I'm curious though, what is the use case? As a developer, I would like to keep the files separate in a logical hierarchy, not receive a single, large file. Is this intended as a sort of way to "share modules" in C++ like packages can be shared in node? I've been out of programming C / C++ for a while so I don't know if there are modern ways of sharing libraries like npm, pypy, etc.
It would be interesting to see if you can incorporate the minification part of it too, this could easily make an obfuscated source file.
@Bri Hey thanks for the comment!
The use case is quite simple: downloading and installing a small library as a static/dynamic dependency is a (relatively) large amount of work compared to just throwing a packaged version within your own source.
It's kinda the same principle as of js files: you don't add
<script>s tags for each file, you amalgamate and minify them to let the user directly use one single file. This is definitely easier for your end user, no need for him to add hundreds of
About minification that's something I keep somewhere in my mind for a possible later feature, thanks!
So if I follow, it's for sharing modular code written in C(++)? I was curious if anyone had implemented something like npm for C, and came across this: https://github.com/substack/dotc
@Bri Yes there are solutions like Microsoft's vcpkg or even cppan.
But my tool would be more like a deployment complement: you would generate your binaries for the end user to download them but also an amalgamated version in case they want to use the quick n easy way.
One thing I'd like to setup if this happens to be successful would be a cloud service which would allow to easily amalgamate your project.