-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathMakefile
70 lines (55 loc) · 1.91 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
# Makefile to aid with local development and testing
# This is not required for automated builds
ifeq ($(OS),Windows_NT)
PLATFORM := win
else
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
PLATFORM := linux
endif
ifeq ($(UNAME),Darwin)
PLATFORM := mac
endif
endif
check-format:
cargo +nightly fmt -- --check
check-docs:
cargo doc --no-deps --workspace --all-features
clippy:
cargo clippy --all-features --all-targets -- -D warnings
test-local:
cargo test --all-features
test-wasm:
cd sdk && wasm-pack test --node
test-wasm-web:
cd sdk && wasm-pack test --chrome --headless -- --features="serialize_thumbnails"
# WASI testing requires upstream llvm clang (not XCode), wasmtime, and the target wasm32-wasip2 on the nightly toolchain
test-wasi:
ifeq ($(PLATFORM),mac)
$(eval CC := /opt/homebrew/opt/llvm/bin/clang)
endif
CC=$(CC) CARGO_TARGET_WASM32_WASIP2_RUNNER="wasmtime -S cli -S http --dir ." cargo +nightly test --target wasm32-wasip2 -p c2pa -p c2pa-crypto -p cawg-identity -p c2patool --all-features
rm -r sdk/Users
# Full local validation, build and test all features including wasm
# Run this before pushing a PR to pre-validate
test: check-format check-docs clippy test-local test-wasm-web
# Auto format code according to standards
fmt:
cargo +nightly fmt
# Builds and views documentation
doc:
cargo doc --no-deps --open
# Builds a set of test images using the make_test_images example
# Outputs to release/test-images
images:
cargo run --release --bin make_test_images
# Exports JSON schema files so that types can easily be exported to other languages
# Outputs to release/json-schema
schema:
cargo run --release --bin export_schema
# Runs the client example using test image and output to target/tmp/client.jpg
client:
cargo run --example client sdk/tests/fixtures/ca.jpg target/tmp/client.jpg
# Runs the show example
show:
cargo run --example show -- sdk/tests/fixtures/ca.jpg