Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 18 additions & 47 deletions udf-runner-cpp/v1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,29 @@ load("//:variables.bzl", "VM_ENABLED_DEFINES")


VM_ENABLED_DEPS=select({
"@exaudfclient_base//:benchmark": ["@exaudfclient_base//benchmark_container:benchmark_container"],
"@exaudfclient_base//:benchmark": ["//benchmark_container:benchmark_container"],
"//conditions:default": []
}) + select({
"@exaudfclient_base//:bash": ["@exaudfclient_base//streaming_container:streamingcontainer"],
"@exaudfclient_base//:bash": ["//streaming_container:streamingcontainer"],
"//conditions:default": []
})


genrule(
name = "exaudflib_output_path_header",
srcs = ["@exaudfclient_base//:libexaudflib_complete.so"],
outs = ["exaudf_lib_output_path.h"],
cmd = '''
echo "#define CUSTOM_LIBEXAUDFLIB_PATH \\"/exaudf/external/$(rlocationpath @exaudfclient_base//:libexaudflib_complete.so)\\"" > $@
''',
)

## Here it may seem like exaudflib is linked twice; one at "deps" and another at "data"
## "deps" is basically used by Bazel for compile and link dependencies.
## "data" basically places the .so file into the runtime-runfiles-location
## so that it can be loaded using apis like load_library / load_symbol later
## therefore, it is not linked twice
cc_library(
name = "exa_udfclient_binary_common_lib",
srcs = [
"exa_udfclient_binary_common/exa_lib_loader.cc",
"exa_udfclient_binary_common/exa_set_env.cc",
"exa_udfclient_binary_common/exa_udf_base.cc",
"exa_udfclient_binary_common/exa_udf_client.cc",
"exa_udfclient_binary_common/exa_vm_factory.cc",
"//:exaudflib_output_path_header",
],
hdrs = [
"exa_udfclient_binary_common/exa_lib_loader.h",
"exa_udfclient_binary_common/exa_set_env.h",
"exa_udfclient_binary_common/exa_udf_base.h",
"exa_udfclient_binary_common/exa_udf_client.h",
"exa_udfclient_binary_common/exa_vm_factory.h",
],
deps = [
"@exaudfclient_base//exaudflib:header",
"@exaudfclient_base//utils:utils",
"@exaudfclient_base//exaudflib:exaudflib-deps",
] + VM_ENABLED_DEPS,
defines = VM_ENABLED_DEFINES,
data = ["@exaudfclient_base//:libexaudflib_complete.so"],
)

cc_binary(
name = "cpp_runner_bin",
srcs = [
"exa_udfclient.cc",
"exa_udf_client.cc",
"exa_udf_client.h",
"exa_vm_factory.cc",
"exa_vm_factory.h",
"@exaudfclient_base//:load_dynamic",
],
linkopts = ["-ldl"],
deps = [":exa_udfclient_binary_common_lib"],
data = ["@exaudfclient_base//:libexaudflib_complete.so"]
deps = [
"@exaudfclient_base//exa_udfclient_binary_common:exa_udfclient_binary_common_lib",
] + VM_ENABLED_DEPS,
defines = VM_ENABLED_DEFINES,
data = ["@exaudfclient_base//:libexaudflib_complete.so"],
)

## The purpose of the static binaries is to verify if the linker namespace test work correctly.
Expand All @@ -79,14 +45,19 @@ cc_binary(
name = "cpp_runner_static",
srcs = [
"exa_udfclient.cc",
"exa_udf_client.cc",
"exa_udf_client.h",
"exa_vm_factory.cc",
"exa_vm_factory.h",
"@exaudfclient_base//:load_dynamic",
],
linkopts = ["-ldl"],
deps = [
":exa_udfclient_binary_common_lib",
"@exaudfclient_base//exa_udfclient_binary_common:exa_udfclient_binary_common_lib",
"@zmq//:zmq",
"@protobuf//:protobuf",
],
] + VM_ENABLED_DEPS,
defines = VM_ENABLED_DEFINES,
data = ["@exaudfclient_base//:libexaudflib_complete.so"],
)

Expand Down
37 changes: 37 additions & 0 deletions udf-runner-cpp/v1/base/exa_udfclient_binary_common/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])

genrule(
name = "exaudflib_output_path_header",
srcs = ["//:libexaudflib_complete.so"],
outs = ["exaudf_lib_output_path.h"],
cmd = '''
echo "#define CUSTOM_LIBEXAUDFLIB_PATH \\"/exaudf/external/$(rlocationpath //:libexaudflib_complete.so)\\"" > $@
''',
)

cc_library(
name = "exaudflib_output_path_header_lib",
hdrs = [":exaudflib_output_path_header"],
)

cc_library(
name = "exa_udfclient_binary_common_lib",
srcs = [
"exa_lib_loader.cc",
"exa_set_env.cc",
"exa_udf_base.cc",
],
hdrs = [
"exa_lib_loader.h",
"exa_set_env.h",
"exa_udf_base.h",
],
deps = [
":exaudflib_output_path_header_lib",
"//:load_dynamic",
"//exaudflib:header",
"//exaudflib:exaudflib-deps",
"//utils:utils",
],
data = ["//:libexaudflib_complete.so"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cstdlib>
#include <string>

#include "exaudf_lib_output_path.h"
#include "exa_udfclient_binary_common/exaudf_lib_output_path.h"
#include "exaudflib/vm/swig_vm.h"
#include "exa_udf_base.h"
#include "exa_lib_loader.h"
Expand Down Expand Up @@ -46,4 +46,4 @@ int ExaUdfClientBase::startClientBase(int argc, char** argv) {
SWIGVMContainers::SWIGVM_params = new SWIGVMContainers::SWIGVM_params_t(true);
set_SWIGVM_params(SWIGVMContainers::SWIGVM_params);
return exaudfclient_main(vmMaker, argc, argv);
}
}
1 change: 0 additions & 1 deletion udf-runner-cpp/v1/base/protobuf_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ protobuf_local_repository = repository_rule(
implementation=_protobuf_local_repository_impl,
local = True,
environ = ["PROTOBUF_LIBRARY_PREFIX","PROTOBUF_BIN","PROTOBUF_INCLUDE_PREFIX"])

1 change: 0 additions & 1 deletion udf-runner-cpp/v1/base/utils/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ cc_library(
"debug_message.h", "exceptions.h"
],
)

1 change: 0 additions & 1 deletion udf-runner-cpp/v1/base/zmq_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ zmq_local_repository = repository_rule(
implementation=_zmq_local_repository_impl,
local = True,
environ = ["ZMQ_LIBRARY_PREFIX","ZMQ_INCLUDE_PREFIX"])

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cc_library(
name = "benchmark_container",
srcs = ["benchmark_container.cc","benchmark_container.h"],
hdrs = ["benchmark_container.h"],
deps = ["//exaudflib:exaudflib-deps","//exaudflib:header", "//utils:utils"]+["//script_options_parser:scriptoptionlines"]
)
deps = ["@exaudfclient_base//exaudflib:exaudflib-deps","@exaudfclient_base//exaudflib:header", "@exaudfclient_base//utils:utils"]
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <string>

#include "exa_udf_base.h"
#include "exa_udfclient_binary_common/exa_udf_base.h"
#include "exaudflib/vm/swig_vm.h"

class ExaUdfClient : public ExaUdfClientBase {
Expand All @@ -15,4 +15,4 @@ class ExaUdfClient : public ExaUdfClientBase {
protected:
std::string m_languageArg;
bool m_useCtpgParser = false;
};
};
4 changes: 2 additions & 2 deletions udf-runner-cpp/v1/exa_udfclient.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "exa_udfclient_binary_common/exa_udf_client.h"
#include "exa_udf_client.h"

int main(int argc, char **argv) {
ExaUdfClient client;
return client.startClientBase(argc, argv);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cc_library(
name = "streamingcontainer",
srcs = ["streamingcontainer.cc","streamingcontainer.h"],
hdrs = ["streamingcontainer.h"],
deps = ["//exaudflib:exaudflib-deps","//exaudflib:header"]
)
deps = ["@exaudfclient_base//exaudflib:exaudflib-deps","@exaudfclient_base//exaudflib:header"]
)