Files in the top-level directory from the latest check-in
- src
- build.conf.lua
- build.lua
- license.txt
- Readme.txt
build.lua
=========
A simple "build" script, that puts snippets into one main file.
I want to deploy just one executable, but be able to code in smaller units and reuse code.
Lua has Modules, which are nice, but you have to deploy more files (check the _PATH) and an update of a module might break another programs.
There is only one in file (with includes) and one out file.
Goals:
- one target file (lua or (stripped) luac) to deploy (including license)
- Good to deploy and only one file to open, read, interpret per call (time and resource management in production)
- doesn't work with external c modules
- drop the env, that isn't needed (avoid code injection)
- optional features (remove unnecessary things)
- the TEST section in a snippet:
- is called once in build process and then cut of
- is kept in the outer "main" snippet
- debug logging, remove for production, there is no need for "if debug then" in every call
- strip comments, interesting for understanding code, but not for execution
NON-Goals:
- minify
- obfuscate/obscure
- universal build system
build.lua contains build.lua, which is build by itself (src/build._main.lua is the in file)
For more details on the configuration, check out the build.conf.lua
For a working example src/...
build
=====
https://holmeinbuch.de/repo/tool is required.
Extract it either into the build directory or next to it.
(include will try ../tool/FILE first, then src/../tool/FILE)
-> run build.lua
Use of features in code files is:
--{FEATURE
-- This block will be used, if FEATURE is defined in build
--}FEATURE
Or with else block:
--{FEATURE
-- This block will be used, if FEATURE is defined in build
--|FEATURE|ALT1
-- This block will be used, if ALT1 is defined in build
--|FEATURE|ALT2
-- This block will be used, if ALT2 is defined in build
--|FEATURE
-- This block will be used, if FEATURE, ALT1 and ALT2 are NOT defined in build (default)
--}FEATURE
Use of file include:
include happens relative to build.conf.lua (or current src file)
The file will be interpreted with TEST parts and then included without TEST parts
--<source.lua
If the file starts with "!", include - no duplicate check/removal
--<!source.lua
If the file starts with "|", plain content will be pasted - no testing/duplicate check
--<|other_source
Missing something?
==================
There are a lot of othe build tools, so check out, what's working for you.
http://lua-users.org/wiki/LuaBuildSystems
http://matthewwild.co.uk/projects/squish/readme.html
https://github.com/gvvaughan/luke/
https://github.com/stevedonovan/luabuild
https://github.com/stevedonovan/Lake
https://github.com/Benjamin-Dobell/luabundle (lib)
https://github.com/Benjamin-Dobell/luabundler (cli)