-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
141 lines (109 loc) · 3.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
.PHONY: FORCE
SHELL = bash
TARGET = release
TARGET_DIR = target/wasm32-unknown-unknown/release
SOURCE_FILES = Makefile Cargo.* src/*.rs src/*/*
#
# Project
#
tests/package-lock.json: tests/package.json
touch $@
tests/node_modules: tests/package-lock.json
cd tests; \
npm install
touch $@
clean:
rm -rf \
tests/node_modules \
.cargo \
target
npm-reinstall-local:
cd tests; npm uninstall $(NPM_PACKAGE); npm i --save $(LOCAL_PATH)
npm-reinstall-public:
cd tests; npm uninstall $(NPM_PACKAGE); npm i --save $(NPM_PACKAGE)
npm-use-app-interface-client-public:
npm-use-app-interface-client-local:
npm-use-app-interface-client-%:
NPM_PACKAGE=@spartan-hc/app-interface-client LOCAL_PATH=../../app-interface-client-js make npm-reinstall-$*
npm-use-backdrop-public:
npm-use-backdrop-local:
npm-use-backdrop-%:
NPM_PACKAGE=@spartan-hc/holochain-backdrop LOCAL_PATH=../../node-backdrop make npm-reinstall-$*
#
# Packages
#
preview-crate: test
cargo publish --dry-run --allow-dirty
publish-crate: test .cargo/credentials
make docs
cargo publish
.cargo/credentials:
cp ~/$@ $@
#
# Testing
#
DEBUG_LEVEL ?= warn
TEST_ENV_VARS = LOG_LEVEL=$(DEBUG_LEVEL)
MOCHA_OPTS = -n enable-source-maps
reset:
rm -f tests/*.dna
rm -f tests/zomes/*.wasm
tests/%.dna: FORCE
cd tests; make $*.dna
test-setup: tests/node_modules
test:
make -s test-unit
make -s test-integration
test-unit:
RUST_BACKTRACE=1 cargo test -- --nocapture
MODEL_DNA = tests/model_dna.dna
test-integration: test-setup $(MODEL_DNA)
cd tests; $(TEST_ENV_VARS) npx mocha $(MOCHA_OPTS) integration/test_basic.js
#
# Repository
#
clean-remove-chaff:
@find . -name '*~' -exec rm {} \;
clean-files: clean-remove-chaff
git clean -nd
clean-files-force: clean-remove-chaff
git clean -fd
clean-files-all: clean-remove-chaff
git clean -ndx
clean-files-all-force: clean-remove-chaff
git clean -fdx
PRE_EDITION = edition = "2018"
NEW_EDITION = edition = "2021"
PRE_HDI_VERSION = hdi = "=0.5.0-dev.17"
NEW_HDI_VERSION = hdi = "=0.5.1"
PRE_HDK_VERSION = hdk = "=0.4.0-dev.19"
NEW_HDK_VERSION = hdk = "=0.4.1"
PRE_HH_VERSION = holo_hash = { version = "=0.4.0-dev.13"
NEW_HH_VERSION = holo_hash = { version = "=0.4.1"
GG_REPLACE_LOCATIONS = ':(exclude)*.lock' tests/*_types tests/zomes/ *_types/ Cargo.toml
update-hdi-version:
git grep -l '$(PRE_HDI_VERSION)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's/$(PRE_HDI_VERSION)/$(NEW_HDI_VERSION)/g'
update-hdk-version:
git grep -l '$(PRE_HDK_VERSION)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's/$(PRE_HDK_VERSION)/$(NEW_HDK_VERSION)/g'
update-holo-hash-version:
git grep -l '$(PRE_HH_VERSION)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's|$(PRE_HH_VERSION)|$(NEW_HH_VERSION)|g'
update-edition:
git grep -l '$(PRE_EDITION)' -- $(GG_REPLACE_LOCATIONS) | xargs sed -i 's/$(PRE_EDITION)/$(NEW_EDITION)/g'
#
# Documentation
#
MAIN_DOCS = target/doc/hdi_extensions/index.html
test-docs:
cargo test --doc
$(MAIN_DOCS): test-docs
cargo doc
@echo -e "\x1b[37mOpen docs in file://$(shell pwd)/$(MAIN_DOCS)\x1b[0m";
docs: $(MAIN_DOCS)
docs-watch:
@inotifywait -r -m -e modify \
--includei '.*\.rs' \
src/ \
| while read -r dir event file; do \
echo -e "\x1b[37m$$event $$dir$$file\x1b[0m";\
make docs; \
done