cgrindel / rules_spm

Provide a means for integrating external Swift packages built by Swift Package Manager into Bazel build using rules_swift.
Apache License 2.0
58 stars 13 forks source link

Cannot include package with binary (not executable) library target #175

Open pswaminathan opened 2 years ago

pswaminathan commented 2 years ago

Example is Braze. Here, BrazeKit is a binary target. The Package.swift points to a zip file with an XCFramework

spm_pkg declaration:

        spm_pkg(
            url = "https://github.com/braze-inc/braze-swift-sdk.git",
            from_version = "5.5.0",
            products = ["BrazeKit", "BrazeUI"]
        ),

Traceback:

ERROR: An error occurred during the fetch of repository 'swift_pkgs':
   Traceback (most recent call last):
    File "/private/var/tmp/_bazel_p/c1a9d93c5d307e720ae1d0573bce325b/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 593, column 30, in _spm_repositories_impl
        _configure_spm_repository(repository_ctx, pkgs, env)
    File "/private/var/tmp/_bazel_p/c1a9d93c5d307e720ae1d0573bce325b/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 541, column 28, in _configure_spm_repository
        _generate_bazel_pkg(
    File "/private/var/tmp/_bazel_p/c1a9d93c5d307e720ae1d0573bce325b/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 68, column 46, in _generate_bazel_pkg
        build_decl = _create_spm_module_decls(
    File "/private/var/tmp/_bazel_p/c1a9d93c5d307e720ae1d0573bce325b/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 172, column 17, in _create_spm_module_decls
        fail("Unrecognized target type. %s" % (target))
Error in fail: Unrecognized target type. {"c99name": "BrazeKit", "module_type": "BinaryTarget", "name": "BrazeKit", "path": "remote/archive/BrazeKit.zip", "product_memberships": ["BrazeKit", "BrazeUI"], "sources": [], "type": "binary", "dependencies": []}

Even if I just wanted to use BrazeUI, the traceback is the same.

cgrindel commented 2 years ago

I haven't come across a binary target before. We will need to add support for it.