Skip to content
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

Conditionally compile the code that uses AWS to pass windows build #8966

Merged
merged 1 commit into from
Sep 9, 2024
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
10 changes: 8 additions & 2 deletions ydb/core/driver_lib/run/kikimr_services_initializers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,13 @@

#include <util/system/hostname.h>

#ifndef KIKIMR_DISABLE_S3_OPS
#include <aws/core/Aws.h>
#endif

namespace {

#ifndef KIKIMR_DISABLE_S3_OPS
struct TAwsApiGuard {
TAwsApiGuard() {
Aws::InitAPI(Options);
Expand All @@ -260,6 +263,7 @@ struct TAwsApiGuard {
private:
Aws::SDKOptions Options;
};
#endif

}

Expand Down Expand Up @@ -2065,8 +2069,8 @@ void TMemoryControllerInitializer::InitializeServices(
mergeResourceBrokerConfigs(Config.GetResourceBrokerConfig());
}

auto* actor = NMemory::CreateMemoryController(TDuration::Seconds(1), ProcessMemoryInfoProvider,
Config.GetMemoryControllerConfig(), resourceBrokerSelfConfig,
auto* actor = NMemory::CreateMemoryController(TDuration::Seconds(1), ProcessMemoryInfoProvider,
Config.GetMemoryControllerConfig(), resourceBrokerSelfConfig,
appData->Counters);
setup->LocalServices.emplace_back(
NMemory::MakeMemoryControllerId(0),
Expand Down Expand Up @@ -2782,6 +2786,7 @@ void TGraphServiceInitializer::InitializeServices(NActors::TActorSystemSetup* se
TActorSetupCmd(NGraph::CreateGraphService(appData->TenantName), TMailboxType::HTSwap, appData->UserPoolId));
}

#ifndef KIKIMR_DISABLE_S3_OPS
TAwsApiInitializer::TAwsApiInitializer(IGlobalObjectStorage& globalObjects)
: GlobalObjects(globalObjects)
{
Expand All @@ -2792,6 +2797,7 @@ void TAwsApiInitializer::InitializeServices(NActors::TActorSystemSetup* setup, c
Y_UNUSED(appData);
GlobalObjects.AddGlobalObject(std::make_shared<TAwsApiGuard>());
}
#endif

} // namespace NKikimrServicesInitializers
} // namespace NKikimr
2 changes: 2 additions & 0 deletions ydb/core/driver_lib/run/kikimr_services_initializers.h
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ class TGraphServiceInitializer : public IKikimrServicesInitializer {
void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
};

#ifndef KIKIMR_DISABLE_S3_OPS
class TAwsApiInitializer : public IServiceInitializer {
IGlobalObjectStorage& GlobalObjects;

Expand All @@ -633,6 +634,7 @@ class TAwsApiInitializer : public IServiceInitializer {

void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
};
#endif

} // namespace NKikimrServicesInitializers
} // namespace NKikimr
2 changes: 2 additions & 0 deletions ydb/core/driver_lib/run/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1676,9 +1676,11 @@ TIntrusivePtr<TServiceInitializersList> TKikimrRunner::CreateServiceInitializers
sil->AddServiceInitializer(new TGraphServiceInitializer(runConfig));
}

#ifndef KIKIMR_DISABLE_S3_OPS
if (serviceMask.EnableAwsService) {
sil->AddServiceInitializer(new TAwsApiInitializer(*this));
}
#endif

return sil;
}
Expand Down
11 changes: 10 additions & 1 deletion ydb/core/driver_lib/run/ya.make
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
LIBRARY(run)

IF (OS_WINDOWS)
CFLAGS(
-DKIKIMR_DISABLE_S3_OPS
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that KIKIMR_DISABLE_S3_OPS flag would be inherited from ydb/apps/ydbd/ya.make. However, this was not the case in my tests, so I included it here.

)
ELSE()
PEERDIR(
contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core
)
ENDIF()

SRCS(
auto_config_initializer.cpp
config.cpp
Expand All @@ -21,7 +31,6 @@ SRCS(
)

PEERDIR(
contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core
contrib/libs/protobuf
ydb/library/actors/core
ydb/library/actors/dnsresolver
Expand Down
Loading