Skip to content

Commit

Permalink
Merge pull request #18 from configcat/upgrade-v4
Browse files Browse the repository at this point in the history
Upgrade v4
  • Loading branch information
pasotee authored May 23, 2024
2 parents 1621ecc + 473727e commit 7a6b6ab
Show file tree
Hide file tree
Showing 57 changed files with 1,960 additions and 1,647 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/plugin-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
tags:
- 'v*'

env:
VCPKG_COMMIT_HASH: "59852bb5bd0779788e5fc95e50d2048ae6c9399d"

jobs:
build-win64:
runs-on: windows-latest
Expand All @@ -16,6 +19,7 @@ jobs:
- name: Install via vcpkg
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
./build/vcpkg/bootstrap-vcpkg.bat
./build/vcpkg/vcpkg install configcat[core] --triplet x64-windows
Expand All @@ -35,6 +39,7 @@ jobs:
- name: Install via vcpkg
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
./build/vcpkg/bootstrap-vcpkg.bat
./build/vcpkg/vcpkg install configcat[core] --triplet arm64-android
Expand All @@ -54,6 +59,7 @@ jobs:
- name: Install via vcpkg
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
./build/vcpkg/bootstrap-vcpkg.sh
./build/vcpkg/vcpkg install configcat[core] --triplet universal-osx-unreal --overlay-triplets "$GITHUB_WORKSPACE/Extras/triplets"
Expand All @@ -73,6 +79,7 @@ jobs:
- name: Install via vcpkg
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
./build/vcpkg/bootstrap-vcpkg.sh
./build/vcpkg/vcpkg install configcat[core] --triplet arm64-ios-unreal --overlay-triplets "$GITHUB_WORKSPACE/Extras/triplets"
Expand All @@ -92,6 +99,7 @@ jobs:
- name: Install via vcpkg
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
./build/vcpkg/bootstrap-vcpkg.sh
# Extra steps for Unreal Engine integration
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- main

env:
VCPKG_COMMIT_HASH: "59852bb5bd0779788e5fc95e50d2048ae6c9399d"

jobs:
build-linux:
runs-on: ubuntu-latest
Expand All @@ -18,6 +21,7 @@ jobs:
- name: Install via vcpkg
run: |
git clone https://github.com/microsoft/vcpkg build/vcpkg
git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
./build/vcpkg/bootstrap-vcpkg.sh
# Extra steps for Unreal Engine integration
Expand Down
6 changes: 6 additions & 0 deletions ConfigCat.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"LoadingPhase": "PreDefault",
"PlatformAllowList": [ "Win64", "Mac", "Linux", "Android", "iOS" ]
},
{
"Name": "ConfigCatWrappers",
"Type": "Runtime",
"LoadingPhase": "PreDefault",
"PlatformAllowList": [ "Win64", "Mac", "Linux", "Android", "iOS" ]
},
{
"Name": "ConfigCatEditor",
"Type": "Editor",
Expand Down
3 changes: 3 additions & 0 deletions Source/ConfigCat/ConfigCat.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public ConfigCat(ReadOnlyTargetRules Target) : base(Target)

PrivateDependencyModuleNames.AddRange(new[]
{
"ConfigCatWrappers",
"ConfigCatCppSdk"
});

Expand All @@ -31,5 +32,7 @@ public ConfigCat(ReadOnlyTargetRules Target) : base(Target)

PrivateDefinitions.Add("CONFIGCAT_HTTPTHREAD_WORKAROUND");
}

bEnableExceptions = true;
}
}
8 changes: 7 additions & 1 deletion Source/ConfigCat/Private/ConfigCatLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FConfigCatLogger::FConfigCatLogger() : ILogger(LOG_LEVEL_DEBUG)
{
}

void FConfigCatLogger::log(configcat::LogLevel level, const std::string& message)
void FConfigCatLogger::log(configcat::LogLevel level, const std::string& message, const std::exception_ptr& exception)
{
const FString& LogMessage = UTF8_TO_TCHAR(message.c_str());

Expand All @@ -32,4 +32,10 @@ void FConfigCatLogger::log(configcat::LogLevel level, const std::string& message
UE_LOG(LogConfigCat, Log, TEXT("[CPP-SDK] %s"), *LogMessage);
break;
}

if (exception)
{
const FString ExceptionMessage = UTF8_TO_TCHAR(unwrap_exception_message(exception).c_str());
UE_LOG(LogConfigCat, Error, TEXT("[CPP-SDK] Exception: %s"), *ExceptionMessage);
}
}
15 changes: 9 additions & 6 deletions Source/ConfigCat/Private/ConfigCatNetworkAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ bool ConfigCatNetworkAdapter::init(uint32_t connectTimeoutMs, uint32_t readTimeo
}

Response ConfigCatNetworkAdapter::get(
const std::string& url, const std::map<std::string, std::string>& header, const std::map<std::string, std::string>& proxies, const std::map<std::string, ProxyAuthentication>& proxyAuthentications
const std::string& url,
const std::map<std::string, std::string>& header,
const std::map<std::string, std::string>& proxies,
const std::map<std::string, ProxyAuthentication>& proxyAuthentications
)
{
UE_LOG(LogConfigCat, Verbose, TEXT("Network Adapter performing GET request."));
Expand All @@ -57,10 +60,10 @@ Response ConfigCatNetworkAdapter::get(
const float Timeout = (ConnectionTimeout + ReadTimeout) / 1000.0f;
GetRequest->SetTimeout(Timeout);

for (const auto& it : header)
for (const std::pair<const std::string, std::string>& It : header)
{
const FString HeaderKey = UTF8_TO_TCHAR(it.first.c_str());
const FString HeaderValue = UTF8_TO_TCHAR(it.second.c_str());
const FString HeaderKey = UTF8_TO_TCHAR(It.first.c_str());
const FString HeaderValue = UTF8_TO_TCHAR(It.second.c_str());
GetRequest->SetHeader(HeaderKey, HeaderValue);
}

Expand Down Expand Up @@ -101,7 +104,7 @@ Response ConfigCatNetworkAdapter::get(
if (!GetResponse)
{
Response.error = "Unreal Engine Network Adapter failed to launch request. Check logs";
Response.operationTimedOut = GetRequest->GetElapsedTime() > Timeout;
Response.errorCode = ResponseErrorCode::InternalError;
return Response;
}

Expand Down Expand Up @@ -131,4 +134,4 @@ void ConfigCatNetworkAdapter::close()
{
GetRequest->CancelRequest();
}
}
}
Loading

0 comments on commit 7a6b6ab

Please sign in to comment.