Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion swiftpkg/internal/repository_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _execute_spm_command(
environment = exec_env,
working_directory = working_directory,
)
if exec_result.return_code != 0:
if exec_result.return_code != 0 and not _can_ignore_spm_error(exec_result):
if err_msg_tpl == None:
err_msg_tpl = """\
Failed to execute SPM command. \
Expand All @@ -73,6 +73,18 @@ return_code: {return_code}\
))
return exec_result.stdout

def _can_ignore_spm_error(exec_result):
"""Ignore error that can occur when an SPM executable product depends on a
binary target.

https://github.com/swiftlang/swift-package-manager/issues/8101"""

# Error message:
# https://github.com/swiftlang/swift-package-manager/blob/339afc838a0083ea0b4da002dc53cfb8005d5978/Sources/PackageLoading/Diagnostics.swift#L83-L88
return exec_result.stderr.endswith(
"an executable target requires a 'main.swift' file\n",
)

def _parsed_json_from_spm_command(
repository_ctx,
arguments,
Expand Down
Loading