mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 03:56:03 +00:00
33d710e8c5
Summary: The pull request adds the `--port` option to `run-ios` allowing a developer to build and launch a react-native app using a single command line like this: ``` react-native run-ios --port 8088 ``` It defaults to the current port 8081. This pull request fixes issue #9145 and issue #14113. This patch also extends `run-android` to properly test and launch the packager with the specified port, extending the work done in PR: ##15316 1. Create a new react-native app, or simply clone this branch and then update your version of react-native using `yarn add file:./path/to/this/fork/of/react-native` 2. run `react-native run-ios --port 8088` 3. watch the packager start on the desired port (8088 in this case) and watch your app in your simulator connect to the packager and launch the app. Closes https://github.com/facebook/react-native/pull/16172 Differential Revision: D6612534 Pulled By: shergin fbshipit-source-id: 50af449f5e4c32fb76ba95f4cb7bf179e35526d5
119 lines
2.9 KiB
C
119 lines
2.9 KiB
C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#if __OBJC__
|
|
# import <Foundation/Foundation.h>
|
|
#endif
|
|
|
|
/**
|
|
* Make global functions usable in C++
|
|
*/
|
|
#if defined(__cplusplus)
|
|
#define RCT_EXTERN extern "C" __attribute__((visibility("default")))
|
|
#define RCT_EXTERN_C_BEGIN extern "C" {
|
|
#define RCT_EXTERN_C_END }
|
|
#else
|
|
#define RCT_EXTERN extern __attribute__((visibility("default")))
|
|
#define RCT_EXTERN_C_BEGIN
|
|
#define RCT_EXTERN_C_END
|
|
#endif
|
|
|
|
/**
|
|
* The RCT_DEBUG macro can be used to exclude error checking and logging code
|
|
* from release builds to improve performance and reduce binary size.
|
|
*/
|
|
#ifndef RCT_DEBUG
|
|
#if DEBUG
|
|
#define RCT_DEBUG 1
|
|
#else
|
|
#define RCT_DEBUG 0
|
|
#endif
|
|
#endif
|
|
|
|
/**
|
|
* The RCT_DEV macro can be used to enable or disable development tools
|
|
* such as the debug executors, dev menu, red box, etc.
|
|
*/
|
|
#ifndef RCT_DEV
|
|
#if DEBUG
|
|
#define RCT_DEV 1
|
|
#else
|
|
#define RCT_DEV 0
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef RCT_ENABLE_INSPECTOR
|
|
#if RCT_DEV && __has_include(<React/RCTInspectorDevServerHelper.h>)
|
|
#define RCT_ENABLE_INSPECTOR 1
|
|
#else
|
|
#define RCT_ENABLE_INSPECTOR 0
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef ENABLE_PACKAGER_CONNECTION
|
|
#if RCT_DEV && __has_include(<React/RCTPackagerConnection.h>)
|
|
#define ENABLE_PACKAGER_CONNECTION 1
|
|
#else
|
|
#define ENABLE_PACKAGER_CONNECTION 0
|
|
#endif
|
|
#endif
|
|
|
|
#if RCT_DEV
|
|
#define RCT_IF_DEV(...) __VA_ARGS__
|
|
#else
|
|
#define RCT_IF_DEV(...)
|
|
#endif
|
|
|
|
#ifndef RCT_PROFILE
|
|
#define RCT_PROFILE RCT_DEV
|
|
#endif
|
|
|
|
/**
|
|
* Add the default Metro packager port number
|
|
*/
|
|
#ifndef RCT_METRO_PORT
|
|
#define RCT_METRO_PORT 8081
|
|
#else
|
|
// test if RCT_METRO_PORT is empty
|
|
#define RCT_METRO_PORT_DO_EXPAND(VAL) VAL ## 1
|
|
#define RCT_METRO_PORT_EXPAND(VAL) RCT_METRO_PORT_DO_EXPAND(VAL)
|
|
#if !defined(RCT_METRO_PORT) || (RCT_METRO_PORT_EXPAND(RCT_METRO_PORT) == 1)
|
|
// Only here if RCT_METRO_PORT is not defined
|
|
// OR RCT_METRO_PORT is the empty string
|
|
#undef RCT_METRO_PORT
|
|
#define RCT_METRO_PORT 8081
|
|
#endif
|
|
#endif
|
|
|
|
/**
|
|
* By default, only raise an NSAssertion in debug mode
|
|
* (custom assert functions will still be called).
|
|
*/
|
|
#ifndef RCT_NSASSERT
|
|
#define RCT_NSASSERT RCT_DEBUG
|
|
#endif
|
|
|
|
/**
|
|
* Concat two literals. Supports macro expansions,
|
|
* e.g. RCT_CONCAT(foo, __FILE__).
|
|
*/
|
|
#define RCT_CONCAT2(A, B) A ## B
|
|
#define RCT_CONCAT(A, B) RCT_CONCAT2(A, B)
|
|
|
|
/**
|
|
* Throw an assertion for unimplemented methods.
|
|
*/
|
|
#define RCT_NOT_IMPLEMENTED(method) \
|
|
_Pragma("clang diagnostic push") \
|
|
_Pragma("clang diagnostic ignored \"-Wmissing-method-return-type\"") \
|
|
_Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \
|
|
RCT_EXTERN NSException *_RCTNotImplementedException(SEL, Class); \
|
|
method NS_UNAVAILABLE { @throw _RCTNotImplementedException(_cmd, [self class]); } \
|
|
_Pragma("clang diagnostic pop")
|