-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
167 lines (131 loc) · 5.08 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
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
#
## Bloombox: Swift API Client
#
SCHEMA ?= Schema/
VERSION ?= 0.5.0-beta5
SCHEMA_BRANCH ?= master
SWIFT_GRPC ?= SwiftGRPC
SWIFT_PROTOC_OPTIONS ?= --swift_opt=FileNaming=PathToUnderscores --swift_opt=Visibility=Public --swiftgrpc_opt=Visibility=Public
all: build test
@echo "Swift API client ready."
docs: clean-docs docs/
docs/:
@echo "Generating docs..."
@mkdir -p docs/ && jazzy \
--output docs/ \
-c --sdk iphone \
-a Bloombox \
-u "https://bloombox.cloud" \
-m Bloombox --module-version=$(VERSION) \
--copyright "© 2016-2018, Momentum Ideas Co." \
--readme README.md \
--podspec Bloombox.podspec \
--min-acl public \
--github_url https://github.com/bloombox/swift \
--theme 'apple' \
--include "Sources/Client/*";
update-docs: clean-docs docs/
@echo "Updating docs..."
@cd docs/ && git init && git add . && git commit -m "Update docs" && \
git checkout -b gh-pages && \
git remote add pages [email protected]:bloombox/swift.git && \
git push pages gh-pages --force;
@echo "Docs update done."
clean: clean-docs
@echo "Cleaning Swift client for Bloombox..."
@-swift package clean
distclean: clean
@echo "Cleaning distributions..."
@rm -frv .build $(SCHEMA)/languages
@echo "Resetting codebase..."
@git reset --hard
forceclean: distclean
@echo "Sanitizing codebase..."
@git clean -xdf
clean-docs:
@echo "Cleaning docs..."
@rm -fr docs/
pods: pod-opencannabis pod-services pod-client
@echo "Pod work done."
check-local:
@echo "Checking local state for releaseability..."
@git diff-index --quiet HEAD --
release: check-local release-begin release-package pods-publish update-docs
@echo "Release complete for version $(VERSION)."
release-begin:
@echo "Performing release..."
release-package:
@echo "Releasing Swift package (version: $(VERSION))..."
@git tag -s -a $(VERSION) -m "Release: $(VERSION)"
@git push origin --tags
@echo "Release $(VERSION) is live."
pods-publish:
@echo "Publishing pods to trunk..."
@pod trunk push --allow-warnings --verbose OpenCannabis.podspec
@pod trunk push --allow-warnings --verbose BloomboxServices.podspec
@pod trunk push --allow-warnings --verbose Bloombox.podspec
@echo "Pods published as version $VERSION."
pod-opencannabis:
@echo "Linting OpenCannabis pod..."
@pod lib lint --allow-warnings --fail-fast --verbose OpenCannabis.podspec
pod-services:
@echo "Linting Bloombox services pod..."
@pod lib lint --allow-warnings --fail-fast --verbose BloomboxServices.podspec
pod-client:
@echo "Linting Bloombox client pod..."
@pod lib lint --allow-warnings --fail-fast --verbose Bloombox.podspec
build: dependencies
@echo "Building Swift client for Bloombox..."
@swift build
dependencies: swift-grpc
test:
@#echo "Running tests..."
@#swift test
submodules: $(SWIFT_PROTOBUF) $(SWIFT_GRPC)
@git submodule update --init --remote SwiftGRPC
schema: $(SCHEMA) $(SCHEMA)/languages/swift
$(SCHEMA):
@echo "Initializing Schema..."
@git submodule add --force --name schema [email protected]:bloombox/Schema.git $(SCHEMA)
@git submodule update --init --remote schema
$(SCHEMA)languages/swift: $(SCHEMA)
@echo "Building schema..."
@mkdir -p Schema/languages/swiftgrpc
@$(MAKE) -C Schema LANGUAGES="swift swiftgrpc" PROTO_FLAGS="--plugin=$(PWD)/SwiftGRPC/protoc-gen-swift --plugin=$(PWD)/SwiftGRPC/protoc-gen-swiftgrpc --swiftgrpc_out=Visibility=Public,Server=false,Client=true:languages/swiftgrpc" SERVICES=yes TABLES=no INCLUDE_DESCRIPTOR=yes build
update-schema:
@echo "Updating schemas..."
@git submodule update --init --remote Schema
regen-schema:
@echo "Removing schema..."
@rm -fr Schema/languages/*swift*
sync-schema: $(SCHEMA)languages/swift
@echo "Syncing Swift schemas..."
@rm -fr Sources/Schema/*.pb.swift
@rm -fr Sources/Schema/*.grpc.swift
@rm -fr Sources/Services/*.swift
@cp -fr $(SCHEMA)languages/swift/*.swift Sources/Schema/
@cp -fr $(SCHEMA)languages/swiftgrpc/*/*/*.swift Sources/Schema/
@cp -fr Sources/Schema/*.grpc.swift Sources/Services/
@rm -f Sources/Schema/*.grpc.swift
@rm -f Sources/Schema/*.server.pb.swift
@rm -f Sources/Client/*.grpc.swift
@rm -f Sources/Client/*.pb.swift
@rm -f Sources/Schema/bq*
@rm -r Sources/Schema/comms_* Sources/Schema/analytics_stream_Filter* Sources/Schema/dash_AccessManifest* Sources/Schema/dash_Notifications* \
Sources/Schema/identity_bio* Sources/Schema/integration_* Sources/Services/GoogleCloud* Sources/Schema/marketing_*
@rm -f Sources/{Schema,Services}/*{WalletService*,DashService*,LedgerService*,MarketingService*,PartnersService*,MediaService*,InventoryTelemetry*}
@mv -f Sources/Schema/*Service_* Sources/Schema/*Streaming_* Sources/Schema/google_api_* Sources/Schema/protoc-gen-swagger* \
Sources/Schema/telemetry_*TelemetryEvent_* \
Sources/Services/
@echo "Sync complete."
swift-grpc: $(SWIFT_GRPC)/.build
@echo "Cleaning SwiftGRPC."
@rm -f $(SWIFT_GRPC)/Package.resolved
$(SWIFT_GRPC)/.build:
@echo "Building SwiftGRPC..."
@$(MAKE) -C $(SWIFT_GRPC)
grpc: $(SWIFT_GRPC) $(SWIFT_GRPC)/.build
@echo "gRPC is ready."
$(SWIFT_GRPC):
@echo "Initializing SwiftGRPC..."
@git submodule add --force --name SwiftGRPC [email protected]:grpc/grpc-swift.git $(SWIFT_GRPC)