From 4840a0766af64771e5a96488b8985280388f1f9c Mon Sep 17 00:00:00 2001 From: Rinat Enikeev Date: Sat, 25 Nov 2023 19:27:39 +0200 Subject: [PATCH] Intents and PNService targets from xcodegen (#1729) * Add PNService to xcodegen * Add intents to xcodegen * Load Keystore PostBuild script (#1730) * Load Keystore PostBuild script Only on Archive for Release configuration loads secrects * add build script --- .gitignore | 1 - intents/Info.plist | 20 +++++++++++++ intents_frameworks.yml | 51 ++++++++++++++++++++++++++++++++++ intents_spm.yml | 50 +++++++++++++++++++++++++++++++++ pnservice.yml | 22 +++++++++++++++ pnservice/Info.plist | 20 +++++++++++++ project_frameworks.yml | 13 ++++++++- project_spm.yml | 13 ++++++++- scripts/build/load_keystore.sh | 16 +++++++++++ 9 files changed, 203 insertions(+), 3 deletions(-) create mode 100644 intents_frameworks.yml create mode 100644 intents_spm.yml create mode 100644 pnservice.yml create mode 100644 scripts/build/load_keystore.sh diff --git a/.gitignore b/.gitignore index 8930e926b..c27536ba3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ station/Classes/Networking/Assembly/Networking.plist # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore ## Build generated -build/ DerivedData/ ## Various settings diff --git a/intents/Info.plist b/intents/Info.plist index 792273965..cde80a610 100644 --- a/intents/Info.plist +++ b/intents/Info.plist @@ -2,6 +2,24 @@ + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Ruuvi Station + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) NSExtension NSExtensionAttributes @@ -20,5 +38,7 @@ NSExtensionPrincipalClass $(PRODUCT_MODULE_NAME).IntentHandler + NSHumanReadableCopyright + Copyright © 2023 Ruuvi Innovations Oy. All rights reserved. diff --git a/intents_frameworks.yml b/intents_frameworks.yml new file mode 100644 index 000000000..689e042be --- /dev/null +++ b/intents_frameworks.yml @@ -0,0 +1,51 @@ +targets: + station.intents: + type: app-extension + platform: iOS + info: + path: intents/Info.plist + properties: + NSExtension: + NSExtensionAttributes: + IntentsRestrictedWhileLocked: [] + IntentsRestrictedWhileProtectedDataUnavailable: [] + IntentsSupported: [RuuviTagSelectionIntent] + NSExtensionPointIdentifier: com.apple.intents-service + NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).IntentHandler + CFBundleDisplayName: Ruuvi Station + CFBundlePackageType: $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString: $(MARKETING_VERSION) + CFBundleVersion: $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright: Copyright © 2023 Ruuvi Innovations Oy. All rights reserved. + settings: + base: + CODE_SIGN_ENTITLEMENTS: station_intents.entitlements + sources: + - path: intents + - path: ruuvi-widgets + excludes: + - Info.plist + dependencies: + - package: Swinject + - package: BTKit + - package: Future + - package: GRDB + - package: Humidity + - package: Realm + - package: KeychainAccess + - package: Realm + product: RealmSwift + - target: RuuviUser + embed: true + - target: RuuviCloud + embed: true + - target: RuuviOntology + embed: true + - target: RuuviPool + embed: true + - target: RuuviLocal + embed: true + - target: RuuviPersistence + embed: true + - target: RuuviContext + embed: true \ No newline at end of file diff --git a/intents_spm.yml b/intents_spm.yml new file mode 100644 index 000000000..e7db6f0cf --- /dev/null +++ b/intents_spm.yml @@ -0,0 +1,50 @@ +targets: + station.intents: + type: app-extension + platform: iOS + info: + path: intents/Info.plist + properties: + NSExtension: + NSExtensionAttributes: + IntentsRestrictedWhileLocked: [] + IntentsRestrictedWhileProtectedDataUnavailable: [] + IntentsSupported: [RuuviTagSelectionIntent] + NSExtensionPointIdentifier: com.apple.intents-service + NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).IntentHandler + CFBundleDisplayName: Ruuvi Station + CFBundlePackageType: $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString: $(MARKETING_VERSION) + CFBundleVersion: $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright: Copyright © 2023 Ruuvi Innovations Oy. All rights reserved. + settings: + base: + CODE_SIGN_ENTITLEMENTS: station_intents.entitlements + sources: + - path: intents + - path: ruuvi-widgets + excludes: + - Info.plist + dependencies: + - package: Swinject + - package: BTKit + - package: Future + - package: GRDB + - package: Humidity + - package: Realm + - package: KeychainAccess + - package: Realm + product: RealmSwift + - package: RuuviUser + - package: RuuviUser + product: RuuviUserCoordinator + - package: RuuviCloud + - package: RuuviCloud + product: RuuviCloudPure + - package: RuuviCloud + product: RuuviCloudApi + - package: RuuviOntology + - package: RuuviPool + - package: RuuviLocal + - package: RuuviPersistence + - package: RuuviContext \ No newline at end of file diff --git a/pnservice.yml b/pnservice.yml new file mode 100644 index 000000000..acfbb15df --- /dev/null +++ b/pnservice.yml @@ -0,0 +1,22 @@ +targets: + station.pnservice: + type: app-extension + platform: iOS + info: + path: pnservice/Info.plist + properties: + NSExtension: + NSExtensionPointIdentifier: com.apple.usernotifications.service + NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).NotificationService + CFBundleDisplayName: Ruuvi Station + CFBundlePackageType: $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString: $(MARKETING_VERSION) + CFBundleVersion: $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright: Copyright © 2023 Ruuvi Innovations Oy. All rights reserved. + settings: + base: + CODE_SIGN_ENTITLEMENTS: pnservice.entitlements + sources: + - path: pnservice + - path: station/Resources/Strings/ + - path: station/Resources/Sounds/ \ No newline at end of file diff --git a/pnservice/Info.plist b/pnservice/Info.plist index 57421ebf9..1383832e9 100644 --- a/pnservice/Info.plist +++ b/pnservice/Info.plist @@ -2,6 +2,24 @@ + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Ruuvi Station + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) NSExtension NSExtensionPointIdentifier @@ -9,5 +27,7 @@ NSExtensionPrincipalClass $(PRODUCT_MODULE_NAME).NotificationService + NSHumanReadableCopyright + Copyright © 2023 Ruuvi Innovations Oy. All rights reserved. diff --git a/project_frameworks.yml b/project_frameworks.yml index 497d63c94..ef1cdc8e8 100644 --- a/project_frameworks.yml +++ b/project_frameworks.yml @@ -182,6 +182,8 @@ include: - Modules/RuuviLocationPicker/target.yml - Modules/RuuviOnboard/target.yml - widget_frameworks.yml +- pnservice.yml +- intents_frameworks.yml targets: station: @@ -194,6 +196,8 @@ targets: - path: pnservice.entitlements dependencies: - target: "station.widgets" + - target: "station.intents" + - target: "station.pnservice" - package: BTKit - package: Charts - package: GRDB @@ -273,7 +277,14 @@ targets: TARGETED_DEVICE_FAMILY: 1,2 SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: true CODE_SIGN_ENTITLEMENTS: station/station.entitlements - + postBuildScripts: + - path: scripts/build/load_keystore.sh + name: Load Keystore + inputFiles: + - $(SRCROOT)/station/Classes/Networking/Assembly/Networking.plist + - $(SRCROOT)/station/Resources/Plists/GoogleService-Info.plist + runOnlyWhenInstalling: true + basedOnDependencyAnalysis: false schemes: station: build: diff --git a/project_spm.yml b/project_spm.yml index 220fad1a0..4cd698505 100644 --- a/project_spm.yml +++ b/project_spm.yml @@ -110,6 +110,8 @@ packages: include: - widget_spm.yml +- pnservice.yml +- intents_spm.yml targets: station: @@ -122,6 +124,8 @@ targets: - path: pnservice.entitlements dependencies: - target: "station.widgets" + - target: "station.intents" + - target: "station.pnservice" - package: BTKit - package: Charts - package: LightRoute @@ -268,7 +272,14 @@ targets: TARGETED_DEVICE_FAMILY: 1,2 SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: true CODE_SIGN_ENTITLEMENTS: station/station.entitlements - + postBuildScripts: + - path: scripts/build/load_keystore.sh + name: Load Keystore + inputFiles: + - $(SRCROOT)/station/Classes/Networking/Assembly/Networking.plist + - $(SRCROOT)/station/Resources/Plists/GoogleService-Info.plist + runOnlyWhenInstalling: true + basedOnDependencyAnalysis: false schemes: station: build: diff --git a/scripts/build/load_keystore.sh b/scripts/build/load_keystore.sh new file mode 100644 index 000000000..105299f57 --- /dev/null +++ b/scripts/build/load_keystore.sh @@ -0,0 +1,16 @@ +if [ "${CONFIGURATION}" = "Release" ]; then + BUILD_APP_DIR=${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME} + git clone git@github.com:ruuvi/com.ruuvi.station.ios.keystore.git + if [ $? -eq 0 ]; then + /bin/cp -rf com.ruuvi.station.ios.keystore/GoogleService-Info.plist "$BUILD_APP_DIR/GoogleService-Info.plist" + /bin/cp -rf com.ruuvi.station.ios.keystore/Networking.plist "$BUILD_APP_DIR/Networking.plist" + rm -rf com.ruuvi.station.ios.keystore + else + if grep -q "{ set your API key here }" $SCRIPT_INPUT_FILE_0; then + echo "warning: Missing OpenWeatherMap API key. In order to make Virtual Sensors work please obtain API key on https://openweathermap.org and put into station/Classes/Networking/Assembly/Networking.plist" + fi + if grep -q "1:925543306936:ios:84f5fda343c52e7671c64d" $SCRIPT_INPUT_FILE_1; then + echo "warning: Demo GoogleServices credentials. If you want to use your own GoogleServices credentials, please replace the station/Resources/Plists/GoogleService-Info.plist file" + fi + fi +fi \ No newline at end of file