Open johndpope opened 2 years ago
What error are you seeing?
BTW, when a repository that hosts a Swift package has a different name from the name in the Package.swift
, you need to specify the name in the spm_pkg
. So, the declaration for supabase-community/supabase-swift
should be:
spm_repositories(
name = "swift_pkgs",
dependencies = [
spm_pkg(
name = "Supabase",
url = "https://github.com/supabase-community/supabase-swift.git",
from_version = "0.0.9",
products = ["Supabase"],
),
],
)
The Firebase repository as mentioned in #147 has a similar situation. It turns out lots of repository names do not the package name. I need to make this clearer in the docs.
Thanks Chuck - good eyes - I plug this in - but hit a snag on subsequent dependency.
INFO: Invocation ID: 02e499fb-a602-415d-a4cc-e4a6b68a8955
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'build' from /Users/johndpope/Documents/gitWorkspace/Telegram-iOS-supabase/.bazelrc:
'build' options: --action_env=ZERO_AR_DATE=1 --apple_platform_type=ios --cxxopt=-std=c++17 --per_file_copt=third-party/webrtc/.*.cpp$,@-std=c++17 --per_file_copt=third-party/webrtc/.*.cc$,@-std=c++17 --per_file_copt=third-party/webrtc/.*.mm$,@-std=c++17 --per_file_copt=submodules/LottieMeshSwift/LottieMeshBinding/Sources/.*.mm$,@-std=c++17 --swiftcopt=-whole-module-optimization --features=debug_prefix_map_pwd_is_dot --features=swift.cacheable_swiftmodules --features=swift.debug_prefix_map --features=swift.enable_vfsoverlays --strategy=Genrule=standalone --spawn_strategy=standalone --strategy=SwiftCompile=standalone --define RULES_SWIFT_BUILD_DUMMY_WORKER=1
INFO: Repository swift_pkgs instantiated at:
/Users/johndpope/Documents/gitWorkspace/Telegram-iOS-supabase/WORKSPACE:102:17: in <toplevel>
Repository rule spm_repositories defined at:
/private/var/tmp/_bazel_johndpope/2ca6f1f29103f2b01aba282476736c24/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_johndpope/2ca6f1f29103f2b01aba282476736c24/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_johndpope/2ca6f1f29103f2b01aba282476736c24/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 535, column 55, in _configure_spm_repository
dep_target_refs_dict = pds.transitive_dependencies(pkg_descs_dict, declared_product_refs)
File "/private/var/tmp/_bazel_johndpope/2ca6f1f29103f2b01aba282476736c24/external/cgrindel_rules_spm/spm/private/package_descriptions.bzl", line 499, column 55, in _transitive_dependencies
prd_target_refs = _get_product_target_refs(pkg_descs_dict, product_ref)
File "/private/var/tmp/_bazel_johndpope/2ca6f1f29103f2b01aba282476736c24/external/cgrindel_rules_spm/spm/private/package_descriptions.bzl", line 467, column 30, in _get_product_target_refs
pkg_desc = pkg_descs_dict[pkg_name]
Error: key "gotrue-swift" not found in dictionary
ERROR: /Users/johndpope/Documents/gitWorkspace/Telegram-iOS-supabase/WORKSPACE:102:17: fetching spm_repositories rule //external:swift_pkgs: Traceback (most recent call last):
File "/private/var/tmp/_bazel_johndpope/2ca6f1f29103f2b01aba282476736c24/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_johndpope/2ca6f1f29103f2b01aba282476736c24/external/cgrindel_rules_spm/spm/private/spm_repositories.bzl", line 535, column 55, in _configure_spm_repository
dep_target_refs_dict = pds.transitive_dependencies(pkg_descs_dict, declared_product_refs)
File "/private/var/tmp/_bazel_johndpope/2ca6f1f29103f2b01aba282476736c24/external/cgrindel_rules_spm/spm/private/package_descriptions.bzl", line 499, column 55, in _transitive_dependencies
prd_target_refs = _get_product_target_refs(pkg_descs_dict, product_ref)
File "/private/var/tmp/_bazel_johndpope/2ca6f1f29103f2b01aba282476736c24/external/cgrindel_rules_spm/spm/private/package_descriptions.bzl", line 467, column 30, in _get_product_target_refs
pkg_desc = pkg_descs_dict[pkg_name]
Error: key "gotrue-swift" not found in dictionary
ERROR: /Users/johndpope/Documents/gitWorkspace/Telegram-iOS-supabase/submodules/TelegramUI/BUILD:42:14: //submodules/TelegramUI:TelegramUI depends on @swift_pkgs//Supabase:Supabase in repository @swift_pkgs which failed to fetch. no such package '@swift_pkgs//Supabase': key "gotrue-swift" not found in dictionary
I attempt to bubble up the dependency as below
spm_repositories(
name = "swift_pkgs",
dependencies = [
spm_pkg(
url = "https://github.com/supabase-community/supabase-swift.git",
name = "Supabase",
from_version = "0.0.9",
products = ["Supabase"],
),spm_pkg(
url = "https://github.com/supabase-community/gotrue-swift.git",
name = "GoTrue",
from_version = "0.0.0",
products = ["GoTrue"],
)
]
)
but no joy
The package does have a name attribute in it. https://github.com/supabase-community/gotrue-swift/blob/main/Package.swift
I'm access the package this way..
"@swift_pkgs//Supabase:Supabase",
the error I'm seeing is
Error: key "gotrue-swift" not found in dictionary
ERROR: /Users/johndpope/Documents/gitWorkspace/Telegram-iOS-supabase/submodules/TelegramUI/BUILD:42:14: //submodules/TelegramUI:TelegramUI depends on @swift_pkgs//Supabase:Supabase in repository @swift_pkgs which failed to fetch. no such package '@swift_pkgs//Supabase': key "gotrue-swift" not found in dictionary
ERROR: Analysis of target '//Telegram:Telegram' failed; build aborted:
INFO: Elapsed time: 13.896s
INFO: 0 processes.
INFO: Build Event Protocol files produced successfully.
I'll keep digging - thanks
UPDATE - so whereas the name fix worked for supabase - when I attempt to use it on this dependency alone (excluding supabase) - all by itself - it doesn't. "@swift_pkgs//GoTrue:GoTrue",
spm_repositories(
name = "swift_pkgs",
dependencies = [
spm_pkg(
url = "https://github.com/supabase-community/gotrue-swift.git",
name = "GoTrue",
from_version = "0.0.8",
products = ["GoTrue"],
)
]
)
I can clearly see name correctly in package -
to get around the swift-gotrue error - I fork project rename it to gotrue (case insensitive)
shell ror: Dependencies could not be resolved because no versions of 'gotrue' match the requirement 0.0.8..<1.0.0 and root depends on 'gotrue' 0.0.8..<1.0.0.
so I create a release with tag https://github.com/johndpope/gotrue/releases/tag/0.0.8
@swift_pkgs//GoTrue:GoTrue in repository @swift_pkgs which failed to fetch. no such package '@swift_pkgs//GoTrue': key "swift-composable-keychain" not found in dictionary
then finally I can proceed to next one.
It's like we need to build some introspection of package names and not depend on repo name.
UPDATE
so I can carry on with this approach to fork repo - rename it - tag and release it
eg.
spm_repositories(
name = "swift_pkgs",
dependencies = [
spm_pkg(
url = "https://github.com/johndpope/ComposableKeychain.git",
name = "ComposableKeychain",
from_version = "0.0.2",
products = ["ComposableKeychain"],
)
]
)
but then when I attempt to add the gotrue back -
spm_pkg(
url = "https://github.com/johndpope/gotrue.git",
name = "GoTrue",
from_version = "0.0.8",
products = ["GoTrue"],
),spm_pkg(
url = "https://github.com/johndpope/ComposableKeychain.git",
name = "ComposableKeychain",
from_version = "0.0.2",
products = ["ComposableKeychain"],
),
Error: key "swift-composable-keychain" not found in dictionary
ERROR: /Users/johndpope/Documents/gitWorkspace/Telegram-iOS-supabase/submodules/TelegramUI/BUILD:42:14: //submodules/TelegramUI:TelegramUI depends on @swift_pkgs//GoTrue:GoTrue in repository @swift_pkgs which failed to fetch. no such package '@swift_pkgs//GoTrue': key "swift-composable-keychain" not found in dictionary
ERROR: Analysis of target '//Telegram:Telegram' failed; build aborted:
it just blows up again
I am not sure what is happening with gotrue-swift
. Right now, I am working on upgrading deps for rules_spm
and adding support for submodule parsing. I will look at this after those two items are done.
also - if there was a way to take a swift build folder - that builds with all dependencies - and somehow plug it in so there's no fetching - just use this local (already buildable package) that would be fine by me. this folder is built checking out the https://github.com/supabase-community/supabase-swift and running swift build
I noticed this - going to give it a test drive.
https://github.com/pswaminathan/rules_spm/commit/35cc25894b8b6700e427c8fe68d5d1b843250830
UPDATE I see it was merged - https://github.com/cgrindel/rules_spm/pull/144/files going to look up skylark on youtube.
Sunday UPDATE so as a sanity check - I checked the xcframeworks (that I had built ) and long story short - they had a problem. This has led me to determine some problems inside supabase around using internal libraries. as a sanity check - running this against package.swift - reveals many problems. (internal system modules were referenced: swift-nio-zlib-support - and others)
brew install mint
mint install unsignedapps/swift-create-xcframework
swift create-xcframework --platform ios
so whereas a simple test for swift build was suffice before - using swift create-xcframework --platform ios helps uncover more things with dependencies.
I tried to fork project and change the name "https://github.com/wweevv-johndpope/Supabase.git",
I can clone project and successfully run swift build
I'm not sure why this fails - but suspect it's a version number? in the package.resolved it says version 1 (which should be 0.0.9)