- New rockspec format
- New commands, including luarocks init for per-project workflows
- New flags, including
--lua-dir
and--lua-version
for 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
builtin
is the default ifbuild.type
is not specified. - The
builtin
type auto-detects modules using the same heuristics aswrite_rockspec
(for example, if you have asrc
directory). With auto-detection of the build type and modules, many rockspecs don't even need an explicitbuild
table anymore. - New table
build_dependencies
: dependencies used only for runningluarocks build
but 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.type
field 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.dir
is improved: when the tarball contains only one directory at the root, assume that is where the sources are. - New
description
fields:labels
, an array of strings;issues_url
, URL to the project's bug tracker.
cmake
build type now supportsbuild.build_pass
andbuild_install_pass
to disablemake
passes.git
fetch type fetches submodules by default.- Patches added in
patches
can 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_modules
directory in the current directory for storing rocks - it creates a
.luarocks/config-5.x.lua
local configuration file - it creates
lua
andluarocks
wrapper scripts in the current directory that are configured to uselua_modules
and.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 newtest
section 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 lfs
will tell you it is a part ofluafilesystem
(and give the full path name to the module). In this sense,luarocks which
is the dual command toluarocks show
.
- New flags
--lua-dir
and--lua-version
which 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--porcelain
flag that serves the same purpose) and--rock-license
. - New flag
--temp-key
forluarocks 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 requestingdev
modules from LuaRocks.org, as in:luarocks install --dev luafilesystem
. The list of URLs configured inrocks_servers
is 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 thebuiltin
build mode. - A new build mode:
make binary
compiles 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-binary
target which builds a Windows version using the MinGW-w64 cross-compiler on Linux.
- New feature: namespaces:
you can use
luarocks install user/package
to 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_dependencies
in 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 add
now works withfile://
repositories- some UI improvements in
luarocks list
andluarocks 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 path
now exports versioned variablesLUA_PATH_5_x
andLUA_CPATH_5_x
instead ofLUA_PATH
andLUA_CPATH
when 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_PATH
and you are running Lua 5.2,luarocks.loader
and theluarocks
command-line tool will convert it to/some/dir/lua/5.2/
. - LuaRocks now uses
dev
instead ofscm
as the favored version identifier to describe development versions of a rock, aligning it with the terminology used in https://luarocks.org. It still understandsscm
as a compatibility fallback. - LuaRocks no longer conflates modules
foo
andfoo.init
as being the same in its internal manifest. Instead, theluarocks.loader
module is adapted to handle the.init
case. - Wrappers installed using
--tree
now prepend the tree's prefix to their package paths. luarocks-admin
commands no longer creates anindex.html
file 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.loader
were moved below theluarocks.core
namespace. Modules inluarocks.core
only depend on otherluarocks.core
modules. (Notably,luarocks.core
does not useluarocks.fs
.) - Modules representing
luarocks
commands were moved into theluarocks.cmd
namespace, andluarocks.command_line
was 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-admin
commands were moved into theluarocks.admin.cmd
namespace. - New internal objects for representing interaction with the repostories:
luarocks.queries
andluarocks.results
- Type checking rules of file formats were moved into the
luarocks.type
namespace.