Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ commands:
name: System setup
command: |
python3 -m pip list -v
./system-setup.py
./sbin/system-setup.py
python3 -m pip list -v
source $HOME/.cargo/env
rustc --version
Expand Down
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/bin/
/target/
/tests/pytest/logs/
/1/

# Object files
*.o
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/bin/
/target/
/tests/pytest/logs/
/1/

# These are backup files generated by rustfmt
**/*.rs.bk
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BUILD redisfab/rejson:${VERSION}-${ARCH}-${OSNICK}

ARG REDIS_VER=6.2.5
ARG REDISEARCH_BRANCH=master
ARG REDISEARCH_BRANCH=2.2

# OSNICK=focal|bionic|xenial|bullseye|centos8|centos7
ARG OSNICK=bullseye
Expand Down Expand Up @@ -36,7 +36,7 @@ ADD . /build

RUN ./deps/readies/bin/getupdates
RUN ./deps/readies/bin/getpy3
RUN ./system-setup.py
RUN ./sbin/system-setup.py

RUN bash -l -c make

Expand Down
56 changes: 30 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif

#----------------------------------------------------------------------------------------------

define HELP
define HELPTEXT
make setup # install prerequisites

make build
Expand Down Expand Up @@ -83,22 +83,23 @@ CARGO_FLAGS=

ifeq ($(DEBUG),1)
ifeq ($(SAN),)
TARGET_DIR=target/debug
TARGET_DIR=$(BINDIR)/target/debug
else
TARGET_DIR=target/$(RUST_TARGET)/debug
TARGET_DIR=$(BINDIR)/target/$(RUST_TARGET)/debug
CARGO_TOOLCHAIN = +nightly
CARGO_FLAGS += -Zbuild-std
endif
else
CARGO_FLAGS += --release
TARGET_DIR=target/release
TARGET_DIR=$(BINDIR)/target/release
endif

ifeq ($(PROFILE),1)
RUSTFLAGS += " -g -C force-frame-pointers=yes"
endif

TARGET=$(TARGET_DIR)/$(MODULE_NAME)
export CARGO_TARGET_DIR=$(BINDIR)/target
TARGET=$(BINDIR)/$(MODULE_NAME)

#----------------------------------------------------------------------------------------------

Expand All @@ -109,15 +110,15 @@ all: build
#----------------------------------------------------------------------------------------------

setup:
./deps/readies/bin/getpy3
./system-setup.py
$(SHOW)./deps/readies/bin/getpy3
$(SHOW)./sbin/system-setup.py

.PHONY: setup

#----------------------------------------------------------------------------------------------

lint:
cargo fmt -- --check
$(SHOW)cargo fmt -- --check

.PHONY: lint

Expand All @@ -135,25 +136,27 @@ RUST_SOEXT.macos=dylib

build:
ifeq ($(SAN),)
$(SHOW)set -e ;\
export RUSTFLAGS=$(RUSTFLAGS) ;\
cargo build --all --all-targets $(CARGO_FLAGS)
else
$(SHOW)set -e ;\
export RUSTFLAGS=-Zsanitizer=$(SAN) ;\
export RUSTDOCFLAGS=-Zsanitizer=$(SAN) ;\
cargo $(CARGO_TOOLCHAIN) build --target $(RUST_TARGET) $(CARGO_FLAGS)
endif
cp $(TARGET_DIR)/librejson.$(RUST_SOEXT.$(OS)) $(TARGET)
$(SHOW)cp $(TARGET_DIR)/librejson.$(RUST_SOEXT.$(OS)) $(TARGET)
ifneq ($(DEBUG),1)
ifneq ($(OS),macos)
$(call extract_symbols,$(TARGET))
$(SHOW)$(call extract_symbols,$(TARGET))
endif
endif

clean:
ifneq ($(ALL),1)
cargo clean
$(SHOW)cargo clean
else
rm -rf target
$(SHOW)rm -rf target
endif

.PHONY: build clean
Expand All @@ -163,10 +166,10 @@ endif
test: pytest

pytest:
MODULE=$(abspath $(TARGET)) ./tests/pytest/tests.sh
$(SHOW)MODULE=$(abspath $(TARGET)) ./tests/pytest/tests.sh

cargo_test:
cargo $(CARGO_TOOLCHAIN) test --features test --all
$(SHOW)cargo $(CARGO_TOOLCHAIN) test --features test --all

.PHONY: pytest cargo_test

Expand All @@ -185,56 +188,57 @@ BENCHMARK_ARGS += --test $(BENCHMARK)
endif

bench benchmark: $(TARGET)
cd ./tests/benchmarks ;\
$(SHOW)set -e ;\
cd tests/benchmarks ;\
redisbench-admin $(BENCHMARK_ARGS)

.PHONY: bench benchmark

#----------------------------------------------------------------------------------------------

pack:
./sbin/pack.sh
$(SHOW)./sbin/pack.sh

.PHONY: pack

#----------------------------------------------------------------------------------------------

docker:
@make -C build/platforms build
$(SHOW)make -C build/platforms build

docker_push:
@make -C build/platforms publish
$(SHOW)make -C build/platforms publish

.PHONY: docker docker_push

#----------------------------------------------------------------------------------------------

platform:
@make -C build/platforms build
$(SHOW)make -C build/platforms build
ifeq ($(PUBLISH),1)
@make -C build/platforms publish
$(SHOW)make -C build/platforms publish
endif

#----------------------------------------------------------------------------------------------

builddocs:
mkdocs build
$(SHOW)mkdocs build

localdocs: builddocs
mkdocs serve
$(SHOW)mkdocs serve

deploydocs: builddocs
mkdocs gh-deploy
$(SHOW)mkdocs gh-deploy

.PHONY: builddocs localdocs deploydocs

#----------------------------------------------------------------------------------------------

nightly:
rustup default nightly
rustup component add rust-src
$(SHOW)rustup default nightly
$(SHOW)rustup component add rust-src

stable:
rustup default stable
$(SHOW)rustup default stable

.PHONY: nightly stable
12 changes: 7 additions & 5 deletions build/docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

ROOT=../..
MK.pyver:=3
include $(ROOT)/deps/readies/mk/main

REDIS_VERSION=6.2.5
PRODUCT=rejson

Expand All @@ -7,10 +12,7 @@ OSNICK_OFFICIAL=bullseye
# if there's a need to manually set the version, override.
# by default this uses ${VERSION} but in a private branch testing with
# VERSION=master, VERSION=2.0 is requireed.
REDISEARCH_VERSION=${VERSION}
export REDISEARCH_VERSION
export REDISEARCH_VERSION=$(VERSION)
export ART_INT_DIR=/usr/lib/redis/modules/

ROOT=../../
READIES=${ROOT}/deps/readies
include ${READIES}/mk/docker.rules
include $(MK)/docker.rules
2 changes: 1 addition & 1 deletion build/docker/dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY --from=redis /usr/local/ /usr/local/
ADD . /build

{% include 'setup_environment.yml' %}
RUN ./system-setup.py
RUN ./sbin/system-setup.py

RUN bash -l -c make

Expand Down
2 changes: 1 addition & 1 deletion build/platforms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ADD . /build

RUN ./deps/readies/bin/getupdates
RUN ./deps/readies/bin/getpy3
RUN ./system-setup.py
RUN ./sbin/system-setup.py

RUN bash -l -c make

Expand Down
2 changes: 1 addition & 1 deletion deps/readies
5 changes: 3 additions & 2 deletions system-setup.py → sbin/system-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import os
import argparse

ROOT = HERE = os.path.abspath(os.path.dirname(__file__))
READIES = os.path.join(HERE, "deps/readies")
HERE = os.path.abspath(os.path.dirname(__file__))
ROOT = os.path.abspath(os.path.join(HERE, ".."))
READIES = os.path.join(ROOT, "deps/readies")
sys.path.insert(0, READIES)
import paella

Expand Down