Skip to content

Commit

Permalink
major port from 9.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rigazilla committed Apr 7, 2023
1 parent e5baabd commit c372043
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 209 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ if(WIN32) # Needed for prebuild on windows
# #add_test(NAME csharp_tests_compatibility COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ CompatibilityModeTestSuite TestResult-compatibility.xml)
add_test(NAME csharp_tests_query COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ RemoteQueryTestSuite TestResult-query.xml)
add_test(NAME csharp_tests_counter COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ CounterTestSuite TestResult-counter.xml)
add_test(NAME csharp_tests_counter_with_listener COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ CounterWithListenerTestSuite TestResult-counter.xml)
add_test(NAME csharp_tests_cluster COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ ClusterTestSuite TestResult-cluster.xml)
add_test(NAME csharp_tests_adminop COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ AdminOpTestSuite TestResult-adminop.xml)

Expand Down Expand Up @@ -533,7 +534,7 @@ if(WIN32 AND NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
file(TO_CMAKE_PATH ${PROTOBUF_PROTOC_EXECUTABLE_CS} CM_PROTOBUF_PROTOC_EXECUTABLE_CS)
install(FILES "${NLOG_DLL_LOCAL}" DESTINATION lib/)
install(FILES "${NLOG_LICENSE_LOCAL}" DESTINATION lib/ OPTIONAL)
install(FILES "${CM_GOOGLE_PROTOBUF_NUPKG}/Google.Protobuf.3.4.0/lib/netstandard1.0/Google.Protobuf.dll" DESTINATION lib/)
install(FILES "${CM_GOOGLE_PROTOBUF_NUPKG}/Google.Protobuf.3.8.0/lib/net45/Google.Protobuf.dll" DESTINATION lib/)
install(FILES "${CM_PROTOBUF_PROTOC_EXECUTABLE_CS}" DESTINATION bin/)
endif(WIN32 AND NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})

Expand Down
54 changes: 32 additions & 22 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
if [%generator%] == [""] set generator="Visual Studio 17 2022"
echo Using generator -G %generator%

set home_drive=%CD:~0,2%

rmdir /s /q build_windows
mkdir build_windows
cd build_windows

set "buildTest=%~1"

if [%CLIENT_VERSION%] neq [] set V1=%CLIENT_VERSION:*/=%

Expand All @@ -31,48 +22,67 @@ if 1%v_3micro% neq +1%v_3micro% set v_3micro=0
set package_name=%v_1major%.%v_2minor%.%v_3micro%.%v_4qualifier%
set nuget_package_name=%v_1major%.%v_2minor%.%v_3micro%-%v_4qualifier%

if [%HOTRODCPP_HOME%] == [] set HOTRODCPP_HOME=%checkoutDir%/cpp-client/build_win/_CPack_Packages/WIN-x86_64/ZIP/infinispan-hotrod-cpp-%package_name%-WIN-x86_64
echo Using HOTRODCPP_HOME=%HOTRODCPP_HOME%

if "%HOTROD_PREBUILT_LIB_DIR%" == "" (
set HOTRODCSDLL=hotrodcs.dll
set PROTOBUFDLL=%GOOGLE_PROTOBUF_NUPKG%\Google.Protobuf.3.4.0\lib\net451\Google.Protobuf.dll
set PROTOBUFDLL=%GOOGLE_PROTOBUF_NUPKG%\Google.Protobuf.3.8.0\lib\net45\Google.Protobuf.dll
) else (
set HOTRODCSDLL=%HOTROD_PREBUILT_LIB_DIR%\hotrodcs.dll
set PROTOBUFDLL=%HOTROD_PREBUILT_LIB_DIR%\Google.Protobuf.dll
)

if NOT DEFINED HOTRODCPP_HOME set HOTRODCPP_HOME=%checkoutDir%/cpp-client/build_win/_CPack_Packages/WIN-x86_64/ZIP/infinispan-hotrod-cpp-%package_name%-WIN-x86_64
echo Using generator -G %generator%

set home_drive=%CD:~0,2%

call :unquote u_generator %generator%

if not "%buildBuild%"=="skip" (
rmdir /s /q build_windows
mkdir build_windows
cd build_windows
set "myest=%~1"

cmake -G "%u_generator%" -DHOTRODCPP_HOME=%HOTRODCPP_HOME% -DHOTROD_VERSION_MAJOR=%v_1major% -DHOTROD_VERSION_MINOR=%v_2minor% -DHOTROD_VERSION_PATCH=%v_3micro% -DHOTROD_VERSION_LABEL=%v_4qualifier% -DSWIG_DIR=%SWIG_DIR% -DSWIG_EXECUTABLE=%SWIG_EXECUTABLE% -DPROTOBUF_PROTOC_EXECUTABLE_CS="%PROTOBUF_PROTOC_EXECUTABLE_CS%" -DGOOGLE_PROTOBUF_NUPKG="%GOOGLE_PROTOBUF_NUPKG%" -DPROTOBUF_INCLUDE_DIR=%PROTOBUF_INCLUDE_DIR% -DJBOSS_HOME=%JBOSS_HOME% -DIKVM_CUSTOM_BIN_PATH=%IKVM_CUSTOM_BIN_PATH% -DOPENSSL_ROOT_DIR=%OPENSSL_ROOT_DIR% -DCONFIGURATION=RelWithDebInfo -DENABLE_DOXYGEN=1 -DENABLE_JAVA_TESTING=FALSE -DProtobuf_LIBRARIES=%PROTOBUFDLL% %~4 ..
if %errorlevel% neq 0 goto fail
if "%HOTROD_PREBUILT_LIB_DIR%" == "" (
cmake --build . --config RelWithDebInfo
) else (
cmake --build . --config RelWithDebInfo --target hotrodcs-test-bin
)
cd ..
)
if %errorlevel% neq 0 goto fail

if not "%buildTest%"=="skip" (
cd build_windows
ctest -V -C RelWithDebInfo
cd ..
)

if %errorlevel% neq 0 goto fail

if "%HOTROD_PREBUILT_LIB_DIR%" == "" (
cpack -G ZIP --config CPackSourceConfig.cmake
if %errorlevel% neq 0 goto fail

cpack -G ZIP --config CPackConfig.cmake
if %errorlevel% neq 0 goto fail
if not "%buildPack%"=="skip" (
cd build_windows
if "%HOTROD_PREBUILT_LIB_DIR%" == "" (
cpack -G ZIP --config CPackSourceConfig.cmake
if %errorlevel% neq 0 goto fail

cpack -G WIX -C RelWithDebInfo
if %errorlevel% neq 0 goto fail
cpack -G ZIP --config CPackConfig.cmake
if %errorlevel% neq 0 goto fail

cmake %* -P ../wix-bundle.cmake
if "%packNuget%"=="true" (
cpack -G NuGet -R %nuget_package_name% -C RelWithDebInfo
cpack -G WIX -C RelWithDebInfo
if %errorlevel% neq 0 goto fail

cmake %* -P ../wix-bundle.cmake
if "%packNuget%"=="true" (
cpack -G NuGet -R %nuget_package_name% -C RelWithDebInfo
if %errorlevel% neq 0 goto fail
)
)
cd ..
)
if %errorlevel% neq 0 goto fail
endlocal
Expand Down
19 changes: 12 additions & 7 deletions buildtools/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ open Fake
open Fake.NuGet.Install
open Fake.DotNetCli

let cppClientVersion = "8.1.0.SNAPSHOT"
let cppClientPackageVersion = "8.2.0-Alpha2" // nuget does not support string values after.
let cppClientVersion = environVar "buildTag"
let cppClientUrlTemplate = "https://github.com/infinispan/cpp-client/releases/download/%s/infinispan-hotrod-cpp-%s-WIN-x86_64.zip"
//#Can't use cppClientUrlTemplate below. TODO fix this
let cppClientUrl = sprintf "https://github.com/infinispan/cpp-client/releases/download/%s/infinispan-hotrod-cpp-%s-WIN-x86_64.zip" cppClientVersion cppClientVersion
//let cppClientUrl = "file://C:\Users\rigazilla\git\cpp-client\build_win\_CPack_Packages\WIN-x86_64\ZIP\infinispan-hotrod-cpp-8.1.1.SNAPSHOT-WIN-x86_64.zip"
let cppClientPackageVersion = environVar "buildTag" // nuget does not support string values after.
let swigVersion = "3.0.12"
let protobufVersion = "3.4.0" // if changing this, be sure to also update Google.Protobuf in src/Infinispan.HotRod/Infinispan.HotRod.csproj
let protobufVersion = "3.8.0" // if changing this, be sure to also update Google.Protobuf in src/Infinispan.HotRod/Infinispan.HotRod.csproj
let nunitToolsVersion = "2.6.1"
let infinispanServerVersion = "9.1.1.Final"
let infinispanServerVersion = "14.0.6.Final"

let generateDir = "../../../src/Infinispan.HotRod/generated"
let generateSwigDir = "../src/Infinispan.HotRod/generated"
Expand Down Expand Up @@ -45,7 +49,7 @@ Target "GenerateSwig" (fun _ ->
let cppClientLocation =
if (environVar "HOTROD_PREBUILT_DIR" <> null)
then environVar "HOTROD_PREBUILT_DIR"
else (downloadCppClientIfNonexist cppClientVersion)
else (downloadCppClientIfNonexist cppClientUrl cppClientVersion)
trace ("Target GenerateSwig: cpp client location is: " <+ cppClientLocation)
let swigToolPath = downloadSwigToolsIfNonexist swigVersion
copyIncludeForSwig cppClientLocation "../swig/native_client/include"
Expand All @@ -63,9 +67,10 @@ Target "BuildSwigWrapper" (fun _ ->
let cppClientLocation =
if (environVar "HOTROD_PREBUILT_DIR" <> null)
then environVar "HOTROD_PREBUILT_DIR"
else (downloadCppClientIfNonexist cppClientVersion)
else (downloadCppClientIfNonexist cppClientUrl cppClientVersion)
copyIncludeForSwig cppClientLocation "../swig/native_client/include"
copyLibForSwig cppClientLocation "../swig/native_client/lib"
EnvironmentHelper.setBuildParam "VisualStudioVersion" "15.0"
buildSwig ()
)

Expand Down Expand Up @@ -127,7 +132,7 @@ Target "CppPackage" (fun _ ->
let cppClientLocation =
if (environVar "HOTROD_PREBUILT_DIR" <> null)
then environVar "HOTROD_PREBUILT_DIR"
else (downloadCppClientIfNonexist cppClientVersion)
else (downloadCppClientIfNonexist cppClientUrl cppClientVersion)
directoryCopy "../swig/build/RelWithDebInfo" binsPath false
Copy binsPath (Directory.EnumerateFiles (sprintf "%s/lib" cppClientLocation))
Copy packageRoot ["Infinispan.HotRod.Cpp-client.win7-x64.nuspec"]
Expand Down
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sdk": {
"version": "2.1.4"
"version": "2.1.4",
"rollForward": "latestMajor"
}
}
4 changes: 2 additions & 2 deletions src/Infinispan.HotRod/Infinispan.HotRod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageVersion>8.2.0-Alpha2</PackageVersion>
<PackageVersion>$(CLIENT_VERSION)</PackageVersion>
<Authors>infinispan.org</Authors>
<Description>.NET core binding of C# HotRod client for connecting to infinispan</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
Expand All @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.4.1" />
<PackageReference Include="Google.Protobuf" Version="3.8.0" />
<PackageReference Include="NLog" Version="4.5.11" />
</ItemGroup>

Expand Down
12 changes: 8 additions & 4 deletions swig/hotrod_wrap.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,29 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WindowsTargetPlatformVersion>10.0.22000.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
2 changes: 1 addition & 1 deletion templates/hotrodcs.proj.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<ItemGroup>
<Reference Include="Google.Protobuf">
<HintPath>${GOOGLE_PROTOBUF_NUPKG}\Google.Protobuf.3.4.0\lib\net451\Google.Protobuf.dll</HintPath>
<HintPath>${GOOGLE_PROTOBUF_NUPKG}\Google.Protobuf.3.8.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="System"/>
<Reference Include="System.Core"/>
Expand Down
5 changes: 4 additions & 1 deletion test/Infinispan.HotRod.Tests/AuthorizationTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@ protected void TestPutRemoveAsyncContains(IRemoteCache<string, string> cache)
cache.Put(K1, V1);
Assert.IsTrue(cache.ContainsKey(K1));
Task<string> result = cache.RemoveAsync(K1);
result.Wait(5000);
if (!result.Wait(5000)) {
// Give more time
result.Wait(5000);
}
Assert.IsFalse(cache.ContainsKey(K1));
}

Expand Down
Loading

0 comments on commit c372043

Please sign in to comment.