diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 26f383f00..1a770c71d 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -1,19 +1,19 @@ name: Claude Code Review -# on: -# pull_request: -# types: [opened, synchronize] -# # Optional: Only run on specific file changes -# # paths: -# # - "src/**/*.ts" -# # - "src/**/*.tsx" -# # - "src/**/*.js" -# # - "src/**/*.jsx" +on: + pull_request: + types: [opened, synchronize] + # Optional: Only run on specific file changes + # paths: + # - "src/**/*.ts" + # - "src/**/*.tsx" + # - "src/**/*.js" + # - "src/**/*.jsx" jobs: claude-review: - # Skip draft PRs - if: github.event.pull_request.draft == false + # Skip draft PRs and Renovate PRs + if: github.event.pull_request.draft == false && github.event.pull_request.user.login != 'app/cgrindel-self-hosted-renovate' # Optional: Filter by PR author # if: | diff --git a/swiftpkg/internal/build_decls.bzl b/swiftpkg/internal/build_decls.bzl index ca9d9cb95..59501990f 100644 --- a/swiftpkg/internal/build_decls.bzl +++ b/swiftpkg/internal/build_decls.bzl @@ -75,7 +75,11 @@ def _uniq(decls): for decl in results: name = decl.name if sets.contains(names, name): - fail("A duplicate decl name was found. name: {}".format(name)) + existing_decls = [d for d in results if d.name == name] + fail("Duplicate declaration name '{}' found. Declaration types: [{}]".format( + name, + ", ".join([d.kind for d in existing_decls]), + )) sets.insert(names, name) return results @@ -97,7 +101,11 @@ def _get(decls, name, fail_if_not_found = True): if decl.name == name: return decl if fail_if_not_found: - fail("Failed to find build declaration. name:", name) + available_names = [d.name for d in decls if d.name] + fail("Failed to find build declaration '{}'. Available declarations: [{}]".format( + name, + ", ".join(available_names), + )) return None build_decls = struct( diff --git a/swiftpkg/internal/clang_files.bzl b/swiftpkg/internal/clang_files.bzl index 8bf14b3ba..def5f9516 100644 --- a/swiftpkg/internal/clang_files.bzl +++ b/swiftpkg/internal/clang_files.bzl @@ -315,7 +315,9 @@ def _collect_files( # directory that holds a public header file and add any magical public # header directories that we find. if len(public_includes) == 0: - public_includes = [paths.dirname(hdr) for hdr in sets.to_list(hdrs_set)] + public_includes = sets.to_list(sets.make( + [paths.dirname(hdr) for hdr in sets.to_list(hdrs_set)], + )) magical_public_hdr_dirs = [] for pi in public_includes: magical_public_hdr_dir = clang_files.find_magical_public_hdr_dir(pi) @@ -401,4 +403,5 @@ clang_files = struct( organize_srcs = _organize_srcs, reduce_paths = _reduce_paths, relativize = _relativize, + PUBLIC_HDR_DIRNAMES = _PUBLIC_HDR_DIRNAMES, ) diff --git a/swiftpkg/internal/pkginfo_targets.bzl b/swiftpkg/internal/pkginfo_targets.bzl index 40faa9f7b..f5513a8a5 100644 --- a/swiftpkg/internal/pkginfo_targets.bzl +++ b/swiftpkg/internal/pkginfo_targets.bzl @@ -29,7 +29,11 @@ def _get(targets, name, fail_if_not_found = True): if target.name == name: return target if fail_if_not_found: - fail("Failed to find target. name:", name) + available_names = [t.name for t in targets] + fail("Failed to find target '{}'. Available targets: [{}]".format( + name, + ", ".join(available_names), + )) return None def _get_by_label(targets, label, fail_if_not_found = True): @@ -50,7 +54,11 @@ def _get_by_label(targets, label, fail_if_not_found = True): if target.label == label: return target if fail_if_not_found: - fail("Failed to find target. label:", label) + available_labels = [t.label for t in targets] + fail("Failed to find target with label '{}'. Available target labels: [{}]".format( + label, + ", ".join(available_labels), + )) return None def _srcs(target): diff --git a/swiftpkg/internal/pkginfos.bzl b/swiftpkg/internal/pkginfos.bzl index 9d33a666c..562316e20 100644 --- a/swiftpkg/internal/pkginfos.bzl +++ b/swiftpkg/internal/pkginfos.bzl @@ -1184,6 +1184,18 @@ def _new_clang_src_info_from_sources( for ep in exclude_paths ] + # DEBUG BEGIN + print("*** CHUCK ============") + print("*** CHUCK c99name: ", c99name) + print("*** CHUCK src_paths: ") + for idx, item in enumerate(src_paths): + print("*** CHUCK", idx, ":", item) + print("*** CHUCK abs_exclude_paths: ") + for idx, item in enumerate(abs_exclude_paths): + print("*** CHUCK", idx, ":", item) + + # DEBUG END + # Get a list of all of the source files all_srcs = [] for sp in src_paths: @@ -1193,6 +1205,32 @@ def _new_clang_src_info_from_sources( exclude_paths = abs_exclude_paths, )) + # TODO(chuck): Document why we are doing this! + for public_hdr_dirname in clang_files.PUBLIC_HDR_DIRNAMES: + path = paths.join( + pkg_path, + target_path, + public_hdr_dirname, + ) + if repository_files.is_directory(repository_ctx, path): + all_srcs.extend(repository_files.list_files_under( + repository_ctx, + path, + exclude_paths = abs_exclude_paths, + )) + public_includes.append(path) + + # DEBUG BEGIN + print("*** CHUCK all_srcs: ") + for idx, item in enumerate(all_srcs): + print("*** CHUCK", idx, ":", item) + + # DEBUG END + + # At this point, we might have duplicates in all_srcs. We need to remove + # them. + all_srcs = sets.to_list(sets.make(all_srcs)) + # Organize the source files # Be sure that the all_srcs and the public_includes that are passed to # `collect_files` are all absolute paths. The relative_to option will @@ -1208,6 +1246,13 @@ def _new_clang_src_info_from_sources( relative_to = pkg_path, ) + # DEBUG BEGIN + print("*** CHUCK organized_files.public_includes: ") + for idx, item in enumerate(organized_files.public_includes): + print("*** CHUCK", idx, ":", item) + + # DEBUG END + # The `cc_library` rule compiles each source file (.c, .cc) separately only providing the # headers. There are some clang modules (e.g., # https://github.com/soto-project/soto-core/tree/main/Sources/CSotoExpat) that include @@ -1219,6 +1264,13 @@ def _new_clang_src_info_from_sources( srcs = [] explicit_srcs = [] public_includes = organized_files.public_includes + + # DEBUG BEGIN + print("*** CHUCK organized_files.hdrs: ") + for idx, item in enumerate(organized_files.hdrs): + print("*** CHUCK", idx, ":", item) + + # DEBUG END private_includes = organized_files.private_includes if len(organized_files.srcs) > 0: explicit_srcs.extend(organized_files.srcs) diff --git a/swiftpkg/internal/swift_package.bzl b/swiftpkg/internal/swift_package.bzl index 2cae8d596..af90915e1 100644 --- a/swiftpkg/internal/swift_package.bzl +++ b/swiftpkg/internal/swift_package.bzl @@ -16,11 +16,19 @@ load(":repo_rules.bzl", "repo_rules") # MARK: - Environment Variables def _clone_or_update_repo(repository_ctx, directory): - if ((not repository_ctx.attr.tag and not repository_ctx.attr.commit and not repository_ctx.attr.branch) or - (repository_ctx.attr.tag and repository_ctx.attr.commit) or - (repository_ctx.attr.tag and repository_ctx.attr.branch) or - (repository_ctx.attr.commit and repository_ctx.attr.branch)): - fail("Exactly one of commit, tag, or branch must be provided") + # Validate that exactly one of commit, tag, or branch is provided + provided = [] + if repository_ctx.attr.commit: + provided.append("commit") + if repository_ctx.attr.tag: + provided.append("tag") + if repository_ctx.attr.branch: + provided.append("branch") + + if len(provided) != 1: + fail("Exactly one of commit, tag, or branch must be provided. Found: [{}]".format( + ", ".join(provided) if provided else "none", + )) git_ = git_repo(repository_ctx, directory) diff --git a/tools/swift_deps_index/cmd/create.go b/tools/swift_deps_index/cmd/create.go index 9513d9130..17a3b5cda 100644 --- a/tools/swift_deps_index/cmd/create.go +++ b/tools/swift_deps_index/cmd/create.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -const dependencyIndexPerms = 0666 +const dependencyIndexPerms = 0644 var outputPath string diff --git a/tools/swift_deps_index/cmd/root.go b/tools/swift_deps_index/cmd/root.go index 289dfa960..879629352 100644 --- a/tools/swift_deps_index/cmd/root.go +++ b/tools/swift_deps_index/cmd/root.go @@ -9,8 +9,8 @@ import ( // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "swift_deps_index", - Short: "Manage a Swift dependences index file.", - Long: `Manage a Swift dependences index file.`, + Short: "Manage a Swift dependencies index file.", + Long: `Manage a Swift dependencies index file.`, } // Execute adds all child commands to the root command and sets flags appropriately.