Skip to content

Commit

Permalink
Improved architectures and signatures in build.
Browse files Browse the repository at this point in the history
This is still not ideal. It's unclear to me why some simulator builds include i386, and why only the macOS framework gets signed.
  • Loading branch information
erikdoe committed Dec 23, 2020
1 parent e165541 commit 7438b18
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 52 deletions.
54 changes: 27 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
2 changes: 1 addition & 1 deletion Source/Changes.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 11 additions & 4 deletions Source/OCMock.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@
TestTargetID = 030EF0A714632FD000B04273;
};
D31108AC1828DB8700737925 = {
ProvisioningStyle = Manual;
TestTargetID = 030EF0DB14632FF700B04273;
};
F0B950F01B0080BE00942C38 = {
Expand Down Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand Down Expand Up @@ -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 = (
Expand All @@ -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;
Expand All @@ -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";
Expand All @@ -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;
};
Expand Down
19 changes: 9 additions & 10 deletions Source/OCMock.xcodeproj/xcshareddata/xcschemes/OCMock.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@
ReferencedContainer = "container:OCMock.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "03565A1A18F05626003AE91E"
BuildableName = "OCMock Tests.xctest"
BlueprintName = "OCMock Tests"
ReferencedContainer = "container:OCMock.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down Expand Up @@ -77,6 +67,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "030EF0A714632FD000B04273"
BuildableName = "OCMock.framework"
BlueprintName = "OCMock"
ReferencedContainer = "container:OCMock.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
6 changes: 4 additions & 2 deletions Source/OCMockCI.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions Source/OCMockDist.xcconfig
Original file line number Diff line number Diff line change
@@ -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: [email protected]
CODE_SIGN_IDENTITY = Apple Development: [email protected] (FJTF47J852)
7 changes: 5 additions & 2 deletions Tools/distcheck.rb → Tools/buildcheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions Tools/makedmg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7438b18

Please sign in to comment.