Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit 24219e8

Browse files
authored
Merge pull request #90 from JasonYang-MSFT/master
Azure Storage Client Library for C++ v2.4.0
2 parents 4ae759a + 4487ea1 commit 24219e8

File tree

146 files changed

+13083
-2758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+13083
-2758
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,9 @@ $RECYCLE.BIN/
182182

183183
# build folders under Linux
184184
Microsoft.WindowsAzure.Storage/build.*/
185+
186+
# ==========================
187+
# OSX detritus
188+
# ==========================
189+
190+
.DS_Store

CONTRIBUTING.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
If you intend to contribute to the project, please make sure you've followed
2+
the instructions provided in the [Azure Projects Contribution Guidelines]
3+
(http://azure.github.io/guidelines/).
4+
5+
## Project Setup on Windows
6+
On Windows, the Azure Storage development team uses Visual Studio so
7+
instructions will be tailored to that preference. However, any preferred IDE or
8+
other toolset should be usable.
9+
10+
### Install
11+
* Visual Studio 2015 or Visual Studio 2013 with C++ toolsets.
12+
* Clone the source code from GitHub.
13+
14+
#### Open Solution
15+
Open the project from Visual Studio using **File->Open->Project/Solution...**
16+
and navigate to the `Microsoft.WindowsAzure.Storage.v140.sln` (for Visual
17+
Studio 2015) or `Microsoft.WindowsAzure.Storage.v120.sln` (for Visual Studio
18+
2013) solution file in the repo base folder. The dependent library Casablanca
19+
will be installed by NuGet upon building.
20+
21+
### Tests
22+
23+
#### Add Unit Test Project
24+
Use Visual Studio menu **File->Add->Existing Project...** and navigate to the
25+
folder `Microsoft.WindowsAzure.Storage\tests`. Select
26+
`Microsoft.WindowsAzure.Storage.UnitTests.v140.vcxproj` (for Visual Studio 2015)
27+
or `Microsoft.WindowsAzure.Storage.UnitTests.v120.vcxproj` (for Visual Studio
28+
2013).
29+
30+
#### Install UnitTest++
31+
* Fetch source code of UnitTest++ from its [GitHub repo]
32+
(https://github.com/unittest-cpp/unittest-cpp)
33+
* Checkout version 1.4
34+
```bash
35+
git checkout v1.4
36+
```
37+
* Create a folder `UnitTest++` under `Microsoft.WindowsAzure.Storage\tests` and
38+
copy all contents of `unittest-cpp` to it.
39+
* Add another existing project to the Visual Studio via **File->Add->Existing
40+
Project...**. Navigate to `Microsoft.WindowsAzure.Storage\tests\UnitTest++`, and
41+
select `UnitTest++.vsnet2005.vcproj`.
42+
* A "Review Project And Solution Changes" dialog popups. Choose **OK**, and a
43+
new `UnitTest++.vsnet2005.vcxproj` is generated and added to the solution.
44+
45+
#### Configuration
46+
The only step to configure testing is to change the `test_configuration.json`
47+
file in `Microsoft.WindowsAzure.Storage\tests` folder. You should insert your
48+
storage account information into the file. If you want to run the tests against
49+
Azure Storage Emulator, change `target` to `devstore`. If you want to run the
50+
tests against real Azure Storage, use real connection string in `production`.
51+
52+
#### Running
53+
Set `Microsoft.WindowsAzure.Storage.UnitTests` as startup project. You can specify
54+
a subset of tests to run on the command line before running the project. Go to the
55+
project properties for the unit test project, select **Configuration Properties->
56+
Debugging->Command Arguments**. Enter a space-separated list of `SUITE:TEST` and/or
57+
`SUITE`. For example: `Queue:Queue_Messages`, `Core`, or `Table TableClient`.
58+
59+
### Debug
60+
To use Fiddler, you need to set the system winhttp proxy. Open an administrator
61+
command prompt. Run `netsh.exe`. Set the proxy by executing the command: `winhttp
62+
set proxy localhost:8888`. Clear the proxy by executing the command: `winhttp reset
63+
proxy`.
64+
65+
## Project Setup on Linux
66+
The Azure Storage development team uses Ubuntu 14.04 LTS as the main development
67+
platform, so instructions will be tailored to that. However, you can refer to other
68+
platforms' documentation to install the dependent libraries and preferred IDE or
69+
other toolset.
70+
71+
### Casablanca
72+
Azure Storage Client Library for C++ depends on Casablanca. Follow [these
73+
instructions](https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux)
74+
to compile and install it.
75+
76+
### Additional Dependencies
77+
```bash
78+
sudo apt-get install libxml++2.6-dev libxml++2.6-doc uuid-dev
79+
```
80+
81+
### Build
82+
```bash
83+
cd azure-storage-cpp/Microsoft.WIndowsAzure.Storage
84+
mkdir build.release
85+
cd build.release
86+
CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release
87+
make
88+
```
89+
In the above command, replace `<path to Casablanca>` to point to your local
90+
installation of Casablanca. For example, if the file `libcpprest.so` exists at
91+
location `~/Github/Casablanca/cpprestsdk/Release/build.release/Binaries/libcpprest.so`,
92+
then your `cmake` command should be:
93+
```bash
94+
CASABLANCA_DIR=~/Github/Casablanca/cpprestsdk CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release
95+
```
96+
The library is generated under
97+
`azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release/Binaries/`.
98+
99+
### Tests
100+
101+
#### Install UnitTest++
102+
```bash
103+
sudo apt-get install libunittest++-dev
104+
```
105+
106+
#### Build the Test Code
107+
```bash
108+
CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON
109+
make
110+
```
111+
The test binary `azurestoragetest` and `test_configuration.json` are generated under
112+
the same directory as `libazurestorage.so`.
113+
114+
#### Configuration
115+
The only step to configure testing is to change the `test_configuration.json`
116+
file in `Microsoft.WindowsAzure.Storage/tests` folder. You should insert your
117+
storage account information into the file. If you want to run the tests against
118+
Azure Storage Emulator, change `target` to `devstore`. If you want to run the
119+
tests against real Azure Storage, use real connection string in `production`.
120+
121+
#### Running
122+
```bash
123+
cd Binaries
124+
./azurestoragetest [<SUITE>|<SUITE:TEST>]*
125+
```
126+
127+
### Samples
128+
```bash
129+
CASABLANCA_DIR=<path to Casablanca> CXX=g++-4.8 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON
130+
make
131+
```
132+
133+
```bash
134+
cd Binaries
135+
./samplesblobs # run the blobs sample
136+
./samplestables # run the tables sample
137+
./samplesjson # run the tables sample with json_no_metadata to reduce payload size
138+
./samplesqueues # run the queues sample
139+
```
140+
141+
## Pull Requests
142+
143+
### Guidelines
144+
The following are the minimum requirements for any pull request that must be met
145+
before contributions can be accepted.
146+
* Make sure you've signed the CLA before you start working on any change.
147+
* Discuss any proposed contribution with the team via a GitHub issue **before**
148+
starting development.
149+
* Code must be professional quality.
150+
* You should strive to mimic the style with which we have written the library.
151+
* Clean, well-commented, well-designed code.
152+
* Try to limit the number of commits for a feature to 1-2. If you end up having
153+
too many we may ask you to squash your changes into fewer commits.
154+
* [Changelog.txt](Changelog.txt) needs to be updated describing the new change.
155+
* [BreakingChanges.txt](BreakingChanges.txt) contains changes that break
156+
backward-compatibility.
157+
* Thoroughly test your feature.
158+
159+
### Testing Features
160+
As you develop a feature, you'll need to write tests to ensure quality. You should
161+
also run existing tests related to your change to address any unexpected breaks.
162+
163+
### Branching Policy
164+
Changes should be based on the `dev` branch. We're following [semver](http://semver.org/).
165+
We generally release any breaking changes in the next major version (e.g. 1.0, 2.0)
166+
and non-breaking changes in the next minor or major version (e.g. 2.1, 2.2).
167+
168+
### Adding Features for All Platforms
169+
We strive to release each new feature for each of our environments at the same time.
170+
Therefore, we ask that all contributions be written for both Window and Linux. This
171+
includes testing work for both platforms as well. Because most of our code is written using
172+
standard C++11 and upon a cross-platform library Casablanca, we expect contributions are
173+
also using standard language and cross-platform libraries, so that it won't cause much effort
174+
for cross-platform support.
175+
176+
### Review Process
177+
We expect all guidelines to be met before accepting a pull request. As such, we will
178+
work with you to address issues we find by leaving comments in your code. Please
179+
understand that it may take a few iterations before the code is accepted as we maintain
180+
high standards on code quality. Once we feel comfortable with a contribution, we will
181+
validate the change and accept the pull request.
182+
183+
# Thank you for any contributions!
184+
Please let the team know if you have any questions or concerns about our contribution policy.

Changelog.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Azure Storage Client Library for C++
22
History of Changes
33

4+
Changes in v2.4:
5+
- Added support for file service: file client, file share, file directory and file.
6+
- Performance improvements with URI cache, string concat, uri builder parameters.
7+
- Fixed the bug that cloud_blob_container didn't exported by dll.
8+
- Fixed the bug that xml parser for table's error message.
9+
- Fixed the bug that copying blob from other accounts doesn't use source credentials.
10+
- Fixed the bug that network took too long time to close while network error happened.
11+
- Fixed the bug that blob name with reserved characters didn't split with right order.
12+
- Fixed the but that blob properties didn't clear after delettion.
13+
- Fixed the coding style for static string to prevent ODR issue.
14+
- Fixed the build issue on OS X, but not offically suporting OS X.
15+
416
Changes in v2.3:
517
- Added the following interfaces to support programmatically configurable HTTP/HTTPS proxy
618
- operation_context::set_default_proxy

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "Microsoft Azure Storage Client Library for C++"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 2.3.0
41+
PROJECT_NUMBER = 2.4.0
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

Microsoft.WindowsAzure.Storage.v120.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.30501.0
4+
VisualStudioVersion = 12.0.40629.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.WindowsAzure.Storage.v120", "Microsoft.WindowsAzure.Storage\Microsoft.WindowsAzure.Storage.v120.vcxproj", "{DCFF75B0-B142-4EC8-992F-3E48F2E3EECE}"
77
EndProject

Microsoft.WindowsAzure.Storage.v140.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.23107.0
4+
VisualStudioVersion = 14.0.24720.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.WindowsAzure.Storage.v140", "Microsoft.WindowsAzure.Storage\Microsoft.WindowsAzure.Storage.v140.vcxproj", "{25D342C3-6CDA-44DD-A16A-32A19B692785}"
77
EndProject

Microsoft.WindowsAzure.Storage/CMakeLists.txt

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,33 @@ option(BUILD_SAMPLES "Build sample codes" OFF)
1515
if(UNIX)
1616
find_package(Boost REQUIRED COMPONENTS log log_setup random system thread locale regex filesystem chrono date_time)
1717
find_package(Threads REQUIRED)
18-
find_package(OpenSSL REQUIRED)
18+
if(APPLE AND NOT OPENSSL_ROOT_DIR)
19+
# Prefer a homebrew version of OpenSSL over the one in /usr/lib
20+
file(GLOB OPENSSL_ROOT_DIR /usr/local/Cellar/openssl/*)
21+
22+
# Prefer the latest (make the latest one first)
23+
list(REVERSE OPENSSL_ROOT_DIR)
24+
25+
# There is a dependency chain Libxml++ -> glibmm -> gobject -> glib -> lintl, however, for some reason,
26+
# with homebrew at least, the -L for where lintl resides is left out. So, we try to find it where homebrew
27+
# would put it, or allow the user to specify it
28+
if(NOT GETTEXT_LIB_DIR)
29+
message(WARNING "No GETTEXT_LIB_DIR specified, assuming: /usr/local/opt/gettext/lib")
30+
set(GETTEXT_LIB_DIR "/usr/local/opt/gettext/lib")
31+
endif()
32+
# If we didn't find it where homebrew would put it, and it hasn't been specified, then we have to throw an error
33+
if(NOT IS_DIRECTORY "${GETTEXT_LIB_DIR}")
34+
message(ERROR "We couldn't find your gettext lib directory (${GETTEXT_LIB_DIR}). Please re-run cmake with -DGETTEXT_LIB_DIR=<your gettext lib dir>. This is usually where libintl.a and libintl.dylib reside.")
35+
endif()
36+
37+
# if we actually have a GETTEXT_LIB_DIR we add the linker flag for it
38+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L${GETTEXT_LIB_DIR}")
39+
endif()
40+
41+
set(_OPENSSL_VERSION "")
42+
find_package(OpenSSL 1.0.0 REQUIRED)
43+
44+
1945
find_package(Glibmm REQUIRED)
2046
find_package(LibXML++ REQUIRED)
2147
find_package(UUID REQUIRED)
@@ -26,6 +52,13 @@ if(UNIX)
2652
endif()
2753

2854
option(BUILD_SHARED_LIBS "Build shared Libraries." ON)
55+
56+
file(GLOB WAS_HEADERS includes/was/*.h)
57+
install(FILES ${WAS_HEADERS} DESTINATION include/was)
58+
file(GLOB WASCORE_HEADERS includes/wascore/*.h)
59+
install(FILES ${WASCORE_HEADERS} DESTINATION include/wascore)
60+
file(GLOB WASCORE_DATA includes/wascore/*.dat)
61+
install(FILES ${WASCORE_DATA} DESTINATION include/wascore)
2962
else()
3063
message("-- Unsupported Build Platform.")
3164
endif()
@@ -39,12 +72,31 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
3972
set(WARNINGS "${WARNINGS} ${LINUX_SUPPRESSIONS}")
4073

4174
set(LD_FLAGS "${LD_FLAGS} -Wl,-z,defs")
42-
75+
4376
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
44-
77+
4578
set(STRICT_CXX_FLAGS ${WARNINGS} "-Werror -pedantic")
46-
47-
add_definitions(-DBOOST_LOG_DYN_LINK)
79+
80+
if (BUILD_SHARED_LIBS)
81+
add_definitions(-DBOOST_LOG_DYN_LINK)
82+
endif()
83+
add_definitions(-D_TURN_OFF_PLATFORM_STRING)
84+
elseif((CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
85+
message("-- Setting clang options")
86+
87+
set(WARNINGS "-Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls")
88+
set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder -Wno-unused-local-typedefs")
89+
set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}")
90+
91+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")
92+
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
93+
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
94+
95+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
96+
if (BUILD_SHARED_LIBS)
97+
add_definitions(-DBOOST_LOG_DYN_LINK)
98+
endif()
99+
add_definitions(-D_TURN_OFF_PLATFORM_STRING)
48100
else()
49101
message("-- Unknown compiler, success is doubtful.")
50102
endif()
@@ -57,20 +109,21 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
57109
set(AZURESTORAGE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/includes)
58110
set(AZURESTORAGE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/includes ${CASABLANCA_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} ${LibXML++_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${Glibmm_INCLUDE_DIRS})
59111

112+
60113
set(AZURESTORAGE_LIBRARY azurestorage)
61114
set(AZURESTORAGE_LIBRARIES ${AZURESTORAGE_LIBRARY} ${CASABLANCA_LIBRARIES} ${Boost_LIBRARIES} ${Boost_FRAMEWORK} ${OPENSSL_LIBRARIES} ${LibXML++_LIBRARIES} ${UUID_LIBRARIES} ${Glibmm_LIBRARIES})
62115

63116
# Set version numbers centralized
64117
set (AZURESTORAGE_VERSION_MAJOR 2)
65-
set (AZURESTORAGE_VERSION_MINOR 3)
118+
set (AZURESTORAGE_VERSION_MINOR 4)
66119
set (AZURESTORAGE_VERSION_REVISION 0)
67120

68121
# Add sources per configuration
69122
add_subdirectory(src)
70123

71124
if(BUILD_TESTS)
72125
set(AZURESTORAGE_LIBRARY_TEST azurestoragetest)
73-
add_subdirectory(tests)
126+
add_subdirectory(tests)
74127
endif()
75128

76129
if(BUILD_SAMPLES)

0 commit comments

Comments
 (0)