Skip to content

Commit

Permalink
build: conditionally link IMA binaries based on platform
Browse files Browse the repository at this point in the history
currently fails with a build error on tvOS but not on iOS
  • Loading branch information
andrewjl-mux committed Dec 5, 2023
1 parent 2fbf09f commit ce2cb05
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Example/DemoApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AVKit
import AVFoundation
import Mux_Stats_Google_IMA
import MUXSDKStats
import GoogleInteractiveMediaAds
import GoogleInteractiveMediaAds_tvOS

Check failure on line 14 in Example/DemoApp/ViewController.swift

View workflow job for this annotation

GitHub Actions / Test the SDK with a Demo App

no such module 'GoogleInteractiveMediaAds_tvOS'

class ViewController: UIViewController, IMAAdsLoaderDelegate, IMAAdsManagerDelegate {

Expand Down
2 changes: 1 addition & 1 deletion Example/MUXSDKIMATVOSExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

import AVFoundation
import GoogleInteractiveMediaAds
import GoogleInteractiveMediaAds_tvOS
import Mux_Stats_Google_IMA
import UIKit

Expand Down
25 changes: 23 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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"
)
]
)

0 comments on commit ce2cb05

Please sign in to comment.