Open cgrindel opened 1 year ago
@AtlilaTheFun Can you share a Swift file showing the imports and how you use Agora?
Thanks! I also created a separate issue for the Firebase version 10+ failure here: https://github.com/cgrindel/swift_bazel/issues/231
I might be able to downgrade to version 8 in the meantime.
Which libraries are you using from Firebase? Right now, some of the libraries won't work due to #208. This is related to how Bazel Objc support does not fully support @import
. I am going to dig back into that once release 0.3.0 is out the door.
I think just the same ones you're currently using in your examples -- FirebaseAnalyticsWithoutAtIdSupport and FirebaseCrashlytics. I was just using a newer version of the dependency than your example.
Can you share a Swift file showing the imports and how you use Agora?
@cgrindel I only use the voice call functionality from the core AgoraRtcKit library.
It's basically the same as their QuickStart guide here but using more of the functionality: https://docs.agora.io/en/voice-calling/get-started/get-started-sdk?platform=ios
In my Package.swift file I depend on it like this:
.package(url: "https://github.com/AgoraIO/AgoraRtcEngine_iOS", .upToNextMajor(from: "3.4.8")),
And then in Swift I import it like:
import AgoraRtcKit
You could just verify you can construct their singleton with:
private var agoraKit: AgoraRtcEngineKit!
init() {
self.agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: appID, delegate: self)
}
I did notice they've updated the APIs a bit since I wrote this code -- I could try pulling the newer version and see if that works better.
@cgrindel Update: I managed to get it working (or at least, not crashing). After I updated to their 4.X version the error was a bit easier to understand. It seems like they use dylibs for their libraries so you can install the specific subset that's relevant to your application and they weakly reference symbols defined in the other dylibs.
Initially I tried just depending on:
"@swiftpkg_agoraaudio_ios//:remote_archive_AgoraRtcKit.xcframework.zip_AgoraRtcKit",
And the app crashed because the Agorafdkaac dylib was not loaded. I added this dependency:
"@swiftpkg_agoraaudio_ios//:remote_archive_Agorafdkaac.xcframework.zip_Agorafdkaac",
And then it crashed because the AgoraSoundTouch dylib was not loaded.
Finally I added:
"@swiftpkg_agoraaudio_ios//:remote_archive_AgoraSoundTouch.xcframework.zip_AgoraSoundTouch",
And it didn't crash. I'll have to do some more testing to make sure I can still make voice calls and such but at least it's not crashing anymore.
Looking at their Package.swift, I see they define a RtcBasic product with these three dependencies:
.library(name: "RtcBasic", targets: ["AgoraRtcKit", "Agorafdkaac", "AgoraSoundTouch"]),
Does swift_bazel have a way to depend on the product rather than the individual targets to ensure that I get all of them if this changes in the future?
Does swift_bazel have a way to depend on the product rather than the individual targets to ensure that I get all of them if this changes in the future?
@AttilaTheFun The short answer is yes and no. Bazel does not have a mechanism to group one or more targets to a single referenceable label. The filegroup
sort of does this for source files.
Under the covers, the Gazelle extension for swift_bazel
does resolve to SPM product(s). When it is time to add the deps, to a swift_xxx
, it retrieves all of the targets associated with the product(s). I have a related issue to ensure that byName
references discovered while processing swift_package
rules resolve to a product name, then fallback to a target name.
@AttilaTheFun I put together a branch with a basic example that uses AgoraRtcEngine_iO
. The test that I added seems to build and execute successfully. Is that package working properly for you?
@AttilaTheFun Just wanted to check in to see if Agora was working for you now. If so, I am inclined to close the issue.
My Package.swift has:
And my BUILD file has:
_Originally posted by @AttilaTheFun in https://github.com/cgrindel/swift_bazel/issues/153#issuecomment-1430074173_