-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (47 loc) · 1.46 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
.PHONY: gen test download-models download-gen
SRCS = $(shell git ls-files '*.go' | grep -v '^vendor/')
TMP = ./tmp
mod:
go mod tidy
## Format the Code.
fmt:
gofmt -s -w $(SRCS)
goimports -w .
download-gen:
# Definitions
mkdir -p $(TMP)
curl https://www.hl7.org/fhir/definitions.json.zip -o $(TMP)/definitions.zip
unzip $(TMP)/definitions.zip profiles-types.json valuesets.json -d $(TMP) -o
rm -rf $(TMP)/definitions.zip
# Profiles
curl http://hl7.org/fhir/bundle.profile.json -o $(TMP)/bundle.json
curl http://hl7.org/fhir/codesystem.profile.json -o $(TMP)/codesystem.json
curl http://hl7.org/fhir/structuredefinition.profile.json -o $(TMP)/structuredefinition.json
curl http://hl7.org/fhir/valueset.profile.json -o $(TMP)/valueset.json
download-models:
# Definitions
mkdir -p $(TMP)
curl https://www.hl7.org/fhir/definitions.json.zip -o $(TMP)/definitions.zip
unzip $(TMP)/definitions.zip profiles-resources.json profiles-types.json valuesets.json -d $(TMP) -o
rm -rf $(TMP)/definitions.zip
gen-gen:
# go generate ./...
rm -rf $(TMP)/*
$(MAKE) download-gen
go run ./gen/types/. -i ./tmp -o ./gen/types/fhir
rm -rf $(TMP)/*
gen-models:
# go generate ./...
rm -rf $(TMP)/*
$(MAKE) download-models
go run ./gen/types/. -i ./tmp -o ./models -d ./gen/client/definitions.go
rm -rf $(TMP)/*
gen-client:
go run ./gen/client/. -o ./
$(MAKE) fmt
gen: ge-gen ge-models gen-client fmt
test: mod gen
go test ./...
clean:
rm -rf tmp
rm -rf .tmp