initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

44
node_modules/react-native/ReactCommon/fabric/BUCK generated vendored Normal file
View File

@@ -0,0 +1,44 @@
load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags")
load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "APPLE_INSPECTOR_FLAGS")
APPLE_COMPILER_FLAGS = []
if not IS_OSS_BUILD:
load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_static_library_ios_flags", "flags")
APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), 'compiler_flags')
rn_xplat_cxx_library(
name = "fabric",
srcs = glob(["*.cpp"]),
header_namespace = "",
exported_headers = subdir_glob(
[
("", "*.h"),
],
prefix = "fabric",
),
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + APPLE_INSPECTOR_FLAGS,
force_static = True,
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
visibility = [
"PUBLIC",
],
deps = [
"xplat//fbsystrace:fbsystrace",
"xplat//folly:headers_only",
"xplat//folly:memory",
"xplat//folly:molly",
"xplat//third-party/glog:glog",
react_native_xplat_target("fabric/core:core"),
],
)

View File

@@ -0,0 +1,54 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "FabricUIManager.h"
#include "IFabricPlatformUIOperationManager.h"
#include "ShadowNode.h"
namespace facebook {
namespace react {
FabricUIManager::FabricUIManager(const std::shared_ptr<IFabricPlatformUIOperationManager> &platformUIOperationManager) :
platformUIOperationManager_(platformUIOperationManager) {};
ShadowNodeRef FabricUIManager::createNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle) {
platformUIOperationManager_->performUIOperation();
return std::make_shared<ShadowNode>(reactTag, viewName, rootTag, props, instanceHandle);
}
ShadowNodeRef FabricUIManager::cloneNode(const ShadowNodeRef &node) {
return nullptr;
}
ShadowNodeRef FabricUIManager::cloneNodeWithNewChildren(const ShadowNodeRef &node) {
return nullptr;
}
ShadowNodeRef FabricUIManager::cloneNodeWithNewProps(const ShadowNodeRef &node, folly::dynamic props) {
return nullptr;
}
ShadowNodeRef FabricUIManager::cloneNodeWithNewChildrenAndProps(const ShadowNodeRef &node, folly::dynamic newProps) {
return nullptr;
}
void FabricUIManager::appendChild(const ShadowNodeRef &parentNode, const ShadowNodeRef &childNode) {
}
ShadowNodeSetRef FabricUIManager::createChildSet(int rootTag) {
return nullptr;
}
void FabricUIManager::appendChildToSet(const ShadowNodeSetRef &childSet, const ShadowNodeRef &childNode) {
}
void FabricUIManager::completeRoot(int rootTag, const ShadowNodeSetRef &childSet) {
}
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,43 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <folly/dynamic.h>
#include <folly/FBVector.h>
#include <memory>
namespace facebook {
namespace react {
class ShadowNode;
class IFabricPlatformUIOperationManager;
typedef std::shared_ptr<const ShadowNode> ShadowNodeRef;
typedef folly::fbvector<const ShadowNodeRef> ShadowNodeSet;
typedef std::shared_ptr<const ShadowNodeSet> ShadowNodeSetRef;
class FabricUIManager {
public:
FabricUIManager(const std::shared_ptr<IFabricPlatformUIOperationManager> &platformUIOperationManager);
ShadowNodeRef createNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle);
ShadowNodeRef cloneNode(const ShadowNodeRef &node);
ShadowNodeRef cloneNodeWithNewChildren(const ShadowNodeRef &node);
ShadowNodeRef cloneNodeWithNewProps(const ShadowNodeRef &node, folly::dynamic props);
ShadowNodeRef cloneNodeWithNewChildrenAndProps(const ShadowNodeRef &node, folly::dynamic newProps);
void appendChild(const ShadowNodeRef &parentNode, const ShadowNodeRef &childNode);
ShadowNodeSetRef createChildSet(int rootTag);
void appendChildToSet(const ShadowNodeSetRef &childSet, const ShadowNodeRef &childNode);
void completeRoot(int rootTag, const ShadowNodeSetRef &childSet);
private:
std::shared_ptr<IFabricPlatformUIOperationManager> platformUIOperationManager_;
};
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,23 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace facebook {
namespace react {
/**
* An interface for FabricUIManager to perform platform-specific UI operations, like updating native UIView's in iOS.
*/
class IFabricPlatformUIOperationManager {
public:
// TODO: add meaningful methods
virtual void performUIOperation() = 0;
};
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ShadowNode.h"
namespace facebook {
namespace react {
ShadowNode::ShadowNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle) :
reactTag_(reactTag),
viewName_(viewName),
rootTag_(rootTag),
props_(props),
instanceHandle_(instanceHandle) {}
}}

View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <folly/dynamic.h>
#include <memory>
namespace facebook {
namespace react {
class ShadowNode {
public:
int reactTag_;
std::string viewName_;
int rootTag_;
folly::dynamic props_;
void *instanceHandle_;
ShadowNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle);
};
}}

51
node_modules/react-native/ReactCommon/fabric/core/BUCK generated vendored Normal file
View File

@@ -0,0 +1,51 @@
load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags")
load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "APPLE_INSPECTOR_FLAGS")
APPLE_COMPILER_FLAGS = []
if not IS_OSS_BUILD:
load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_static_library_ios_flags", "flags")
APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), 'compiler_flags')
rn_xplat_cxx_library(
name = "core",
srcs = glob(
[
"**/*.cpp",
],
),
headers = glob(
[
"**/*.h",
],
),
header_namespace = "",
exported_headers = subdir_glob(
[
("primitives", "*.h"),
],
prefix = "fabric/core",
),
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + APPLE_INSPECTOR_FLAGS,
force_static = True,
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
visibility = ["PUBLIC"],
deps = [
"xplat//fbsystrace:fbsystrace",
"xplat//folly:headers_only",
"xplat//folly:memory",
"xplat//folly:molly",
"xplat//third-party/glog:glog",
react_native_xplat_target("fabric/debug:debug"),
],
)

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "Sealable.h"
#include <stdexcept>
namespace facebook {
namespace react {
void Sealable::seal() const {
sealed_ = true;
}
bool Sealable::getSealed() const {
return sealed_;
}
void Sealable::ensureUnsealed() const {
if (sealed_) {
throw std::runtime_error("Attempt to mutate a sealed object.");
}
}
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,57 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace facebook {
namespace react {
/*
* Represents something which can be *sealed* (imperatively marked as immutable).
*
* Why do we need this? In Fabric, some objects are semi-immutable
* even if they explicitly marked as `const`. It means that in some special
* cases those objects can be const-cast-away and then mutated. That comes from
* the fact that we share some object's life-cycle responsibilities with React
* and the immutability is guaranteed by some logic splitted between native and
* JavaScript worlds (which makes impossible to fully use immutability
* enforcement at a language level).
* To detect possible errors as early as possible we additionally mark objects
* as *sealed* after some stage and then enforce this at run-time.
*
* How to use:
* 1. Inherit your class from `Sealable`.
* 2. Call `ensureUnsealed()` from all non-const methods.
* 3. Call `seal()` at some point from which any modifications
* must be prevented.
*/
class Sealable {
public:
/*
* Seals the object. This operation is irreversible;
* the object cannot be "unsealed" after being sealing.
*/
void seal() const;
/*
* Returns if the object already sealed or not.
*/
bool getSealed() const;
protected:
/*
* Throws an exception if the object is sealed.
* Call this from all non-`const` methods.
*/
void ensureUnsealed() const;
private:
mutable bool sealed_ {false};
};
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,46 @@
load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_debug_preprocessor_flags")
load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library", "APPLE_INSPECTOR_FLAGS")
APPLE_COMPILER_FLAGS = []
if not IS_OSS_BUILD:
load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_static_library_ios_flags", "flags")
APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), 'compiler_flags')
rn_xplat_cxx_library(
name = "debug",
srcs = glob(
[
"**/*.cpp",
],
),
headers = glob(
[
"**/*.h",
],
),
header_namespace = "",
exported_headers = subdir_glob(
[
("", "*.h"),
],
prefix = "fabric/debug",
),
compiler_flags = [
"-std=c++14",
"-Wall",
"-fexceptions",
"-frtti",
],
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + APPLE_INSPECTOR_FLAGS,
force_static = True,
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
visibility = ["PUBLIC"],
deps = [
"xplat//folly:headers_only",
],
)

View File

@@ -0,0 +1,71 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "DebugStringConvertible.h"
namespace facebook {
namespace react {
std::string DebugStringConvertible::getDebugChildrenDescription(int level) const {
std::string childrenString = "";
for (auto child : getDebugChildren()) {
childrenString += child->getDebugDescription(level + 1);
}
return childrenString;
}
std::string DebugStringConvertible::getDebugPropsDescription(int level) const {
std::string propsString = "";
for (auto prop : getDebugProps()) {
auto name = prop->getDebugName();
auto value = prop->getDebugValue();
auto children = prop->getDebugPropsDescription(level + 1);
auto valueAndChildren = value + (children.empty() ? "" : "(" + children + ")");
propsString += " " + name + (valueAndChildren.empty() ? "" : "=" + valueAndChildren);
}
if (!propsString.empty()) {
// Removing leading space character.
propsString.erase(propsString.begin());
}
return propsString;
}
std::string DebugStringConvertible::getDebugDescription(int level) const {
std::string nameString = getDebugName();
std::string valueString = getDebugValue();
std::string childrenString = getDebugChildrenDescription(level);
std::string propsString = getDebugPropsDescription(level);
return "<" + nameString +
(valueString.empty() ? "" : "=" + valueString) +
(propsString.empty() ? "" : " " + propsString) +
(childrenString.empty() ? "/>" : ">" + childrenString + "</" + nameString + ">");
}
std::string DebugStringConvertible::getDebugName() const {
return "Node";
}
std::string DebugStringConvertible::getDebugValue() const {
return "";
}
SharedDebugStringConvertibleList DebugStringConvertible::getDebugChildren() const {
return SharedDebugStringConvertibleList();
}
SharedDebugStringConvertibleList DebugStringConvertible::getDebugProps() const {
return SharedDebugStringConvertibleList();
}
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,59 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <string>
#include <vector>
namespace facebook {
namespace react {
class DebugStringConvertible;
using SharedDebugStringConvertible = std::shared_ptr<const DebugStringConvertible>;
using SharedDebugStringConvertibleList = std::vector<const SharedDebugStringConvertible>;
// Abstract class describes conformance to DebugStringConvertible concept
// and implements basic recursive debug string assembly algorithm.
// Use this as a base class for providing a debugging textual representation
// of your class.
// TODO (#26770211): Clear up the naming.
class DebugStringConvertible {
public:
// Returns a name of the object.
// Default implementation returns "Node".
virtual std::string getDebugName() const;
// Returns a value assosiate with the object.
// Default implementation returns an empty string.
virtual std::string getDebugValue() const;
// Returns a list of `DebugStringConvertible` objects which can be considered
// as *children* of the object.
// Default implementation returns an empty list.
virtual SharedDebugStringConvertibleList getDebugChildren() const;
// Returns a list of `DebugStringConvertible` objects which can be considered
// as *properties* of the object.
// Default implementation returns an empty list.
virtual SharedDebugStringConvertibleList getDebugProps() const;
// Returns a string which represents the object in a human-readable way.
// Default implementation returns a description of the subtree
// rooted at this node, represented in XML-like format.
virtual std::string getDebugDescription(int level = 0) const;
// Do same as `getDebugDescription` but return only *children* and
// *properties* parts (which are used in `getDebugDescription`).
virtual std::string getDebugPropsDescription(int level = 0) const;
virtual std::string getDebugChildrenDescription(int level = 0) const;
};
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,41 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "DebugStringConvertibleItem.h"
namespace facebook {
namespace react {
DebugStringConvertibleItem::DebugStringConvertibleItem(
const std::string &name,
const std::string &value,
const SharedDebugStringConvertibleList &props,
const SharedDebugStringConvertibleList &children
):
name_(name),
value_(value),
props_(props),
children_(children) {}
std::string DebugStringConvertibleItem::getDebugName() const {
return name_;
}
std::string DebugStringConvertibleItem::getDebugValue() const {
return value_;
}
SharedDebugStringConvertibleList DebugStringConvertibleItem::getDebugProps() const {
return props_;
}
SharedDebugStringConvertibleList DebugStringConvertibleItem::getDebugChildren() const {
return children_;
}
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,45 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <fabric/debug/DebugStringConvertible.h>
namespace facebook {
namespace react {
// Trivial implementation of `DebugStringConvertible` abstract class
// with a stored output; useful for assembling `DebugStringConvertible` values
// in custom implementations of `getDebugChildren` and `getDebugProps`.
class DebugStringConvertibleItem:
public DebugStringConvertible {
public:
DebugStringConvertibleItem() = default;
DebugStringConvertibleItem(const DebugStringConvertibleItem &item) = default;
DebugStringConvertibleItem(
const std::string &name = "",
const std::string &value = "",
const SharedDebugStringConvertibleList &props = {},
const SharedDebugStringConvertibleList &children = {}
);
std::string getDebugName() const override;
std::string getDebugValue() const override;
SharedDebugStringConvertibleList getDebugChildren() const override;
SharedDebugStringConvertibleList getDebugProps() const override;
private:
std::string name_;
std::string value_;
SharedDebugStringConvertibleList props_;
SharedDebugStringConvertibleList children_;
};
} // namespace react
} // namespace facebook