From ce2cb0574bad2357214d4a2dbe2a0e177ec469aa Mon Sep 17 00:00:00 2001 From: AJ Lauer Barinov Date: Mon, 4 Dec 2023 18:22:27 -0800 Subject: [PATCH] build: conditionally link IMA binaries based on platform currently fails with a build error on tvOS but not on iOS --- Example/DemoApp/ViewController.swift | 2 +- .../MUXSDKIMATVOSExample/ViewController.swift | 2 +- Package.swift | 25 +++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Example/DemoApp/ViewController.swift b/Example/DemoApp/ViewController.swift index 397a6c8..e11c642 100644 --- a/Example/DemoApp/ViewController.swift +++ b/Example/DemoApp/ViewController.swift @@ -11,7 +11,7 @@ import AVKit import AVFoundation import Mux_Stats_Google_IMA import MUXSDKStats -import GoogleInteractiveMediaAds +import GoogleInteractiveMediaAds_tvOS class ViewController: UIViewController, IMAAdsLoaderDelegate, IMAAdsManagerDelegate { diff --git a/Example/MUXSDKIMATVOSExample/ViewController.swift b/Example/MUXSDKIMATVOSExample/ViewController.swift index d9db925..6fa1733 100644 --- a/Example/MUXSDKIMATVOSExample/ViewController.swift +++ b/Example/MUXSDKIMATVOSExample/ViewController.swift @@ -4,7 +4,7 @@ // import AVFoundation -import GoogleInteractiveMediaAds +import GoogleInteractiveMediaAds_tvOS import Mux_Stats_Google_IMA import UIKit diff --git a/Package.swift b/Package.swift index 28c7558..c9739bb 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,13 @@ import PackageDescription let package = Package( name: "Mux_Stats_Google_IMA", products: [ - .library(name: "Mux_Stats_Google_IMA", targets: ["Mux_Stats_Google_IMA", "GoogleInteractiveMediaAds",]), + .library( + name: "Mux_Stats_Google_IMA", + targets: [ + "Mux_Stats_Google_IMA", + "GoogleInteractiveMediaAds", + ] + ), ], dependencies: [ .package( @@ -16,13 +22,28 @@ let package = Package( targets: [ .target( name: "Mux_Stats_Google_IMA", - dependencies: ["MUXSDKStats", "GoogleInteractiveMediaAds"], + dependencies: [ + "MUXSDKStats", + .targetItem( + name: "GoogleInteractiveMediaAds", + condition: .when(platforms: [.iOS]) + ), + .targetItem( + name: "GoogleInteractiveMediaAds_tvOS", + condition: .when(platforms: [.tvOS]) + ) + ], path: "MUXSDKImaListener/Classes" ), .binaryTarget( name: "GoogleInteractiveMediaAds", url: "https://imasdk.googleapis.com/native/downloads/ima-ios-v3.16.3.zip", checksum: "049bac92551b50247ea14dcbfde9aeb99ac2bea578a74f67c6f3e781d9aca101" + ), + .binaryTarget( + name: "GoogleInteractiveMediaAds_tvOS", + url: "https://imasdk.googleapis.com/native/downloads/ima-tvos-v4.9.2.zip", + checksum: "c0c2c44a533bf36aafb871402612d0c067457e44bc7a24af62ccc38e285e7e98" ) ] )