From 5ea4f9abafc7e8a32c57547f731622ca632c2d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 7 May 2020 18:43:55 +0200 Subject: [PATCH 01/22] [CocoaPods] Add Hermes and get app to build & run --- RNTester/Podfile | 1 + RNTester/Podfile.lock | 9 +++++++++ RNTester/RNTester-macOS/RNTester_macOS.entitlements | 2 ++ ReactCommon/cxxreact/React-cxxreact.podspec | 2 ++ 4 files changed, 14 insertions(+) diff --git a/RNTester/Podfile b/RNTester/Podfile index d402ce4ab53374..3b507221fae25e 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -118,6 +118,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' + pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => 'f9e7bdc495b033ccac2b4a838f0264f4846d2887' pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index c4f0cbd821d554..bed0292a2fa740 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -343,6 +343,7 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) + - hermes (from `https://github.com/alloy/hermes.git`, commit `f9e7bdc495b033ccac2b4a838f0264f4846d2887`) - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) - React (from `../`) @@ -398,6 +399,9 @@ EXTERNAL SOURCES: :podspec: "../third-party-podspecs/Folly.podspec" glog: :podspec: "../third-party-podspecs/glog.podspec" + hermes: + :commit: f9e7bdc495b033ccac2b4a838f0264f4846d2887 + :git: https://github.com/alloy/hermes.git RCTRequired: :path: "../Libraries/RCTRequired" RCTTypeSafety: @@ -445,6 +449,11 @@ EXTERNAL SOURCES: Yoga: :path: "../ReactCommon/yoga" +CHECKOUT OPTIONS: + hermes: + :commit: f9e7bdc495b033ccac2b4a838f0264f4846d2887 + :git: https://github.com/alloy/hermes.git + SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 diff --git a/RNTester/RNTester-macOS/RNTester_macOS.entitlements b/RNTester/RNTester-macOS/RNTester_macOS.entitlements index 36fe293685410b..3879a569d09f88 100644 --- a/RNTester/RNTester-macOS/RNTester_macOS.entitlements +++ b/RNTester/RNTester-macOS/RNTester_macOS.entitlements @@ -2,6 +2,8 @@ + com.apple.security.cs.disable-library-validation + com.apple.security.get-task-allow com.apple.security.personal-information.photos-library diff --git a/ReactCommon/cxxreact/React-cxxreact.podspec b/ReactCommon/cxxreact/React-cxxreact.podspec index d4b42eaca43020..fabfbf6b836952 100644 --- a/ReactCommon/cxxreact/React-cxxreact.podspec +++ b/ReactCommon/cxxreact/React-cxxreact.podspec @@ -40,4 +40,6 @@ Pod::Spec.new do |s| s.dependency "Folly", folly_version s.dependency "glog" s.dependency "React-jsinspector", version + + s.osx.dependency "hermes" # TODO(macOS GH#214) end From dabc0e730e40a82f15e12c7c2fc01b3a80a62920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 8 May 2020 14:49:14 +0200 Subject: [PATCH 02/22] [Hermes] Create instance of VM from within Cxx codebase Closes https://github.com/microsoft/react-native-macos/projects/4#card-37781762 --- .../RNTesterPods.xcodeproj/project.pbxproj | 54 +++++++++++++++++++ React/CxxBridge/RCTCxxBridge.mm | 7 +++ 2 files changed, 61 insertions(+) diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 232ec1a5d64c32..2207e4ecfae792 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -731,6 +731,7 @@ 9F153459233AB2C4006DFE44 /* Resources */, 38C8132424577FB500BFFA62 /* Build JS Bundle */, 51B9D81723C4D5A4002B30E1 /* Start Metro */, + 52C05E8F0A0D42391FED0384 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -750,6 +751,7 @@ 9F15346A233AB2C7006DFE44 /* Frameworks */, 9F15346B233AB2C7006DFE44 /* Resources */, 3882C0E12445655100E92FB9 /* Copy Files (1 item) */, + FCD2DDFC0BFB9BB094987AD7 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -769,6 +771,7 @@ 9F153474233AB2C7006DFE44 /* Sources */, 9F153475233AB2C7006DFE44 /* Frameworks */, 9F153476233AB2C7006DFE44 /* Resources */, + A36BB805A218F9C565B51C6E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -1042,6 +1045,23 @@ shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; showEnvVarsInLog = 0; }; + 52C05E8F0A0D42391FED0384 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 56D84768A7BBB2750D674CF3 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1137,6 +1157,23 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; }; + A36BB805A218F9C565B51C6E /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; DFD62DE759BFAB8AABFA4179 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1199,6 +1236,23 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + FCD2DDFC0BFB9BB094987AD7 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index f24da99d851387..c151a44983f374 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -42,6 +42,10 @@ #import "RCTMessageThread.h" #import "RCTObjcExecutor.h" +#if TARGET_OS_OSX +#import +#endif + #ifdef WITH_FBSYSTRACE #import #endif @@ -347,6 +351,9 @@ - (void)start executorFactory = [cxxDelegate jsExecutorFactoryForBridge:self]; } if (!executorFactory) { +#if TARGET_OS_OSX + auto _runtime = facebook::hermes::makeHermesRuntime(); +#endif executorFactory = std::make_shared(nullptr); } } else { From b82f58109beb9f7e31c72a1102f17d7e2881de0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 12 May 2020 11:38:29 +0200 Subject: [PATCH 03/22] [Hermes] Actually use Hermes for RN bridge. --- RNTester/Podfile | 2 +- RNTester/Podfile.lock | 6 +- React-Core.podspec | 2 +- React/CxxBridge/HermesExecutorFactory.h | 50 +++++ React/CxxBridge/HermesExecutorFactory.mm | 233 +++++++++++++++++++++++ React/CxxBridge/RCTCxxBridge.mm | 19 +- 6 files changed, 300 insertions(+), 12 deletions(-) create mode 100644 React/CxxBridge/HermesExecutorFactory.h create mode 100644 React/CxxBridge/HermesExecutorFactory.mm diff --git a/RNTester/Podfile b/RNTester/Podfile index 3b507221fae25e..2166e6f6c44cd2 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -118,7 +118,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' - pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => 'f9e7bdc495b033ccac2b4a838f0264f4846d2887' + pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => '84108dac91a066eabbc41e0a5b5a197dd627d9d5' pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index bed0292a2fa740..e33cb6e5f57001 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -343,7 +343,7 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) - - hermes (from `https://github.com/alloy/hermes.git`, commit `f9e7bdc495b033ccac2b4a838f0264f4846d2887`) + - hermes (from `https://github.com/alloy/hermes.git`, commit `84108dac91a066eabbc41e0a5b5a197dd627d9d5`) - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) - React (from `../`) @@ -400,7 +400,7 @@ EXTERNAL SOURCES: glog: :podspec: "../third-party-podspecs/glog.podspec" hermes: - :commit: f9e7bdc495b033ccac2b4a838f0264f4846d2887 + :commit: 84108dac91a066eabbc41e0a5b5a197dd627d9d5 :git: https://github.com/alloy/hermes.git RCTRequired: :path: "../Libraries/RCTRequired" @@ -451,7 +451,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: hermes: - :commit: f9e7bdc495b033ccac2b4a838f0264f4846d2887 + :commit: 84108dac91a066eabbc41e0a5b5a197dd627d9d5 :git: https://github.com/alloy/hermes.git SPEC CHECKSUMS: diff --git a/React-Core.podspec b/React-Core.podspec index 762f947ab60c76..5bf3e3605ae56d 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -58,7 +58,7 @@ Pod::Spec.new do |s| "React/DevSupport/**/*", "React/Fabric/**/*", "React/Inspector/**/*" - ss.ios.exclude_files = "React/**/RCTTV*.*", + ss.ios.exclude_files = "React/**/RCTTV*.*", "React/CxxBridge/HermesExecutorFactory.*" # [TODO(macOS ISS#2323203) "**/MacOS/*" diff --git a/React/CxxBridge/HermesExecutorFactory.h b/React/CxxBridge/HermesExecutorFactory.h new file mode 100644 index 00000000000000..5913317e243328 --- /dev/null +++ b/React/CxxBridge/HermesExecutorFactory.h @@ -0,0 +1,50 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +class HermesExecutorFactory : public JSExecutorFactory { + public: + explicit HermesExecutorFactory( + JSIExecutor::RuntimeInstaller runtimeInstaller, + const JSIScopedTimeoutInvoker& timeoutInvoker = + JSIExecutor::defaultTimeoutInvoker, + ::hermes::vm::RuntimeConfig runtimeConfig = ::hermes::vm::RuntimeConfig()) + : runtimeInstaller_(runtimeInstaller), + timeoutInvoker_(timeoutInvoker), + runtimeConfig_(std::move(runtimeConfig)) { + assert(timeoutInvoker_ && "Should not have empty timeoutInvoker"); + } + + std::unique_ptr createJSExecutor( + std::shared_ptr delegate, + std::shared_ptr jsQueue) override; + + private: + JSIExecutor::RuntimeInstaller runtimeInstaller_; + JSIScopedTimeoutInvoker timeoutInvoker_; + ::hermes::vm::RuntimeConfig runtimeConfig_; +}; + +class HermesExecutor : public JSIExecutor { + public: + HermesExecutor( + std::shared_ptr runtime, + std::shared_ptr delegate, + std::shared_ptr jsQueue, + const JSIScopedTimeoutInvoker& timeoutInvoker, + RuntimeInstaller runtimeInstaller); + + private: + JSIScopedTimeoutInvoker timeoutInvoker_; +}; + +} // namespace react +} // namespace facebook diff --git a/React/CxxBridge/HermesExecutorFactory.mm b/React/CxxBridge/HermesExecutorFactory.mm new file mode 100644 index 00000000000000..91e03389b771e6 --- /dev/null +++ b/React/CxxBridge/HermesExecutorFactory.mm @@ -0,0 +1,233 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include "HermesExecutorFactory.h" + +#include + +#include +#include +#include +#include + +#ifdef HERMES_ENABLE_DEBUGGER +#include +#include +#endif + +//#include "JSITracing.h" + +using namespace facebook::hermes; +using namespace facebook::jsi; + +namespace facebook { +namespace react { + +namespace { + +std::unique_ptr makeHermesRuntimeSystraced( + const ::hermes::vm::RuntimeConfig &runtimeConfig) { + SystraceSection s("HermesExecutorFactory::makeHermesRuntimeSystraced"); + return hermes::makeHermesRuntime(runtimeConfig); +} + +#ifdef HERMES_ENABLE_DEBUGGER + +class HermesExecutorRuntimeAdapter + : public facebook::hermes::inspector::RuntimeAdapter { + public: + HermesExecutorRuntimeAdapter( + std::shared_ptr runtime, + HermesRuntime &hermesRuntime, + std::shared_ptr thread) + : runtime_(runtime), + hermesRuntime_(hermesRuntime), + thread_(std::move(thread)) {} + + virtual ~HermesExecutorRuntimeAdapter() = default; + + HermesRuntime &getRuntime() override { + return hermesRuntime_; + } + + void tickleJs() override { + // The queue will ensure that runtime_ is still valid when this + // gets invoked. + // clang-format off + thread_->runOnQueue([&runtime = hermesRuntime_]() { + // clang-format on + auto func = runtime.global().getPropertyAsFunction(runtime, "__tickleJs"); + func.call(runtime); + }); + } + + private: + std::shared_ptr runtime_; + HermesRuntime &hermesRuntime_; + + std::shared_ptr thread_; +}; + +#endif + +struct ReentrancyCheck { +// This is effectively a very subtle and complex assert, so only +// include it in builds which would include asserts. +#ifndef NDEBUG + ReentrancyCheck() : tid(std::thread::id()), depth(0) {} + + void before() { + std::thread::id this_id = std::this_thread::get_id(); + std::thread::id expected = std::thread::id(); + + // A note on memory ordering: the main purpose of these checks is + // to observe a before/before race, without an intervening after. + // This will be detected by the compare_exchange_strong atomicity + // properties, regardless of memory order. + // + // For everything else, it is easiest to think of 'depth' as a + // proxy for any access made inside the VM. If access to depth + // are reordered incorrectly, the same could be true of any other + // operation made by the VM. In fact, using acquire/release + // memory ordering could create barriers which mask a programmer + // error. So, we use relaxed memory order, to avoid masking + // actual ordering errors. Although, in practice, ordering errors + // of this sort would be surprising, because the decorator would + // need to call after() without before(). + + if (tid.compare_exchange_strong( + expected, this_id, std::memory_order_relaxed)) { + // Returns true if tid and expected were the same. If they + // were, then the stored tid referred to no thread, and we + // atomically saved this thread's tid. Now increment depth. + assert(depth == 0 && "No thread id, but depth != 0"); + ++depth; + } else if (expected == this_id) { + // If the stored tid referred to a thread, expected was set to + // that value. If that value is this thread's tid, that's ok, + // just increment depth again. + assert(depth != 0 && "Thread id was set, but depth == 0"); + ++depth; + } else { + // The stored tid was some other thread. This indicates a bad + // programmer error, where VM methods were called on two + // different threads unsafely. Fail fast (and hard) so the + // crash can be analyzed. + __builtin_trap(); + } + } + + void after() { + assert( + tid.load(std::memory_order_relaxed) == std::this_thread::get_id() && + "No thread id in after()"); + if (--depth == 0) { + // If we decremented depth to zero, store no-thread into tid. + std::thread::id expected = std::this_thread::get_id(); + bool didWrite = tid.compare_exchange_strong( + expected, std::thread::id(), std::memory_order_relaxed); + assert(didWrite && "Decremented to zero, but no tid write"); + } + } + + std::atomic tid; + // This is not atomic, as it is only written or read from the owning + // thread. + unsigned int depth; +#endif +}; + +// This adds ReentrancyCheck and debugger enable/teardown to the given +// Runtime. +class DecoratedRuntime : public jsi::WithRuntimeDecorator { + public: + // The first argument may be a tracing runtime which itself + // decorates the real HermesRuntime, depending on the build config. + // The second argument is the the real HermesRuntime as well to + // manage the debugger registration. + DecoratedRuntime( + std::unique_ptr runtime, + HermesRuntime &hermesRuntime, + std::shared_ptr jsQueue) + : jsi::WithRuntimeDecorator(*runtime, reentrancyCheck_), + runtime_(std::move(runtime)), + hermesRuntime_(hermesRuntime) { +#ifdef HERMES_ENABLE_DEBUGGER + auto adapter = std::make_unique( + runtime_, hermesRuntime_, jsQueue); + facebook::hermes::inspector::chrome::enableDebugging( + std::move(adapter), "Hermes React Native"); +#else + (void)hermesRuntime_; +#endif + } + + ~DecoratedRuntime() { +#ifdef HERMES_ENABLE_DEBUGGER + facebook::hermes::inspector::chrome::disableDebugging(hermesRuntime_); +#endif + } + + private: + // runtime_ is a TracingRuntime, but we don't need to worry about + // the details. hermesRuntime is a reference to the HermesRuntime + // managed by the TracingRuntime. + // + // HermesExecutorRuntimeAdapter requirements are kept, because the + // dtor will disable debugging on the HermesRuntime before the + // member managing it is destroyed. + + std::shared_ptr runtime_; + ReentrancyCheck reentrancyCheck_; + HermesRuntime &hermesRuntime_; +}; + +} // namespace + +std::unique_ptr HermesExecutorFactory::createJSExecutor( + std::shared_ptr delegate, + std::shared_ptr jsQueue) { +// std::unique_ptr hermesRuntime = +// makeHermesRuntimeSystraced(runtimeConfig_); +// HermesRuntime& hermesRuntimeRef = *hermesRuntime; +// auto decoratedRuntime = std::make_shared( +// makeTracingHermesRuntime(std::move(hermesRuntime), runtimeConfig_), +// hermesRuntimeRef, +// jsQueue); +// +// // So what do we have now? +// // DecoratedRuntime -> TracingRuntime -> HermesRuntime +// // +// // DecoratedRuntime is held by JSIExecutor. When it gets used, it +// // will check that it's on the right thread, do any necessary trace +// // logging, then call the real HermesRuntime. When it is destroyed, +// // it will shut down the debugger before the HermesRuntime is. In +// // the normal case where tracing and debugging are not compiled in, +// // all that's left is the thread checking. +// +// // Add js engine information to Error.prototype so in error reporting we +// // can send this information. +// auto errorPrototype = +// decoratedRuntime->global() +// .getPropertyAsObject(*decoratedRuntime, "Error") +// .getPropertyAsObject(*decoratedRuntime, "prototype"); +// errorPrototype.setProperty(*decoratedRuntime, "jsEngine", "hermes"); +// +// return std::make_unique( +// decoratedRuntime, delegate, jsQueue, timeoutInvoker_, runtimeInstaller_); + + auto runtime = hermes::makeHermesRuntime(runtimeConfig_); + return std::make_unique(std::move(runtime), delegate, jsQueue, timeoutInvoker_, runtimeInstaller_); +} + +HermesExecutor::HermesExecutor( + std::shared_ptr runtime, + std::shared_ptr delegate, + std::shared_ptr jsQueue, + const JSIScopedTimeoutInvoker &timeoutInvoker, + RuntimeInstaller runtimeInstaller) + : JSIExecutor(runtime, delegate, timeoutInvoker, runtimeInstaller) { +// jsi::addNativeTracingHooks(*runtime); +} + +} // namespace react +} // namespace facebook diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index c151a44983f374..9bc36bdb5b244d 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -37,15 +37,19 @@ #import #import +#if TARGET_OS_OSX +#define RCT_USE_HERMES 1 +#endif +#if RCT_USE_HERMES +#import "HermesExecutorFactory.h" +#else #import "JSCExecutorFactory.h" +#endif + #import "NSDataBigString.h" #import "RCTMessageThread.h" #import "RCTObjcExecutor.h" -#if TARGET_OS_OSX -#import -#endif - #ifdef WITH_FBSYSTRACE #import #endif @@ -351,10 +355,11 @@ - (void)start executorFactory = [cxxDelegate jsExecutorFactoryForBridge:self]; } if (!executorFactory) { -#if TARGET_OS_OSX - auto _runtime = facebook::hermes::makeHermesRuntime(); -#endif +#if RCT_USE_HERMES + executorFactory = std::make_shared(nullptr); +#else executorFactory = std::make_shared(nullptr); +#endif } } else { id objcExecutor = [self moduleForClass:self.executorClass]; From 7248255279b644c984a6274f96015ad5fe207329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 13 May 2020 18:19:40 +0200 Subject: [PATCH 04/22] [Hermes] Use a release build to speed things up --- RNTester/Podfile | 2 +- RNTester/Podfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index 2166e6f6c44cd2..f82ef126e5e98b 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -118,7 +118,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' - pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => '84108dac91a066eabbc41e0a5b5a197dd627d9d5' + pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => '4af03d10f76418a781b51e8434efeceee015ce5a' pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index e33cb6e5f57001..0d2788d15164b3 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -343,7 +343,7 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) - - hermes (from `https://github.com/alloy/hermes.git`, commit `84108dac91a066eabbc41e0a5b5a197dd627d9d5`) + - hermes (from `https://github.com/alloy/hermes.git`, commit `4af03d10f76418a781b51e8434efeceee015ce5a`) - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) - React (from `../`) @@ -400,7 +400,7 @@ EXTERNAL SOURCES: glog: :podspec: "../third-party-podspecs/glog.podspec" hermes: - :commit: 84108dac91a066eabbc41e0a5b5a197dd627d9d5 + :commit: 4af03d10f76418a781b51e8434efeceee015ce5a :git: https://github.com/alloy/hermes.git RCTRequired: :path: "../Libraries/RCTRequired" @@ -451,7 +451,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: hermes: - :commit: 84108dac91a066eabbc41e0a5b5a197dd627d9d5 + :commit: 4af03d10f76418a781b51e8434efeceee015ce5a :git: https://github.com/alloy/hermes.git SPEC CHECKSUMS: From a964b7ac3818d884158848a7ba5b7e06cd4c9bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 13 May 2020 19:02:49 +0200 Subject: [PATCH 05/22] [Hermes] Use a binary distribution for now --- RNTester/Podfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index f82ef126e5e98b..3b7b38d3a361d5 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -118,7 +118,8 @@ end target 'RNTester-macOS' do platform :osx, '10.14' - pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => '4af03d10f76418a781b51e8434efeceee015ce5a' + # pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => '4af03d10f76418a781b51e8434efeceee015ce5a' + pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.2.1/hermes-macos-0.2.1.zip', :flatten => true pods() end From cb48b3cb57d32a1753b6f60f3267f541e79790a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 13 May 2020 21:54:28 +0200 Subject: [PATCH 06/22] [Hermes] Fix binary distribution --- RNTester/Podfile | 2 +- RNTester/Podfile.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index 3b7b38d3a361d5..bf1fd11b00ec5c 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -119,7 +119,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' # pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => '4af03d10f76418a781b51e8434efeceee015ce5a' - pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.2.1/hermes-macos-0.2.1.zip', :flatten => true + pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip', :flatten => true pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 0d2788d15164b3..6079c0b63cec4f 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -343,7 +343,7 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) - - hermes (from `https://github.com/alloy/hermes.git`, commit `4af03d10f76418a781b51e8434efeceee015ce5a`) + - "hermes (from `{:http=>\"https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip\", :flatten=>true}`)" - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) - React (from `../`) @@ -400,8 +400,8 @@ EXTERNAL SOURCES: glog: :podspec: "../third-party-podspecs/glog.podspec" hermes: - :commit: 4af03d10f76418a781b51e8434efeceee015ce5a - :git: https://github.com/alloy/hermes.git + :flatten: true + :http: https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip RCTRequired: :path: "../Libraries/RCTRequired" RCTTypeSafety: @@ -451,8 +451,8 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: hermes: - :commit: 4af03d10f76418a781b51e8434efeceee015ce5a - :git: https://github.com/alloy/hermes.git + :flatten: true + :http: https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 From 4f2fbd9ec9b0c902192c5882773abecea67708f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 15 May 2020 14:55:06 +0200 Subject: [PATCH 07/22] [Hermes] Bind native logger, which enables console.js polyfill This fixes the lack of console.assert and consequent exception from event-target-shim.js Fixes https://github.com/microsoft/react-native-macos/projects/4#card-38201832 --- React/CxxBridge/HermesExecutorFactory.mm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/React/CxxBridge/HermesExecutorFactory.mm b/React/CxxBridge/HermesExecutorFactory.mm index 91e03389b771e6..941fe725dadca0 100644 --- a/React/CxxBridge/HermesExecutorFactory.mm +++ b/React/CxxBridge/HermesExecutorFactory.mm @@ -9,6 +9,8 @@ #include #include +#import + #ifdef HERMES_ENABLE_DEBUGGER #include #include @@ -215,8 +217,21 @@ void after() { // return std::make_unique( // decoratedRuntime, delegate, jsQueue, timeoutInvoker_, runtimeInstaller_); + auto installBindings = [runtimeInstaller=runtimeInstaller_](jsi::Runtime &runtime) { + react::Logger iosLoggingBinder = [](const std::string &message, unsigned int logLevel) { + _RCTLogJavaScriptInternal( + static_cast(logLevel), + [NSString stringWithUTF8String:message.c_str()]); + }; + react::bindNativeLogger(runtime, iosLoggingBinder); + // Wrap over the original runtimeInstaller + if (runtimeInstaller) { + runtimeInstaller(runtime); + } + }; + auto runtime = hermes::makeHermesRuntime(runtimeConfig_); - return std::make_unique(std::move(runtime), delegate, jsQueue, timeoutInvoker_, runtimeInstaller_); + return std::make_unique(std::move(runtime), delegate, jsQueue, timeoutInvoker_, std::move(installBindings)); } HermesExecutor::HermesExecutor( From a710e8bdf62901543321f7add79d797c42914fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 15 May 2020 17:41:54 +0200 Subject: [PATCH 08/22] [Hermes] Add reentrancy check Closes https://github.com/microsoft/react-native-macos/projects/4#card-38298715 --- React/CxxBridge/HermesExecutorFactory.mm | 92 +++++++++++------------- 1 file changed, 41 insertions(+), 51 deletions(-) diff --git a/React/CxxBridge/HermesExecutorFactory.mm b/React/CxxBridge/HermesExecutorFactory.mm index 941fe725dadca0..fa88eb6b1c5a1b 100644 --- a/React/CxxBridge/HermesExecutorFactory.mm +++ b/React/CxxBridge/HermesExecutorFactory.mm @@ -1,3 +1,5 @@ +// TODO: Share code with the Android HermesExecutorFactory.cpp module. + // Copyright 2004-present Facebook. All Rights Reserved. #include "HermesExecutorFactory.h" @@ -16,8 +18,6 @@ #include #endif -//#include "JSITracing.h" - using namespace facebook::hermes; using namespace facebook::jsi; @@ -26,12 +26,6 @@ namespace { -std::unique_ptr makeHermesRuntimeSystraced( - const ::hermes::vm::RuntimeConfig &runtimeConfig) { - SystraceSection s("HermesExecutorFactory::makeHermesRuntimeSystraced"); - return hermes::makeHermesRuntime(runtimeConfig); -} - #ifdef HERMES_ENABLE_DEBUGGER class HermesExecutorRuntimeAdapter @@ -188,50 +182,46 @@ void after() { std::unique_ptr HermesExecutorFactory::createJSExecutor( std::shared_ptr delegate, std::shared_ptr jsQueue) { -// std::unique_ptr hermesRuntime = -// makeHermesRuntimeSystraced(runtimeConfig_); -// HermesRuntime& hermesRuntimeRef = *hermesRuntime; -// auto decoratedRuntime = std::make_shared( -// makeTracingHermesRuntime(std::move(hermesRuntime), runtimeConfig_), -// hermesRuntimeRef, -// jsQueue); -// -// // So what do we have now? -// // DecoratedRuntime -> TracingRuntime -> HermesRuntime -// // -// // DecoratedRuntime is held by JSIExecutor. When it gets used, it -// // will check that it's on the right thread, do any necessary trace -// // logging, then call the real HermesRuntime. When it is destroyed, -// // it will shut down the debugger before the HermesRuntime is. In -// // the normal case where tracing and debugging are not compiled in, -// // all that's left is the thread checking. -// -// // Add js engine information to Error.prototype so in error reporting we -// // can send this information. -// auto errorPrototype = -// decoratedRuntime->global() -// .getPropertyAsObject(*decoratedRuntime, "Error") -// .getPropertyAsObject(*decoratedRuntime, "prototype"); -// errorPrototype.setProperty(*decoratedRuntime, "jsEngine", "hermes"); -// -// return std::make_unique( -// decoratedRuntime, delegate, jsQueue, timeoutInvoker_, runtimeInstaller_); - - auto installBindings = [runtimeInstaller=runtimeInstaller_](jsi::Runtime &runtime) { - react::Logger iosLoggingBinder = [](const std::string &message, unsigned int logLevel) { - _RCTLogJavaScriptInternal( - static_cast(logLevel), - [NSString stringWithUTF8String:message.c_str()]); + auto hermesRuntime = hermes::makeHermesRuntime(runtimeConfig_); + HermesRuntime& hermesRuntimeRef = *hermesRuntime; + auto decoratedRuntime = std::make_shared( + std::move(hermesRuntime), hermesRuntimeRef, jsQueue); + // So what do we have now? + // DecoratedRuntime -> HermesRuntime + // + // DecoratedRuntime is held by JSIExecutor. When it gets used, it + // will check that it's on the right thread, do any necessary trace + // logging, then call the real HermesRuntime. When it is destroyed, + // it will shut down the debugger before the HermesRuntime is. In + // the normal case where tracing and debugging are not compiled in, + // all that's left is the thread checking. + + // Add js engine information to Error.prototype so in error reporting we + // can send this information. + auto errorPrototype = + decoratedRuntime->global() + .getPropertyAsObject(*decoratedRuntime, "Error") + .getPropertyAsObject(*decoratedRuntime, "prototype"); + errorPrototype.setProperty(*decoratedRuntime, "jsEngine", "hermes"); + + // TODO: Share with JSCExecutorFactory.mm + auto installBindings = + [runtimeInstaller=runtimeInstaller_](jsi::Runtime &runtime) { + react::Logger iosLoggingBinder = + [](const std::string &message, unsigned int logLevel) { + _RCTLogJavaScriptInternal( + static_cast(logLevel), + [NSString stringWithUTF8String:message.c_str()]); + }; + react::bindNativeLogger(runtime, iosLoggingBinder); + // Wrap over the original runtimeInstaller + if (runtimeInstaller) { + runtimeInstaller(runtime); + } }; - react::bindNativeLogger(runtime, iosLoggingBinder); - // Wrap over the original runtimeInstaller - if (runtimeInstaller) { - runtimeInstaller(runtime); - } - }; - - auto runtime = hermes::makeHermesRuntime(runtimeConfig_); - return std::make_unique(std::move(runtime), delegate, jsQueue, timeoutInvoker_, std::move(installBindings)); + + return std::make_unique(decoratedRuntime, delegate, jsQueue, + timeoutInvoker_, std::move(installBindings)); } HermesExecutor::HermesExecutor( From c12739478a959fce41330fc189656a19746bf000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 15 May 2020 19:33:13 +0200 Subject: [PATCH 09/22] [Hermes] Compile and use bytecode bundle with RNTester Closes https://github.com/microsoft/react-native-macos/projects/4#card-38307271 --- scripts/react-native-xcode.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 8f57fff51f28a8..76e76d72e8fb8f 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -108,13 +108,15 @@ source "$REACT_NATIVE_DIR/scripts/node-binary.sh" [ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle" +[ -z "$HERMES_PATH" ] && HERMES_PATH="$PROJECT_ROOT/RNTester/Pods/hermes/destroot/bin/hermes" + if [[ -z "$BUNDLE_CONFIG" ]]; then CONFIG_ARG="" else CONFIG_ARG="--config $BUNDLE_CONFIG" fi -BUNDLE_FILE="$DEST/main.jsbundle" +BUNDLE_FILE="$CONFIGURATION_BUILD_DIR/main.jsbundle" case "$PLATFORM_NAME" in "macosx") @@ -141,6 +143,9 @@ fi $EXTRA_ARGS \ $EXTRA_PACKAGER_ARGS +# TODO: Emit source-map for release builds +"$HERMES_PATH" -emit-binary -out "$DEST/main.jsbundle" "$BUNDLE_FILE" + if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then echo "error: File $BUNDLE_FILE does not exist. This must be a bug with" >&2 echo "React Native, please report it here: https://github.com/facebook/react-native/issues" From 45ef55ef9bbf2e43d0b9da1603a9b0555b2428a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Sat, 23 May 2020 19:27:10 +0200 Subject: [PATCH 10/22] [Hermes] Build with debugger support. Closes https://github.com/microsoft/react-native-macos/projects/4#card-38726225 --- RNTester/Podfile | 5 +-- RNTester/Podfile.lock | 40 ++++++++++++++------- React-Core.podspec | 19 ++++++++-- ReactCommon/cxxreact/React-cxxreact.podspec | 2 -- third-party-podspecs/Folly.podspec | 34 ++++++++++++++++++ third-party-podspecs/libevent.podspec | 22 ++++++++++++ 6 files changed, 104 insertions(+), 18 deletions(-) create mode 100644 third-party-podspecs/libevent.podspec diff --git a/RNTester/Podfile b/RNTester/Podfile index bf1fd11b00ec5c..f685702c7de749 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -118,8 +118,9 @@ end target 'RNTester-macOS' do platform :osx, '10.14' - # pod 'hermes', :git => 'https://github.com/alloy/hermes.git', :commit => '4af03d10f76418a781b51e8434efeceee015ce5a' - pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip', :flatten => true + # TODO: Point to actual release + pod 'hermes', :path => '/Users/eloy/Code/ReactNative/Hermes/src' + pod 'libevent', :podspec => "../third-party-podspecs/libevent.podspec" pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 6079c0b63cec4f..9698a4dda3ee5b 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -66,7 +66,14 @@ PODS: - boost-for-react-native - DoubleConversion - glog + - Folly/Futures (2018.10.22.00): + - boost-for-react-native + - DoubleConversion + - glog + - libevent - glog (0.3.5) + - hermes (0.5.0) + - libevent (2.1.11) - OpenSSL-Universal (1.0.2.19): - OpenSSL-Universal/Static (= 1.0.2.19) - OpenSSL-Universal/Static (1.0.2.19) @@ -118,6 +125,7 @@ PODS: - React-Core/Default (1000.0.0): - Folly (= 2018.10.22.00) - glog + - React-Core/Hermes - React-cxxreact (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) @@ -132,6 +140,15 @@ PODS: - React-jsiexecutor (= 1000.0.0) - React-jsinspector (= 1000.0.0) - Yoga + - React-Core/Hermes (1000.0.0): + - Folly (= 2018.10.22.00) + - Folly/Futures + - glog + - hermes (~> 0.5.0) + - React-cxxreact (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - Yoga - React-Core/RCTActionSheetHeaders (1000.0.0): - Folly (= 2018.10.22.00) - glog @@ -343,7 +360,8 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) - - "hermes (from `{:http=>\"https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip\", :flatten=>true}`)" + - hermes (from `/Users/eloy/Code/ReactNative/Hermes/src`) + - libevent (from `../third-party-podspecs/libevent.podspec`) - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) - React (from `../`) @@ -373,7 +391,7 @@ DEPENDENCIES: - Yoga (from `../ReactCommon/yoga`) SPEC REPOS: - trunk: + https://cdn.cocoapods.org/: - CocoaAsyncSocket - CocoaLibEvent - Flipper @@ -400,8 +418,9 @@ EXTERNAL SOURCES: glog: :podspec: "../third-party-podspecs/glog.podspec" hermes: - :flatten: true - :http: https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip + :path: "/Users/eloy/Code/ReactNative/Hermes/src" + libevent: + :podspec: "../third-party-podspecs/libevent.podspec" RCTRequired: :path: "../Libraries/RCTRequired" RCTTypeSafety: @@ -449,11 +468,6 @@ EXTERNAL SOURCES: Yoga: :path: "../ReactCommon/yoga" -CHECKOUT OPTIONS: - hermes: - :flatten: true - :http: https://github.com/alloy/hermes/releases/download/v0.2.1/hermes.zip - SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 @@ -468,14 +482,16 @@ SPEC CHECKSUMS: Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 Flipper-RSocket: 64e7431a55835eb953b0bf984ef3b90ae9fdddd7 FlipperKit: 88b7f0d0cf907ddc2137b85eeb7f3d4d8d9395c8 - Folly: feff29ba9d0b7c2e4f793a94942831d6cc5bbad7 + Folly: ae1e11fb7b57cac65fa994a5c9da9b6f652d934b glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00 + hermes: b40d67dcc166a3f569b323e2f16442f64f399045 + libevent: 52af31075d5ade81f97298a56c0656a5618ccc23 OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355 RCTRequired: 66250bf27479214eb5c530ca2d8c772ebe4d7e71 RCTTypeSafety: 2bf56caee198adc4adc63a5d18e8ffff8b92fbbb React: bacecd5320c8bb453aa396179b93061ebd9d34bf React-ART: 2f0eb928d7bc51e6262da595955b0e8fcf6c0a9e - React-Core: 8a9c0454b0540cfcca1261e8e084a324976bb6c2 + React-Core: 4ec38c69f68ea045a45ea40e37edb7222ebcbca7 React-CoreModules: fbe1e42d49cb14db5c9bf02dee33a18d281331f7 React-cxxreact: 7ff40ab26e02c3f8b2fec2f5ea3d9f4774ef2523 React-jsi: b23bf7e79fb2149f3bb9bd4e25e570bff9c03d10 @@ -496,6 +512,6 @@ SPEC CHECKSUMS: Yoga: 3ed3c35bb7c41fa8f5056b767bc048539f6526ad YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 524ab13b924fd82bc5c4393c133fcd02eb70efa4 +PODFILE CHECKSUM: 396995f9856998a561672293335bfd6d321ba9f7 COCOAPODS: 1.9.1 diff --git a/React-Core.podspec b/React-Core.podspec index 5bf3e3605ae56d..786343728da46a 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -57,8 +57,9 @@ Pod::Spec.new do |s| ss.exclude_files = "React/CoreModules/**/*", "React/DevSupport/**/*", "React/Fabric/**/*", - "React/Inspector/**/*" - ss.ios.exclude_files = "React/**/RCTTV*.*", "React/CxxBridge/HermesExecutorFactory.*" + "React/Inspector/**/*", + "React/CxxBridge/HermesExecutorFactory.*" # TODO(macOS GH#214) + ss.ios.exclude_files = "React/**/RCTTV*.*" # [TODO(macOS ISS#2323203) "**/MacOS/*" @@ -69,6 +70,7 @@ Pod::Spec.new do |s| "React/Views/{RCTModal*,RCTMasked*,RCTTV*,RCTWrapperViewController}.*", "React/Views/RefreshControl/*", "React/Views/SafeAreaView/*" + ss.osx.dependency "React-Core/Hermes" # ]TODO(macOS ISS#2323203) ss.tvos.exclude_files = "React/Modules/RCTClipboard*", @@ -80,6 +82,19 @@ Pod::Spec.new do |s| ss.private_header_files = "React/Cxx*/*.h" end + # [TODO(macOS GH#214) + s.subspec "Hermes" do |ss| + ss.platforms = { :osx => "10.14" } + ss.source_files = "React/CxxBridge/HermesExecutorFactory.*", + "ReactCommon/hermes/inspector/*.{cpp,h}", + "ReactCommon/hermes/inspector/chrome/*.{cpp,h}", + "ReactCommon/hermes/inspector/detail/*.{cpp,h}" + ss.pod_target_xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } + ss.dependency "Folly/Futures" + ss.dependency "hermes", "~> 0.5.0" + end + # ]TODO(macOS GH#214) + s.subspec "DevSupport" do |ss| ss.source_files = "React/DevSupport/*.{h,mm,m}", "React/Inspector/*.{h,mm,m}" diff --git a/ReactCommon/cxxreact/React-cxxreact.podspec b/ReactCommon/cxxreact/React-cxxreact.podspec index fabfbf6b836952..d4b42eaca43020 100644 --- a/ReactCommon/cxxreact/React-cxxreact.podspec +++ b/ReactCommon/cxxreact/React-cxxreact.podspec @@ -40,6 +40,4 @@ Pod::Spec.new do |s| s.dependency "Folly", folly_version s.dependency "glog" s.dependency "React-jsinspector", version - - s.osx.dependency "hermes" # TODO(macOS GH#214) end diff --git a/third-party-podspecs/Folly.podspec b/third-party-podspecs/Folly.podspec index b883cb8e67f22e..8753c8cf52a8af 100644 --- a/third-party-podspecs/Folly.podspec +++ b/third-party-podspecs/Folly.podspec @@ -70,6 +70,40 @@ Pod::Spec.new do |spec| 'folly/system/ThreadId.h' end + # [TODO(macOS GH#214) + spec.subspec 'Futures' do |futures| + futures.dependency 'libevent' + futures.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => ["$(inherited)", "$(PODS_ROOT)/Headers/Public/libevent/event"] } + futures.source_files = 'folly/futures/*.{h,cpp}', + 'folly/futures/detail/*.{h,cpp}', + 'folly/executors/*.{h,cpp}', + 'folly/executors/thread_factory/{NamedThreadFactory,ThreadFactory}.{h,cpp}', + 'folly/executors/task_queue/{BlockingQueue,LifoSemMPMCQueue,PriorityLifoSemMPMCQueue}.{h,cpp}', + 'folly/concurrency/*.{h,cpp}', + 'folly/system/{ThreadId,ThreadName}.{h,cpp}', + 'folly/synchronization/*.{h,cpp}', + 'folly/synchronization/detail/*.{h,cpp}', + 'folly/experimental/{ExecutionObserver,ReadMostlySharedPtr,TLRefCount}.{h,cpp}', + 'folly/io/async/{AsyncTimeout,DelayedDestruction,DelayedDestructionBase,EventBase,EventBaseManager,EventHandler,EventUtil,HHWheelTimer,NotificationQueue,Request,TimeoutManager,VirtualEventBase}.{h,cpp}', + 'folly/io/{Cursor,Cursor-inl,IOBuf,IOBufQueue}.{h,cpp}', + 'folly/tracing/StaticTracepoint.{h,cpp}', + 'folly/{Executor,ExceptionWrapper,ExceptionWrapper-inl,FileUtil,Singleton,SharedMutex}.{h,cpp}', + 'folly/detail/{AtFork,Futex,Futex-inl,MemoryIdler,StaticSingletonManager,ThreadLocalDetail}.{h,cpp}', + 'folly/lang/SafeAssert.{h,cpp}', + 'folly/memory/MallctlHelper.{h,cpp}', + 'folly/portability/SysUio.{h,cpp}' + # TODO: Perhaps some of the wildcards above can be further trimmed down with some of these: + # + # 'folly/executors/{DrivableExecutor,InlineExecutor,QueuedImmediateExecutor,TimedDrivableExecutor}.{h,cpp}', + # 'folly/concurrency/{CacheLocality,UnboundedQueue}.{h,cpp}', + # 'folly/system/ThreadId.h', + # 'folly/synchronization/Hazptr{,-fwd,Domain,Holder,Obj,ObjLinked,Rec,ThrLocal}.{h,cpp}', + # 'folly/synchronization/{AsymmetricMemoryBarrier,AtomicStruct,Baton,MicroSpinLock,ParkingLot,RWSpinLock,SanitizeThread,SaturatingSemaphore,WaitOptions}.{h,cpp}', + # 'folly/synchronization/detail/{AtomicUtils,Sleeper,Spin}.{h,cpp}', + # 'folly/experimental/{ReadMostlySharedPtr,TLRefCount}.h', + end + # ]TODO(macOS GH#214) + # Pinning to the same version as React.podspec. spec.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) end diff --git a/third-party-podspecs/libevent.podspec b/third-party-podspecs/libevent.podspec new file mode 100644 index 00000000000000..67af0434bd8776 --- /dev/null +++ b/third-party-podspecs/libevent.podspec @@ -0,0 +1,22 @@ +Pod::Spec.new do |spec| + spec.name = "libevent" + spec.version = "2.1.11" + spec.summary = "Event notification library" + spec.description = "The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts." + spec.homepage = "https://libevent.org" + spec.license = { :type => "BSD 3-Clause", :file => "LICENSE" } + spec.author = "Niels Provos and Nick Mathewson" + spec.platforms = { :osx => "10.14" } + spec.source = { :git => "https://github.com/libevent/libevent.git", :tag => "release-#{spec.version}-stable" } + + # spec.header_dir = "event" + spec.source_files = "destroot/include/**/*.h" + spec.header_mappings_dir = "destroot/include" + spec.vendored_library = "destroot/lib/libevent.a" + + spec.prepare_command = <<-EOS + ./autogen.sh + ./configure --disable-shared --disable-openssl --disable-samples --disable-libevent-regress --prefix "${PWD}/destroot" + make install + EOS +end From c9b5ff7a265da2ec8f052afb5cce83ef2ea988d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 2 Jun 2020 14:54:45 +0200 Subject: [PATCH 11/22] [Hermes] Use v0.5.0 bin release --- RNTester/Podfile | 2 +- RNTester/Podfile.lock | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index f685702c7de749..780da78e9a3db8 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -119,7 +119,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' # TODO: Point to actual release - pod 'hermes', :path => '/Users/eloy/Code/ReactNative/Hermes/src' + pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip' pod 'libevent', :podspec => "../third-party-podspecs/libevent.podspec" pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 9698a4dda3ee5b..54ddf409177bdd 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -360,7 +360,7 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) - - hermes (from `/Users/eloy/Code/ReactNative/Hermes/src`) + - "hermes (from `{:http=>\"https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip\"}`)" - libevent (from `../third-party-podspecs/libevent.podspec`) - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) @@ -391,7 +391,7 @@ DEPENDENCIES: - Yoga (from `../ReactCommon/yoga`) SPEC REPOS: - https://cdn.cocoapods.org/: + trunk: - CocoaAsyncSocket - CocoaLibEvent - Flipper @@ -418,7 +418,7 @@ EXTERNAL SOURCES: glog: :podspec: "../third-party-podspecs/glog.podspec" hermes: - :path: "/Users/eloy/Code/ReactNative/Hermes/src" + :http: https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip libevent: :podspec: "../third-party-podspecs/libevent.podspec" RCTRequired: @@ -468,6 +468,10 @@ EXTERNAL SOURCES: Yoga: :path: "../ReactCommon/yoga" +CHECKOUT OPTIONS: + hermes: + :http: https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip + SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 CocoaAsyncSocket: eafaa68a7e0ec99ead0a7b35015e0bf25d2c8987 @@ -484,7 +488,7 @@ SPEC CHECKSUMS: FlipperKit: 88b7f0d0cf907ddc2137b85eeb7f3d4d8d9395c8 Folly: ae1e11fb7b57cac65fa994a5c9da9b6f652d934b glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00 - hermes: b40d67dcc166a3f569b323e2f16442f64f399045 + hermes: c17c5906d0cb28e0e6d749924417735d129c7938 libevent: 52af31075d5ade81f97298a56c0656a5618ccc23 OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355 RCTRequired: 66250bf27479214eb5c530ca2d8c772ebe4d7e71 @@ -512,6 +516,6 @@ SPEC CHECKSUMS: Yoga: 3ed3c35bb7c41fa8f5056b767bc048539f6526ad YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 396995f9856998a561672293335bfd6d321ba9f7 +PODFILE CHECKSUM: ed659b200f815752413d649f3884bccfc6ff3818 COCOAPODS: 1.9.1 From 6b82e8e76d37522895d73389786a964efc952da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 2 Jun 2020 16:16:10 +0200 Subject: [PATCH 12/22] [Hermes] Enable on macOS when sources exist --- React/CxxBridge/RCTCxxBridge.mm | 2 +- scripts/react-native-xcode.sh | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 9bc36bdb5b244d..b83301f3c7163b 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -37,7 +37,7 @@ #import #import -#if TARGET_OS_OSX +#if TARGET_OS_OSX && __has_include() #define RCT_USE_HERMES 1 #endif #if RCT_USE_HERMES diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 76e76d72e8fb8f..d9c3e85cd15be3 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -108,7 +108,7 @@ source "$REACT_NATIVE_DIR/scripts/node-binary.sh" [ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle" -[ -z "$HERMES_PATH" ] && HERMES_PATH="$PROJECT_ROOT/RNTester/Pods/hermes/destroot/bin/hermes" +[ -z "$HERMES_PATH" ] && HERMES_PATH="$PODS_ROOT/hermes/destroot/bin/hermes" if [[ -z "$BUNDLE_CONFIG" ]]; then CONFIG_ARG="" @@ -143,8 +143,12 @@ fi $EXTRA_ARGS \ $EXTRA_PACKAGER_ARGS -# TODO: Emit source-map for release builds -"$HERMES_PATH" -emit-binary -out "$DEST/main.jsbundle" "$BUNDLE_FILE" +if [[ "$BUNDLE_PLATFORM" == "macos" && -f "$HERMES_PATH" ]]; then + # TODO: Emit source-map for release builds + "$HERMES_PATH" -emit-binary -out "$DEST/main.jsbundle" "$BUNDLE_FILE" +else + mv "$BUNDLE_FILE" "$DEST/" +fi if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then echo "error: File $BUNDLE_FILE does not exist. This must be a bug with" >&2 From 3e767efcef600de5852b8da628d7fec3e7379e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 2 Jun 2020 16:40:06 +0200 Subject: [PATCH 13/22] [Hermes] Use optimizations in release builds --- scripts/react-native-xcode.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index d9c3e85cd15be3..d53f4dff313b2f 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -145,7 +145,13 @@ fi if [[ "$BUNDLE_PLATFORM" == "macos" && -f "$HERMES_PATH" ]]; then # TODO: Emit source-map for release builds - "$HERMES_PATH" -emit-binary -out "$DEST/main.jsbundle" "$BUNDLE_FILE" + EXTRA_COMPILER_ARGS= + if [[ $DEV == true ]]; then + EXTRA_COMPILER_ARGS=-Og + else + EXTRA_COMPILER_ARGS=-O + fi + "$HERMES_PATH" -emit-binary $EXTRA_COMPILER_ARGS -out "$DEST/main.jsbundle" "$BUNDLE_FILE" else mv "$BUNDLE_FILE" "$DEST/" fi From 71822f30d88c9ded88dbe01a21efcedafe0b9109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 3 Jun 2020 19:29:44 +0200 Subject: [PATCH 14/22] [CxxBridge] Share logger binding between engines --- React/CxxBridge/HermesExecutorFactory.mm | 20 +------------------- React/CxxBridge/JSCExecutorFactory.mm | 15 +-------------- React/CxxBridge/RCTCxxBridge.mm | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/React/CxxBridge/HermesExecutorFactory.mm b/React/CxxBridge/HermesExecutorFactory.mm index fa88eb6b1c5a1b..5519fae15a2398 100644 --- a/React/CxxBridge/HermesExecutorFactory.mm +++ b/React/CxxBridge/HermesExecutorFactory.mm @@ -11,8 +11,6 @@ #include #include -#import - #ifdef HERMES_ENABLE_DEBUGGER #include #include @@ -204,24 +202,8 @@ void after() { .getPropertyAsObject(*decoratedRuntime, "prototype"); errorPrototype.setProperty(*decoratedRuntime, "jsEngine", "hermes"); - // TODO: Share with JSCExecutorFactory.mm - auto installBindings = - [runtimeInstaller=runtimeInstaller_](jsi::Runtime &runtime) { - react::Logger iosLoggingBinder = - [](const std::string &message, unsigned int logLevel) { - _RCTLogJavaScriptInternal( - static_cast(logLevel), - [NSString stringWithUTF8String:message.c_str()]); - }; - react::bindNativeLogger(runtime, iosLoggingBinder); - // Wrap over the original runtimeInstaller - if (runtimeInstaller) { - runtimeInstaller(runtime); - } - }; - return std::make_unique(decoratedRuntime, delegate, jsQueue, - timeoutInvoker_, std::move(installBindings)); + timeoutInvoker_, runtimeInstaller_); } HermesExecutor::HermesExecutor( diff --git a/React/CxxBridge/JSCExecutorFactory.mm b/React/CxxBridge/JSCExecutorFactory.mm index 12d96eb5c16480..61e87e99d01061 100644 --- a/React/CxxBridge/JSCExecutorFactory.mm +++ b/React/CxxBridge/JSCExecutorFactory.mm @@ -7,7 +7,6 @@ #include "JSCExecutorFactory.h" -#import #import #import @@ -18,23 +17,11 @@ std::unique_ptr JSCExecutorFactory::createJSExecutor( std::shared_ptr delegate, std::shared_ptr __unused jsQueue) { - auto installBindings = [runtimeInstaller=runtimeInstaller_](jsi::Runtime &runtime) { - react::Logger iosLoggingBinder = [](const std::string &message, unsigned int logLevel) { - _RCTLogJavaScriptInternal( - static_cast(logLevel), - [NSString stringWithUTF8String:message.c_str()]); - }; - react::bindNativeLogger(runtime, iosLoggingBinder); - // Wrap over the original runtimeInstaller - if (runtimeInstaller) { - runtimeInstaller(runtime); - } - }; return std::make_unique( facebook::jsc::makeJSCRuntime(), delegate, JSIExecutor::defaultTimeoutInvoker, - std::move(installBindings)); + runtimeInstaller_); } } // namespace react diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index b83301f3c7163b..d3f9d3035d1f90 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -355,10 +355,20 @@ - (void)start executorFactory = [cxxDelegate jsExecutorFactoryForBridge:self]; } if (!executorFactory) { + auto installBindings = + [](facebook::jsi::Runtime &runtime) { + facebook::react::Logger iosLoggingBinder = + [](const std::string &message, unsigned int logLevel) { + _RCTLogJavaScriptInternal( + static_cast(logLevel), + [NSString stringWithUTF8String:message.c_str()]); + }; + facebook::react::bindNativeLogger(runtime, iosLoggingBinder); + }; #if RCT_USE_HERMES - executorFactory = std::make_shared(nullptr); + executorFactory = std::make_shared(installBindings); #else - executorFactory = std::make_shared(nullptr); + executorFactory = std::make_shared(installBindings); #endif } } else { From 8a39db7a360d6007b19146550437c517e82dc7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 4 Jun 2020 23:01:30 +0200 Subject: [PATCH 15/22] [Hermes] Share Android and macOS executor code. --- RNTester/Podfile | 2 +- RNTester/Podfile.lock | 18 +- .../RNTesterPods.xcodeproj/project.pbxproj | 2 +- React-Core.podspec | 4 +- React/CxxBridge/HermesExecutorFactory.h | 50 ---- React/CxxBridge/HermesExecutorFactory.mm | 220 ------------------ .../executor}/HermesExecutorFactory.cpp | 0 .../hermes/executor}/HermesExecutorFactory.h | 0 .../hermes/executor}/JSITracing.cpp | 2 +- .../hermes/executor}/JSITracing.h | 0 10 files changed, 14 insertions(+), 284 deletions(-) delete mode 100644 React/CxxBridge/HermesExecutorFactory.h delete mode 100644 React/CxxBridge/HermesExecutorFactory.mm rename {ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor => ReactCommon/hermes/executor}/HermesExecutorFactory.cpp (100%) rename {ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor => ReactCommon/hermes/executor}/HermesExecutorFactory.h (100%) rename {ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor => ReactCommon/hermes/executor}/JSITracing.cpp (89%) rename {ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor => ReactCommon/hermes/executor}/JSITracing.h (100%) diff --git a/RNTester/Podfile b/RNTester/Podfile index 780da78e9a3db8..8eaeb77ccc6515 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -119,7 +119,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' # TODO: Point to actual release - pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip' + pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip' pod 'libevent', :podspec => "../third-party-podspecs/libevent.podspec" pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 54ddf409177bdd..30fb6e63e1318d 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -72,7 +72,7 @@ PODS: - glog - libevent - glog (0.3.5) - - hermes (0.5.0) + - hermes (0.4.1) - libevent (2.1.11) - OpenSSL-Universal (1.0.2.19): - OpenSSL-Universal/Static (= 1.0.2.19) @@ -144,7 +144,7 @@ PODS: - Folly (= 2018.10.22.00) - Folly/Futures - glog - - hermes (~> 0.5.0) + - hermes (~> 0.4.1) - React-cxxreact (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) @@ -360,7 +360,7 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) - - "hermes (from `{:http=>\"https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip\"}`)" + - "hermes (from `{:http=>\"https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip\"}`)" - libevent (from `../third-party-podspecs/libevent.podspec`) - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) @@ -391,7 +391,7 @@ DEPENDENCIES: - Yoga (from `../ReactCommon/yoga`) SPEC REPOS: - trunk: + https://cdn.cocoapods.org/: - CocoaAsyncSocket - CocoaLibEvent - Flipper @@ -418,7 +418,7 @@ EXTERNAL SOURCES: glog: :podspec: "../third-party-podspecs/glog.podspec" hermes: - :http: https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip + :http: https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip libevent: :podspec: "../third-party-podspecs/libevent.podspec" RCTRequired: @@ -470,7 +470,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: hermes: - :http: https://github.com/alloy/hermes/releases/download/v0.5.0-macOS/hermes-v0.5.0.zip + :http: https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 @@ -488,14 +488,14 @@ SPEC CHECKSUMS: FlipperKit: 88b7f0d0cf907ddc2137b85eeb7f3d4d8d9395c8 Folly: ae1e11fb7b57cac65fa994a5c9da9b6f652d934b glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00 - hermes: c17c5906d0cb28e0e6d749924417735d129c7938 + hermes: b8e0f2e298d0020c53377694cc3227b2f77ef5ca libevent: 52af31075d5ade81f97298a56c0656a5618ccc23 OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355 RCTRequired: 66250bf27479214eb5c530ca2d8c772ebe4d7e71 RCTTypeSafety: 2bf56caee198adc4adc63a5d18e8ffff8b92fbbb React: bacecd5320c8bb453aa396179b93061ebd9d34bf React-ART: 2f0eb928d7bc51e6262da595955b0e8fcf6c0a9e - React-Core: 4ec38c69f68ea045a45ea40e37edb7222ebcbca7 + React-Core: 01a57b159135f2a2e84403181d9b44e6abd866e4 React-CoreModules: fbe1e42d49cb14db5c9bf02dee33a18d281331f7 React-cxxreact: 7ff40ab26e02c3f8b2fec2f5ea3d9f4774ef2523 React-jsi: b23bf7e79fb2149f3bb9bd4e25e570bff9c03d10 @@ -516,6 +516,6 @@ SPEC CHECKSUMS: Yoga: 3ed3c35bb7c41fa8f5056b767bc048539f6526ad YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: ed659b200f815752413d649f3884bccfc6ff3818 +PODFILE CHECKSUM: b48ab0c6619e325f27ef32e405f569ea5c1634a1 COCOAPODS: 1.9.1 diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 2207e4ecfae792..a21a45913d0382 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ diff --git a/React-Core.podspec b/React-Core.podspec index 786343728da46a..42da4e0b16f440 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -85,13 +85,13 @@ Pod::Spec.new do |s| # [TODO(macOS GH#214) s.subspec "Hermes" do |ss| ss.platforms = { :osx => "10.14" } - ss.source_files = "React/CxxBridge/HermesExecutorFactory.*", + ss.source_files = "ReactCommon/hermes/executor/*.{cpp,h}", "ReactCommon/hermes/inspector/*.{cpp,h}", "ReactCommon/hermes/inspector/chrome/*.{cpp,h}", "ReactCommon/hermes/inspector/detail/*.{cpp,h}" ss.pod_target_xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } ss.dependency "Folly/Futures" - ss.dependency "hermes", "~> 0.5.0" + ss.dependency "hermes", "~> 0.4.1" end # ]TODO(macOS GH#214) diff --git a/React/CxxBridge/HermesExecutorFactory.h b/React/CxxBridge/HermesExecutorFactory.h deleted file mode 100644 index 5913317e243328..00000000000000 --- a/React/CxxBridge/HermesExecutorFactory.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#pragma once - -#include -#include -#include -#include - -namespace facebook { -namespace react { - -class HermesExecutorFactory : public JSExecutorFactory { - public: - explicit HermesExecutorFactory( - JSIExecutor::RuntimeInstaller runtimeInstaller, - const JSIScopedTimeoutInvoker& timeoutInvoker = - JSIExecutor::defaultTimeoutInvoker, - ::hermes::vm::RuntimeConfig runtimeConfig = ::hermes::vm::RuntimeConfig()) - : runtimeInstaller_(runtimeInstaller), - timeoutInvoker_(timeoutInvoker), - runtimeConfig_(std::move(runtimeConfig)) { - assert(timeoutInvoker_ && "Should not have empty timeoutInvoker"); - } - - std::unique_ptr createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) override; - - private: - JSIExecutor::RuntimeInstaller runtimeInstaller_; - JSIScopedTimeoutInvoker timeoutInvoker_; - ::hermes::vm::RuntimeConfig runtimeConfig_; -}; - -class HermesExecutor : public JSIExecutor { - public: - HermesExecutor( - std::shared_ptr runtime, - std::shared_ptr delegate, - std::shared_ptr jsQueue, - const JSIScopedTimeoutInvoker& timeoutInvoker, - RuntimeInstaller runtimeInstaller); - - private: - JSIScopedTimeoutInvoker timeoutInvoker_; -}; - -} // namespace react -} // namespace facebook diff --git a/React/CxxBridge/HermesExecutorFactory.mm b/React/CxxBridge/HermesExecutorFactory.mm deleted file mode 100644 index 5519fae15a2398..00000000000000 --- a/React/CxxBridge/HermesExecutorFactory.mm +++ /dev/null @@ -1,220 +0,0 @@ -// TODO: Share code with the Android HermesExecutorFactory.cpp module. - -// Copyright 2004-present Facebook. All Rights Reserved. - -#include "HermesExecutorFactory.h" - -#include - -#include -#include -#include -#include - -#ifdef HERMES_ENABLE_DEBUGGER -#include -#include -#endif - -using namespace facebook::hermes; -using namespace facebook::jsi; - -namespace facebook { -namespace react { - -namespace { - -#ifdef HERMES_ENABLE_DEBUGGER - -class HermesExecutorRuntimeAdapter - : public facebook::hermes::inspector::RuntimeAdapter { - public: - HermesExecutorRuntimeAdapter( - std::shared_ptr runtime, - HermesRuntime &hermesRuntime, - std::shared_ptr thread) - : runtime_(runtime), - hermesRuntime_(hermesRuntime), - thread_(std::move(thread)) {} - - virtual ~HermesExecutorRuntimeAdapter() = default; - - HermesRuntime &getRuntime() override { - return hermesRuntime_; - } - - void tickleJs() override { - // The queue will ensure that runtime_ is still valid when this - // gets invoked. - // clang-format off - thread_->runOnQueue([&runtime = hermesRuntime_]() { - // clang-format on - auto func = runtime.global().getPropertyAsFunction(runtime, "__tickleJs"); - func.call(runtime); - }); - } - - private: - std::shared_ptr runtime_; - HermesRuntime &hermesRuntime_; - - std::shared_ptr thread_; -}; - -#endif - -struct ReentrancyCheck { -// This is effectively a very subtle and complex assert, so only -// include it in builds which would include asserts. -#ifndef NDEBUG - ReentrancyCheck() : tid(std::thread::id()), depth(0) {} - - void before() { - std::thread::id this_id = std::this_thread::get_id(); - std::thread::id expected = std::thread::id(); - - // A note on memory ordering: the main purpose of these checks is - // to observe a before/before race, without an intervening after. - // This will be detected by the compare_exchange_strong atomicity - // properties, regardless of memory order. - // - // For everything else, it is easiest to think of 'depth' as a - // proxy for any access made inside the VM. If access to depth - // are reordered incorrectly, the same could be true of any other - // operation made by the VM. In fact, using acquire/release - // memory ordering could create barriers which mask a programmer - // error. So, we use relaxed memory order, to avoid masking - // actual ordering errors. Although, in practice, ordering errors - // of this sort would be surprising, because the decorator would - // need to call after() without before(). - - if (tid.compare_exchange_strong( - expected, this_id, std::memory_order_relaxed)) { - // Returns true if tid and expected were the same. If they - // were, then the stored tid referred to no thread, and we - // atomically saved this thread's tid. Now increment depth. - assert(depth == 0 && "No thread id, but depth != 0"); - ++depth; - } else if (expected == this_id) { - // If the stored tid referred to a thread, expected was set to - // that value. If that value is this thread's tid, that's ok, - // just increment depth again. - assert(depth != 0 && "Thread id was set, but depth == 0"); - ++depth; - } else { - // The stored tid was some other thread. This indicates a bad - // programmer error, where VM methods were called on two - // different threads unsafely. Fail fast (and hard) so the - // crash can be analyzed. - __builtin_trap(); - } - } - - void after() { - assert( - tid.load(std::memory_order_relaxed) == std::this_thread::get_id() && - "No thread id in after()"); - if (--depth == 0) { - // If we decremented depth to zero, store no-thread into tid. - std::thread::id expected = std::this_thread::get_id(); - bool didWrite = tid.compare_exchange_strong( - expected, std::thread::id(), std::memory_order_relaxed); - assert(didWrite && "Decremented to zero, but no tid write"); - } - } - - std::atomic tid; - // This is not atomic, as it is only written or read from the owning - // thread. - unsigned int depth; -#endif -}; - -// This adds ReentrancyCheck and debugger enable/teardown to the given -// Runtime. -class DecoratedRuntime : public jsi::WithRuntimeDecorator { - public: - // The first argument may be a tracing runtime which itself - // decorates the real HermesRuntime, depending on the build config. - // The second argument is the the real HermesRuntime as well to - // manage the debugger registration. - DecoratedRuntime( - std::unique_ptr runtime, - HermesRuntime &hermesRuntime, - std::shared_ptr jsQueue) - : jsi::WithRuntimeDecorator(*runtime, reentrancyCheck_), - runtime_(std::move(runtime)), - hermesRuntime_(hermesRuntime) { -#ifdef HERMES_ENABLE_DEBUGGER - auto adapter = std::make_unique( - runtime_, hermesRuntime_, jsQueue); - facebook::hermes::inspector::chrome::enableDebugging( - std::move(adapter), "Hermes React Native"); -#else - (void)hermesRuntime_; -#endif - } - - ~DecoratedRuntime() { -#ifdef HERMES_ENABLE_DEBUGGER - facebook::hermes::inspector::chrome::disableDebugging(hermesRuntime_); -#endif - } - - private: - // runtime_ is a TracingRuntime, but we don't need to worry about - // the details. hermesRuntime is a reference to the HermesRuntime - // managed by the TracingRuntime. - // - // HermesExecutorRuntimeAdapter requirements are kept, because the - // dtor will disable debugging on the HermesRuntime before the - // member managing it is destroyed. - - std::shared_ptr runtime_; - ReentrancyCheck reentrancyCheck_; - HermesRuntime &hermesRuntime_; -}; - -} // namespace - -std::unique_ptr HermesExecutorFactory::createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) { - auto hermesRuntime = hermes::makeHermesRuntime(runtimeConfig_); - HermesRuntime& hermesRuntimeRef = *hermesRuntime; - auto decoratedRuntime = std::make_shared( - std::move(hermesRuntime), hermesRuntimeRef, jsQueue); - // So what do we have now? - // DecoratedRuntime -> HermesRuntime - // - // DecoratedRuntime is held by JSIExecutor. When it gets used, it - // will check that it's on the right thread, do any necessary trace - // logging, then call the real HermesRuntime. When it is destroyed, - // it will shut down the debugger before the HermesRuntime is. In - // the normal case where tracing and debugging are not compiled in, - // all that's left is the thread checking. - - // Add js engine information to Error.prototype so in error reporting we - // can send this information. - auto errorPrototype = - decoratedRuntime->global() - .getPropertyAsObject(*decoratedRuntime, "Error") - .getPropertyAsObject(*decoratedRuntime, "prototype"); - errorPrototype.setProperty(*decoratedRuntime, "jsEngine", "hermes"); - - return std::make_unique(decoratedRuntime, delegate, jsQueue, - timeoutInvoker_, runtimeInstaller_); -} - -HermesExecutor::HermesExecutor( - std::shared_ptr runtime, - std::shared_ptr delegate, - std::shared_ptr jsQueue, - const JSIScopedTimeoutInvoker &timeoutInvoker, - RuntimeInstaller runtimeInstaller) - : JSIExecutor(runtime, delegate, timeoutInvoker, runtimeInstaller) { -// jsi::addNativeTracingHooks(*runtime); -} - -} // namespace react -} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.cpp b/ReactCommon/hermes/executor/HermesExecutorFactory.cpp similarity index 100% rename from ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.cpp rename to ReactCommon/hermes/executor/HermesExecutorFactory.cpp diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.h b/ReactCommon/hermes/executor/HermesExecutorFactory.h similarity index 100% rename from ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.h rename to ReactCommon/hermes/executor/HermesExecutorFactory.h diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/JSITracing.cpp b/ReactCommon/hermes/executor/JSITracing.cpp similarity index 89% rename from ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/JSITracing.cpp rename to ReactCommon/hermes/executor/JSITracing.cpp index 763ed1ce69a68a..3493b04ba6c1b3 100644 --- a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/JSITracing.cpp +++ b/ReactCommon/hermes/executor/JSITracing.cpp @@ -10,7 +10,7 @@ namespace facebook { namespace jsi { void addNativeTracingHooks(Runtime &rt) { - assert(false && "unimplemented"); +// assert(false && "unimplemented"); } } // namespace jsi } // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/JSITracing.h b/ReactCommon/hermes/executor/JSITracing.h similarity index 100% rename from ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/JSITracing.h rename to ReactCommon/hermes/executor/JSITracing.h From 63c10f9266910b7d873727d280dde461da64e896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Mon, 22 Jun 2020 13:30:05 +0200 Subject: [PATCH 16/22] [Xcode] Remove need to sign locally Fixes https://github.com/microsoft/react-native-macos/projects/4#card-37781557 --- RNTester/RNTester-macOS/RNTester_macOS.entitlements | 2 -- RNTester/RNTesterPods.xcodeproj/project.pbxproj | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RNTester/RNTester-macOS/RNTester_macOS.entitlements b/RNTester/RNTester-macOS/RNTester_macOS.entitlements index 3879a569d09f88..36fe293685410b 100644 --- a/RNTester/RNTester-macOS/RNTester_macOS.entitlements +++ b/RNTester/RNTester-macOS/RNTester_macOS.entitlements @@ -2,8 +2,6 @@ - com.apple.security.cs.disable-library-validation - com.apple.security.get-task-allow com.apple.security.personal-information.photos-library diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index a21a45913d0382..4e2c465c0997be 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -1868,6 +1868,7 @@ CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = "RNTester-macOS/RNTester_macOS.entitlements"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; @@ -1922,6 +1923,7 @@ CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = "RNTester-macOS/RNTester_macOS.entitlements"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; From 2d2549c1a7451c8e99dbd607f2380e2fcff213ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Mon, 22 Jun 2020 17:20:50 +0200 Subject: [PATCH 17/22] [Pods] Build libevent from source and use prebuilt hermes framework --- RNTester/Podfile | 3 +- RNTester/Podfile.lock | 16 +- third-party-podspecs/libevent.podspec | 580 +++++++++++++++++++++++++- 3 files changed, 584 insertions(+), 15 deletions(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index 8eaeb77ccc6515..bde1d0870ea7d2 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -119,7 +119,8 @@ end target 'RNTester-macOS' do platform :osx, '10.14' # TODO: Point to actual release - pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip' + pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip', + :sha256 => 'd33c7eafded94d8113a3bb74f56aef3ec1cd3df513e99df7fa3c7c34b867d379' pod 'libevent', :podspec => "../third-party-podspecs/libevent.podspec" pods() end diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 30fb6e63e1318d..83d4db625f4a0b 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -73,7 +73,11 @@ PODS: - libevent - glog (0.3.5) - hermes (0.4.1) - - libevent (2.1.11) + - libevent (2.1.11): + - libevent/core (= 2.1.11) + - libevent/core (2.1.11): + - libevent/event2-headers + - libevent/event2-headers (2.1.11) - OpenSSL-Universal (1.0.2.19): - OpenSSL-Universal/Static (= 1.0.2.19) - OpenSSL-Universal/Static (1.0.2.19) @@ -360,7 +364,7 @@ DEPENDENCIES: - FlipperKit/SKIOSNetworkPlugin (~> 0.30.1) - Folly (from `../third-party-podspecs/Folly.podspec`) - glog (from `../third-party-podspecs/glog.podspec`) - - "hermes (from `{:http=>\"https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip\"}`)" + - "hermes (from `{:http=>\"https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip\", :sha256=>\"d33c7eafded94d8113a3bb74f56aef3ec1cd3df513e99df7fa3c7c34b867d379\"}`)" - libevent (from `../third-party-podspecs/libevent.podspec`) - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) @@ -419,6 +423,7 @@ EXTERNAL SOURCES: :podspec: "../third-party-podspecs/glog.podspec" hermes: :http: https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip + :sha256: d33c7eafded94d8113a3bb74f56aef3ec1cd3df513e99df7fa3c7c34b867d379 libevent: :podspec: "../third-party-podspecs/libevent.podspec" RCTRequired: @@ -471,6 +476,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: hermes: :http: https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip + :sha256: d33c7eafded94d8113a3bb74f56aef3ec1cd3df513e99df7fa3c7c34b867d379 SPEC CHECKSUMS: boost-for-react-native: a110407d9db2642fd2e1bcd7c5a51c81f2521dc9 @@ -488,8 +494,8 @@ SPEC CHECKSUMS: FlipperKit: 88b7f0d0cf907ddc2137b85eeb7f3d4d8d9395c8 Folly: ae1e11fb7b57cac65fa994a5c9da9b6f652d934b glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00 - hermes: b8e0f2e298d0020c53377694cc3227b2f77ef5ca - libevent: 52af31075d5ade81f97298a56c0656a5618ccc23 + hermes: ea5308401c53c1352fcb566548f2a45605c36f15 + libevent: c2d56c8554ac18101d9c5f4c66ef762798209682 OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355 RCTRequired: 66250bf27479214eb5c530ca2d8c772ebe4d7e71 RCTTypeSafety: 2bf56caee198adc4adc63a5d18e8ffff8b92fbbb @@ -516,6 +522,6 @@ SPEC CHECKSUMS: Yoga: 3ed3c35bb7c41fa8f5056b767bc048539f6526ad YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: b48ab0c6619e325f27ef32e405f569ea5c1634a1 +PODFILE CHECKSUM: dc0e44775280712bf6829827f27849bc76251c6e COCOAPODS: 1.9.1 diff --git a/third-party-podspecs/libevent.podspec b/third-party-podspecs/libevent.podspec index 67af0434bd8776..b4782522ba0203 100644 --- a/third-party-podspecs/libevent.podspec +++ b/third-party-podspecs/libevent.podspec @@ -1,3 +1,541 @@ +# Because libevent is also relied on by Flipper and *with* OpenSSL bindings, +# building it as a prebuilt binary may lead to hard to satisfy permutations, if +# we'd ever try to build this for other Apple platforms besides macOS. Therefore +# let Xcode build it from source instead. +# +# Generated with: +# +# $ mkdir build && cd build +# $ cmake -G Ninja .. \ +# -DEVENT__DISABLE_OPENSSL:BOOL=ON \ +# -DEVENT__DISABLE_BENCHMARK:BOOL=ON \ +# -DEVENT__DISABLE_TESTS:BOOL=ON \ +# -DEVENT__DISABLE_REGRESS:BOOL=ON \ +# -DEVENT__DISABLE_SAMPLES:BOOL=ON +# $ cat include/event2/event-config.h +# +CONFIG_WITHOUT_OPENSSL = <<-END_OF_CONFIG +/* event-config.h + * + * This file was generated by cmake when the makefiles were generated. + * + * DO NOT EDIT THIS FILE. + * + * Do not rely on macros in this file existing in later versions. + */ +#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_ +#define EVENT2_EVENT_CONFIG_H_INCLUDED_ + +/* Numeric representation of the version */ +#define EVENT__NUMERIC_VERSION 0x02020001 +#define EVENT__PACKAGE_VERSION "2.2.0" + +#define EVENT__VERSION_MAJOR 2 +#define EVENT__VERSION_MINOR 2 +#define EVENT__VERSION_PATCH 0 + +/* Version number of package */ +#define EVENT__VERSION "2.2.0-alpha-dev" + +/* Name of package */ +#define EVENT__PACKAGE "libevent" + +/* Define to the address where bug reports for this package should be sent. */ +#define EVENT__PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define EVENT__PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define EVENT__PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define EVENT__PACKAGE_TARNAME "" + +/* Define if libevent should build without support for a debug mode */ +/* #undef EVENT__DISABLE_DEBUG_MODE */ + +/* Define if libevent should not allow replacing the mm functions */ +/* #undef EVENT__DISABLE_MM_REPLACEMENT */ + +/* Define if libevent should not be compiled with thread support */ +/* #undef EVENT__DISABLE_THREAD_SUPPORT */ + +/* Define to 1 if you have the `accept4' function. */ +/* #undef EVENT__HAVE_ACCEPT4 */ + +/* Define to 1 if you have the `arc4random' function. */ +#define EVENT__HAVE_ARC4RANDOM 1 + +/* Define to 1 if you have the `arc4random_buf' function. */ +#define EVENT__HAVE_ARC4RANDOM_BUF 1 + +/* Define to 1 if you have the `arc4random_addrandom' function. */ +#define EVENT__HAVE_ARC4RANDOM_ADDRANDOM 1 + +/* Define if clock_gettime is available in libc */ +#define EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1 + +/* Define is no secure id variant is available */ +/* #undef EVENT__DNS_USE_GETTIMEOFDAY_FOR_ID */ +/* #undef EVENT__DNS_USE_FTIME_FOR_ID */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define EVENT__HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the declaration of `CTL_KERN'. */ +#define EVENT__HAVE_DECL_CTL_KERN 1 + +/* Define to 1 if you have the declaration of `KERN_ARND'. */ +#define EVENT__HAVE_DECL_KERN_ARND 0 + +/* Define to 1 if you have `getrandom' function. */ +/* #undef EVENT__HAVE_GETRANDOM */ + +/* Define if /dev/poll is available */ +/* #undef EVENT__HAVE_DEVPOLL */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_NETDB_H 1 + +/* Define to 1 if fd_mask type is defined */ +#define EVENT__HAVE_FD_MASK 1 + +/* Define to 1 if the header file defines TAILQ_FOREACH. */ +#define EVENT__HAVE_TAILQFOREACH 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_DLFCN_H 1 + +/* Define if your system supports the epoll system calls */ +/* #undef EVENT__HAVE_EPOLL */ + +/* Define to 1 if you have the `epoll_create1' function. */ +/* #undef EVENT__HAVE_EPOLL_CREATE1 */ + +/* Define to 1 if you have the `epoll_ctl' function. */ +/* #undef EVENT__HAVE_EPOLL_CTL */ + +/* Define if your system supports the wepoll module */ +/* #undef EVENT__HAVE_WEPOLL */ + +/* Define to 1 if you have the `eventfd' function. */ +/* #undef EVENT__HAVE_EVENTFD */ + +/* Define if your system supports event ports */ +/* #undef EVENT__HAVE_EVENT_PORTS */ + +/* Define to 1 if you have the `fcntl' function. */ +#define EVENT__HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define EVENT__HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getegid' function. */ +#define EVENT__HAVE_GETEGID 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define EVENT__HAVE_GETEUID 1 + +/* TODO: Check for different gethostname argument counts. CheckPrototypeDefinition.cmake can be used. */ +/* Define this if you have any gethostbyname_r() */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R */ + +/* Define this if gethostbyname_r takes 3 arguments */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */ + +/* Define this if gethostbyname_r takes 5 arguments */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */ + +/* Define this if gethostbyname_r takes 6 arguments */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */ + +/* Define to 1 if you have the `getifaddrs' function. */ +#define EVENT__HAVE_GETIFADDRS 1 + +/* Define to 1 if you have the `getnameinfo' function. */ +#define EVENT__HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getprotobynumber' function. */ +#define EVENT__HAVE_GETPROTOBYNUMBER 1 + +/* Define to 1 if you have the `getservbyname' function. */ +#define EVENT__HAVE_GETSERVBYNAME 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define EVENT__HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_IFADDRS_H 1 + +/* Define to 1 if you have the `inet_ntop' function. */ +#define EVENT__HAVE_INET_NTOP 1 + +/* Define to 1 if you have the `inet_pton' function. */ +#define EVENT__HAVE_INET_PTON 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `issetugid' function. */ +#define EVENT__HAVE_ISSETUGID 1 + +/* Define to 1 if you have the `kqueue' function. */ +#define EVENT__HAVE_KQUEUE 1 + +/* Define if the system has zlib */ +/* #undef EVENT__HAVE_LIBZ */ + +/* Define to 1 if you have the `mach_absolute_time' function. */ +#define EVENT__HAVE_MACH_ABSOLUTE_TIME 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_MACH_MACH_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_MACH_MACH_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define EVENT__HAVE_MMAP 1 + +/* Define to 1 if you have the `nanosleep' function. */ +#define EVENT__HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the `usleep' function. */ +#define EVENT__HAVE_USLEEP 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_NETINET_IN6_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_NETINET_TCP_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_AFUNIX_H */ + +/* Define if the system has openssl */ +/* #undef EVENT__HAVE_OPENSSL */ + +/* Define to 1 if you have the `pipe' function. */ +#define EVENT__HAVE_PIPE 1 + +/* Define to 1 if you have the `pipe2' function. */ +/* #undef EVENT__HAVE_PIPE2 */ + +/* Define to 1 if you have the `poll' function. */ +#define EVENT__HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_POLL_H 1 + +/* Define to 1 if you have the `port_create' function. */ +/* #undef EVENT__HAVE_PORT_CREATE */ + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_PORT_H */ + +/* Define if we have pthreads on this system */ +#define EVENT__HAVE_PTHREADS 1 + +/* Define to 1 if you have the `putenv' function. */ +#define EVENT__HAVE_PUTENV 1 + +/* Define to 1 if the system has the type `sa_family_t'. */ +#define EVENT__HAVE_SA_FAMILY_T 1 + +/* Define to 1 if you have the `select' function. */ +#define EVENT__HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +#define EVENT__HAVE_SETENV 1 + +/* Define if F_SETFD is defined in */ +#define EVENT__HAVE_SETFD 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define EVENT__HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the `sendfile' function. */ +#define EVENT__HAVE_SENDFILE 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define EVENT__HAVE_SIGACTION 1 + +/* Define to 1 if you have the `signal' function. */ +#define EVENT__HAVE_SIGNAL 1 + +/* Define to 1 if you have the `strsignal' function. */ +#define EVENT__HAVE_STRSIGNAL 1 + +/* Define to 1 if you have the `splice' function. */ +/* #undef EVENT__HAVE_SPLICE */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define EVENT__HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strsep' function. */ +#define EVENT__HAVE_STRSEP 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define EVENT__HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define EVENT__HAVE_STRTOLL 1 + +/* Define to 1 if you have the `_gmtime64_s' function. */ +/* #undef EVENT__HAVE__GMTIME64_S */ + +/* Define to 1 if you have the `_gmtime64' function. */ +/* #undef EVENT__HAVE__GMTIME64 */ + +/* Define to 1 if the system has the type `struct addrinfo'. */ +#define EVENT__HAVE_STRUCT_ADDRINFO 1 + +/* Define to 1 if the system has the type `struct in6_addr'. */ +#define EVENT__HAVE_STRUCT_IN6_ADDR 1 + +/* Define to 1 if `s6_addr16' is member of `struct in6_addr'. */ +/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 */ + +/* Define to 1 if `s6_addr32' is member of `struct in6_addr'. */ +/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 */ + +/* Define to 1 if the system has the type `struct sockaddr_in6'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1 + +/* Define to 1 if `sin6_len' is member of `struct sockaddr_in6'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1 + +/* Define to 1 if `sin_len' is member of `struct sockaddr_in'. */ +/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ + +/* Define to 1 if the system has the type `struct sockaddr_un'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_UN 1 + +/* Define to 1 if the system has the type `struct sockaddr_storage'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 + +/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */ +/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */ + +/* Define to 1 if the system has the type `struct linger'. */ +#define EVENT__HAVE_STRUCT_LINGER 1 + +/* Define to 1 if you have the `sysctl' function. */ +#define EVENT__HAVE_SYSCTL 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_EPOLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_EVENTFD_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_EVENT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_QUEUE_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_SENDFILE_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_RANDOM_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_SYSCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_TIMERFD_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_ERRNO_H 1 + +/* Define if TAILQ_FOREACH is defined in */ +#define EVENT__HAVE_TAILQFOREACH 1 + +/* Define if timeradd is defined in */ +#define EVENT__HAVE_TIMERADD 1 + +/* Define if timerclear is defined in */ +#define EVENT__HAVE_TIMERCLEAR 1 + +/* Define if timercmp is defined in */ +#define EVENT__HAVE_TIMERCMP 1 + + +/* Define to 1 if you have the `timerfd_create' function. */ +/* #undef EVENT__HAVE_TIMERFD_CREATE */ + +/* Define if timerisset is defined in */ +#define EVENT__HAVE_TIMERISSET 1 + +/* Define to 1 if the system has the type `uint8_t'. */ +#define EVENT__HAVE_UINT8_T 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#define EVENT__HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `uint32_t'. */ +#define EVENT__HAVE_UINT32_T 1 + +/* Define to 1 if the system has the type `uint64_t'. */ +#define EVENT__HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define EVENT__HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the `umask' function. */ +#define EVENT__HAVE_UMASK 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define EVENT__HAVE_UNSETENV 1 + +/* Define to 1 if you have the `vasprintf' function. */ +#define EVENT__HAVE_VASPRINTF 1 + +/* Define if kqueue works correctly with pipes */ +#define EVENT__HAVE_WORKING_KQUEUE 1 + +#ifdef __USE_UNUSED_DEFINITIONS__ +/* Define to necessary symbol if this constant uses a non-standard name on your system. */ +/* XXX: Hello, this isn't even used, nor is it defined anywhere... - Ellzey */ +#define EVENT__PTHREAD_CREATE_JOINABLE +#endif + +/* The size of `pthread_t', as computed by sizeof. */ +#define EVENT__SIZEOF_PTHREAD_T 8 + +/* The size of a `int', as computed by sizeof. */ +#define EVENT__SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define EVENT__SIZEOF_LONG 8 + +/* The size of a `long long', as computed by sizeof. */ +#define EVENT__SIZEOF_LONG_LONG 8 + +/* The size of `off_t', as computed by sizeof. */ +#define EVENT__SIZEOF_OFF_T 8 + +#define EVENT__SIZEOF_SSIZE_T 8 + + +/* The size of a `short', as computed by sizeof. */ +#define EVENT__SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define EVENT__SIZEOF_SIZE_T 8 + +/* Define to 1 if you can safely include both and . */ +/* #undef EVENT__TIME_WITH_SYS_TIME */ + +/* The size of `socklen_t', as computed by sizeof. */ +#define EVENT__SIZEOF_SOCKLEN_T 4 + +/* The size of 'void *', as computer by sizeof */ +#define EVENT__SIZEOF_VOID_P 8 + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* why not c++? + * + * and are we really expected to use EVENT__inline everywhere, + * shouldn't we just do: + * ifdef EVENT__inline + * define inline EVENT__inline + * + * - Ellzey + */ + +#define EVENT__inline inline +#endif + +#define EVENT__HAVE___func__ 1 +#define EVENT__HAVE___FUNCTION__ 1 + +/* Define to `unsigned' if does not define. */ +#define EVENT__size_t size_t + +/* Define to unsigned int if you dont have it */ +#define EVENT__socklen_t socklen_t + +/* Define to `int' if does not define. */ +#define EVENT__ssize_t ssize_t + +#endif /* \EVENT2_EVENT_CONFIG_H_INCLUDED_ */ +END_OF_CONFIG + Pod::Spec.new do |spec| spec.name = "libevent" spec.version = "2.1.11" @@ -9,14 +547,38 @@ Pod::Spec.new do |spec| spec.platforms = { :osx => "10.14" } spec.source = { :git => "https://github.com/libevent/libevent.git", :tag => "release-#{spec.version}-stable" } - # spec.header_dir = "event" - spec.source_files = "destroot/include/**/*.h" - spec.header_mappings_dir = "destroot/include" - spec.vendored_library = "destroot/lib/libevent.a" + # NOTE: Because libevent is also relied on by Flipper and *with* OpenSSL bindings, + # building it as a prebuilt binary may lead to hard to satisfy permutations, + # if we'd ever try to build this for other Apple platforms besides macOS. + # + # spec.source_files = "destroot/include/**/*.h" + # spec.header_mappings_dir = "destroot/include" + # spec.vendored_library = "destroot/lib/libevent.a" + # spec.prepare_command = <<-EOS + # ./autogen.sh + # ./configure --disable-shared --disable-openssl --disable-samples --disable-libevent-regress --prefix "${PWD}/destroot" + # make install + # EOS + + spec.default_subspec = "core" + spec.prepare_command = "touch evconfig-private.h; echo -e #{Shellwords.escape(CONFIG_WITHOUT_OPENSSL)} > include/event2/event-config.h" + + # This subspec only exists so we can namespace these headers. + spec.subspec "event2-headers" do |ss| + ss.source_files = "include/event2/*.h" + ss.public_header_files = "include/event2/*.h" + ss.header_dir = "event2" + end - spec.prepare_command = <<-EOS - ./autogen.sh - ./configure --disable-shared --disable-openssl --disable-samples --disable-libevent-regress --prefix "${PWD}/destroot" - make install - EOS + spec.subspec "core" do |ss| + ss.dependency "libevent/event2-headers" + ss.source_files = + "include/*.h", "*-{internal,private}.h", + "buffer.c", "bufferevent.c", "bufferevent_filter.c", "bufferevent_pair.c", "bufferevent_ratelim.c", "bufferevent_sock.c", + "event.c", "evmap.c", "evthread.c", "evutil.c", "evutil_rand.c", "evutil_time.c", + "kqueue.c", "listener.c", "log.c", "poll.c", "select.c", "signal.c", "strlcpy.c", "watch.c", + "evdns.c", "event_tagging.c", "evrpc.c", "http.c" + ss.private_header_files = "*-{internal,private}.h" + ss.public_header_files = "include/*.h" + end end From 782083a8ab4a9c10f204f1e4e7729d9a06005e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 25 Jun 2020 17:01:28 +0200 Subject: [PATCH 18/22] [Pods] Make React-Core/Hermes an optional dep --- RNTester/Podfile | 1 + RNTester/Podfile.lock | 6 +- .../RNTesterPods.xcodeproj/project.pbxproj | 62 ++++--------------- React-Core.podspec | 1 - 4 files changed, 17 insertions(+), 53 deletions(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index bde1d0870ea7d2..611fce5544a512 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -119,6 +119,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' # TODO: Point to actual release + pod 'React-Core/Hermes', :path => '../' pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip', :sha256 => 'd33c7eafded94d8113a3bb74f56aef3ec1cd3df513e99df7fa3c7c34b867d379' pod 'libevent', :podspec => "../third-party-podspecs/libevent.podspec" diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 83d4db625f4a0b..3646d87efa162b 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -129,7 +129,6 @@ PODS: - React-Core/Default (1000.0.0): - Folly (= 2018.10.22.00) - glog - - React-Core/Hermes - React-cxxreact (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) @@ -372,6 +371,7 @@ DEPENDENCIES: - React-ART (from `../Libraries/ART`) - React-Core (from `../`) - React-Core/DevSupport (from `../`) + - React-Core/Hermes (from `../`) - React-Core/RCTWebSocket (from `../`) - React-CoreModules (from `../React/CoreModules`) - React-cxxreact (from `../ReactCommon/cxxreact`) @@ -501,7 +501,7 @@ SPEC CHECKSUMS: RCTTypeSafety: 2bf56caee198adc4adc63a5d18e8ffff8b92fbbb React: bacecd5320c8bb453aa396179b93061ebd9d34bf React-ART: 2f0eb928d7bc51e6262da595955b0e8fcf6c0a9e - React-Core: 01a57b159135f2a2e84403181d9b44e6abd866e4 + React-Core: 0fb3a932eb28dcb299eceb7fb4e359b547557528 React-CoreModules: fbe1e42d49cb14db5c9bf02dee33a18d281331f7 React-cxxreact: 7ff40ab26e02c3f8b2fec2f5ea3d9f4774ef2523 React-jsi: b23bf7e79fb2149f3bb9bd4e25e570bff9c03d10 @@ -522,6 +522,6 @@ SPEC CHECKSUMS: Yoga: 3ed3c35bb7c41fa8f5056b767bc048539f6526ad YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: dc0e44775280712bf6829827f27849bc76251c6e +PODFILE CHECKSUM: 1d6e8da2335acaa51e68b1f46928f6c18ca5c5ea COCOAPODS: 1.9.1 diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 4e2c465c0997be..0e461077a2c950 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -731,7 +731,7 @@ 9F153459233AB2C4006DFE44 /* Resources */, 38C8132424577FB500BFFA62 /* Build JS Bundle */, 51B9D81723C4D5A4002B30E1 /* Start Metro */, - 52C05E8F0A0D42391FED0384 /* [CP] Embed Pods Frameworks */, + 4733C3A4FBA299F6E1E956BA /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -751,7 +751,6 @@ 9F15346A233AB2C7006DFE44 /* Frameworks */, 9F15346B233AB2C7006DFE44 /* Resources */, 3882C0E12445655100E92FB9 /* Copy Files (1 item) */, - FCD2DDFC0BFB9BB094987AD7 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -771,7 +770,6 @@ 9F153474233AB2C7006DFE44 /* Sources */, 9F153475233AB2C7006DFE44 /* Frameworks */, 9F153476233AB2C7006DFE44 /* Resources */, - A36BB805A218F9C565B51C6E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -1026,40 +1024,40 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.macos.js\n"; }; - 51B9D81723C4D5A4002B30E1 /* Start Metro */ = { + 4733C3A4FBA299F6E1E956BA /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - ); - name = "Start Metro"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - ); - outputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 52C05E8F0A0D42391FED0384 /* [CP] Embed Pods Frameworks */ = { + 51B9D81723C4D5A4002B30E1 /* Start Metro */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Embed Pods Frameworks"; + inputPaths = ( + ); + name = "Start Metro"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester-macOS/Pods-RNTester-macOS-frameworks.sh\"\n"; + shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; showEnvVarsInLog = 0; }; 56D84768A7BBB2750D674CF3 /* [CP] Check Pods Manifest.lock */ = { @@ -1157,23 +1155,6 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; }; - A36BB805A218F9C565B51C6E /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSIntegrationTests/Pods-RNTester-macOSIntegrationTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; DFD62DE759BFAB8AABFA4179 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1236,23 +1217,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - FCD2DDFC0BFB9BB094987AD7 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester-macOSUnitTests/Pods-RNTester-macOSUnitTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/React-Core.podspec b/React-Core.podspec index 42da4e0b16f440..7ee369e65e1fd8 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -70,7 +70,6 @@ Pod::Spec.new do |s| "React/Views/{RCTModal*,RCTMasked*,RCTTV*,RCTWrapperViewController}.*", "React/Views/RefreshControl/*", "React/Views/SafeAreaView/*" - ss.osx.dependency "React-Core/Hermes" # ]TODO(macOS ISS#2323203) ss.tvos.exclude_files = "React/Modules/RCTClipboard*", From 84d4c6adb0c84ece6853321938cc715f15222d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 25 Jun 2020 17:02:37 +0200 Subject: [PATCH 19/22] [Xcode] Add ability to create source-maps for release builds, including for hermes. --- .../RNTesterPods.xcodeproj/project.pbxproj | 2 +- scripts/react-native-xcode.sh | 40 ++++++++++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 0e461077a2c950..8e81c081cfa374 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -1022,7 +1022,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.macos.js\n"; + shellScript = "export NODE_BINARY=node\nexport PROJECT_ROOT=$SRCROOT/..\nexport SOURCEMAP_FILE=sourcemap.macOS.map\n# export FORCE_BUNDLING=true\n$SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.macos.js\n"; }; 4733C3A4FBA299F6E1E956BA /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index d53f4dff313b2f..1d2e850e685219 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -110,6 +110,8 @@ source "$REACT_NATIVE_DIR/scripts/node-binary.sh" [ -z "$HERMES_PATH" ] && HERMES_PATH="$PODS_ROOT/hermes/destroot/bin/hermes" +[ -z "$COMPOSE_SOURCEMAP_PATH" ] && COMPOSE_SOURCEMAP_PATH="$REACT_NATIVE_DIR/scripts/compose-source-maps.js" + if [[ -z "$BUNDLE_CONFIG" ]]; then CONFIG_ARG="" else @@ -127,11 +129,31 @@ case "$PLATFORM_NAME" in ;; esac +USE_HERMES= +if [[ "$BUNDLE_PLATFORM" == "macos" && -f "$HERMES_PATH" ]]; then + USE_HERMES=true +fi + EXTRA_ARGS= if [ -d "$PROJECT_ROOT/node_modules/react-native-macos" ]; then EXTRA_ARGS=--use-react-native-macos fi +EMIT_SOURCEMAP= +if [[ ! -z "$SOURCEMAP_FILE" ]]; then + EMIT_SOURCEMAP=true +fi + +PACKAGER_SOURCEMAP_FILE= +if [[ $EMIT_SOURCEMAP == true ]]; then + if [[ $USE_HERMES == true ]]; then + PACKAGER_SOURCEMAP_FILE="$CONFIGURATION_BUILD_DIR/$(basename $SOURCEMAP_FILE)" + else + PACKAGER_SOURCEMAP_FILE="$SOURCEMAP_FILE" + fi + EXTRA_ARGS="$EXTRA_ARGS --sourcemap-output $PACKAGER_SOURCEMAP_FILE" +fi + "$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \ $CONFIG_ARG \ --entry-file "$ENTRY_FILE" \ @@ -143,17 +165,25 @@ fi $EXTRA_ARGS \ $EXTRA_PACKAGER_ARGS -if [[ "$BUNDLE_PLATFORM" == "macos" && -f "$HERMES_PATH" ]]; then - # TODO: Emit source-map for release builds +if [[ $USE_HERMES != true ]]; then + mv "$BUNDLE_FILE" "$DEST/" +else EXTRA_COMPILER_ARGS= if [[ $DEV == true ]]; then EXTRA_COMPILER_ARGS=-Og else EXTRA_COMPILER_ARGS=-O fi - "$HERMES_PATH" -emit-binary $EXTRA_COMPILER_ARGS -out "$DEST/main.jsbundle" "$BUNDLE_FILE" -else - mv "$BUNDLE_FILE" "$DEST/" + if [[ $EMIT_SOURCEMAP == true ]]; then + EXTRA_COMPILER_ARGS="$EXTRA_COMPILER_ARGS -output-source-map" + fi + HBC_FILE="$CONFIGURATION_BUILD_DIR/$(basename $BUNDLE_FILE)" + "$HERMES_PATH" -emit-binary $EXTRA_COMPILER_ARGS -out "$HBC_FILE" "$BUNDLE_FILE" + mv "$HBC_FILE" "$DEST/" + if [[ $EMIT_SOURCEMAP == true ]]; then + HBC_SOURCEMAP_FILE="$HBC_FILE.map" + "$NODE_BINARY" "$COMPOSE_SOURCEMAP_PATH" "$PACKAGER_SOURCEMAP_FILE" "$HBC_SOURCEMAP_FILE" -o "$SOURCEMAP_FILE" + fi fi if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then From aa1f62d41f86a6ea98e12f6bbacd1d16bc9fb082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 25 Jun 2020 17:03:02 +0200 Subject: [PATCH 20/22] Tiny doc fix. --- ReactCommon/hermes/inspector/chrome/Connection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactCommon/hermes/inspector/chrome/Connection.cpp b/ReactCommon/hermes/inspector/chrome/Connection.cpp index 1f8e109b6572b9..7c8402bfdeab68 100644 --- a/ReactCommon/hermes/inspector/chrome/Connection.cpp +++ b/ReactCommon/hermes/inspector/chrome/Connection.cpp @@ -187,8 +187,8 @@ bool Connection::Impl::disconnect() { inspector_->disable().via(executor_.get()).thenValue([this](auto &&) { // HACK: We purposely call RemoteConnection::onDisconnect on a *different* - // rather than on this thread (the executor thread). This is to prevent this - // scenario: + // thread, rather than on this thread (the executor thread). This is to + // prevent this scenario: // // 1. RemoteConnection::onDisconnect runs on the executor thread // 2. onDisconnect through a long chain of calls causes the Connection From d0388a1e84e242b1aaeca771b507533a323e3da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 25 Jun 2020 18:55:19 +0200 Subject: [PATCH 21/22] [Pods] Move hermes deps to autolink script --- RNTester/Podfile | 12 +++--------- RNTester/Podfile.lock | 2 +- scripts/autolink-ios.rb | 11 ++++++++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index 611fce5544a512..e38c697fc32900 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -47,11 +47,10 @@ if ENV['USE_FRAMEWORKS'] == '1' use_frameworks! end -def pods() +def pods(options = {}) project 'RNTesterPods.xcodeproj' - # Enable TurboModule - use_react_native!(path: "..") + use_react_native!(options.merge(path: "..")) pod 'ReactCommon/turbomodule/samples', :path => '../ReactCommon' # Additional Pods which aren't included in the default Podfile @@ -118,12 +117,7 @@ end target 'RNTester-macOS' do platform :osx, '10.14' - # TODO: Point to actual release - pod 'React-Core/Hermes', :path => '../' - pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip', - :sha256 => 'd33c7eafded94d8113a3bb74f56aef3ec1cd3df513e99df7fa3c7c34b867d379' - pod 'libevent', :podspec => "../third-party-podspecs/libevent.podspec" - pods() + pods(:hermes_enabled => true) end target 'RNTesterUnitTests' do diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 3646d87efa162b..b5b0d345f1e68e 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -522,6 +522,6 @@ SPEC CHECKSUMS: Yoga: 3ed3c35bb7c41fa8f5056b767bc048539f6526ad YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 1d6e8da2335acaa51e68b1f46928f6c18ca5c5ea +PODFILE CHECKSUM: 9f7ce884d267d41098ed0c95a51abea8c184a0ea COCOAPODS: 1.9.1 diff --git a/scripts/autolink-ios.rb b/scripts/autolink-ios.rb index b6dedae310ebfb..b5a564a01aa6a2 100644 --- a/scripts/autolink-ios.rb +++ b/scripts/autolink-ios.rb @@ -13,6 +13,8 @@ def use_react_native! (options={}) # Include DevSupport dependency production = options[:production] ||= false + hermes_enabled = options[:hermes_enabled] ||= false + # The Pods which should be included in all projects pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "#{prefix}/Libraries/FBReactNativeSpec" @@ -58,6 +60,13 @@ def use_react_native! (options={}) pod 'React-RCTFabric', :path => "#{prefix}/React" pod 'Folly/Fabric', :podspec => "#{prefix}/third-party-podspecs/Folly.podspec" end + + if hermes_enabled + pod 'React-Core/Hermes', :path => "#{prefix}/" + pod 'hermes', :http => 'https://github.com/alloy/hermes/releases/download/v0.4.1-macOS/hermes-v0.4.1.zip', + :sha256 => 'd33c7eafded94d8113a3bb74f56aef3ec1cd3df513e99df7fa3c7c34b867d379' + pod 'libevent', :podspec => "#{prefix}/third-party-podspecs/libevent.podspec" + end end def add_flipper_pods!(versions = {}) @@ -101,4 +110,4 @@ def flipper_post_install(installer) end end end -end \ No newline at end of file +end From 8539c5a5be50bda52264e9892a63f581705fe1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 26 Jun 2020 18:06:09 +0200 Subject: [PATCH 22/22] Minor cleanups --- ReactCommon/hermes/executor/JSITracing.cpp | 2 +- third-party-podspecs/libevent.podspec | 32 ++++++---------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/ReactCommon/hermes/executor/JSITracing.cpp b/ReactCommon/hermes/executor/JSITracing.cpp index 3493b04ba6c1b3..376c83eac76388 100644 --- a/ReactCommon/hermes/executor/JSITracing.cpp +++ b/ReactCommon/hermes/executor/JSITracing.cpp @@ -10,7 +10,7 @@ namespace facebook { namespace jsi { void addNativeTracingHooks(Runtime &rt) { -// assert(false && "unimplemented"); + // unimplemented } } // namespace jsi } // namespace facebook diff --git a/third-party-podspecs/libevent.podspec b/third-party-podspecs/libevent.podspec index b4782522ba0203..6f5be6ed077f75 100644 --- a/third-party-podspecs/libevent.podspec +++ b/third-party-podspecs/libevent.podspec @@ -537,29 +537,15 @@ CONFIG_WITHOUT_OPENSSL = <<-END_OF_CONFIG END_OF_CONFIG Pod::Spec.new do |spec| - spec.name = "libevent" - spec.version = "2.1.11" - spec.summary = "Event notification library" - spec.description = "The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts." - spec.homepage = "https://libevent.org" - spec.license = { :type => "BSD 3-Clause", :file => "LICENSE" } - spec.author = "Niels Provos and Nick Mathewson" - spec.platforms = { :osx => "10.14" } - spec.source = { :git => "https://github.com/libevent/libevent.git", :tag => "release-#{spec.version}-stable" } - - # NOTE: Because libevent is also relied on by Flipper and *with* OpenSSL bindings, - # building it as a prebuilt binary may lead to hard to satisfy permutations, - # if we'd ever try to build this for other Apple platforms besides macOS. - # - # spec.source_files = "destroot/include/**/*.h" - # spec.header_mappings_dir = "destroot/include" - # spec.vendored_library = "destroot/lib/libevent.a" - # spec.prepare_command = <<-EOS - # ./autogen.sh - # ./configure --disable-shared --disable-openssl --disable-samples --disable-libevent-regress --prefix "${PWD}/destroot" - # make install - # EOS - + spec.name = "libevent" + spec.version = "2.1.11" + spec.summary = "Event notification library" + spec.description = "The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts." + spec.homepage = "https://libevent.org" + spec.license = { :type => "BSD 3-Clause", :file => "LICENSE" } + spec.author = "Niels Provos and Nick Mathewson" + spec.platforms = { :osx => "10.14" } + spec.source = { :git => "https://github.com/libevent/libevent.git", :tag => "release-#{spec.version}-stable" } spec.default_subspec = "core" spec.prepare_command = "touch evconfig-private.h; echo -e #{Shellwords.escape(CONFIG_WITHOUT_OPENSSL)} > include/event2/event-config.h"