akaffenberger / firebase-ios-sdk-xcframeworks

A small mirror for https://github.com/firebase/firebase-ios-sdk, to add support for binary (xcframework) distribution with swift package manager.
MIT License
134 stars 32 forks source link

bazel + spm #42

Closed wweevv-johndpope closed 1 year ago

wweevv-johndpope commented 1 year ago

it's possible to use spm + bazel with some scripts by @cgrindel

I want to do it with firebase - there's a long discussion here - and Google haven't been able to come to the party.... I'm thinking with your xcframework approach - it maybe possible. I don't expect you to invest too much time - https://github.com/firebase/firebase-ios-sdk/issues/6115

here's a top level write up with spm + bazel https://chuckgrindel.com/swift-packages-in-bazel


load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "cgrindel_rules_spm",
    sha256 = "03718eb865a100ba4449ebcbca6d97bf6ea78fa17346ce6d55532312e8bf9aa8",
    strip_prefix = "rules_spm-0.11.0",
    urls = [
        "http://github.com/cgrindel/rules_spm/archive/v0.11.0.tar.gz",
    ],
)

load(
    "@cgrindel_rules_spm//spm:deps.bzl",
    "spm_rules_dependencies",
)

spm_rules_dependencies()

load(
    "@build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_dependencies",
)

swift_rules_dependencies()

load(
    "@build_bazel_rules_swift//swift:extras.bzl",
    "swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load("@cgrindel_rules_spm//spm:defs.bzl", "spm_pkg", "spm_repositories")

spm_repositories(
    name = "swift_pkgs",
    dependencies = [
        spm_pkg(
            "https://github.com/firebase/firebase-ios-sdk.git",
            from_version = "8.10.0",
            products = ["Firebase"],
        ),
    ],
)

unfortunately -


spm_repositories(
    name = "swift_pkgs",
    dependencies = [
        spm_pkg(
            "https://github.com/akaffenberger/firebase-ios-sdk-xcframeworks.git",
            from_version = "8.10.0",
            products = ["Firebase"],
        ),
    ],
)

couldn't get it to work with your spm either.

"@swift_pkgs//Firebase:Firebase",

wweevv-johndpope commented 1 year ago

I got it working - but it's not as elegant as your solution using xcframeworks. would be nice to automate.

UPDATE - had to use this route instead https://github.com/vikage/DemoBazel/tree/firebase