-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
126 lines (103 loc) · 4.31 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
# Base path used with Xcode Command
DEMO_BUILD_DIR=build/demo
# Xcode creates .xcarchive with the given path
DEMO_ARCHIVE_DIR=${DEMO_BUILD_DIR}.xcarchive
LEGACY_DEMO_BUILD_DIR=build/legacy-demo
LEGACY_DEMO_ARCHIVE_DIR=${LEGACY_DEMO_BUILD_DIR}.xcarchive
DOCS_BUILD_DIR=build/docs
DOCS_DIR=docs
# default value for when testing locally
GITHUB_RUN_NUMBER ?= "1"
FRAMEWORKS_OUTPUT=./build/frameworks
FRAMEWORK_NAME=HubspotMobileSDK
clean:
rm -rf betabuild.tmp
rm -rf ${DOCS_DIR}
rm -rf ${DOCS_BUILD_DIR}
rm -rf ${DEMO_BUILD_DIR}
rm -rf ${LEGACY_DEMO_BUILD_DIR}
rm -rf ${DEMO_ARCHIVE_DIR}
rm -rf ${LEGACY_DEMO_ARCHIVE_DIR}
rm -rf ${FRAMEWORKS_OUTPUT}
lint:
swift format lint --recursive --strict Sources
swift format lint --recursive --strict Tests
swift format lint --recursive --strict Demo
swift format lint --recursive --strict UIKitDemo
format:
swift format --in-place --recursive Sources
swift format --in-place --recursive Tests
swift format --in-place --recursive Demo
swift format --in-place --recursive UIKitDemo
make-doc-archive:
xcodebuild \
-workspace HubspotSDK.xcworkspace \
-scheme HubspotMobileSDK \
-destination generic/platform=iOS \
docbuild \
-derivedDataPath $(DOCS_BUILD_DIR)/
make-static-docs: make-doc-archive
xcrun docc process-archive transform-for-static-hosting \
$(DOCS_BUILD_DIR)/Build/Products/Debug-iphoneos/HubspotMobileSDK.doccarchive/ \
--hosting-base-path '/mobile-chat-sdk-ios' \
--output-path $(DOCS_DIR)
set-demo-version:
cd Demo && xcrun agvtool new-version $(GITHUB_RUN_NUMBER)
cd UIKitDemo/HubspotLegacyUIDemo && xcrun agvtool new-version $(GITHUB_RUN_NUMBER)
build-demo: set-demo-version
# Depending on process context, this may or may not be needed
# security unlock-keychain -p $(KEYCHAIN_PASSWORD) ~/Library/Keychains/login.keychain
xcodebuild \
-allowProvisioningUpdates \
-authenticationKeyPath $(AUTH_KEY_PATH) \
-authenticationKeyID $(AUTH_KEY_ID) \
-authenticationKeyIssuerID $(AUTH_KEY_ISSUERID) \
-workspace HubspotSDK.xcworkspace \
-scheme HubspotDemo \
-destination generic/platform=iOS \
-archivePath ${DEMO_BUILD_DIR} \
clean archive
build-legacy-demo: set-demo-version
# Depending on process context, this may or may not be needed
# security unlock-keychain -p $(KEYCHAIN_PASSWORD) ~/Library/Keychains/login.keychain
xcodebuild \
-allowProvisioningUpdates \
-authenticationKeyPath $(AUTH_KEY_PATH) \
-authenticationKeyID $(AUTH_KEY_ID) \
-authenticationKeyIssuerID $(AUTH_KEY_ISSUERID) \
-workspace HubspotSDK.xcworkspace \
-scheme HubspotLegacyUIDemo \
-destination generic/platform=iOS \
-archivePath ${LEGACY_DEMO_BUILD_DIR} \
clean archive
upload-demo:
xcodebuild -allowProvisioningUpdates \
-authenticationKeyPath $(AUTH_KEY_PATH) \
-authenticationKeyID $(AUTH_KEY_ID) \
-authenticationKeyIssuerID $(AUTH_KEY_ISSUERID) \
-exportArchive -archivePath ${DEMO_ARCHIVE_DIR} \
-exportOptionsPlist demo-uploadoptions.plist
#
# Note: Untested. Keeping this incase I need it, but it will only build frameworks if the library type is set to dynamic in the Package.swift
#
create-binary-framework:
@echo "Creating a binary xcframework in $(FRAMEWORKS_OUTPUT) - typically we want to add this as a SPM source dependency rather than a binary framework, but the ability to generate one may still be useful"
@echo "Note: update Package.swift to use dynamic type first"
xcodebuild archive \
-workspace HubspotSDK.xcworkspace \
-scheme HubspotMobileSDK \
-destination "generic/platform=iOS" \
-archivePath "$(FRAMEWORKS_OUTPUT)/ios/$(FRAMEWORK_NAME).xcarchive" \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild archive \
-workspace HubspotSDK.xcworkspace \
-scheme HubspotMobileSDK \
-destination "generic/platform=iOS Simulator" \
-archivePath "$(FRAMEWORKS_OUTPUT)/ios-simulator/$(FRAMEWORK_NAME).xcarchive" \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild -create-xcframework \
-archive "$(FRAMEWORKS_OUTPUT)/ios/$(FRAMEWORK_NAME).xcarchive" -framework $(FRAMEWORK_NAME).framework \
-archive "$(FRAMEWORKS_OUTPUT)/ios-simulator/$(FRAMEWORK_NAME).xcarchive" -framework $(FRAMEWORK_NAME).framework \
-output "$(FRAMEWORKS_OUTPUT)/$(FRAMEWORK_NAME).xcframework"
@echo "Created XCFramework (and platform specific frameworks) in $(FRAMEWORKS_OUTPUT)"
@echo "WARNING: This is an untested method of integration"