Skip to content

Commit

Permalink
hermes | inspector | Don't include posix headers on non-posix systems
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

Hermes inspector includes pthreads, arpa and sys headers on all OSes that would break vanilla Windows builds. This diff adds a check for posix-compliance before inclusion

(Note: this ignores all push blocking failures!)

Reviewed By: dulinriley

Differential Revision: D20564449

fbshipit-source-id: 8e264bc3104065dc4315bb291e8560609fe65184
  • Loading branch information
Oleg Bogdanov authored and facebook-github-bot committed Mar 25, 2020
1 parent 05e2ec6 commit 79c69be
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions ReactCommon/hermes/inspector/chrome/AutoAttachUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@

#include "AutoAttachUtils.h"

#ifdef _WINDOWS
namespace facebook {
namespace hermes {
namespace inspector {
namespace chrome {
bool isNetworkInspected(
const std::string &,
const std::string &,
const std::string &) {
return false;
}
} // namespace chrome
} // namespace inspector
} // namespace hermes
} // namespace facebook

#else
#include <arpa/inet.h>
#include <sys/socket.h>
#include <unistd.h>
Expand Down Expand Up @@ -130,3 +147,5 @@ bool isNetworkInspected(
} // namespace inspector
} // namespace hermes
} // namespace facebook

#endif
2 changes: 0 additions & 2 deletions ReactCommon/hermes/inspector/detail/SerialExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#include "SerialExecutor.h"

#include <pthread.h>

namespace facebook {
namespace hermes {
namespace inspector {
Expand Down
4 changes: 3 additions & 1 deletion ReactCommon/hermes/inspector/detail/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <functional>
#include <memory>

#ifndef __ANDROID__
#ifdef _WINDOWS
#include <thread>
#elif !defined(__ANDROID__)
#include <pthread.h>
#include <thread>
#endif
Expand Down

0 comments on commit 79c69be

Please sign in to comment.