bazel-xcode / PodToBUILD

An easy way to integrate CocoaPods into Bazel
Apache License 2.0
321 stars 69 forks source link

Using with swift project (swift_library) #181

Open tgprojet opened 2 years ago

tgprojet commented 2 years ago

Hi, I am trying to use this macro with a project that is built using swift_library

I've created the Pods.WORKSPACE file with the following content

new_pod_repository(
  name = "CryptoSwift",
  url = "https://github.com/krzyzanowskim/CryptoSwift/archive/refs/tags/1.4.1.zip",
  inhibit_warnings = True,
  podspec_url = "https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/3/e/b/CryptoSwift/1.4.1/CryptoSwift.podspec.json"
)

Added the following lines to the root WORKSPACE

http_archive(
    name = "rules_pods",
    urls = ["https://github.com/pinterest/PodToBUILD/releases/download/0.25.2-8a5efa0/PodToBUILD.zip"],
)

load("@rules_pods//BazelExtensions:workspace.bzl", "new_pod_repository")

But when I try to use it as follows

swift_library(

    name = ".......
    deps = [
        "//Vendor/CryptoSwift:CryptoSwift",

I get the next error:

no such target '//Vendor/CryptoSwift:CryptoSwift': target 'CryptoSwift' not declared in package 'Vendor/CryptoSwift' defined by

johndpope commented 1 year ago

did you try running bazel run @rules_pods//:update_pods -- --src_root $PWD

this should checkout to the vendor folder

http_archive(
    name = "rules_pods",
    urls = ["https://github.com/pinterest/PodToBUILD/releases/download/4.1.0-412495/PodToBUILD.zip"],
)