-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
186 lines (160 loc) · 7.11 KB
/
Makefile
File metadata and controls
186 lines (160 loc) · 7.11 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
SHELL := /bin/bash
bold := $(shell tput bold)
sgr0 := $(shell tput sgr0)
NVA_API_TOKEN ?= ""
NVA_API_URL ?= "https://api.navability.io/graphql"
NVA_PWA_URL ?= "https://app.navability.io"
WHICHBROWSER=$(shell xdg-settings get default-web-browser)
NVA_API_SCHEMA_PATH := src/gql/schema.json
default: help ;
.PHONY: default
clean: delete-schema
@echo "Cleaning up..."
cargo clean
rm -rf test/build
.PHONY: clean
delete-schema:
@echo "Deleting GraphQL schema..."
rm -f $(NVA_API_SCHEMA_PATH)
test-tokio: build-tokio
cargo test -F tokio
.PHONY: test-tokio
test-tokio-unsafe: build-tokio
cargo test -F tokio -- --nocapture
.PHONY: test-tokio
build-tokio:
cargo build -F tokio -F own_runtime
.PHONY: build-tokio
build-thread:
cargo build -F thread
.PHONY: build-thread
build-wasm:
cargo build -F wasm
.PHONY: build-wasm
$(NVA_API_SCHEMA_PATH):
@echo "Fetching GraphQL schema from $(NVA_API_URL)..."
@graphql-client introspect-schema --authorization $(NVA_API_TOKEN) --output src/gql/schema.json $(NVA_API_URL)
fetch-schema: delete-schema $(NVA_API_SCHEMA_PATH) ;
.PHONY: fetch-schema
graphql-codegen:
@echo "Generating Rust code from GraphQL schema..."
mkdir -p target/debug/gql
@graphql-client generate --output-directory target/debug/gql $(query_path) --schema-path $(NVA_API_SCHEMA_PATH)
.PHONY: graphql-codegen
install-sys-deps:
sudo apt install curl pkg-config libssl-dev xclip -y
install-rust: install-sys-deps
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# partial-duplicate of cargo.toml::build-dependencies
install-rust-deps:
@echo "Remember to first run 'make install-rust' or 'make install-sys-deps' if you have not already done so, or check this Makefile if you unsure of the impact."
cargo install graphql_client_cli
update-api-token: default-browser-firefox-api default-browser-chromium-api default-browser-gchrome-api
@echo ""
@echo "Find the newly opened browser and log in to Nva App, then run the following command in your terminal:"
@echo "$(bold)export NAVABILITY_API_TOKEN=<paste your token here>$(sgr0)"
# Copy output of command to clipboard
nva-api-url-to-clipboard:
@echo "Dumping the contents of env variable NVA_API_URL into the clipboard"
@echo $(NVA_API_URL) | tr -d '\n' | xclip -selection clipboard
# Copy output of command to clipboard
nva-api-token-to-clipboard:
@echo "Dumping the contents of env variable NVA_API_TOKEN into the clipboard"
@echo $(NVA_API_TOKEN) | tr -d '\n' | xclip -selection clipboard
# Retrieve text from clipboard
nva-api-token-from-clipboard:
@echo "Dumping the clipboard into env variable NVA_API_TOKEN"
$(NVA_API_TOKEN)=$(xclip -o -selection clipboard)
# Retrieve text from clipboard
nva-org-id-from-clipboard:
@echo "Dumping the clipboard into env variable NVA_API_TOKEN"
$(NVA_ORG_ID)=$(xclip -o -selection clipboard)
fetch-org-id-to-clipboard:
@echo "Fetching org-id and dumping into the clipboard: $(NVA_API_URL)"
@curl -s $(NVA_API_URL) \
-X POST \
-H 'Authorization: Bearer $(NVA_API_TOKEN)' \
-H 'content-type: application/json' \
--data '{ "query": "{ orgs { id } }" }' | grep -o -P "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" | tr -d '\n' | xclip -selection clipboard
info: help
.PHONY: info
help:
@echo ""
@echo " ....... "
@echo " ............ "
@echo " ........... ... "
@echo " ... . . ... "
@echo " ...... . .. . "
@echo " ............ . .. .... "
@echo " ... ...... .... . ... . .... "
@echo " ..... ....... .... ..... "
@echo " ... . ......... . ..."
@echo " ... . ......... . ..."
@echo " ..... .... ....... ..... "
@echo " ... ..... . .... ...... .... "
@echo " .... .... ............ "
@echo " . .... ...... "
@echo " ... . . ... "
@echo " .... ...... ... "
@echo " ............ "
@echo " ....... "
@echo ""
@echo "Welcome to the command line interface (CLI) for NavAbilitySDK."
@echo ""
@echo "The NavAbilitySDKs provide machine/human friendly access to NavAbility(TM) Accelerator,"
@echo " including various use cases: real-time, in-situ, interactive, batch, and analysis."
@echo " Similar SDKs are available for popular programming languages:"
@echo " - https://github.com/NavAbility"
@echo ""
@echo "COMPILED BINARIES:"
@echo " Downloads (.so/.h)"
@echo " - C-Compliant .deb (Debian/Ubuntu): https://www.wherewhen.ai/_tba_ (Coming Feb2025!)"
@echo " - examples: https://github.com/NavAbility/NavAbilitySDK.c"
@echo " General Docs: "
@echo " - https://navability.github.io/NavAbilitySDK.py/"
@echo ""
@echo ""
@echo "------------ Hello: ------------"
@echo "To use, run: make [task]:"
@echo ""
@echo "- make [help|info] // this documentation, also the default printout"
@echo ""
@echo "Get a token from the human-friendly App"
@echo ""
@echo "- make update-api-token // update env var NAV_API_TOKEN (browser login)"
@echo ""
@echo " $$""NVA_PWA_URL = "$(NVA_PWA_URL)
@echo " $$""NVA_API_TOKEN <- copy-paste-24hrs"
@echo ""
@echo "--------- Dependencies: ---------"
@echo "The following commands are necessary for building the source code (Linux):"
@echo ""
@echo "- make install-sys-deps // sudo apt install -y"
@echo "- make install-rust // rustup www.rust-lang.org"
@echo "- make install-rust-deps // cargo install"
@echo ""
@echo "----------- Compile: -----------"
@echo "For targets native (x86, ARM, ..) or WASM, respectively:"
@echo " Rust type-safety implies/requires env vars: NVA_API_URL/TOKEN"
@echo " (also see compiled binaries above)"
@echo ""
@echo "- make build-tokio"
@echo "- make build-wasm"
@echo ""
@echo ""
@echo "NavAbility(TM) Accelerator by WhereWhen.ai Technologies Inc."
@echo "--------------------------"
@echo "Our mission is to empower teams to bring robotic-like systems to the market faster, and accelerate"
@echo " the data transformation of large asset industries with bespoke spatial intelligence software."
@echo "WhereWhen.ai develops and supports open-source science via permissive licenses of our core algorithms"
@echo " to simplify, amplify, and encourage more access to mission critical navigation-like (GNC) software."
@echo ""
@echo "See more about our process here:"
@echo " - https://www.wherewhen.ai/post/the-navability-logo"
@echo " - https://github.com/JuliaRobotics/Caesar.jl"
@echo ""
@echo "For more information or help please contact us at, or open an issue at:"
@echo " - https://github.com/NavAbility/NavAbilitySDK.rs/issues/new"
@echo " - info@wherewhen.ai"
@echo ""
.PHONY: help