This repository was archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
This repository was archived by the owner on Apr 3, 2023. It is now read-only.
Unable to add dependency on Stripe #162
Copy link
Copy link
Open
Description
I'm unable to add a dependency on Stripe. I believe this is a reasonable way of loading it in (happy to be told I'm wrong on that front).
WORKSPACE:
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/stripe/stripe-ios.git",
exact_version = "22.6.0",
products = ["Stripe"], # https://github.com/stripe/stripe-ios/blob/f5b0b5973aaa7ce6a2865e56f5942637cfef53f7/Package.swift#L11-L14
),
],
)BUILD:
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary")
swift_binary(
name = "simple",
srcs = ["main.swift"],
visibility = ["//swift:__subpackages__"],
deps = [
"@swift_pkgs//stripe:Stripe",
]
)main.swift:
import Swift
print("Hello world")Even when I try to do something relatively simple like query #swift_pkgs , not even running the binary, I get the following output:
$ bazel query @swift_pkgs//...
INFO: Repository swift_pkgs instantiated at:
/Users/achew/Projects/rules_spm_stripe/WORKSPACE:35:17: in <toplevel>
Repository rule spm_repositories defined at:
/private/var/tmp/_bazel_achew/a0c57e4798e25f0c55e1618fdb2cda0e/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl:595:35: in <toplevel>
ERROR: An error occurred during the fetch of repository 'swift_pkgs':
Traceback (most recent call last):
File "/private/var/tmp/_bazel_achew/a0c57e4798e25f0c55e1618fdb2cda0e/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_achew/a0c57e4798e25f0c55e1618fdb2cda0e/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 524, column 49, in _configure_spm_repository
product = pds.get_product(pkg_descs_dict[pkg_name], product_name)
Error: key "stripe-ios" not found in dictionary
ERROR: /Users/achew/Projects/rules_spm_stripe/WORKSPACE:35:17: fetching spm_repositories rule //external:swift_pkgs: Traceback (most recent call last):
File "/private/var/tmp/_bazel_achew/a0c57e4798e25f0c55e1618fdb2cda0e/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_achew/a0c57e4798e25f0c55e1618fdb2cda0e/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 524, column 49, in _configure_spm_repository
product = pds.get_product(pkg_descs_dict[pkg_name], product_name)
Error: key "stripe-ios" not found in dictionary
ERROR: key "stripe-ios" not found in dictionary
Loading: 0 packages loaded
And bazel run //:simple has a similar error:
$ bazel run //:simple
INFO: Repository swift_pkgs instantiated at:
/Users/achew/Projects/rules_spm_stripe/WORKSPACE:35:17: in <toplevel>
Repository rule spm_repositories defined at:
/private/var/tmp/_bazel_achew/a0c57e4798e25f0c55e1618fdb2cda0e/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl:595:35: in <toplevel>
ERROR: An error occurred during the fetch of repository 'swift_pkgs':
Traceback (most recent call last):
File "/private/var/tmp/_bazel_achew/a0c57e4798e25f0c55e1618fdb2cda0e/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_achew/a0c57e4798e25f0c55e1618fdb2cda0e/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 524, column 49, in _configure_spm_repository
product = pds.get_product(pkg_descs_dict[pkg_name], product_name)
Error: key "stripe-ios" not found in dictionary
ERROR: /Users/achew/Projects/rules_spm_stripe/WORKSPACE:35:17: fetching spm_repositories rule //external:swift_pkgs: Traceback (most recent call last):
File "/private/var/tmp/_bazel_achew/a0c57e4798e25f0c55e1618fdb2cda0e/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_achew/a0c57e4798e25f0c55e1618fdb2cda0e/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 524, column 49, in _configure_spm_repository
product = pds.get_product(pkg_descs_dict[pkg_name], product_name)
Error: key "stripe-ios" not found in dictionary
ERROR: /Users/achew/Projects/rules_spm_stripe/BUILD:3:13: //:simple depends on @swift_pkgs//stripe-ios:Stripe in repository @swift_pkgs which failed to fetch. no such package '@swift_pkgs//stripe-ios': key "stripe-ios" not found in dictionary
ERROR: Analysis of target '//:simple' failed; build aborted: Analysis failed
INFO: Elapsed time: 3.222s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
I think there is a good chance that I'm holding it wrong, but I can't understand what I'm doing wrong here. Happy to provide any additional debug information you might want.
$ bazel version
Bazelisk version: development
Build label: 5.2.0
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 7 16:11:09 2022 (1654618269)
Build timestamp: 1654618269
Build timestamp as int: 1654618269
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels