Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 1 | # This makefile has the following top-level targets: |
| 2 | # - ci used by Travis for continuous integration |
| 3 | # - dist used to build the binary distribution |
| 4 | # |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 5 | # Note that the dist target uses git checkout to copy the source into the |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 6 | # product directory. This means you should make sure that you don't have |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 7 | # uncommited local changes when building a distribution. |
Erik Doernenburg | 4fe18e9 | 2014-08-28 11:11:19 +0200 | [diff] [blame] | 8 | |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 9 | BUILD_DIR = $(CURDIR)/Build |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 10 | ARCHIVE_DIR = $(BUILD_DIR)/Archives |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 11 | PRODUCT_DIR = $(BUILD_DIR)/Product |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 12 | SOURCE_DIR = $(CURDIR)/Source |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 13 | FWK_PATH = /Products/Library/Frameworks/OCMock.framework |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 14 | XCODECI = xcodebuild -project "$(SOURCE_DIR)/OCMock.xcodeproj" -xcconfig "$(SOURCE_DIR)/OCMockCI.xcconfig" -destination-timeout 600 |
| 15 | XCODEDIST = xcodebuild -project "$(SOURCE_DIR)/OCMock.xcodeproj" -xcconfig "$(SOURCE_DIR)/OCMockDist.xcconfig" |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 16 | XCODEXCF = xcodebuild |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 17 | SHELL = /bin/bash -e -o pipefail |
Maksym Shcheglov | b726134 | 2014-08-26 00:52:50 +0200 | [diff] [blame] | 18 | |
Maksym Koshtenko | 120308c | 2022-07-27 17:22:22 +0100 | [diff] [blame] | 19 | .PHONY: macos ioslib ios catalyst tvos watchos buildcheck archives xcframework sourcecode ci-swiftpm carthage |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 20 | |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 21 | |
Maksym Shcheglov | b726134 | 2014-08-26 00:52:50 +0200 | [diff] [blame] | 22 | clean: |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 23 | rm -rf "$(BUILD_DIR)" |
| 24 | rm -rf "$(SOURCE_DIR)/Carthage" |
Maksym Shcheglov | b726134 | 2014-08-26 00:52:50 +0200 | [diff] [blame] | 25 | |
Maksym Shcheglov | b726134 | 2014-08-26 00:52:50 +0200 | [diff] [blame] | 26 | |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 27 | ci: ci-macos ci-ios ci-swiftpm |
Maksym Shcheglov | b726134 | 2014-08-26 00:52:50 +0200 | [diff] [blame] | 28 | |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 29 | ci-macos: |
| 30 | @echo "Building macOS framework and running tests..." |
Erik Doernenburg | 939039f | 2021-10-26 22:13:38 +0200 | [diff] [blame] | 31 | $(XCODECI) -scheme OCMock -destination 'platform=macOS' test | xcpretty -c |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 32 | |
| 33 | ci-ios: |
| 34 | @echo "Building iOS library and running tests..." |
Erik Doernenburg | 7a5f233 | 2023-10-03 23:18:28 +0200 | [diff] [blame] | 35 | $(XCODECI) -scheme OCMockLib -destination 'platform=iOS Simulator,OS=latest,name=iPhone 15' test | xcpretty -c |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 36 | |
| 37 | |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 38 | dist: archives xcframework sourcecode dmg |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 39 | |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 40 | macos: |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 41 | @echo "** Building macOS framework..." |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 42 | $(XCODEDIST) archive -scheme OCMock -destination 'generic/platform=macOS' -archivePath $(ARCHIVE_DIR)/OCMock-macOS | xcpretty -c |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 43 | |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 44 | ioslib: |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 45 | @echo "** Building iOS libraries..." |
| 46 | $(XCODEDIST) archive -scheme OCMockLib -destination 'generic/platform=iOS' -archivePath $(ARCHIVE_DIR)/OCMock-iOS-lib | xcpretty -c |
| 47 | $(XCODEDIST) archive -scheme OCMockLib -destination 'generic/platform=iOS Simulator' -archivePath $(ARCHIVE_DIR)/OCMock-iOS-lib-sim | xcpretty -c |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 48 | |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 49 | ios: |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 50 | @echo "** Building iOS frameworks..." |
| 51 | $(XCODEDIST) archive -scheme "OCMock iOS" -destination 'generic/platform=iOS' -archivePath $(ARCHIVE_DIR)/OCMock-iOS | xcpretty -c |
| 52 | $(XCODEDIST) archive -scheme "OCMock iOS" -destination 'generic/platform=iOS Simulator' -archivePath $(ARCHIVE_DIR)/OCMock-iOS-sim | xcpretty -c |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 53 | |
Maksym Koshtenko | 120308c | 2022-07-27 17:22:22 +0100 | [diff] [blame] | 54 | catalyst: |
| 55 | @echo "** Building Mac Catalyst framework..." |
| 56 | $(XCODEDIST) archive -scheme "OCMock iOS" -destination 'generic/platform=macOS,variant=Mac Catalyst' -archivePath $(ARCHIVE_DIR)/OCMock-catalyst | xcpretty -c |
| 57 | |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 58 | tvos: |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 59 | @echo "** Building tvOS frameworks..." |
| 60 | $(XCODEDIST) archive -scheme "OCMock tvOS" -destination 'generic/platform=tvOS' -archivePath $(ARCHIVE_DIR)/OCMock-tvOS | xcpretty -c |
| 61 | $(XCODEDIST) archive -scheme "OCMock tvOS" -destination 'generic/platform=tvOS Simulator' -archivePath $(ARCHIVE_DIR)/OCMock-tvOS-sim | xcpretty -c |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 62 | |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 63 | watchos: |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 64 | @echo "** Building watchOS frameworks..." |
| 65 | $(XCODEDIST) archive -scheme "OCMock watchOS" -destination 'generic/platform=watchOS' -archivePath $(ARCHIVE_DIR)/OCMock-watchOS | xcpretty -c |
| 66 | $(XCODEDIST) archive -scheme "OCMock watchOS" -destination 'generic/platform=watchOS Simulator' -archivePath $(ARCHIVE_DIR)/OCMock-watchOS-sim | xcpretty -c |
| 67 | |
| 68 | buildcheck: |
| 69 | @echo "** Verifying archives..." |
| 70 | Tools/buildcheck.rb $(ARCHIVE_DIR) |
| 71 | |
Maksym Koshtenko | 120308c | 2022-07-27 17:22:22 +0100 | [diff] [blame] | 72 | archives: macos ioslib ios catalyst tvos watchos buildcheck |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 73 | |
| 74 | xcframework: |
| 75 | @echo "** Creating XCFrameworks..." |
| 76 | rm -rf $(PRODUCT_DIR)/OCMock.xcframework |
| 77 | $(XCODEXCF) -create-xcframework -output $(PRODUCT_DIR)/OCMock.xcframework \ |
Maksym Koshtenko | 120308c | 2022-07-27 17:22:22 +0100 | [diff] [blame] | 78 | -framework $(ARCHIVE_DIR)/OCMock-catalyst.xcarchive$(FWK_PATH) \ |
Erik Doernenburg | 7c0b465 | 2021-10-26 21:02:00 +0200 | [diff] [blame] | 79 | -framework $(ARCHIVE_DIR)/OCMock-macOS.xcarchive$(FWK_PATH) \ |
| 80 | -framework $(ARCHIVE_DIR)/OCMock-iOS.xcarchive$(FWK_PATH) \ |
| 81 | -framework $(ARCHIVE_DIR)/OCMock-iOS-sim.xcarchive$(FWK_PATH) \ |
| 82 | -framework $(ARCHIVE_DIR)/OCMock-tvOS.xcarchive$(FWK_PATH) \ |
| 83 | -framework $(ARCHIVE_DIR)/OCMock-tvOS-sim.xcarchive$(FWK_PATH) \ |
| 84 | -framework $(ARCHIVE_DIR)/OCMock-watchOS.xcarchive$(FWK_PATH) \ |
| 85 | -framework $(ARCHIVE_DIR)/OCMock-watchOS-sim.xcarchive$(FWK_PATH) |
| 86 | rm -rf $(PRODUCT_DIR)/libOCMock.xcframework |
| 87 | $(XCODEXCF) -create-xcframework -output $(PRODUCT_DIR)/libOCMock.xcframework \ |
| 88 | -library $(ARCHIVE_DIR)/OCMock-iOS-lib.xcarchive/Products/usr/local/lib/libOCMock.a -headers $(ARCHIVE_DIR)/OCMock-iOS-lib.xcarchive/Products/usr/local/lib/OCMock \ |
| 89 | -library $(ARCHIVE_DIR)/OCMock-iOS-lib-sim.xcarchive/Products/usr/local/lib/libOCMock.a -headers $(ARCHIVE_DIR)/OCMock-iOS-lib-sim.xcarchive/Products/usr/local/lib/OCMock |
| 90 | |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 91 | |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 92 | sourcecode: |
| 93 | @echo "** Checking out source code..." |
| 94 | mkdir -p "$(PRODUCT_DIR)" |
| 95 | git archive master | tar -x -C "$(PRODUCT_DIR)" Source |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 96 | |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 97 | dmg: |
Erik Doernenburg | bf30e69 | 2020-12-22 00:35:24 +0100 | [diff] [blame] | 98 | @echo "** Creating disk image..." |
Erik Doernenburg | 7438b18 | 2020-12-23 19:50:10 +0100 | [diff] [blame] | 99 | Tools/makedmg.rb $(PRODUCT_DIR) $(BUILD_DIR) |
Erik Doernenburg | 4a49ebb | 2020-12-30 18:30:57 +0100 | [diff] [blame] | 100 | |
| 101 | |
Erik Doernenburg | 826310b | 2021-10-16 14:12:39 +0200 | [diff] [blame] | 102 | ci-swiftpm: |
| 103 | @echo "** Testing Swift Package Manager Distribution" |
| 104 | rm -rf $(SOURCE_DIR)/Carthage |
Erik Doernenburg | 7261b39 | 2021-05-11 18:11:19 +0200 | [diff] [blame] | 105 | swift build |
| 106 | swift test |
| 107 | |
| 108 | |
Erik Doernenburg | 4a49ebb | 2020-12-30 18:30:57 +0100 | [diff] [blame] | 109 | carthage: |
Erik Doernenburg | ef21a2e | 2021-10-26 22:26:40 +0200 | [diff] [blame] | 110 | carthage build --project-directory "$(SOURCE_DIR)" --no-skip-current --use-xcframeworks |