- New rockspec format
- New commands, including luarocks init for per-project workflows
- New flags, including
--lua-dirand--lua-versionfor using multiple Lua installs with a single LuaRocks - New build system
- General improvements, including namespaces
- User-visible changes, including some breaking changes
- Internal changes
New rockspec format: if you add rockspec_format = "3.0" to your rockspec,
you can use a number of new features. Note that these rockspecs will only work
with LuaRocks 3.0 and above, but older versions will detect that directive and
fail gracefully, giving the user a message telling them to upgrade. Rockspecs
without the rockspec_format directive are interpreted as having format 1.0
(the same format from LuaRocks series 1.x and 2.x) and are still supported.
The following features are only enabled if rockspec_format = "3.0" is set in
the rockspec:
- Build type
builtinis the default ifbuild.typeis not specified. - The
builtintype auto-detects modules using the same heuristics aswrite_rockspec(for example, if you have asrcdirectory). With auto-detection of the build type and modules, many rockspecs don't even need an explicitbuildtable anymore. - New table
build_dependencies: dependencies used only for runningluarocks buildbut not when installing binary rocks. - New table
test_dependencies: dependencies used only for runningluarocks test - New table
test: settings for configuring the behavior ofluarocks test. Supports atest.typefield so that the test backend can be specified. Currently supported test backends are:"busted", for running Busted"command", for running a plain command.- Custom backends can be loaded via
test_dependencies
- New field
build.macosx_deployment_target = "10.9"is supported in Mac platforms, and adjusts$(CC)and$(LD)variables to export the corresponding environment variable. - LuaJIT can be detected in dependencies and uses version reported by the
running interpreter: e.g.
"luajit >= 2.1". - Auto-detection of
source.diris improved: when the tarball contains only one directory at the root, assume that is where the sources are. - New
descriptionfields:labels, an array of strings;issues_url, URL to the project's bug tracker.
cmakebuild type now supportsbuild.build_passandbuild_install_passto disablemakepasses.gitfetch type fetches submodules by default.- Patches added in
patchescan create and delete files, following standard patch rules.
- New command:
luarocks init. This command performs the setup for using LuaRocks in a "project directory":- it creates a
lua_modulesdirectory in the current directory for storing rocks - it creates a
.luarocks/config-5.x.lualocal configuration file - it creates
luaandluarockswrapper scripts in the current directory that are configured to uselua_modulesand.luarocks/config-5.x.lua - if there are no rockspecs in the current directory, it creates one based on the directory name and contents.
- it creates a
- New command:
luarocks test. It runs a rock's test suite, as specified in the newtestsection of the rockspec file. It also does some autodetection, so it already works with many existing rocks as well. - New command:
luarocks which. Given the name of an installed, it tells you which rock it is a part of. For example,luarocks which lfswill tell you it is a part ofluafilesystem(and give the full path name to the module). In this sense,luarocks whichis the dual command toluarocks show.
- New flags
--lua-dirand--lua-versionwhich can be used with all commands. This allows you to specify a Lua version and installation prefix at runtime, so a single LuaRocks installation can be used to manage packages for any Lua version. It is no longer necessary to install separate copies of LuaRocks to manage packages for Lua 5.x and 5.y. - New flags added to
luarocks show:--porcelain, giving a stable script-friendly output (named after the Git--porcelainflag that serves the same purpose) and--rock-license. - New flag
--temp-keyforluarocks upload, allowing you to easily upload rocks into an alternate account without disrupting the stored configuration of your main account. - New flag
--dev, for enabling development-branch sub-repositories. This adds support for easily requestingdevmodules from LuaRocks.org, as in:luarocks install --dev luafilesystem. The list of URLs configured inrocks_serversis prepended with a list containing "/dev" in their paths. luarocks config, when called with no arguments, now displays your entire active configuration, using the same Lua syntax as the configuration file. It is sensitive to the flags given to it (--tree,--lua-dir, etc.) so it presents the resulting configuration produced by loading the currently-active configuration files and the given flags.
New build system: the configure and Makefile scripts were completely
overhauled, making use of LuaRocks 3 features to greatly simplify them:
- Much of the detection and configuration work they performed were moved to runtime, to make LuaRocks more dynamic and resilient to environment changes
- The system-package-manager-friendly mode is still available, as the
default target (
make, formerlymake build). - The LuaRocks-as-a-rock mode (
make bootstrap) is also still available, and was greatly simplified: it no longer uses custom Makefiles: LuaRocks installs itself usingluarocks make, and its own rockspec uses thebuiltinbuild mode. - A new build mode:
make binarycompiles all of LuaRocks into a single executable, bundling various Lua modules to make it self-sufficient, such as LuaFileSystem, LuaSocket and LuaSec.- For version 3.0, this will remain as an option, as we evaluate its suitability moving forward to become the default mode of distribution.
- The goal is to eventually use this mode to produce the Windows
version of LuaRocks. We currently include an experimental
make windows-binarytarget which builds a Windows version using the MinGW-w64 cross-compiler on Linux.
- New feature: namespaces:
you can use
luarocks install user/packageto install a package from a specific user of the repository. - Improved defaults for finding external libraries on Linux and Windows.
- Detection of the Lua library and header directories is now done at runtime.
This uses the same machinery that LuaRocks employs for
external_dependenciesin general (with some added logic to cope with the unfortunate rampant inconsistency in naming of Lua libraries and header paths due to lack of upstream standardization). luarocks-admin addnow works withfile://repositories- some UI improvements in
luarocks listandluarocks search. - Preliminary support for the upcoming Lua 5.4: LuaRocks is written in the common dialect supporting Lua 5.1-5.3 and LuaJIT, but since a single installation can manage packages for any Lua version now, it can already manage packages for Lua 5.4 even though that's not out yet.
- Breaking change: The support for deprecated unversioned paths
(e.g.
/usr/local/lib/luarocks/rocks/and/etc/luarocks/config.lua) was removed, LuaRocks will now only create and use paths versioned to the specific Lua version in use (e.g./usr/local/lib/luarocks/rocks-5.3/and/etc/luarocks/config-5.3.lua). - Breaking changes:
luarocks pathnow exports versioned variablesLUA_PATH_5_xandLUA_CPATH_5_xinstead ofLUA_PATHandLUA_CPATHwhen those are in use in your system. - Package paths are sanitized to only reference the current Lua version.
For example, if you have
/some/dir/lua/5.1/in your$LUA_PATHand you are running Lua 5.2,luarocks.loaderand theluarockscommand-line tool will convert it to/some/dir/lua/5.2/. - LuaRocks now uses
devinstead ofscmas the favored version identifier to describe development versions of a rock, aligning it with the terminology used in https://luarocks.org. It still understandsscmas a compatibility fallback. - LuaRocks no longer conflates modules
fooandfoo.initas being the same in its internal manifest. Instead, theluarocks.loadermodule is adapted to handle the.initcase. - Wrappers installed using
--treenow prepend the tree's prefix to their package paths. luarocks-admincommands no longer creates anindex.htmlfile in the repository by default (it does update it if it already exists)
- Major improvements in the test suite done by @georgeroman as part of the ongoing Google Summer of Code 2018 program. The coverage improvements and test suite speed-ups have been essential in getting the sprint towards LuaRocks 3.0 more efficient and reliable!
- Modules needed by
luarocks.loaderwere moved below theluarocks.corenamespace. Modules inluarocks.coreonly depend on otherluarocks.coremodules. (Notably,luarocks.coredoes not useluarocks.fs.) - Modules representing
luarockscommands were moved into theluarocks.cmdnamespace, andluarocks.command_linewas renamed toluarocks.cmd. Eventually, all CLI-related code will live underluarocks.cmd, as we move towards a clean CLI-API separation, in preparation for a stable public API. - Likewise, modules representing
luarocks-admincommands were moved into theluarocks.admin.cmdnamespace. - New internal objects for representing interaction with the repostories:
luarocks.queriesandluarocks.results - Type checking rules of file formats were moved into the
luarocks.typenamespace.