Skip to content

Commit 5b3a502

Browse files
committed
Merge branch 'develop'
2 parents 7da8858 + 7448850 commit 5b3a502

File tree

17 files changed

+744
-87
lines changed

17 files changed

+744
-87
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,5 @@ javawrapper/device/samples/file-upload-sample/target
239239
javawrapper/device/samples/send-event-sample/target
240240
javawrapper/device/test/target
241241
javawrapper/device/samples/target
242+
*.so
243+
python/build_all/windows/pyenv.bat

c/build_all/windows/build_client.cmd

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ set CMAKE_use_wsio=OFF
2828
set CMAKE_build_python=OFF
2929
set CMAKE_build_javawrapper=OFF
3030
set CMAKE_no_logging=OFF
31+
set CMAKE_skip_unittests=OFF
3132

3233
:args-loop
3334
if "%1" equ "" goto args-done
@@ -37,6 +38,7 @@ if "%1" equ "--use-websockets" goto arg-use-websockets
3738
if "%1" equ "--buildpython" goto arg-build-python
3839
if "%1" equ "--build-javawrapper" goto arg-build-javawrapper
3940
if "%1" equ "--no-logging" goto arg-no-logging
41+
if "%1" equ "--skip-unittests" goto arg-skip-unittests
4042
call :usage && exit /b 1
4143

4244
:arg-build-config
@@ -72,6 +74,10 @@ goto args-continue
7274
set CMAKE_no_logging=ON
7375
goto args-continue
7476

77+
:arg-skip-unittests
78+
set CMAKE_skip_unittests=ON
79+
goto args-continue
80+
7581
:args-continue
7682
shift
7783
goto args-loop
@@ -99,11 +105,11 @@ pushd %USERPROFILE%\%cmake-output%
99105

100106
if %build-platform% == Win32 (
101107
echo ***Running CMAKE for Win32***
102-
cmake %build-root% -Duse_wsio:BOOL=%CMAKE_use_wsio% -Dbuild_python:STRING=%CMAKE_build_python% -Dbuild_javawrapper:BOOL=%CMAKE_build_javawrapper% -Dno_logging:BOOL=%CMAKE_no_logging%
108+
cmake %build-root% -Dskip_unittests:BOOL=%CMAKE_skip_unittests% -Duse_wsio:BOOL=%CMAKE_use_wsio% -Dbuild_python:STRING=%CMAKE_build_python% -Dbuild_javawrapper:BOOL=%CMAKE_build_javawrapper% -Dno_logging:BOOL=%CMAKE_no_logging%
103109
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
104110
) else (
105111
echo ***Running CMAKE for Win64***
106-
cmake %build-root% -G "Visual Studio 14 Win64" -Dbuild_python:STRING=%CMAKE_build_python% -Dbuild_javawrapper:BOOL=%CMAKE_build_javawrapper% -Dno_logging:BOOL=%CMAKE_no_logging%
112+
cmake %build-root% -G "Visual Studio 14 Win64" -Dskip_unittests:BOOL=%CMAKE_skip_unittests% -Duse_wsio:BOOL=%CMAKE_use_wsio% -Dbuild_python:STRING=%CMAKE_build_python% -Dbuild_javawrapper:BOOL=%CMAKE_build_javawrapper% -Dno_logging:BOOL=%CMAKE_no_logging%
107113
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
108114
)
109115

@@ -130,4 +136,5 @@ echo --config ^<value^> [Debug] build configuration (e.g. Debug, Releas
130136
echo --platform ^<value^> [Win32] build platform (e.g. Win32, x64, ...)
131137
echo --buildpython ^<value^> [2.7] build python extension (e.g. 2.7, 3.4, ...)
132138
echo --no-logging Disable logging
139+
echo --use-websockets Enable websocket support for AMQP and MQTT
133140
goto :eof

c/configs/azure_iot_sdksFunctions.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ function(linkUAMQP whatExecutableIsBuilding)
1616

1717
file(COPY $ENV{OpenSSLDir}/bin/libeay32.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug)
1818
file(COPY $ENV{OpenSSLDir}/bin/ssleay32.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug)
19+
20+
file(COPY $ENV{OpenSSLDir}/bin/libeay32.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release)
21+
file(COPY $ENV{OpenSSLDir}/bin/ssleay32.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release)
1922
endif()
2023
else()
2124
target_link_libraries(${whatExecutableIsBuilding} uamqp aziotsharedutil ssl crypto)

java/device/iothub-java-client/src/main/java/com/microsoft/azure/iothub/transport/mqtt/MqttIotHubConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public void connectionLost(Throwable throwable)
291291

292292
// Codes_SRS_MQTTIOTHUBCONNECTION_15_018: [The maximum wait interval
293293
// until a reconnect is attempted shall be 60 seconds.]
294-
Thread.sleep(TransportUtils.generateSleepInterval(currentReconnectionAttempt) * 1000);
294+
Thread.sleep(TransportUtils.generateSleepInterval(currentReconnectionAttempt));
295295
} catch (InterruptedException exception)
296296
{
297297
// do nothing, reconnection attempts will continue

jenkins/windows_python.cmd

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@ for %%i in ("%build-root%") do set build-root=%%~fi
1010

1111
REM -- Python --
1212
cd %build-root%\python\build_all\windows
13-
if "%1" equ "--use-cmake" (
14-
echo Building client using cmake
15-
call build_client.cmd %2 %3
16-
) else (
17-
echo Building client using Nuget packages
18-
call build.cmd --run-ut
19-
)
13+
echo Building client using cmake
14+
call build_client.cmd %2 %3
15+
2016
if errorlevel 1 exit /b 1
2117
cd %build-root%

python/build_all/windows/build_client.cmd

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
@REM Copyright (c) Microsoft. All rights reserved.
22
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
@setlocal EnableExtensions EnableDelayedExpansion
54
@echo off
65

6+
rem ensure python.exe exists
7+
where /q python.exe
8+
if errorlevel 1 goto :NeedPython
9+
10+
python python_version_check.py >pyenv.bat
11+
if errorlevel 1 goto :NeedPython
12+
13+
call pyenv.bat
14+
15+
@setlocal EnableExtensions EnableDelayedExpansion
16+
717
set build-root=%~dp0
818
rem // resolve to fully qualified path
919
for %%i in ("%build-root%") do set build-root=%%~fi
@@ -13,24 +23,16 @@ rem ----------------------------------------------------------------------------
1323
rem -- check prerequisites
1424
rem -----------------------------------------------------------------------------
1525

16-
rem ensure python.exe exists
17-
where /q python.exe
18-
if errorlevel 1 goto :NeedPython
19-
2026
rem -----------------------------------------------------------------------------
2127
rem -- detect Python x86 or x64 version, select build target accordingly
2228
rem -----------------------------------------------------------------------------
2329

2430
REM target may be set to 64 bit build if a Python x64 detected
25-
set build-platform=Win32
2631
set build-config=Release
27-
set build-python=2.7
2832
set wheel=0
2933
set platname=win32
34+
set use-websockets=OFF
3035

31-
python python_version_check.py >pyenv.bat
32-
if errorlevel 1 goto :NeedPython
33-
call pyenv.bat
3436
@Echo Using Python found in: %PYTHON_PATH%, building Python %build-python% %build-platform% extension
3537
goto :args-loop
3638

@@ -43,6 +45,8 @@ exit /b 1
4345
if "%1" equ "" goto args-done
4446
if "%1" equ "--config" goto arg-build-config
4547
if "%1" equ "--wheel" goto arg-build-wheel
48+
if "%1" equ "--use-websockets" goto arg-use-websockets
49+
4650
call :usage && exit /b 1
4751

4852
:arg-build-config
@@ -55,6 +59,10 @@ goto args-continue
5559
set wheel=1
5660
goto args-continue
5761

62+
:arg-use-websockets
63+
set use-websockets=ON
64+
goto args-continue
65+
5866
:args-continue
5967
shift
6068
goto args-loop
@@ -67,7 +75,13 @@ set cmake-output=cmake_%build-platform%
6775

6876
REM -- C --
6977
cd %build-root%..\..\..\c\build_all\windows
70-
call build_client.cmd --platform %build-platform% --buildpython %build-python% --config %build-config%
78+
79+
if %use-websockets% == ON (
80+
call build_client.cmd --platform %build-platform% --buildpython %build-python% --config %build-config% --use-websockets --skip-unittests
81+
) else (
82+
call build_client.cmd --platform %build-platform% --buildpython %build-python% --config %build-config% --skip-unittests
83+
)
84+
7185
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
7286
cd %build-root%
7387

@@ -110,3 +124,14 @@ if %wheel%==1 (
110124
dir dist
111125
echo Yet another Python wheel done
112126
)
127+
goto :eof
128+
129+
:usage
130+
echo build_client.cmd [options]
131+
echo options:
132+
echo --config ^<value^> [Debug] build configuration (e.g. Debug, Release)
133+
echo --platform ^<value^> [Win32] build platform (e.g. Win32, x64, ...)
134+
echo --buildpython ^<value^> [2.7] build python extension (e.g. 2.7, 3.4, ...)
135+
echo --no-logging Disable logging
136+
echo --use-websockets Enable websocket support for AMQP and MQTT
137+
goto :eof

python/build_all/windows/python_version_check.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def __str__(self):
2222
else:
2323
if (plat[0] != "32bit"):
2424
raise PlatformError("Require Windows CPython >= 2.7 or >= 3.4 32bit or 64bit version")
25+
print ("SET build-platform=Win32")
26+
2527
print ("SET PYTHON_PATH=%s" % os.path.dirname(sys.executable))
2628
print ("SET build-python=%s.%s" % (sys.version_info[0],sys.version_info[1]))
2729
sys.exit(0)

python/device/iothub_client_python/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,9 @@ if(${use_mqtt})
7575
include_directories(${IOTHUB_CLIENT_MQTT_TRANSPORT_INC_FOLDER} ${MQTT_INC_FOLDER})
7676
endif()
7777

78+
if(${use_wsio})
79+
add_definitions(-DUSE_WEBSOCKETS)
80+
endif()
81+
7882
add_subdirectory(src)
7983
add_subdirectory(test)

python/device/iothub_client_python/src/CMakeLists.txt

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ set(iothub_client_python_c_files
77
./iothub_client_python.cpp
88
)
99

10-
1110
if(WIN32)
12-
set(iothub_client_python_c_files ${iothub_client_python_c_files} ../windows/dllmain.c ../windows/iothub_client.def)
11+
if(${use_wsio})
12+
set(iothub_client_python_c_files ${iothub_client_python_c_files} ../windows/dllmain.c ../windows/iothub_client_ws.def)
13+
else()
14+
set(iothub_client_python_c_files ${iothub_client_python_c_files} ../windows/dllmain.c ../windows/iothub_client.def)
15+
endif()
1316
endif()
1417

1518
include_directories(.)
@@ -25,16 +28,36 @@ IF(WIN32)
2528
SET_TARGET_PROPERTIES(iothub_client_python PROPERTIES SUFFIX ".pyd")
2629
ENDIF(WIN32)
2730

28-
target_link_libraries(
29-
iothub_client_python
30-
iothub_client_mqtt_transport
31-
iothub_client_http_transport
32-
iothub_client_amqp_transport
33-
iothub_client
34-
uamqp
35-
${Boost_LIBRARIES}
36-
${PYTHON_LIBRARIES}
37-
)
31+
if(${use_wsio})
32+
target_link_libraries(
33+
iothub_client_python
34+
iothub_client_http_transport
35+
iothub_client_amqp_transport
36+
iothub_client_amqp_ws_transport
37+
iothub_client_mqtt_transport
38+
iothub_client_mqtt_ws_transport
39+
iothub_client
40+
uamqp
41+
${Boost_LIBRARIES}
42+
${PYTHON_LIBRARIES}
43+
)
44+
else()
45+
target_link_libraries(
46+
iothub_client_python
47+
iothub_client_http_transport
48+
iothub_client_amqp_transport
49+
iothub_client_mqtt_transport
50+
iothub_client
51+
uamqp
52+
${Boost_LIBRARIES}
53+
${PYTHON_LIBRARIES}
54+
)
55+
endif()
56+
57+
if(${use_wsio} AND WIN32)
58+
file(COPY $ENV{OpenSSLDir}/bin/libeay32.dll DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../samples)
59+
file(COPY $ENV{OpenSSLDir}/bin/ssleay32.dll DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../samples)
60+
endif()
3861

3962
linkSharedUtil(iothub_client_python)
4063
linkUAMQP(iothub_client_python)

0 commit comments

Comments
 (0)