diff --git a/Package.swift b/Package.swift index 63d1216ddd..fb94dd9b4f 100644 --- a/Package.swift +++ b/Package.swift @@ -27,6 +27,10 @@ var additionalCompilerFlags: [PackageDescription.SwiftSetting] = { ?? [] }() +var ciCompilerFlags: [PackageDescription.SwiftSetting] = [ + // REPLACE_WITH_DEFINES_HERE +] + // Only add DocC Plugin when building docs, so that clients of this library won't // unnecessarily also get the DocC Plugin let environmentVariables = ProcessInfo.processInfo.environment @@ -75,7 +79,7 @@ let package = Package( resources: [ .copy("../Sources/PrivacyInfo.xcprivacy") ], - swiftSettings: [visionOSSetting] + additionalCompilerFlags), + swiftSettings: [visionOSSetting] + ciCompilerFlags + additionalCompilerFlags), .target(name: "RevenueCat_CustomEntitlementComputation", path: "CustomEntitlementComputation", exclude: ["Info.plist", "LocalReceiptParsing/ReceiptParser-only-files"], @@ -85,7 +89,7 @@ let package = Package( swiftSettings: [ .define("ENABLE_CUSTOM_ENTITLEMENT_COMPUTATION"), visionOSSetting - ] + additionalCompilerFlags), + ] + ciCompilerFlags + additionalCompilerFlags), // Receipt Parser .target(name: "ReceiptParser", path: "LocalReceiptParsing"), @@ -101,7 +105,7 @@ let package = Package( .copy("Resources/background.jpg"), .process("Resources/icons.xcassets") ], - swiftSettings: additionalCompilerFlags), + swiftSettings: ciCompilerFlags + additionalCompilerFlags), .testTarget(name: "RevenueCatUITests", dependencies: [ "RevenueCatUI", diff --git a/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/OfferingList/APIKeyDashboardList.swift b/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/OfferingList/APIKeyDashboardList.swift index 73545f344c..d3b31aec72 100644 --- a/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/OfferingList/APIKeyDashboardList.swift +++ b/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/OfferingList/APIKeyDashboardList.swift @@ -176,9 +176,10 @@ struct APIKeyDashboardList: View { Text(self.offering.serverDescription) Spacer() #if PAYWALL_COMPONENTS - Image(systemName: "exclamationmark.circle.fill") - .foregroundStyle(Color.red) - .hidden(if: self.offering.paywallComponentsData?.errorInfo?.isEmpty ?? true) + if let errorInfo = self.offering.paywallComponentsData?.errorInfo, !errorInfo.isEmpty { + Image(systemName: "exclamationmark.circle.fill") + .foregroundStyle(Color.red) + } #endif } } @@ -199,7 +200,6 @@ extension APIKeyDashboardList.Template: CustomStringConvertible { var description: String { if let name = self.name { - #if DEBUG if name == "components" { return "V2" } else if let template = PaywallTemplate(rawValue: name) { @@ -207,9 +207,6 @@ extension APIKeyDashboardList.Template: CustomStringConvertible { } else { return "Unrecognized template" } - #else - return name - #endif } else { return "No paywall" } diff --git a/Tests/TestingApps/PaywallsTester/ci_scripts/ci_pre_xcodebuild.sh b/Tests/TestingApps/PaywallsTester/ci_scripts/ci_pre_xcodebuild.sh index 03f6e17d48..5c7bcdda5b 100755 --- a/Tests/TestingApps/PaywallsTester/ci_scripts/ci_pre_xcodebuild.sh +++ b/Tests/TestingApps/PaywallsTester/ci_scripts/ci_pre_xcodebuild.sh @@ -7,5 +7,13 @@ echo "Replacing API keys on PaywallsTester" file="$SCRIPT_DIR/../PaywallsTester/Config/ConfigItem.swift" sed -i '' 's/static var apiKey: String { "" }/static var apiKey: String { "'"$REVENUECAT_XCODE_CLOUD_RC_APP_API_KEY"'" }/' $file -echo "Enabling PAYWALL_COMPONENTS compiler flag" -echo "SWIFT_ACTIVE_COMPILATION_CONDITIONS = \$(inherited) PAYWALL_COMPONENTS" > "$SCRIPT_DIR/../Local.xcconfig" +# This allow Local.xcconfig to be found by Xcode +xcconfig_file="$(cd "$SCRIPT_DIR/../../../../" && pwd)/Local.xcconfig" + +echo "Enabling PAYWALL_COMPONENTS compiler flag in $xcconfig_file" +echo "SWIFT_ACTIVE_COMPILATION_CONDITIONS = \$(inherited) PAYWALL_COMPONENTS" > "$xcconfig_file" + +# Update Package.swift with PAYWALL_COMPONENTS define +package_file="$(cd "$SCRIPT_DIR/../../../../" && pwd)/Package.swift" +sed -i '' 's/\/\/ REPLACE_WITH_DEFINES_HERE/.define("PAYWALL_COMPONENTS")/' "$package_file" +