From 7438b18c4e0c3d40665c66b4b81f8ecbdd245462 Mon Sep 17 00:00:00 2001 From: Erik Doernenburg Date: Wed, 23 Dec 2020 19:50:10 +0100 Subject: [PATCH] Improved architectures and signatures in build. This is still not ideal. It's unclear to me why some simulator builds include i386, and why only the macOS framework gets signed. --- Makefile | 54 +++++++++---------- Source/Changes.txt | 2 +- Source/OCMock.xcodeproj/project.pbxproj | 15 ++++-- .../xcshareddata/xcschemes/OCMock.xcscheme | 19 ++++--- Source/OCMockCI.xcconfig | 6 ++- Source/OCMockDist.xcconfig | 9 ++-- Tools/{distcheck.rb => buildcheck.rb} | 7 ++- Tools/makedmg.rb | 4 +- 8 files changed, 64 insertions(+), 52 deletions(-) rename Tools/{distcheck.rb => buildcheck.rb} (87%) diff --git a/Makefile b/Makefile index e729b005..efe9bc51 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,17 @@ # - ci used by Travis for continuous integration # - dist used to build the binary distribution # -# Note that the dist target will checkout the source code to a temporary -# directory. Any uncommited changes will not affect the build. That said, -# it will use the locally checked out version of the Xcode configs. +# Note that the dist target uses git checkout to copy the source into the +# product directory. This means you should make sure that you don't have +# uncommited local changes when building a distribution. -SYMROOT = $(CURDIR)/Build -DISTDIR = $(SYMROOT)/Product -XCODECI = xcodebuild -project "$(CURDIR)/Source/OCMock.xcodeproj" -xcconfig "$(CURDIR)/Source/OCMockCI.xcconfig" -XCODEDIST = xcodebuild -project "$(DISTDIR)/Source/OCMock.xcodeproj" -xcconfig "$(CURDIR)/Source/OCMockDist.xcconfig" -SHELL = /bin/bash -e -o pipefail +BUILD_DIR = $(CURDIR)/Build +PRODUCT_DIR = $(BUILD_DIR)/Product +XCODECI = xcodebuild -project "$(CURDIR)/Source/OCMock.xcodeproj" -xcconfig "$(CURDIR)/Source/OCMockCI.xcconfig" +XCODEDIST = xcodebuild -project "$(CURDIR)/Source/OCMock.xcodeproj" -xcconfig "$(CURDIR)/Source/OCMockDist.xcconfig" +SHELL = /bin/bash -e -o pipefail -.PHONY: checkout macos ioslib ios tvos watchos +.PHONY: macos ioslib ios tvos watchos sourcecode product dmg clean: rm -rf "$(CURDIR)/Build" @@ -29,37 +29,37 @@ ci-ios: $(XCODECI) -scheme OCMockLib -destination 'platform=iOS Simulator,OS=latest,name=iPhone 11' test | xcpretty -c -dist: clean product dmg - -checkout: - @echo "** Checking out source..." - mkdir -p "$(DISTDIR)" - git archive master | tar -x -C "$(DISTDIR)" Source - -macos: checkout +dist: product sourcecode dmg + +macos: @echo "** Building macOS framework..." - $(XCODEDIST) -target OCMock -sdk macosx install INSTALL_PATH="/macOS" | xcpretty -c - -ioslib: checkout + $(XCODEDIST) -scheme OCMock install INSTALL_PATH="/macOS" | xcpretty -c + +ioslib: @echo "** Building iOS library..." $(XCODEDIST) -target OCMockLib -sdk iphonesimulator install INSTALL_PATH="/iOS library" | xcpretty -c -ios: checkout +ios: @echo "** Building iOS framework..." $(XCODEDIST) -target "OCMock iOS" -sdk iphonesimulator install INSTALL_PATH="/iOS" | xcpretty -c -tvos: checkout +tvos: @echo "** Building tvOS framework..." $(XCODEDIST) -target "OCMock tvOS" -sdk appletvsimulator install INSTALL_PATH="/tvOS" | xcpretty -c -watchos: checkout +watchos: @echo "** Building watchOS framework..." - $(XCODEDIST) -target "OCMock watchOS" -sdk watchsimulator install INSTALL_PATH="/watchOS"| xcpretty -c + $(XCODEDIST) -target "OCMock watchOS" -sdk watchsimulator install INSTALL_PATH="/watchOS" | xcpretty -c + +sourcecode: + @echo "** Checking out source code..." + mkdir -p "$(PRODUCT_DIR)" + git archive master | tar -x -C "$(PRODUCT_DIR)" Source product: macos ioslib ios tvos watchos - @echo "** Verifying products..." - Tools/distcheck.rb $(DISTDIR) + @echo "** Verifying build products..." + Tools/buildcheck.rb $(PRODUCT_DIR) dmg: @echo "** Creating disk image..." - Tools/makedmg.rb $(DISTDIR) $(SYMROOT) + Tools/makedmg.rb $(PRODUCT_DIR) $(BUILD_DIR) diff --git a/Source/Changes.txt b/Source/Changes.txt index 1a76584e..b0567f60 100644 --- a/Source/Changes.txt +++ b/Source/Changes.txt @@ -1,7 +1,7 @@ Listing of notable changes by release. More detail is usually found in the Git commit messages and/or the pull requests. -OCMock 3.8 (2020-12-21) +OCMock 3.8 (2020-12-23) * Added support for ARM-based Macs. Unfortunately, this means that the hack to combine the device targets with the simulator targets no longer works. The diff --git a/Source/OCMock.xcodeproj/project.pbxproj b/Source/OCMock.xcodeproj/project.pbxproj index f0a478e0..703d9506 100644 --- a/Source/OCMock.xcodeproj/project.pbxproj +++ b/Source/OCMock.xcodeproj/project.pbxproj @@ -1334,6 +1334,7 @@ TestTargetID = 030EF0A714632FD000B04273; }; D31108AC1828DB8700737925 = { + ProvisioningStyle = Manual; TestTargetID = 030EF0DB14632FF700B04273; }; F0B950F01B0080BE00942C38 = { @@ -1885,8 +1886,6 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; - VALID_ARCHS = "arm64 armv7 armv7s arm64e"; - "VALID_ARCHS[sdk=iphonesimulator*]" = "x86_64 i386"; }; name = Debug; }; @@ -1904,8 +1903,6 @@ SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; - VALID_ARCHS = "arm64 armv7 armv7s arm64e"; - "VALID_ARCHS[sdk=iphonesimulator*]" = "x86_64 i386"; }; name = Release; }; @@ -2120,6 +2117,9 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "OCMockLibTests/OCMockLibTests-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -2133,6 +2133,8 @@ OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = "org.ocmock.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SDKROOT = iphoneos; }; name = Debug; @@ -2148,6 +2150,9 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; ENABLE_NS_ASSERTIONS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "OCMockLibTests/OCMockLibTests-Prefix.pch"; @@ -2158,6 +2163,8 @@ OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = "org.ocmock.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; diff --git a/Source/OCMock.xcodeproj/xcshareddata/xcschemes/OCMock.xcscheme b/Source/OCMock.xcodeproj/xcshareddata/xcschemes/OCMock.xcscheme index e671eee7..8d173a5b 100644 --- a/Source/OCMock.xcodeproj/xcshareddata/xcschemes/OCMock.xcscheme +++ b/Source/OCMock.xcodeproj/xcshareddata/xcschemes/OCMock.xcscheme @@ -39,16 +39,6 @@ ReferencedContainer = "container:OCMock.xcodeproj"> - - - - + + + + diff --git a/Source/OCMockCI.xcconfig b/Source/OCMockCI.xcconfig index 6e78a6c2..964244c4 100644 --- a/Source/OCMockCI.xcconfig +++ b/Source/OCMockCI.xcconfig @@ -2,5 +2,7 @@ // https://help.apple.com/xcode/#/dev745c5c974 // If you change these here you must also update the makefile -SYMROOT = ../Build -OBJROOT = ../Build +// Note that OBJROOT is not defined in terms of SYMROOT. For some +// reason that doesn't work; PIFcache files get misplaced. +SYMROOT = $(PROJECT_DIR)/../Build +OBJROOT = $(PROJECT_DIR)/../Build/Intermediaries diff --git a/Source/OCMockDist.xcconfig b/Source/OCMockDist.xcconfig index ee05ab8f..bf135272 100644 --- a/Source/OCMockDist.xcconfig +++ b/Source/OCMockDist.xcconfig @@ -1,14 +1,15 @@ // Configuration settings file format documentation can be found at: // https://help.apple.com/xcode/#/dev745c5c974 -// If you change these here you must also update the makefile -SYMROOT = ../../../Build -OBJROOT = ../../../Build/Intermediaries +#include "OCMockCI.xcconfig" + +// If you change this here you must also update the makefile DSTROOT = $(SYMROOT)/Product // Make sure that files are copied to DSTROOT SKIP_INSTALL = NO // Set the codesign identity for distribution +CODE_SIGN_STYLE = Manual TEAM_IDENTIFIER = 28U2VZ7DF8 -CODE_SIGN_IDENTITY = Apple Development: erik@doernenburg.com +CODE_SIGN_IDENTITY = Apple Development: erik@doernenburg.com (FJTF47J852) diff --git a/Tools/distcheck.rb b/Tools/buildcheck.rb similarity index 87% rename from Tools/distcheck.rb rename to Tools/buildcheck.rb index 9495fbc1..f99f9b2e 100755 --- a/Tools/distcheck.rb +++ b/Tools/buildcheck.rb @@ -12,7 +12,10 @@ def run(cmd, &block) def checkArchs(path, expected) archs = nil run("lipo -info \"#{path}\"") { |lipo| archs = /re: (.*)/.match(lipo.readline)[1].strip() } - if archs != expected + if (expected.split(" ") - archs.split(" ")).count > 0 + puts "Warning: missing architecture; expected \"#{expected}\", found \"#{archs}\"" + end + if (archs.split(" ") - expected.split(" ")).count > 0 puts "Warning: unexpected architecture; expected \"#{expected}\", found \"#{archs}\"" end end @@ -39,7 +42,7 @@ def checkAuthority(path, expected) watchosproduct = "#{productdir}/watchOS/OCMock.framework" checkArchs "#{macosproduct}/OCMock", "x86_64 arm64" -checkArchs "#{ioslibproduct}", "armv7 i386 x86_64 arm64" +checkArchs "#{ioslibproduct}", "x86_64 arm64" checkArchs "#{iosproduct}/OCMock", "x86_64 arm64" checkArchs "#{tvosproduct}/OCMock", "x86_64 arm64" checkArchs "#{watchosproduct}/OCMock", "x86_64 arm64" diff --git a/Tools/makedmg.rb b/Tools/makedmg.rb index 879548b7..307d435d 100755 --- a/Tools/makedmg.rb +++ b/Tools/makedmg.rb @@ -17,7 +17,7 @@ def getVersion(productdir) end def makeDMG(productdir, dmgdir, dmgname, volumename) - tempdmg = "/tmp/ocmock-temp-#{Process.pid}.dmg" + tempdmg = "#{dmgdir}/ocmock-temp-#{Process.pid}.dmg" finaldmg = "#{dmgdir}/#{dmgname}.dmg" run("hdiutil create -size 8m #{tempdmg} -layout NONE") disk_id = nil @@ -27,7 +27,7 @@ def makeDMG(productdir, dmgdir, dmgname, volumename) run("hdid #{tempdmg}") { |hdid| disk_id = hdid.readline.split[0] } run("cp -R #{productdir}/* '/Volumes/#{volumename}'") run("hdiutil eject #{disk_id}") - run("rm #{finaldmg}") { } + run("rm -f #{finaldmg}") run("hdiutil convert -format UDZO #{tempdmg} -o #{finaldmg} -imagekey zlib-level=9") run("rm #{tempdmg}") end