Skip to content

fix: support cassandra client #1721

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
22 changes: 11 additions & 11 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -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: |
Expand Down
12 changes: 10 additions & 2 deletions swiftpkg/internal/build_decls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion swiftpkg/internal/clang_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -401,4 +403,5 @@ clang_files = struct(
organize_srcs = _organize_srcs,
reduce_paths = _reduce_paths,
relativize = _relativize,
PUBLIC_HDR_DIRNAMES = _PUBLIC_HDR_DIRNAMES,
)
12 changes: 10 additions & 2 deletions swiftpkg/internal/pkginfo_targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
52 changes: 52 additions & 0 deletions swiftpkg/internal/pkginfos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down
18 changes: 13 additions & 5 deletions swiftpkg/internal/swift_package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tools/swift_deps_index/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)

const dependencyIndexPerms = 0666
const dependencyIndexPerms = 0644

var outputPath string

Expand Down
4 changes: 2 additions & 2 deletions tools/swift_deps_index/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading