-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
113 lines (89 loc) · 3.21 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
MOBILECOIN_DIR = Vendor/mobilecoin
LIBMOBILECOIN_LIB_DIR = $(MOBILECOIN_DIR)/libmobilecoin
LIBMOBILECOIN_ARTIFACTS_DIR = $(LIBMOBILECOIN_LIB_DIR)/out/ios
LIBMOBILECOIN_ARTIFACTS_HEADERS = $(LIBMOBILECOIN_LIB_DIR)/out/ios/include
ARTIFACTS_DIR = Artifacts
IOS_TARGETS = x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim aarch64-apple-ios-macabi x86_64-apple-ios-macabi
LIBMOBILECOIN_PROFILE = mobile-release
define BINARY_copy
$(foreach arch,$(IOS_TARGETS),cp $(LIBMOBILECOIN_ARTIFACTS_DIR)/$(1)/$(arch)/$(LIBMOBILECOIN_PROFILE)/libmobilecoin.a $(ARTIFACTS_DIR)/target/$(arch)/release/libmobilecoin.a;)
endef
.PHONY: default
default: setup build clean-artifacts copy generate
.PHONY: legacy
legacy: setup build-legacy clean-artifacts copy-legacy generate
.PHONY: setup
setup:
cd "$(LIBMOBILECOIN_LIB_DIR)"
bundle install
# Unexport conditional environment variables so the build is more predictable
unexport SGX_MODE
unexport IAS_MODE
unexport CARGO_BUILD_FLAGS
unexport CARGO_TARGET_DIR
unexport CARGO_PROFILE
.PHONY: build
build:
cd "$(LIBMOBILECOIN_LIB_DIR)" && $(MAKE)
.PHONY: build-legacy
build-legacy:
cd "$(LIBMOBILECOIN_LIB_DIR)" && $(MAKE) legacy
.PHONY: clean-artifacts
copy-legacy:
rm -r "$(ARTIFACTS_DIR)" 2>/dev/null || true
mkdir -p "$(ARTIFACTS_DIR)"
# Create arch specific folders for each lib
$(foreach arch,$(IOS_TARGETS),mkdir -p $(ARTIFACTS_DIR)/target/$(arch)/release;)
.PHONY: copy
copy:
$(call BINARY_copy,target)
cp -R "$(LIBMOBILECOIN_ARTIFACTS_HEADERS)" "$(ARTIFACTS_DIR)"
.PHONY: copy-legacy
copy-legacy:
$(call BINARY_copy,legacy)
cp -R "$(LIBMOBILECOIN_ARTIFACTS_HEADERS)" "$(ARTIFACTS_DIR)"
.PHONY: generate
generate:
rm -r Sources/Generated/Proto 2>/dev/null || true
DOCKER_BUILDKIT=1 docker build . \
--build-arg grpc_swift_version=1.0.0 \
--output .
.PHONY: lint
lint: lint-podspec
.PHONY: lint-locally
lint-locally: lint-locally-podspec
.PHONY: publish
publish: tag-release publish-podspec
.PHONY: publish-hotfix
publish-hotfix: tag-hotfix publish-podspec
.PHONY: push-generated
push-generated:
git add Artifacts/*
git add Sources/Generated/Proto/*
if ! git diff-index --quiet HEAD; then \
git commit -m '[skip ci] commit build Artifacts and generated protos from build machine'; \
git push origin HEAD; \
fi
# Release
.PHONY: tag-release
tag-release:
@[[ "$$(git rev-parse --abbrev-ref HEAD)" == "master" ]] || \
{ echo 'Error: Must be on branch "master" when tagging a release.'; exit 1; }
VERSION="$$(bundle exec pod ipc spec LibMobileCoin.podspec | jq -r '.version')" && \
git tag "v$$VERSION" && \
git push [email protected]:mobilecoinofficial/libmobilecoin-ios-artifacts.git "refs/tags/v$$VERSION"
.PHONY: tag-hotfix
tag-hotfix:
VERSION="$$(bundle exec pod ipc spec LibMobileCoin.podspec | jq -r '.version')" && \
git tag "v$$VERSION" && \
git push [email protected]:mobilecoinofficial/libmobilecoin-ios-artifacts.git "refs/tags/v$$VERSION"
# LibMobileCoin pod
.PHONY: lint-locally-podspec
lint-locally-podspec:
bundle exec pod lib lint LibMobileCoin.podspec --allow-warnings
.PHONY: lint-podspec
lint-podspec:
bundle exec pod spec lint LibMobileCoin.podspec --allow-warnings
.PHONY: publish-podspec
publish-podspec:
bundle exec pod trunk push LibMobileCoin.podspec --allow-warnings