love.maker (automated distribution + minification)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

love.maker (automated distribution + minification)

Post 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
Last edited by ivan on Wed Jul 12, 2023 2:37 pm, edited 15 times in total.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Love maker (build automation)

Post 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
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

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

Post by ivan »

Moved the code to the following repo:
https://github.com/2dengine/love.maker

Has anybody managed to test this on Linux/Mac?
Last edited by ivan on Sat Dec 11, 2021 8:23 am, edited 1 time in total.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

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

Post 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
User avatar
pgimeno
Party member
Posts: 3541
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

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

Post 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.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

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

Post 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!
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: love.maker (automated distribution + minification)

Post by borr »

how should i use this? should i put lua separately?
love start onlu main.lua file
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.maker (automated distribution + minification)

Post 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.
Last edited by ivan on Sun Feb 14, 2021 7:56 pm, edited 1 time in total.
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: love.maker (automated distribution + minification)

Post by borr »

i created a separate script build.lua with code from your example. how to run this script?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 11 guests