Skip to content

Commit

Permalink
rock: build with cmake
Browse files Browse the repository at this point in the history
The ability to override built-in modules was introduced with [1]. To use
it, you must install the package files using the override.package path
for each file included.

Using soft links inside the rock seems like a bad idea -- luarocks try
to resolve them on files deploy and fails to do so. The only stable
approach is seems to be to duplicate the files to the override
folder.

builtin rockspec doesn't allow to specify a single file twice, so we
need to store the soft link in the repo to workaround it. To build
override package with builtin rockspec, we'll also need to manually
maintain two lists of package files.

cmake approach allows to automatize it. On the other hand, to work with
cmake-built rock, you'll need to `make` the rock while working locally.
Since `make .rocks` is a dependency of `make test`, it shouldn't be
a big issue.

1. tarantool/tarantool#7774

Part of tarantool/tarantool#7727
  • Loading branch information
DifferentialOrange committed Mar 23, 2023
1 parent d922704 commit 7bbdeaf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ doc/output/
doc/locale/en/

*.lua.c

build.luarocks
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `'all'` and `'none'` options for `include` argument,
- simultaneous `include` and `exclude` arguments
(`exclude` has higher priority)
- Build rock with cmake

### Deprecated
- Passing nonexistent metrics to `enable_default_metrics()`
Expand Down
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)

project(metrics NONE)

## Install ####################################################################
###############################################################################

if(NOT DEFINED TARANTOOL_INSTALL_LUADIR)
set(TARANTOOL_INSTALL_LUADIR "${PROJECT_SOURCE_DIR}/.rocks/share/tarantool")
endif()

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}
DESTINATION ${TARANTOOL_INSTALL_LUADIR}
)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cartridge
DESTINATION ${TARANTOOL_INSTALL_LUADIR}
)
49 changes: 4 additions & 45 deletions metrics-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,10 @@ dependencies = {
}

build = {
type = 'builtin',

modules = {
['metrics'] = 'metrics/init.lua',
['metrics.api'] = 'metrics/api.lua',
['metrics.registry'] = 'metrics/registry.lua',
['metrics.quantile'] = 'metrics/quantile.lua',
['metrics.http_middleware'] = 'metrics/http_middleware.lua',
['metrics.collectors.shared'] = 'metrics/collectors/shared.lua',
['metrics.collectors.summary'] = 'metrics/collectors/summary.lua',
['metrics.collectors.counter'] = 'metrics/collectors/counter.lua',
['metrics.collectors.gauge'] = 'metrics/collectors/gauge.lua',
['metrics.collectors.histogram'] = 'metrics/collectors/histogram.lua',
['metrics.const'] = 'metrics/const.lua',
['metrics.plugins.graphite'] = 'metrics/plugins/graphite.lua',
['metrics.plugins.prometheus'] = 'metrics/plugins/prometheus.lua',
['metrics.plugins.json'] = 'metrics/plugins/json.lua',
['metrics.tarantool'] = 'metrics/tarantool.lua',
['metrics.tarantool.fibers'] = 'metrics/tarantool/fibers.lua',
['metrics.tarantool.info'] = 'metrics/tarantool/info.lua',
['metrics.tarantool.memory'] = 'metrics/tarantool/memory.lua',
['metrics.tarantool.memtx'] = 'metrics/tarantool/memtx.lua',
['metrics.tarantool.network'] = 'metrics/tarantool/network.lua',
['metrics.tarantool.operations'] = 'metrics/tarantool/operations.lua',
['metrics.tarantool.replicas'] = 'metrics/tarantool/replicas.lua',
['metrics.tarantool.runtime'] = 'metrics/tarantool/runtime.lua',
['metrics.tarantool.slab'] = 'metrics/tarantool/slab.lua',
['metrics.tarantool.spaces'] = 'metrics/tarantool/spaces.lua',
['metrics.tarantool.system'] = 'metrics/tarantool/system.lua',
['metrics.tarantool.cpu'] = 'metrics/tarantool/cpu.lua',
['metrics.tarantool.event_loop'] = 'metrics/tarantool/event_loop.lua',
['metrics.cartridge.issues'] = 'metrics/cartridge/issues.lua',
['metrics.cartridge.failover'] = 'metrics/cartridge/failover.lua',
['metrics.tarantool.clock'] = 'metrics/tarantool/clock.lua',
['metrics.psutils.cpu'] = 'metrics/psutils/cpu.lua',
['metrics.psutils.psutils_linux'] = 'metrics/psutils/psutils_linux.lua',
['metrics.tarantool.luajit'] = 'metrics/tarantool/luajit.lua',
['metrics.tarantool.vinyl'] = 'metrics/tarantool/vinyl.lua',
['metrics.utils'] = 'metrics/utils.lua',
['metrics.cfg'] = 'metrics/cfg.lua',
['metrics.stash'] = 'metrics/stash.lua',
['metrics.version'] = 'metrics/version.lua',
['cartridge.roles.metrics'] = 'cartridge/roles/metrics.lua',
['cartridge.health'] = 'cartridge/health.lua',
}
type = 'cmake',
variables = {
TARANTOOL_INSTALL_LUADIR = '$(LUADIR)',
},
}

-- vim: syntax=lua

0 comments on commit 7bbdeaf

Please sign in to comment.