love.maker (automated distribution + minification)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ivan
Party member
Posts: 1915
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")
love.maker.setExtensions('lua', 'png', 'txt') -- include only the specified extensions

local build = love.maker.newBuild("C://path/to/project/folder/") -- create from source folder
build:ignore('/readme.txt') -- exclude a specific file
build:ignoreMatch('^/%.git') -- exclude based on pattern matching
build:allow('/images/exception.jpg') -- whitelist a specific file

build:save('C://path/to/output/game.love', 'DEMO') -- build the .love project file
local comment = love.maker.getComment(dest)
print(comment)
Special thanks
RamiLego4Game and his file zipping library
Minification by ReFreezed
Un-Restricted File System by Ross Grams

Limitations
* Empty directories are not included in the generated file
* Does not fuse games

https://github.com/2dengine/love.maker
Last edited by ivan on Fri Sep 13, 2024 8:28 am, edited 17 times in total.
User avatar
ivan
Party member
Posts: 1915
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: 1915
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: 1915
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: 3673
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: 1915
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: 1915
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: 1915
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: No registered users and 1 guest