bazel-xcode / PodToBUILD

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

Error in join: expected string for sequence element 0, got 'path' #176

Open sgammon opened 3 years ago

sgammon commented 3 years ago

While trying to build an iOS application linked to some pods (non-vendored), I get the following error:

(16:37:49) INFO: Invocation ID: e462672e-427c-4928-8d68-e4763ee2d6ad
(16:37:53) INFO: Repository Logging instantiated at:
  /Volumes/VANTAGE/platform/WORKSPACE:307:19: in <toplevel>
  /private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl:275:14: in new_pod_repository
Repository rule pod_repo_ defined at:
  /private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl:173:28: in <toplevel>
(16:37:53) ERROR: An error occurred during the fetch of repository 'Logging':
   Traceback (most recent call last):
    File "/private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl", line 105, column 27, in _impl
        _fetch_remote_repo(
    File "/private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl", line 47, column 25, in _fetch_remote_repo
        fetch_output = _exec(repository_ctx, fetch_cmd)
    File "/private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl", line 7, column 50, in _exec
        fail("Could not exec command " + " ".join(command))
Error in join: expected string for sequence element 0, got 'path'
(16:37:53) ERROR: Error fetching repository: Traceback (most recent call last):
    File "/private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl", line 105, column 27, in _impl
        _fetch_remote_repo(
    File "/private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl", line 47, column 25, in _fetch_remote_repo
        fetch_output = _exec(repository_ctx, fetch_cmd)
    File "/private/var/tmp/_bazel_sam.g/.../external/rules_pods/BazelExtensions/workspace.bzl", line 7, column 50, in _exec
        fail("Could not exec command " + " ".join(command))
Error in join: expected string for sequence element 0, got 'path'

I figured this might be an incompatibility with Bazel 4.0.0, which we recently switched to. I saw the recent commits on master related to Bazel 4 compatibility, but when using master directly, I run into #112.

WORKSPACE:

http_archive(
    name = "rules_pods",
    urls = ["https://github.com/pinterest/PodToBUILD/releases/download/0.25.2-8a5efa0/PodToBUILD.zip"],
    sha256 = "db4256e80fda350bff752f70385f3a332ac8b93d63c3ef677b11dca075dbe1ff",
)
load("@rules_pods//BazelExtensions:workspace.bzl", "new_pod_repository")

new_pod_repository(
  name = "Logging",
  url = "https://github.com/apple/swift-log/archive/173f567a2dfec11d74588eea82cecea555bdc0bc.zip",
  podspec_url = "https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/8/d/b/Logging/1.2.0/Logging.podspec.json",
  generate_module_map = False,
  inhibit_warnings = True,
)
sgammon commented 3 years ago

@dgcoffman i saw you applied the changes that introduced Bazel 4 compatibility. we're on 4.0 and getting this error -- any ideas?

dgcoffman commented 3 years ago

Not really... the error message looks to me like it's being generated from a failure in the error handling code itself, so who knows what the actual failure was

def _exec(repository_ctx, command):
    if repository_ctx.attr.trace:
        print("__EXEC", command)
    output = repository_ctx.execute(command)
    if output.return_code != 0:
        print("__OUTPUT", output.return_code, output.stdout, output.stderr)
        fail("Could not exec command " + " ".join(command))
    elif repository_ctx.attr.trace:
        print("__OUTPUT", output.return_code, output.stdout, output.stderr)

    return output
dgcoffman commented 3 years ago

The examples in this codebase are a good test harness, so if you want to go deep, you can attempt to replicate the failure in one of the examples and then you can debug workspace.bzl.