Page 1 of 3

love.maker (automated distribution + minification)

Posted: Sun Jul 14, 2019 8:37 am
by ivan
Greetings folks.
Got a pretty neat tool that can save you a ton of time if you make a lot of revisions to your game.
It's an automatic .LOVE builder implemented in Lua without requiring any external binaries.

Basic API
The lib allows you to customize your build and filter files by extensions, filename and even using pattern matching!
love.maker can output anywhere which is super useful if you are using other tools (like Android's APK tool or Valve's ContentBuilder)

Code: Select all

love.maker = require("maker.main")
love.maker.setExtensions("lua", "txt", "png") -- include ONLY the selected formats
local build = love.maker.newBuild("C://path/to/project/")
build:ignore('/readme.txt') -- ignore specific files or folders
build:ignoreMatch('^/.git') -- ignore based on pattern matching
build:allow("/images/exception.jpg") -- whitelist a specific file
build:save(dest, "DEMO") -- absolute path and comment/stamp
local stamp = love.maker.getComment(dest) -- get the stamp
Special thanks
RamiLego4Game and his file zipping library
Minification by ReFreezed

Limitations
* Folders located outside of the currently active Love2D directory are copied to the AppData folder before processing
* Empty directories are not included in the generated file
* Does not fuse games

https://github.com/2dengine/love.maker

Re: Love maker (build automation)

Posted: Wed Jul 17, 2019 7:34 am
by ivan
Update:
* 150% faster thanks to FFI bitops
* 50% faster since we don't create an intermediate folder
* 15% faster after profiling Rami's code (fixed a bottleneck in CRC32)
* should be thread safe by using os.tmpname
* allows writing/reading comments inside the generated .love file

Re: love.maker (cross platform, automated distribution)

Posted: Mon Jul 29, 2019 7:08 am
by ivan
Moved the code to the following repo:
https://github.com/2dengine/love.maker

Has anybody managed to test this on Linux/Mac?

Re: love.maker (cross platform, automated distribution)

Posted: Sat Sep 21, 2019 11:08 am
by ivan
Wow, nobody found this lib useful at all? That's really surprising.
IMO a lib like this should be built into love2d by default.
Furthermore, it would be good to have CRC32 functionality in love.math too.
Up-vote my request at:
https://bitbucket.org/rude/love/issues/1514/crc32

Re: love.maker (cross platform, automated distribution)

Posted: Sat Sep 21, 2019 12:12 pm
by pgimeno
ivan wrote: Sat Sep 21, 2019 11:08 am Wow, nobody found this lib useful at all? That's really surprising.
IMO a lib like this should be built into love2d by default.
Maybe people are using it but not providing feedback? :)

Personally I package my programs either manually or with makefiles. I usually have more files in my project folders than those that need to be included, therefore I need to list the files to include manually.

ivan wrote: Sat Sep 21, 2019 11:08 am Furthermore, it would be good to have CRC32 functionality in love.math too.
Up-vote my request at:
https://bitbucket.org/rude/love/issues/1514/crc32
I'd prefer a generic CRC class where you can enter the bit width, the polynomial, the bit direction and the initial value, and update() and finish() methods.

The correct place would probably be love.data, where love.data.hash() already resides. Unfortunately, love.data.hash() does not include update() and finish(), so maybe for consistency the CRC function shouldn't either. Or conversely, perhaps it would be nice to have a love.data.newHash() that returns an object with update() and finish() methods.

Re: love.maker (cross platform, automated distribution)

Posted: Sat Sep 21, 2019 2:26 pm
by ivan
pgimeno wrote: Sat Sep 21, 2019 12:12 pm I usually have more files in my project folders than those that need to be included, therefore I need to list the files to include manually.
True, it's often more complicated than just zipping the entire game folder.
Using the lib above, you can filter and ignore files using pattern matching: build:ignoreMatch('^/.git') or based on extension.
Now if you wanted to include files from outside of the game folder then things get hairy.

Re: love.maker (cross platform, automated distribution)

Posted: Sat Feb 13, 2021 1:07 pm
by ivan
Ok. I have some cool news.
love.maker can now minify and string.dump your Lua files so they take up less space and load faster!

Re: love.maker (automated distribution + minification)

Posted: Sun Feb 14, 2021 5:58 pm
by borr
how should i use this? should i put lua separately?
love start onlu main.lua file

Re: love.maker (automated distribution + minification)

Posted: Sun Feb 14, 2021 7:52 pm
by ivan
The easiest way is to drop the maker folder in your game folder.

Code: Select all

love.maker = require("maker.main")
local build = love.maker.newBuild()
build:ignoreMatch('^/maker') -- ignore the maker itself
build:save("dest.love", "supergame v1.0", "minify")
You can choose between "minify" and "dump". The former produces a smaller .love whereas the latter is faster.

Re: love.maker (automated distribution + minification)

Posted: Sun Feb 14, 2021 7:56 pm
by borr
i created a separate script build.lua with code from your example. how to run this script?