Skip to content

Commit 10bc9af

Browse files
authored
Merge pull request #11 from aperture-data/support_building_locally
Support building locally
2 parents 6d91cfe + cb896af commit 10bc9af

File tree

11 files changed

+39
-21
lines changed

11 files changed

+39
-21
lines changed

SConstruct

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ comm_env.Replace(
5353
LIBPATH = []
5454
)
5555

56-
comm_env.Replace(CXXFLAGS = comm_env['CXXFLAGS'].replace("-Weffc++", ""))
57-
comm_env.Replace(CXXFLAGS = re.sub("-Warray-bounds[^\s]+", "-Warray-bounds=1", comm_env['CXXFLAGS']))
58-
comm_env.Replace(CXXFLAGS = re.sub("-Wsuggest-attribute=const", "-Wno-suggest-attribute=const", comm_env['CXXFLAGS']))
59-
comm_env.Replace(CXXFLAGS = re.sub("-Wsuggest-final-types", "-Wno-suggest-final-types", comm_env['CXXFLAGS']))
60-
comm_env.Replace(CXXFLAGS = re.sub("-Wuseless-cast", "-Wno-useless-cast", comm_env['CXXFLAGS']))
61-
comm_env.Replace(CXXFLAGS = re.sub("-Wsuggest-override", "-Wno-suggest-override", comm_env['CXXFLAGS']))
56+
# This is to compile protobuf-based .cc whose code-generation we do not control.
57+
# The rest of the code is supposed to compiled using higher standards.
58+
lenient_env = comm_env.Clone()
59+
lenient_env.Replace(CXXFLAGS = lenient_env['CXXFLAGS'].replace("-Weffc++", ""))
60+
lenient_env.Replace(CXXFLAGS = re.sub("-Warray-bounds[^\s]+", "-Warray-bounds=1", lenient_env['CXXFLAGS']))
61+
lenient_env.Replace(CXXFLAGS = re.sub("-Wsuggest-attribute=const", "-Wno-suggest-attribute=const", lenient_env['CXXFLAGS']))
62+
lenient_env.Replace(CXXFLAGS = re.sub("-Wsuggest-final-types", "-Wno-suggest-final-types", lenient_env['CXXFLAGS']))
63+
lenient_env.Replace(CXXFLAGS = re.sub("-Wuseless-cast", "-Wno-useless-cast", lenient_env['CXXFLAGS']))
64+
lenient_env.Replace(CXXFLAGS = re.sub("-Wsuggest-override", "-Wno-suggest-override", lenient_env['CXXFLAGS']))
6265

6366
comm_cc = [
6467
'src/comm/ConnClient.cc',
@@ -86,15 +89,19 @@ client_env.Replace(
8689

8790
compileProtoFiles(client_env)
8891

89-
client_cc = [
92+
protobuf_cc = [
9093
'src/aperturedb/queryMessage.pb.cc',
94+
]
95+
client_cc = [
9196
'src/aperturedb/TokenBasedVDMSClient.cc',
9297
'src/aperturedb/VDMSClient.cc',
9398
'src/aperturedb/VDMSClientImpl.cc'
9499
]
95100

96101
client_env.ParseConfig('pkg-config --cflags --libs protobuf')
97-
ulib = client_env.SharedLibrary('lib/aperturedb-client', client_cc)
102+
ulib = client_env.SharedLibrary('lib/aperturedb-client',
103+
[client_cc, lenient_env.SharedObject(protobuf_cc)]
104+
)
98105

99106
CXXFLAGS = env['CXXFLAGS']
100107

src/aperturedb/TokenBasedVDMSClient.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ TokenBasedVDMSClient::TokenBasedVDMSClient(const VDMSClientConfig& config)
5454
false,
5555
config.metrics
5656
)))
57+
, _connection(_client->connect())
5758
{
58-
_connection = _client->connect();
5959
}
6060

6161
TokenBasedVDMSClient::~TokenBasedVDMSClient() = default;

src/aperturedb/VDMSClientImpl.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,18 @@ VDMSClientImpl::VDMSClientImpl(std::string username, std::string password, const
8888
: TokenBasedVDMSClient(config)
8989
, _username(std::move(username))
9090
, _password(std::move(password))
91+
, _api_key()
92+
, _auth_token()
9193
{
9294
re_authenticate();
9395
}
9496

9597
VDMSClientImpl::VDMSClientImpl(std::string api_key, const VDMSClientConfig& config)
9698
: TokenBasedVDMSClient(config)
99+
, _username()
100+
, _password()
97101
, _api_key(std::move(api_key))
102+
, _auth_token()
98103
{
99104
re_authenticate();
100105
}

src/aperturedb/VDMSClientImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
namespace VDMS {
4242

4343
struct AuthToken {
44-
std::chrono::system_clock::time_point issued_at;
45-
std::string refresh_token;
44+
std::chrono::system_clock::time_point issued_at{};
45+
std::string refresh_token{};
4646
int32_t refresh_token_expires_in{-1};
47-
std::string session_token;
47+
std::string session_token{};
4848
int32_t session_token_expires_in{-1};
4949
};
5050

src/comm/ConnClient.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ using namespace comm;
4949

5050
ConnClient::ConnClient(const Address& server_address, ConnClientConfig config) :
5151
_config(std::move(config)),
52-
_server(std::move(server_address))
52+
_connection(),
53+
_server(std::move(server_address)),
54+
_ssl_ctx(create_client_context())
5355
{
54-
_ssl_ctx = create_client_context();
55-
5656
set_default_verify_paths(_ssl_ctx.get());
5757

5858
if (config.verify_certificate) {

src/comm/ConnServer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ using namespace comm;
5151

5252
ConnServer::ConnServer(int port, ConnServerConfig config) :
5353
_config(std::move(config)),
54+
_listening_socket(),
5455
_open_ssl_initializer(OpenSSLInitializer::instance()),
55-
_port(port)
56+
_port(port),
57+
_ssl_ctx(create_server_context())
5658
{
57-
_ssl_ctx = create_server_context();
58-
5959
set_default_verify_paths(_ssl_ctx.get());
6060

6161
if (_config.auto_generate_certificate) {

src/comm/TCPConnection.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ using namespace comm;
4343

4444
TCPConnection::TCPConnection(ConnMetrics* metrics)
4545
: Connection(metrics)
46+
, _tcp_socket()
4647
{
4748
}
4849

src/comm/TLS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <openssl/ssl.h>
1212

1313
struct Certificate {
14-
std::string private_key;
15-
std::string cert;
14+
std::string private_key{};
15+
std::string cert{};
1616
};
1717

1818
class OpenSSLInitializer

src/comm/TLSConnection.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ using namespace comm;
1818

1919
TLSConnection::TLSConnection(ConnMetrics* metrics)
2020
: Connection(metrics)
21+
, _tls_socket()
2122
{
2223
}
2324

tools/prometheus_ambassador/SConscript

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ Import('env')
77

88
prom_amb_env = env.Clone()
99
prom_amb_env.Replace(
10-
CPPPATH = [ 'src',
10+
CPPPATH = [ 'src', '../../include/util',
1111
os.getenv('AD_COMM_INCLUDE', default='../../include'),
1212
os.getenv('AD_CLIENT_INCLUDE', default='../../include'),
1313
os.getenv('PROMETHEUS_CPP_CORE_INCLUDE', default=''),
1414
os.getenv('PROMETHEUS_CPP_PULL_INCLUDE', default=''),
15+
os.getenv('NLOHMANN_JSON_INCLUDE', default='/usr/include'),
1516
],
1617
LIBS = [ 'comm',
1718
'aperturedb-client',

0 commit comments

Comments
 (0)