Skip to content

Commit

Permalink
Reduce stdafx.h header inclusion to avoid running out of memory on *n…
Browse files Browse the repository at this point in the history
…ix boxes in Pipelines (#906)

* Pare down stdafx.h to avoid running out of memory on the Linux builders with ninja.

* Remove ninja -j.
  • Loading branch information
BillyONeal authored Oct 11, 2018
1 parent acd96cf commit b9dd8ea
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 34 deletions.
11 changes: 4 additions & 7 deletions Release/include/cpprest/asyncrt_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@

#pragma once

#include <string>
#include <vector>
#include <chrono>
#include <cstdint>
#include <system_error>
#include <random>
#include <string>
#include <system_error>
#include <vector>
#include <locale.h>
#include <limits.h>
#include "pplx/pplxtasks.h"
#include "cpprest/details/basic_types.h"

#if !defined(_WIN32) || (_MSC_VER >= 1700)
#include <chrono>
#endif

#ifndef _WIN32
#include <sys/time.h>
#if !defined(ANDROID) && !defined(__ANDROID__) && defined(HAVE_XLOCALE_H) // CodePlex 269
Expand Down
1 change: 1 addition & 0 deletions Release/src/http/client/http_client_asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
****/

#include "stdafx.h"
#include <sstream>

#include "../common/internal_http_helpers.h"
#include "cpprest/asyncrt_utils.h"
Expand Down
2 changes: 2 additions & 0 deletions Release/src/http/common/http_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
****/
#include "stdafx.h"
#include <sstream>
#include "../common/internal_http_helpers.h"
#include "cpprest/producerconsumerstream.h"

using namespace web;
using namespace utility;
Expand Down
2 changes: 2 additions & 0 deletions Release/src/http/listener/http_server_asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
#include "stdafx.h"

#include <sstream>
#include <set>
#include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/read_until.hpp>
Expand Down
1 change: 1 addition & 0 deletions Release/src/http/listener/http_server_httpsys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
****/

#include "stdafx.h"
#include "cpprest/rawptrstream.h"

#if _WIN32_WINNT >= _WIN32_WINNT_VISTA

Expand Down
2 changes: 2 additions & 0 deletions Release/src/http/oauth/oauth2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include "stdafx.h"

#include <sstream>

using web::http::client::http_client;
using web::http::client::http_client_config;
using web::http::oauth2::details::oauth2_strings;
Expand Down
18 changes: 0 additions & 18 deletions Release/src/pch/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
#include <stdint.h>
#include <cstdint>
#include <string>
#include <sstream>
#include <thread>
#include <atomic>
#include <signal.h>
#include "pthread.h"
Expand All @@ -75,33 +73,21 @@
// This is to help track how many developers are directly building from source themselves.
#define _CASA_BUILD_FROM_SRC

#include <iostream>
#include <fstream>
#include <algorithm>
#include <exception>
#include <assert.h>
#include <streambuf>
#include <atomic>
#include <mutex>
#include <array>
#include <vector>
#include <memory>
#include <thread>
#include <set>

#include "cpprest/details/cpprest_compat.h"
#include "cpprest/details/basic_types.h"

#include "pplx/pplxtasks.h"
#include "cpprest/version.h"

// streams
#include "cpprest/streams.h"
#include "cpprest/astreambuf.h"
#include "cpprest/rawptrstream.h"
#include "cpprest/interopstream.h"
#include "cpprest/producerconsumerstream.h"

// json
#include "cpprest/json.h"

Expand All @@ -124,10 +110,6 @@
#endif
#include "cpprest/oauth2.h"

// websockets
#include "cpprest/ws_client.h"
#include "cpprest/ws_msg.h"

#if !defined(__cplusplus_winrt)
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
#include "cpprest/details/http_server.h"
Expand Down
1 change: 1 addition & 0 deletions Release/src/pplx/pplxlinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "pplx/pplx.h"
#include "pplx/threadpool.h"
#include "sys/syscall.h"
#include <thread>

#ifdef _WIN32
#error "ERROR: This file should only be included in non-windows Build"
Expand Down
2 changes: 2 additions & 0 deletions Release/src/uri/uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include "stdafx.h"

#include <sstream>

using namespace utility::conversions;

namespace web { namespace details
Expand Down
10 changes: 6 additions & 4 deletions Release/src/uri/uri_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include "stdafx.h"

#include <sstream>

namespace web
{

Expand Down Expand Up @@ -120,8 +122,8 @@ bool uri_builder::is_valid()
return uri::validate(m_uri.join());
}

void uri_builder::append_query_encode_impl(const utility::string_t & name, const utf8string & value)
{
void uri_builder::append_query_encode_impl(const utility::string_t & name, const utf8string & value)
{
utility::string_t encodedQuery = uri::encode_query_impl(utility::conversions::to_utf8string(name));
encodedQuery.append(_XPLATSTR("="));
encodedQuery.append(uri::encode_query_impl(value));
Expand All @@ -130,8 +132,8 @@ void uri_builder::append_query_encode_impl(const utility::string_t & name, const
append_query(encodedQuery, false);
}

void uri_builder::append_query_no_encode_impl(const utility::string_t & name, const utility::string_t & value)
{
void uri_builder::append_query_no_encode_impl(const utility::string_t & name, const utility::string_t & value)
{
append_query(name + _XPLATSTR("=") + value, false);
}

Expand Down
1 change: 1 addition & 0 deletions Release/src/utilities/asyncrt_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <cpprest/asyncrt_utils.h>
#include <algorithm>
#include <string>
#include <sstream>

#ifndef _WIN32
#if defined(__clang__)
Expand Down
3 changes: 2 additions & 1 deletion Release/src/websockets/client/ws_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
****/
#include "stdafx.h"
#include "cpprest/ws_client.h"

#if !defined(CPPREST_EXCLUDE_WEBSOCKETS)

Expand Down Expand Up @@ -91,4 +92,4 @@ pplx::task<websocket_incoming_message> websocket_client_task_impl::receive()

}}}}

#endif
#endif
1 change: 1 addition & 0 deletions Release/src/websockets/client/ws_client_wspp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
****/

#include "stdafx.h"
#include <thread>

#if !defined(CPPREST_EXCLUDE_WEBSOCKETS)

Expand Down
3 changes: 3 additions & 0 deletions Release/src/websockets/client/ws_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
****/
#include "stdafx.h"
#include <sstream>
#include "cpprest/ws_client.h"
#include "cpprest/ws_msg.h"
#include "../../http/common/internal_http_helpers.h"

#if !defined(CPPREST_EXCLUDE_WEBSOCKETS)
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug ..'
- script: |
cd build.debug
ninja -j 4
ninja
displayName: 'Run ninja'
- script: |
cd build.debug/Release/Binaries
Expand All @@ -41,7 +41,7 @@ jobs:
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release ..'
- script: |
cd build.release
ninja -j 4
ninja
displayName: 'Run ninja'
- script: |
cd build.release/Release/Binaries
Expand All @@ -61,7 +61,7 @@ jobs:
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug ..'
- script: |
cd build.debug
ninja -j 4
ninja
displayName: 'Run ninja'
- script: |
cd build.debug/Release/Binaries
Expand All @@ -81,7 +81,7 @@ jobs:
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release ..'
- script: |
cd build.release
ninja -j 4
ninja
displayName: 'Run ninja'
- script: |
cd build.release/Release/Binaries
Expand Down

0 comments on commit b9dd8ea

Please sign in to comment.