diff --git a/Config/RMStoreFramework-iOS.xcconfig b/Config/RMStoreFramework-iOS.xcconfig index 51248819..de46259c 100644 --- a/Config/RMStoreFramework-iOS.xcconfig +++ b/Config/RMStoreFramework-iOS.xcconfig @@ -14,7 +14,7 @@ PRODUCT_NAME = RMStoreFramework PRODUCT_BUNDLE_IDENTIFIER = com.balthisar.RMStore-iOS -INFOPLIST_FILE = RMStoreFramework/Info.plist +INFOPLIST_FILE = RMStoreFramework/RMStoreFramework-Info.plist SUPPORTS_MACCATALYST = YES DEFINES_MODULE = YES diff --git a/Config/RMStoreFramework-macOS.xcconfig b/Config/RMStoreFramework-macOS.xcconfig index 1e21700d..33625d4f 100644 --- a/Config/RMStoreFramework-macOS.xcconfig +++ b/Config/RMStoreFramework-macOS.xcconfig @@ -14,7 +14,7 @@ PRODUCT_NAME = RMStoreFramework PRODUCT_BUNDLE_IDENTIFIER = com.balthisar.RMStore-macOS -INFOPLIST_FILE = RMStoreFramework/Info.plist +INFOPLIST_FILE = RMStoreFramework/RMStoreFramework-Info.plist SDKROOT = macosx DEFINES_MODULE = YES diff --git a/Config/RMStoreFramework-tvOS.xcconfig b/Config/RMStoreFramework-tvOS.xcconfig index 25649baf..2ee26bf2 100644 --- a/Config/RMStoreFramework-tvOS.xcconfig +++ b/Config/RMStoreFramework-tvOS.xcconfig @@ -15,7 +15,7 @@ PRODUCT_NAME = RMStoreFramework SDKROOT = appletvos PRODUCT_BUNDLE_IDENTIFIER = com.balthisar.RMStore-tvOS -INFOPLIST_FILE = RMStoreFramework/Info.plist +INFOPLIST_FILE = RMStoreFramework/RMStoreFramework-Info.plist TARGETED_DEVICE_FAMILY = 3 DEFINES_MODULE = YES diff --git a/RMStore.xcodeproj/project.pbxproj b/RMStore.xcodeproj/project.pbxproj index e6305176..f69e9392 100644 --- a/RMStore.xcodeproj/project.pbxproj +++ b/RMStore.xcodeproj/project.pbxproj @@ -250,7 +250,7 @@ /* Begin PBXFileReference section */ 15AD6C9D228BF84E00B68F53 /* RMStoreFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RMStoreFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 15AD6C9F228BF84E00B68F53 /* RMStoreFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RMStoreFramework.h; sourceTree = ""; }; - 15AD6CA0228BF84E00B68F53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 15AD6CA0228BF84E00B68F53 /* RMStoreFramework-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RMStoreFramework-Info.plist"; sourceTree = ""; }; 8700D1C017DCA548005C8F5D /* NSNotification+RMStoreTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotification+RMStoreTests.m"; sourceTree = ""; }; 876046471812FB7500C9B78C /* RMStoreKeychainPersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMStoreKeychainPersistence.h; sourceTree = ""; }; 876046481812FB7500C9B78C /* RMStoreKeychainPersistence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMStoreKeychainPersistence.m; sourceTree = ""; }; @@ -307,6 +307,11 @@ D0576EE623A8044E0097012E /* RMStoreViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RMStoreViewController.xib; sourceTree = ""; }; D0576EE723A8044E0097012E /* RMPurchasesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RMPurchasesViewController.xib; sourceTree = ""; }; D05ADFA7237AE2D00018CD6A /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; + D064399723A858BA0083EF25 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + D064399823A858C90083EF25 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + D064399E23A85E0E0083EF25 /* RMStore-ContainerFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "RMStore-ContainerFramework.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + D06439AD23A85EB70083EF25 /* RMStore_ContainerFramework-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "RMStore_ContainerFramework-Info.plist"; sourceTree = ""; }; + D06439AF23A85EC70083EF25 /* RMStore_ContainerFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMStore_ContainerFramework.h; sourceTree = ""; }; D06825952373A31C00EAF052 /* libRMStore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRMStore.a; sourceTree = BUILT_PRODUCTS_DIR; }; D0725F0023A322340072C528 /* PurchasesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PurchasesViewController.h; sourceTree = ""; }; D0725F0123A322340072C528 /* PurchasesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PurchasesViewController.m; sourceTree = ""; }; @@ -406,6 +411,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D064399B23A85E0E0083EF25 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D068258B2373A31C00EAF052 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -455,7 +467,9 @@ isa = PBXGroup; children = ( 15AD6C9F228BF84E00B68F53 /* RMStoreFramework.h */, - 15AD6CA0228BF84E00B68F53 /* Info.plist */, + 15AD6CA0228BF84E00B68F53 /* RMStoreFramework-Info.plist */, + D06439AF23A85EC70083EF25 /* RMStore_ContainerFramework.h */, + D06439AD23A85EB70083EF25 /* RMStore_ContainerFramework-Info.plist */, ); path = RMStoreFramework; sourceTree = ""; @@ -553,6 +567,7 @@ D0EB86B3239E870900992915 /* RMStoreFramework.framework */, D0188DD5239FC8CA002CC46B /* RMStoreTestsHost.app */, D0188DFC23A01C28002CC46B /* RMStoreTestsMacOS.xctest */, + D064399E23A85E0E0083EF25 /* RMStore-ContainerFramework.framework */, ); name = Products; sourceTree = ""; @@ -610,6 +625,7 @@ A0AF3D7617A8085900D2E836 /* RMStoreDemo-iOS */ = { isa = PBXGroup; children = ( + D064399823A858C90083EF25 /* README.md */, A0AF3D7C17A8085900D2E836 /* main.m */, A0AF3D7F17A8085900D2E836 /* RMAppDelegate.h */, A0AF3D8017A8085900D2E836 /* RMAppDelegate.m */, @@ -665,6 +681,7 @@ D078FA7B23734C1300982C56 /* RMStoreDemo-macOS */ = { isa = PBXGroup; children = ( + D064399723A858BA0083EF25 /* README.md */, D078FA8123734C1300982C56 /* main.m */, D078FA7C23734C1300982C56 /* AppDelegate.h */, D078FA8323734C1300982C56 /* AppDelegate.m */, @@ -715,6 +732,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D064399923A85E0E0083EF25 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D078FA8B2373554700982C56 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -853,6 +877,25 @@ productReference = D0188DFC23A01C28002CC46B /* RMStoreTestsMacOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + D064399D23A85E0E0083EF25 /* RMStore-ContainerFramework */ = { + isa = PBXNativeTarget; + buildConfigurationList = D06439A323A85E0E0083EF25 /* Build configuration list for PBXNativeTarget "RMStore-ContainerFramework" */; + buildPhases = ( + D064399923A85E0E0083EF25 /* Headers */, + D064399A23A85E0E0083EF25 /* Sources */, + D064399B23A85E0E0083EF25 /* Frameworks */, + D064399C23A85E0E0083EF25 /* Resources */, + D0EF44AB23AA8C3F003C810D /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "RMStore-ContainerFramework"; + productName = "RMStore-ContainerFramework"; + productReference = D064399E23A85E0E0083EF25 /* RMStore-ContainerFramework.framework */; + productType = "com.apple.product-type.framework"; + }; D06825832373A31C00EAF052 /* RMStore (macOS) */ = { isa = PBXNativeTarget; buildConfigurationList = D06825922373A31C00EAF052 /* Build configuration list for PBXNativeTarget "RMStore (macOS)" */; @@ -966,6 +1009,9 @@ D0188DFB23A01C28002CC46B = { CreatedOnToolsVersion = 11.2.1; }; + D064399D23A85E0E0083EF25 = { + CreatedOnToolsVersion = 11.3; + }; D078FA8F2373554700982C56 = { CreatedOnToolsVersion = 11.1; ProvisioningStyle = Automatic; @@ -1006,6 +1052,7 @@ 15AD6C9C228BF84E00B68F53 /* RMStoreFramework (iOS) */, D0EB86B2239E870900992915 /* RMStoreFramework (tvOS) */, D078FA8F2373554700982C56 /* RMStoreFramework (macOS) */, + D064399D23A85E0E0083EF25 /* RMStore-ContainerFramework */, ); }; /* End PBXProject section */ @@ -1046,6 +1093,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D064399C23A85E0E0083EF25 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D078FA8E2373554700982C56 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1082,6 +1136,26 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + D0EF44AB23AA8C3F003C810D /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "BUILD=\"${BUILT_PRODUCTS_DIR}/RMStore-ContainerFramework.framework/Versions/A/Resources\"\n\n# In the event that you have a a proxy defined here.\nsource \"${HOME}/.zshenv\"\n\n# Build the XCFramework\n./RMStoreFramework/build_xcframework.sh\n\n# Copy it into the fake framework.\ncp -r \"$BUILD_DIR/RMStoreFramework.xcframework\" \"${BUILD}/\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 15AD6C99228BF84E00B68F53 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -1162,6 +1236,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D064399A23A85E0E0083EF25 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D06825842373A31C00EAF052 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1404,6 +1485,26 @@ }; name = Release; }; + D06439A423A85E0E0083EF25 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = "RMStoreFramework/RMStore_ContainerFramework-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.balthisar.RMStore-ContainerFramework"; + PRODUCT_NAME = "RMStore-ContainerFramework"; + SDKROOT = macosx; + }; + name = Debug; + }; + D06439A523A85E0E0083EF25 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = "RMStoreFramework/RMStore_ContainerFramework-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "com.balthisar.RMStore-ContainerFramework"; + PRODUCT_NAME = "RMStore-ContainerFramework"; + SDKROOT = macosx; + }; + name = Release; + }; D06825932373A31C00EAF052 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = D07E3C91237F32B200BBAE5B /* RMStoreLib-macOS.xcconfig */; @@ -1542,6 +1643,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + D06439A323A85E0E0083EF25 /* Build configuration list for PBXNativeTarget "RMStore-ContainerFramework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D06439A423A85E0E0083EF25 /* Debug */, + D06439A523A85E0E0083EF25 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; D06825922373A31C00EAF052 /* Build configuration list for PBXNativeTarget "RMStore (macOS)" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/RMStore.xcodeproj/xcshareddata/xcschemes/RMStore-ContainerFramework.xcscheme b/RMStore.xcodeproj/xcshareddata/xcschemes/RMStore-ContainerFramework.xcscheme new file mode 100644 index 00000000..57fe6b06 --- /dev/null +++ b/RMStore.xcodeproj/xcshareddata/xcschemes/RMStore-ContainerFramework.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RMStore/Optional/RMAppReceipt.m b/RMStore/Optional/RMAppReceipt.m index b7ccf355..998534b0 100644 --- a/RMStore/Optional/RMAppReceipt.m +++ b/RMStore/Optional/RMAppReceipt.m @@ -19,7 +19,6 @@ // #import "RMAppReceipt.h" -#import #import #import #import diff --git a/RMStoreDemo-iOS/README.md b/RMStoreDemo-iOS/README.md new file mode 100644 index 00000000..80d33d50 --- /dev/null +++ b/RMStoreDemo-iOS/README.md @@ -0,0 +1,15 @@ +# RMStoreDemo-macOS + +These materials build all of the iphoneos-derived demo applications, as described +below. The all share the same source code, although Apple TV requires its own +resources, and the targets link to appropriate versions of the RMStoreFramework. + +- iPhone/iPad and simulators +- Mac Catalyst +- Apple TV and simulator + +Note that in-app-purchases (even in the IAP sandbox) aren't supported by _any_ of the +simulators, and you'll need a real device to try the demos. All of the simulators except +Apple TV simulator can pull the products from the Apple Store, though. You'll need a +real Apple TV to see anything useful with the demo. + diff --git a/RMStoreDemo-macOS/README.md b/RMStoreDemo-macOS/README.md new file mode 100644 index 00000000..030f0ad1 --- /dev/null +++ b/RMStoreDemo-macOS/README.md @@ -0,0 +1,3 @@ +# RMStoreDemo-macOS + +These materials build the macOS native demo application. diff --git a/RMStoreFramework/Info.plist b/RMStoreFramework/RMStoreFramework-Info.plist similarity index 100% rename from RMStoreFramework/Info.plist rename to RMStoreFramework/RMStoreFramework-Info.plist diff --git a/RMStoreFramework/RMStore_ContainerFramework-Info.plist b/RMStoreFramework/RMStore_ContainerFramework-Info.plist new file mode 100644 index 00000000..9bcb2444 --- /dev/null +++ b/RMStoreFramework/RMStore_ContainerFramework-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + + diff --git a/RMStoreFramework/RMStore_ContainerFramework.h b/RMStoreFramework/RMStore_ContainerFramework.h new file mode 100644 index 00000000..e7b35865 --- /dev/null +++ b/RMStoreFramework/RMStore_ContainerFramework.h @@ -0,0 +1,18 @@ +// +// RMStore_ContainerFramework.h +// RMStore-ContainerFramework +// +// Created by Jim Derry on 12/16/19. +// + +#import + +//! Project version number for RMStore_ContainerFramework. +FOUNDATION_EXPORT double RMStore_ContainerFrameworkVersionNumber; + +//! Project version string for RMStore_ContainerFramework. +FOUNDATION_EXPORT const unsigned char RMStore_ContainerFrameworkVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/RMStoreFramework/build_xcframework.sh b/RMStoreFramework/build_xcframework.sh new file mode 100755 index 00000000..e08f3993 --- /dev/null +++ b/RMStoreFramework/build_xcframework.sh @@ -0,0 +1,195 @@ +#!/bin/bash + +#————————————————————————————————————————————————————————————————————————————————————————— +# Setup +#————————————————————————————————————————————————————————————————————————————————————————— + +set -euo pipefail + +# +# Determine script directory and go to working directory. +# +SCRIPTDIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) +SRCROOT=${SRCROOT:-"$SCRIPTDIR/.."} +cd "$SRCROOT" + +# NOTES temp +# -destination 'platform=macOS,variant=Mac Catalyst'. +# ARCHS="x86_64h" + +# +# This table details what we're going to build. The correct architecture will be used according +# to the SDK; as of this writing, no fat binaries should be build because the minimum SDK +# versions are all 64 bit, and no legacy architectures need be built. +# +# BUILD_SCHEME ; BUILD_SDK +MANIFEST=$(cat </dev/null; fi + + local pid=$! + local delay=0.75 + local spinstr='|/-\' #\'' (<- fix for some syntax highlighters) + while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do + local temp=${spinstr#?} + printf " [%c]" "$spinstr" + local spinstr=$temp${spinstr%"$temp"} + sleep $delay + printf "\b\b\b\b\b" + done + + wait $pid + if [[ $_XTRACE -eq 0 ]]; then set -x; fi + return $? +} + + +#————————————————————————————————————————————————————————————————————————————————————————— +# Main +#————————————————————————————————————————————————————————————————————————————————————————— + +# +# Process command line arguments +# +while [[ $# -gt 0 ]]; do + i="$1" + case $i in + -h|--help) + echo_help + exit + ;; + *) + echo "Unknown argument: ${i}" + echo "Use -h or --help for help. Hint: this script takes no arguments." + exit 1 + ;; + esac +done + + +# +# Remember the successful framework builds in order to assemble them into xcframework later. +# +FRAMEWORKS=() + + +# +# Build Loop +# +while IFS=';' read -ra KVP; do + + BUILD_SCHEME=$(echo "${KVP[0]}" | xargs) + BUILD_SDK=$(echo "${KVP[1]}" | xargs) + + # Capture Xcode's build settings for this scheme. + BUILD_SETTINGS=$(xcodebuild \ + archive \ + -scheme "$BUILD_SCHEME" \ + -sdk "$BUILD_SDK" \ + -showBuildSettings \ + SKIP_INSTALL=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ + ) + + # From those, we can get paths to show to the user. + BUILD_DIR=$(echo "$BUILD_SETTINGS" | grep [[:space:]]BUILD_DIR | sed 's/^.*= //') + BUILT_DIR=$(echo "$BUILD_SETTINGS" | grep [[:space:]]BUILT_PRODUCTS_DIR | sed 's/^.*= //') + + # We'll capture stdout to a logfile. + BUILD_LOG="$BUILT_DIR/${BUILD_SDK}.log" + + cat < "$BUILD_LOG" + (xcodebuild \ + archive \ + -scheme "$BUILD_SCHEME" \ + -sdk "$BUILD_SDK" \ + -archivePath "${BUILT_DIR}/${BUILD_SDK}.xcarchive" \ + SKIP_INSTALL=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ + >> "$BUILD_LOG" + ) & spinner + + RESULT=$? + if [ "${RESULT}" != 0 ]; then + printf " Problem during xcodebuild; please check ${BUILD_LOG}\n\n" + exit $RESULT + else + printf " complete\n\n" + FRAMEWORKS+=("-framework ${BUILT_DIR}/${BUILD_SDK}.xcarchive/Products/Library/Frameworks/RMStoreFramework.framework ") + fi + +done <<< "$MANIFEST" + + +# +# Make an xcframework. +# + +XCFRAMEWORK="$BUILD_DIR/RMStoreFramework.xcframework" +rm -R "$XCFRAMEWORK" +xcodebuild -create-xcframework ${FRAMEWORKS[*]} -output "$XCFRAMEWORK" +RESULT=$? +if [[ "${RESULT}" != 0 ]]; then + echo "Something went wrong building the XCFramework." + exit $RESULT +fi + + +# +# Done +# + +cd "$SCRIPTDIR"