|
| 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. |
0 commit comments