diff --git a/.gitignore b/.gitignore index f1cbcd5e8df..ad00da2eefa 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,8 @@ project.xcworkspace # Buck .buckd buck-out +/.lsp.buckd +/.lsp-buck-out /ReactAndroid/src/main/jni/prebuilt/lib/ /ReactAndroid/src/main/gen diff --git a/ReactCommon/hermes/inspector/Exceptions.h b/ReactCommon/hermes/inspector/Exceptions.h index 132af0eb46a..b47f45c83f9 100644 --- a/ReactCommon/hermes/inspector/Exceptions.h +++ b/ReactCommon/hermes/inspector/Exceptions.h @@ -5,7 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#pragma once +// using include guards instead of #pragma once due to compile issues +// with MSVC and BUCK +#ifndef HERMES_INSPECTOR_EXCEPTIONS_H +#define HERMES_INSPECTOR_EXCEPTIONS_H #include @@ -47,3 +50,5 @@ class MultipleCommandsPendingException : public std::runtime_error { } // namespace inspector } // namespace hermes } // namespace facebook + +#endif // HERMES_INSPECTOR_EXCEPTIONS_H diff --git a/ReactCommon/hermes/inspector/Inspector.h b/ReactCommon/hermes/inspector/Inspector.h index 5d98588286d..3e4612530ea 100644 --- a/ReactCommon/hermes/inspector/Inspector.h +++ b/ReactCommon/hermes/inspector/Inspector.h @@ -5,7 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#pragma once +// using include guards instead of #pragma once due to compile issues +// with MSVC and BUCK +#ifndef HERMES_INSPECTOR_INSPECTOR_H +#define HERMES_INSPECTOR_INSPECTOR_H #include #include @@ -362,3 +365,5 @@ class Inspector : public facebook::hermes::debugger::EventObserver, } // namespace inspector } // namespace hermes } // namespace facebook + +#endif // HERMES_INSPECTOR_INSPECTOR_H diff --git a/ReactCommon/hermes/inspector/InspectorState.h b/ReactCommon/hermes/inspector/InspectorState.h index 827f3149f43..67a8fbede47 100644 --- a/ReactCommon/hermes/inspector/InspectorState.h +++ b/ReactCommon/hermes/inspector/InspectorState.h @@ -5,7 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#pragma once +// using include guards instead of #pragma once due to compile issues +// with MSVC and BUCK +#ifndef HERMES_INSPECTOR_INSPECTOR_STATE_H +#define HERMES_INSPECTOR_INSPECTOR_STATE_H #include #include @@ -405,3 +408,5 @@ class InspectorState::Paused : public InspectorState { } // namespace inspector } // namespace hermes } // namespace facebook + +#endif // HERMES_INSPECTOR_INSPECTOR_STATE_H diff --git a/ReactCommon/hermes/inspector/RuntimeAdapter.h b/ReactCommon/hermes/inspector/RuntimeAdapter.h index bfe32c98329..dcf8a008b88 100644 --- a/ReactCommon/hermes/inspector/RuntimeAdapter.h +++ b/ReactCommon/hermes/inspector/RuntimeAdapter.h @@ -11,6 +11,18 @@ #include +#ifndef INSPECTOR_EXPORT +#ifdef _MSC_VER +#ifdef CREATE_SHARED_LIBRARY +#define INSPECTOR_EXPORT __declspec(dllexport) +#else +#define INSPECTOR_EXPORT +#endif // CREATE_SHARED_LIBRARY +#else // _MSC_VER +#define INSPECTOR_EXPORT __attribute__((visibility("default"))) +#endif // _MSC_VER +#endif // !defined(INSPECTOR_EXPORT) + namespace facebook { namespace hermes { namespace inspector { @@ -20,7 +32,7 @@ namespace inspector { * runtime object should stay alive for at least as long as the RuntimeAdapter * is alive. */ -class RuntimeAdapter { +class INSPECTOR_EXPORT RuntimeAdapter { public: virtual ~RuntimeAdapter() = 0; @@ -49,7 +61,7 @@ class RuntimeAdapter { * uses shared_ptr to hold on to the runtime. It's generally only used in tests, * since it does not implement tickleJs. */ -class SharedRuntimeAdapter : public RuntimeAdapter { +class INSPECTOR_EXPORT SharedRuntimeAdapter : public RuntimeAdapter { public: SharedRuntimeAdapter( std::shared_ptr runtime, diff --git a/ReactCommon/hermes/inspector/chrome/Connection.h b/ReactCommon/hermes/inspector/chrome/Connection.h index d8c0fe3197e..0e49e69e0b0 100644 --- a/ReactCommon/hermes/inspector/chrome/Connection.h +++ b/ReactCommon/hermes/inspector/chrome/Connection.h @@ -5,7 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#pragma once +// using include guards instead of #pragma once due to compile issues +// with MSVC and BUCK +#ifndef HERMES_INSPECTOR_CONNECTION_H +#define HERMES_INSPECTOR_CONNECTION_H #include #include @@ -21,7 +24,7 @@ namespace inspector { namespace chrome { /// Connection is a duplex connection between the client and the debugger. -class Connection { +class INSPECTOR_EXPORT Connection { public: /// Connection constructor enables the debugger on the provided runtime. This /// should generally called before you start running any JS in the runtime. @@ -60,3 +63,5 @@ class Connection { } // namespace inspector } // namespace hermes } // namespace facebook + +#endif // HERMES_INSPECTOR_CONNECTION_H diff --git a/ReactCommon/jsi/jsi/instrumentation.h b/ReactCommon/jsi/jsi/instrumentation.h index 548a8c5cad8..04c76ce2594 100644 --- a/ReactCommon/jsi/jsi/instrumentation.h +++ b/ReactCommon/jsi/jsi/instrumentation.h @@ -21,7 +21,7 @@ namespace jsi { /// controls the instrumentation of. /// None of these functions should return newly created jsi values, nor should /// it modify the values of any jsi values in the heap (although GCs are fine). -class Instrumentation { +class JSI_EXPORT Instrumentation { public: virtual ~Instrumentation() = default; diff --git a/ReactCommon/jsi/jsi/jsi.h b/ReactCommon/jsi/jsi/jsi.h index 67823488442..25c152227e6 100644 --- a/ReactCommon/jsi/jsi/jsi.h +++ b/ReactCommon/jsi/jsi/jsi.h @@ -17,11 +17,11 @@ #ifndef JSI_EXPORT #ifdef _MSC_VER -#ifdef JSI_CREATE_SHARED_LIBRARY +#ifdef CREATE_SHARED_LIBRARY #define JSI_EXPORT __declspec(dllexport) #else #define JSI_EXPORT -#endif // JSI_CREATE_SHARED_LIBRARY +#endif // CREATE_SHARED_LIBRARY #else // _MSC_VER #define JSI_EXPORT __attribute__((visibility("default"))) #endif // _MSC_VER @@ -31,14 +31,14 @@ class FBJSRuntime; namespace facebook { namespace jsi { -class Buffer { +class JSI_EXPORT Buffer { public: virtual ~Buffer(); virtual size_t size() const = 0; virtual const uint8_t* data() const = 0; }; -class StringBuffer : public Buffer { +class JSI_EXPORT StringBuffer : public Buffer { public: StringBuffer(std::string s) : s_(std::move(s)) {} size_t size() const override { @@ -56,7 +56,7 @@ class StringBuffer : public Buffer { /// form optimized for execution, in a runtime-specific way. Construct one via /// jsi::Runtime::prepareJavaScript(). /// ** This is an experimental API that is subject to change. ** -class PreparedJavaScript { +class JSI_EXPORT PreparedJavaScript { protected: PreparedJavaScript() = default; @@ -145,7 +145,7 @@ class JSI_EXPORT HostObject { /// in a non-Runtime-managed object, and not clean it up before the Runtime /// is shut down. If your lifecycle is such that avoiding this is hard, /// you will probably need to do use your own locks. -class Runtime { +class JSI_EXPORT Runtime { public: virtual ~Runtime(); @@ -326,7 +326,7 @@ class Runtime { }; // Base class for pointer-storing types. -class Pointer { +class JSI_EXPORT Pointer { protected: explicit Pointer(Pointer&& other) : ptr_(other.ptr_) { other.ptr_ = nullptr; @@ -349,7 +349,7 @@ class Pointer { }; /// Represents something that can be a JS property key. Movable, not copyable. -class PropNameID : public Pointer { +class JSI_EXPORT PropNameID : public Pointer { public: using Pointer::Pointer; @@ -423,7 +423,7 @@ class PropNameID : public Pointer { /// the debugger not to crash when a Symbol is a property in an Object /// or element in an array. Complete support for creating will come /// later. -class Symbol : public Pointer { +class JSI_EXPORT Symbol : public Pointer { public: using Pointer::Pointer; @@ -446,7 +446,7 @@ class Symbol : public Pointer { }; /// Represents a JS String. Movable, not copyable. -class String : public Pointer { +class JSI_EXPORT String : public Pointer { public: using Pointer::Pointer; @@ -504,7 +504,7 @@ class Array; class Function; /// Represents a JS Object. Movable, not copyable. -class Object : public Pointer { +class JSI_EXPORT Object : public Pointer { public: using Pointer::Pointer; @@ -692,7 +692,7 @@ class Object : public Pointer { /// Represents a weak reference to a JS Object. If the only reference /// to an Object are these, the object is eligible for GC. Method /// names are inspired by C++ weak_ptr. Movable, not copyable. -class WeakObject : public Pointer { +class JSI_EXPORT WeakObject : public Pointer { public: using Pointer::Pointer; @@ -714,7 +714,7 @@ class WeakObject : public Pointer { /// Represents a JS Object which can be efficiently used as an array /// with integral indices. -class Array : public Object { +class JSI_EXPORT Array : public Object { public: Array(Array&&) = default; /// Creates a new Array instance, with \c length undefined elements. @@ -769,7 +769,7 @@ class Array : public Object { }; /// Represents a JSArrayBuffer -class ArrayBuffer : public Object { +class JSI_EXPORT ArrayBuffer : public Object { public: ArrayBuffer(ArrayBuffer&&) = default; ArrayBuffer& operator=(ArrayBuffer&&) = default; @@ -796,7 +796,7 @@ class ArrayBuffer : public Object { }; /// Represents a JS Object which is guaranteed to be Callable. -class Function : public Object { +class JSI_EXPORT Function : public Object { public: Function(Function&&) = default; Function& operator=(Function&&) = default; @@ -906,7 +906,7 @@ class Function : public Object { /// Represents any JS Value (undefined, null, boolean, number, symbol, /// string, or object). Movable, or explicitly copyable (has no copy /// ctor). -class Value { +class JSI_EXPORT Value { public: /// Default ctor creates an \c undefined JS value. Value() : Value(UndefinedKind) {} @@ -1178,7 +1178,7 @@ class Value { /// Instances of this class are intended to be created as automatic stack /// variables in which case destructor calls don't require any additional /// locking, provided that the lock (if any) is managed with RAII helpers. -class Scope { +class JSI_EXPORT Scope { public: explicit Scope(Runtime& rt) : rt_(rt), prv_(rt.pushScope()) {} ~Scope() { diff --git a/ReactCommon/jsinspector/InspectorInterfaces.h b/ReactCommon/jsinspector/InspectorInterfaces.h index 32178e7b9a0..345434be2f6 100644 --- a/ReactCommon/jsinspector/InspectorInterfaces.h +++ b/ReactCommon/jsinspector/InspectorInterfaces.h @@ -12,6 +12,18 @@ #include #include +#ifndef JSINSPECTOR_EXPORT +#ifdef _MSC_VER +#ifdef CREATE_SHARED_LIBRARY +#define JSINSPECTOR_EXPORT __declspec(dllexport) +#else +#define JSINSPECTOR_EXPORT +#endif // CREATE_SHARED_LIBRARY +#else // _MSC_VER +#define JSINSPECTOR_EXPORT __attribute__((visibility("default"))) +#endif // _MSC_VER +#endif // !defined(JSINSPECTOR_EXPORT) + namespace facebook { namespace react { @@ -27,7 +39,7 @@ struct InspectorPage { }; /// IRemoteConnection allows the VM to send debugger messages to the client. -class IRemoteConnection : public IDestructible { +class JSINSPECTOR_EXPORT IRemoteConnection : public IDestructible { public: virtual ~IRemoteConnection() = 0; virtual void onMessage(std::string message) = 0; @@ -35,7 +47,7 @@ class IRemoteConnection : public IDestructible { }; /// ILocalConnection allows the client to send debugger messages to the VM. -class ILocalConnection : public IDestructible { +class JSINSPECTOR_EXPORT ILocalConnection : public IDestructible { public: virtual ~ILocalConnection() = 0; virtual void sendMessage(std::string message) = 0; @@ -43,7 +55,7 @@ class ILocalConnection : public IDestructible { }; /// IInspector tracks debuggable JavaScript targets (pages). -class IInspector : public IDestructible { +class JSINSPECTOR_EXPORT IInspector : public IDestructible { public: using ConnectFunc = std::function( std::unique_ptr)>;