Skip to content

fix: Replicates SPM default behavior for publicHeadersPath: If this is nil, the directory is set to include #1429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
8 changes: 8 additions & 0 deletions swiftpkg/internal/pkginfos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,14 @@ def _new_clang_src_info_from_sources(
paths.normalize(paths.join(abs_target_path, public_hdrs_path)),
)

# If the Swift package manifest does not specify a public headers path,
# use the default "include" directory, if it exists.
# This copies the behavior of the canonical Swift Package Manager implementation.
# https://developer.apple.com/documentation/packagedescription/target/publicheaderspath
if public_hdrs_path == None:
if repository_files.path_exists(repository_ctx, paths.join(abs_target_path, "include")):
public_includes.append(paths.join(abs_target_path, "include"))

# If the Swift package manifest has explicit source paths, respect them.
# (Be sure to include any explicitly specified include directories.)
# Otherwise, use all of the source files under the target path.
Expand Down
Loading