Skip to content

Commit

Permalink
fix: Query Sync doesn't crash on projects using BUILD.bazel file names (
Browse files Browse the repository at this point in the history
  • Loading branch information
tpasternak authored Oct 3, 2024
1 parent de57f45 commit 3f676d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion aspect/build_dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ load(
"CPP_COMPILE_ACTION_NAME",
"C_COMPILE_ACTION_NAME",
)
load(":java_info.bzl", "get_java_info")

ALWAYS_BUILD_RULES = "java_proto_library,java_lite_proto_library,java_mutable_proto_library,kt_proto_library_helper,_java_grpc_library,_java_lite_grpc_library,kt_grpc_library_helper,java_stubby_library,kt_stubby_library_helper,aar_import,java_import"

Expand All @@ -16,6 +15,16 @@ PROTO_RULE_KINDS = [
"kt_proto_library_helper",
]

def java_info_in_target(target):
return JavaInfo in target

def get_java_info(target):
if JavaInfo in target:
return target[JavaInfo]

def java_info_reference():
return [JavaInfo]

def _package_dependencies_impl(target, ctx):
java_info_file = _write_java_target_info(target, ctx)
cc_info_file = _write_cc_target_info(target, ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public QuerySpec deriveQuerySpec(Context<?> context, Path workspaceRoot) throws
*/
private static boolean isValidPathForQuery(Context<?> context, Path candidate)
throws IOException {
if (Files.exists(candidate.resolve("BUILD"))) {
if (Files.exists(candidate.resolve("BUILD")) || Files.exists(candidate.resolve("BUILD.bazel"))) {
return true;
}
if (!Files.isDirectory(candidate)) {
Expand Down

0 comments on commit 3f676d4

Please sign in to comment.