Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from aspect-build/cpp
Browse files Browse the repository at this point in the history
fix cpp generation
  • Loading branch information
alexeagle authored Aug 15, 2024
2 parents 6454f55 + 12dd55c commit 084d094
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
8 changes: 5 additions & 3 deletions .aspect/cli/rules_cc.star
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def add_target(ctx, file, hdrs = []):
src = file.path,
))
is_test = basename.endswith("-test") or basename.endswith(".test")
# TODO: query for whether there's a function named main with the expected signatune
is_main = False
print("deps", deps)
is_main = len(file.query_results["has_main"]) > 0
attrs = {
"srcs": [file.path],
"hdrs": [h.path for h in hdrs],
Expand Down Expand Up @@ -91,6 +89,10 @@ aspect.register_configure_extension(
filter = "*.cc",
expression = """#include\\s+"(?P<import>[^.]+).h\"""",
),
"has_main": aspect.RegexQuery(
filter = "*.cc",
expression = "int\\s+main\\(",
),
},
),
declare = declare,
Expand Down
2 changes: 1 addition & 1 deletion .bazeliskrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BAZELISK_BASE_URL=https://static.aspect.build/aspect
USE_BAZEL_VERSION=aspect/2024.33.13
USE_BAZEL_VERSION=aspect/2024.33.63
8 changes: 7 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ bazel_dep(name = "toolchains_llvm", version = "1.1.2")
bazel_dep(name = "toolchains_protoc", version = "0.3.1")

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(llvm_version = "15.0.6")
llvm.toolchain(
llvm_versions = {
"": "15.0.6",
"darwin-aarch64": "15.0.7",
"darwin-x86_64": "15.0.7",
},
)

use_repo(llvm, "llvm_toolchain")

Expand Down
2 changes: 1 addition & 1 deletion speller/lookup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cc_test(
size = "small",
srcs = ["lookup-test.cc"],
deps = [
"@googletest//:gtest",
":lookup_lib",
"@googletest//:gtest_main",
],
)

Expand Down
5 changes: 2 additions & 3 deletions speller/main/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_binary")

cc_library(
cc_binary(
name = "build-dictionary_lib",
srcs = ["build-dictionary.cc"],
visibility = ["//:__subpackages__"],
deps = ["//speller/lookup:lookup_lib"],
)

0 comments on commit 084d094

Please sign in to comment.