fbshipit-source-id: 5d9ecf33fca19e4a6b8c979b879ec9dd82af1ef9

This commit is contained in:
Daniel Buchele
2018-06-25 04:33:04 -07:00
parent ec0b3829e2
commit 6fda334a00
70 changed files with 896 additions and 1464 deletions

View File

@@ -22,6 +22,7 @@ module.exports = {
'consistent-return': 0,
'max-len': 0, // let's take prettier take care of this
indent: 0, // let's take prettier take care of this
'no-console': 0, // we're setting window.console in App.js
// additional rules for this project
'header/header': [2, 'block', {pattern}],

View File

@@ -1,10 +1,4 @@
/*
* Copyright (c) 2004-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.
*
*/
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#import <Foundation/Foundation.h>

View File

@@ -1,81 +0,0 @@
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")
load("@xplat//build_defs:fb_java_library.bzl", "fb_java_library")
ANNOTATIONS_SRCS = [
"java/com/facebook/jni/annotations/*.java",
]
fb_java_library(
name = "java_annotations",
srcs = glob(ANNOTATIONS_SRCS),
required_for_source_only_abi = True,
)
fb_java_library(
name = "java",
srcs = glob(
["java/**/*.java"],
exclude = ANNOTATIONS_SRCS,
),
required_for_source_only_abi = True,
visibility = ["PUBLIC"],
deps = [
"//libraries/soloader/java/com/facebook/soloader:soloader",
"//third-party/java/jsr-305:jsr-305",
],
exported_deps = [
":java_annotations",
],
)
fb_xplat_cxx_library(
name = "fbjni",
srcs = glob([
"cxx/fbjni/**/*.cpp",
]),
header_namespace = "",
exported_headers = subdir_glob([
("cxx", "fbjni/**/*.h"),
]),
allow_jni_merging = True,
compiler_flags = [
"-fexceptions",
"-fno-omit-frame-pointer",
"-frtti",
"-ffunction-sections",
],
enable_static_variant = True,
exported_platform_headers = [
(
"^(?!android-arm$).*$",
subdir_glob([
("cxx", "lyra/**/*.h"),
]),
),
],
fbandroid_deps = [
"xplat//third-party/linker_lib:atomic",
],
platform_srcs = [
(
"^(?!android-arm$).*$",
glob([
"cxx/lyra/*.cpp",
]),
),
],
preprocessor_flags = [
"-DLOG_TAG=\"libfbjni\"",
],
soname = "libfbjni.$(ext)",
visibility = [
"PUBLIC",
],
deps = [
"xplat//third-party/linker_lib:android",
],
exported_deps = [
"xplat//third-party/linker_lib:log",
"//native/jni-hack:jni-hack",
],
)

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fbjni/ByteBuffer.h>
#include <stdexcept>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <fbjni/fbjni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <fbjni/fbjni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <fbjni/fbjni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <fbjni/fbjni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <fbjni/fbjni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fbjni/fbjni.h>
#include <fbjni/NativeRunnable.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fbjni/ReadableByteChannel.h>
namespace facebook {

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <fbjni/fbjni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "CoreClasses.h"

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @file Common.h
*
* Defining the stuff that don't deserve headers of their own...

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
/** @file CoreClasses.h

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fbjni/fbjni.h>
#include <functional>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <functional>
#include <string>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CoreClasses.h"
#include "Log.h"

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file Exceptions.h
*

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fbjni/fbjni.h>
namespace facebook {

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
namespace facebook {

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "CoreClasses.h"

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "CoreClasses.h"

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @file ALog.h
*
* Very simple (android only) logging. Define LOG_TAG to enable the macros.

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
namespace facebook {

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <jni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @file meta.h
*
* Provides wrappers for meta data such as methods and fields.

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <jni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <cassert>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file ReferenceAllocators.h
*

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "ReferenceAllocators.h"

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <new>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "References.h"
namespace facebook {

View File

@@ -1,20 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @file References.h
*
* Functionality similar to smart pointers, but for references into the VM. Four main reference

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "Exceptions.h"

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <jni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <type_traits>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "utf8.h"
#include "Log.h"

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fbjni/fbjni.h>
#include <mutex>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <jni.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <atomic>
#include <stdexcept>
#include <cxxabi.h>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <lyra/lyra.h>
#include <atomic>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <iomanip>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <lyra/lyra.h>
namespace facebook {

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <lyra/lyra_exceptions.h>
#include <cstdlib>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <exception>

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;
import com.facebook.jni.annotations.DoNotStrip;

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;
import com.facebook.jni.annotations.DoNotStrip;

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;
import java.lang.ref.PhantomReference;

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;
import com.facebook.jni.annotations.DoNotStrip;

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;
import com.facebook.jni.annotations.DoNotStrip;

View File

@@ -1,17 +1,9 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;

View File

@@ -1,17 +1,9 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;

View File

@@ -1,17 +1,9 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;
import com.facebook.jni.annotations.DoNotStrip;

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2018-present, Facebook, Inc.
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni;
import com.facebook.jni.annotations.DoNotStrip;

View File

@@ -1,19 +1,10 @@
/**
* Copyright 2004-present, Facebook, Inc.
/*
* Copyright (c) 2004-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.jni.annotations;
import static java.lang.annotation.RetentionPolicy.CLASS;
@@ -25,9 +16,8 @@ import java.lang.annotation.Target;
/**
* Add this annotation to a class, method, or field to instruct Proguard to not strip it out.
*
* This is useful for methods called via reflection that could appear as unused to Proguard.
* <p>This is useful for methods called via reflection that could appear as unused to Proguard.
*/
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR })
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(CLASS)
public @interface DoNotStrip {
}
public @interface DoNotStrip {}

View File

@@ -63,7 +63,9 @@ export class App extends React.Component<Props, State> {
super();
this.initTracking();
setupEnvironment();
this.logger = new Logger();
replaceGlobalConsole(this.logger);
this.state = {
activeAppKey: null,
@@ -76,7 +78,6 @@ export class App extends React.Component<Props, State> {
this.bugReporter = new BugReporter(this.logger);
this.commandLineArgs = yargs.parse(electron.remote.process.argv);
setupMenu(this.sendKeyboardAction);
}
@@ -358,3 +359,28 @@ export default connect(
}),
{toggleBugDialogVisible},
)(App);
function replaceGlobalConsole(logger: Logger) {
const loggerMethods = {
log: logger.info,
warn: logger.warn,
error: logger.error,
};
const consoleHandler = {
get: function(obj, prop) {
return prop in loggerMethods
? args => {
obj[prop] && obj[prop](args);
return loggerMethods[prop].bind(logger)(args);
}
: obj[prop];
},
};
window.console = new Proxy(console, consoleHandler);
}
function setupEnvironment() {
if (!process.env.ANDROID_HOME) {
process.env.ANDROID_HOME = '/opt/android_sdk';
}
}

View File

@@ -1,562 +0,0 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import type {
TableBodyRow,
TableColumnOrder,
TableColumnSizes,
TableColumns,
} from 'sonar';
import type {Counter} from './LogWatcher.js';
import type {DeviceLogEntry} from '../../devices/BaseDevice.js';
import {
Text,
ManagedTable,
Button,
colors,
FlexCenter,
LoadingIndicator,
ContextMenu,
FlexColumn,
Glyph,
} from 'sonar';
import {SonarDevicePlugin, SearchableTable} from 'sonar';
import textContent from '../../utils/textContent.js';
import createPaste from '../../utils/createPaste.js';
import LogWatcher from './LogWatcher';
const LOG_WATCHER_LOCAL_STORAGE_KEY = 'LOG_WATCHER_LOCAL_STORAGE_KEY';
type Entries = Array<{
row: TableBodyRow,
entry: DeviceLogEntry,
}>;
type LogsState = {|
initialising: boolean,
rows: Array<TableBodyRow>,
entries: Entries,
key2entry: {[key: string]: DeviceLogEntry},
highlightedRows: Array<string>,
counters: Array<Counter>,
|};
const Icon = Glyph.extends({
marginTop: 5,
});
function getLineCount(str: string): number {
let count = 1;
for (let i = 0; i < str.length; i++) {
if (str[i] === '\n') {
count++;
}
}
return count;
}
function keepKeys(obj, keys) {
const result = {};
for (const key in obj) {
if (keys.includes(key)) {
result[key] = obj[key];
}
}
return result;
}
const COLUMN_SIZE = {
type: 32,
time: 120,
pid: 60,
tid: 60,
tag: 120,
app: 200,
message: 'flex',
};
const COLUMNS = {
type: {
value: '',
},
time: {
value: 'Time',
},
pid: {
value: 'PID',
},
tid: {
value: 'TID',
},
tag: {
value: 'Tag',
},
app: {
value: 'App',
},
message: {
value: 'Message',
},
};
const INITIAL_COLUMN_ORDER = [
{
key: 'type',
visible: true,
},
{
key: 'time',
visible: false,
},
{
key: 'pid',
visible: false,
},
{
key: 'tid',
visible: false,
},
{
key: 'tag',
visible: true,
},
{
key: 'app',
visible: true,
},
{
key: 'message',
visible: true,
},
];
const LOG_TYPES: {
[level: string]: {
label: string,
color: string,
icon?: React.Node,
style?: Object,
},
} = {
verbose: {
label: 'Verbose',
color: colors.purple,
},
debug: {
label: 'Debug',
color: colors.grey,
},
info: {
label: 'Info',
icon: <Icon name="info-circle" color={colors.cyan} />,
color: colors.cyan,
},
warn: {
label: 'Warn',
style: {
backgroundColor: colors.yellowTint,
color: colors.yellow,
fontWeight: 500,
},
icon: <Icon name="caution-triangle" color={colors.yellow} />,
color: colors.yellow,
},
error: {
label: 'Error',
style: {
backgroundColor: colors.redTint,
color: colors.red,
fontWeight: 500,
},
icon: <Icon name="caution-octagon" color={colors.red} />,
color: colors.red,
},
fatal: {
label: 'Fatal',
style: {
backgroundColor: colors.redTint,
color: colors.red,
fontWeight: 700,
},
icon: <Icon name="stop" color={colors.red} />,
color: colors.red,
},
};
const DEFAULT_FILTERS = [
{
type: 'enum',
enum: Object.keys(LOG_TYPES).map(value => ({
label: LOG_TYPES[value].label,
value,
})),
key: 'type',
value: [],
persistent: true,
},
];
const NonSelectableText = Text.extends({
alignSelf: 'baseline',
userSelect: 'none',
lineHeight: '130%',
marginTop: 6,
});
const LogCount = NonSelectableText.extends(
{
backgroundColor: props => props.color,
borderRadius: '999em',
fontSize: 11,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
marginTop: 4,
width: 16,
height: 16,
color: colors.white,
},
{
ignoreAttributes: ['color'],
},
);
const HiddenScrollText = NonSelectableText.extends({
'&::-webkit-scrollbar': {
display: 'none',
},
});
function pad(chunk: mixed, len: number): string {
let str = String(chunk);
while (str.length < len) {
str = `0${str}`;
}
return str;
}
export default class LogTable extends SonarDevicePlugin<LogsState> {
static id = 'DeviceLogs';
static title = 'Logs';
static icon = 'arrow-right';
static keyboardActions = ['clear', 'goToBottom', 'createPaste'];
onKeyboardAction = (action: string) => {
if (action === 'clear') {
this.clearLogs();
} else if (action === 'goToBottom') {
this.goToBottom();
} else if (action === 'createPaste') {
this.createPaste();
}
};
restoreSavedCounters = (): Array<Counter> => {
const savedCounters =
window.localStorage.getItem(LOG_WATCHER_LOCAL_STORAGE_KEY) || '[]';
return JSON.parse(savedCounters).map((counter: Counter) => ({
...counter,
expression: new RegExp(counter.label, 'gi'),
count: 0,
}));
};
state = {
rows: [],
entries: [],
key2entry: {},
initialising: true,
highlightedRows: [],
counters: this.restoreSavedCounters(),
};
tableRef: ?ManagedTable;
columns: TableColumns;
columnSizes: TableColumnSizes;
columnOrder: TableColumnOrder;
init() {
let batch: Entries = [];
let queued = false;
let counter = 0;
const supportedColumns = this.device.supportedColumns();
this.columns = keepKeys(COLUMNS, supportedColumns);
this.columnSizes = keepKeys(COLUMN_SIZE, supportedColumns);
this.columnOrder = INITIAL_COLUMN_ORDER.filter(obj =>
supportedColumns.includes(obj.key),
);
this.device.addLogListener((entry: DeviceLogEntry) => {
const {icon, style} =
LOG_TYPES[(entry.type: string)] || LOG_TYPES.verbose;
// clean message
const message = entry.message.trim();
entry.type === 'error';
let counterUpdated = false;
const counters = this.state.counters.map(counter => {
if (message.match(counter.expression)) {
counterUpdated = true;
if (counter.notify) {
new window.Notification(`${counter.label}`, {
body: 'The watched log message appeared',
});
}
return {
...counter,
count: counter.count + 1,
};
} else {
return counter;
}
});
if (counterUpdated) {
this.setState({counters});
}
// build the item, it will either be batched or added straight away
const item = {
entry,
row: {
columns: {
type: {
value: icon,
},
time: {
value: (
<HiddenScrollText code={true}>
{entry.date.toTimeString().split(' ')[0] +
'.' +
pad(entry.date.getMilliseconds(), 3)}
</HiddenScrollText>
),
},
message: {
value: <HiddenScrollText code={true}>{message}</HiddenScrollText>,
},
tag: {
value: (
<NonSelectableText code={true}>{entry.tag}</NonSelectableText>
),
isFilterable: true,
},
pid: {
value: (
<NonSelectableText code={true}>
{String(entry.pid)}
</NonSelectableText>
),
isFilterable: true,
},
tid: {
value: (
<NonSelectableText code={true}>
{String(entry.tid)}
</NonSelectableText>
),
isFilterable: true,
},
app: {
value: (
<NonSelectableText code={true}>{entry.app}</NonSelectableText>
),
isFilterable: true,
},
},
height: getLineCount(message) * 15 + 10, // 15px per line height + 8px padding
style,
type: entry.type,
filterValue: entry.message,
key: String(counter++),
},
};
// batch up logs to be processed every 250ms, if we have lots of log
// messages coming in, then calling an setState 200+ times is actually
// pretty expensive
batch.push(item);
if (!queued) {
queued = true;
setTimeout(() => {
const thisBatch = batch;
batch = [];
queued = false;
// update rows/entries
this.setState(state => {
const rows = [...state.rows];
const entries = [...state.entries];
const key2entry = {...state.key2entry};
for (let i = 0; i < thisBatch.length; i++) {
const {entry, row} = thisBatch[i];
entries.push({row, entry});
key2entry[row.key] = entry;
let previousEntry: ?DeviceLogEntry = null;
if (i > 0) {
previousEntry = thisBatch[i - 1].entry;
} else if (state.rows.length > 0 && state.entries.length > 0) {
previousEntry = state.entries[state.entries.length - 1].entry;
}
this.addRowIfNeeded(rows, row, entry, previousEntry);
}
return {
entries,
rows,
key2entry,
};
});
}, 100);
}
});
setTimeout(() => {
this.setState({
initialising: false,
});
}, 2000);
}
addRowIfNeeded(
rows: Array<TableBodyRow>,
row: TableBodyRow,
entry: DeviceLogEntry,
previousEntry: ?DeviceLogEntry,
) {
const previousRow = rows.length > 0 ? rows[rows.length - 1] : null;
if (
previousRow &&
previousEntry &&
entry.message === previousEntry.message &&
entry.tag === previousEntry.tag &&
previousRow.type != null
) {
const count = (previousRow.columns.time.value.props.count || 1) + 1;
previousRow.columns.type.value = (
<LogCount color={LOG_TYPES[previousRow.type].color}>{count}</LogCount>
);
} else {
rows.push(row);
}
}
clearLogs = () => {
this.setState({
entries: [],
rows: [],
highlightedRows: [],
key2entry: {},
counters: this.state.counters.map(counter => ({
...counter,
count: 0,
})),
});
};
createPaste = () => {
let paste = '';
const mapFn = row =>
Object.keys(COLUMNS)
.map(key => textContent(row.columns[key].value))
.join('\t');
if (this.state.highlightedRows.length > 0) {
// create paste from selection
paste = this.state.rows
.filter(row => this.state.highlightedRows.indexOf(row.key) > -1)
.map(mapFn)
.join('\n');
} else {
// create paste with all rows
paste = this.state.rows.map(mapFn).join('\n');
}
createPaste(paste);
};
setTableRef = (ref: React.ElementRef<*>) => {
this.tableRef = ref;
};
goToBottom = () => {
if (this.tableRef != null) {
this.tableRef.scrollToBottom();
}
};
onRowHighlighted = (highlightedRows: Array<string>) => {
this.setState({
...this.state,
highlightedRows,
});
};
renderSidebar = () => {
return (
<LogWatcher
counters={this.state.counters}
onChange={counters =>
this.setState({counters}, () =>
window.localStorage.setItem(
LOG_WATCHER_LOCAL_STORAGE_KEY,
JSON.stringify(this.state.counters),
),
)
}
/>
);
};
static ContextMenu = ContextMenu.extends({
flex: 1,
});
render() {
const {initialising, highlightedRows, rows} = this.state;
const contextMenuItems = [
{
type: 'separator',
},
{
label: 'Clear all',
click: this.clearLogs,
},
];
return initialising ? (
<FlexCenter fill={true}>
<LoadingIndicator />
</FlexCenter>
) : (
<LogTable.ContextMenu items={contextMenuItems} component={FlexColumn}>
<SearchableTable
innerRef={this.setTableRef}
floating={false}
multiline={true}
columnSizes={this.columnSizes}
columnOrder={this.columnOrder}
columns={this.columns}
stickyBottom={highlightedRows.length === 0}
rows={rows}
onRowHighlighted={this.onRowHighlighted}
multiHighlight={true}
defaultFilters={DEFAULT_FILTERS}
zebra={false}
actions={<Button onClick={this.clearLogs}>Clear Logs</Button>}
/>
</LogTable.ContextMenu>
);
}
}

View File

@@ -95,7 +95,8 @@ export default class LogWatcher extends PureComponent<Props, State> {
onAdd = () => {
if (
this.props.counters.findIndex(({label}) => label === this.state.input) >
-1
-1 ||
this.state.input.length === 0
) {
// prevent duplicates
return;
@@ -198,7 +199,11 @@ export default class LogWatcher extends PureComponent<Props, State> {
onChange={this.onChange}
onKeyDown={this.onSubmit}
/>
<Button onClick={this.onAdd}>Add counter</Button>
<Button
onClick={this.onAdd}
disabled={this.state.input.length === 0}>
Add counter
</Button>
</Toolbar>
<ManagedTable
onRowHighlighted={this.onRowHighlighted}

View File

@@ -4,5 +4,558 @@
* LICENSE file in the root directory of this source tree.
* @format
*/
import LogTable from './LogTable.js';
export default LogTable;
import type {
TableBodyRow,
TableColumnOrder,
TableColumnSizes,
TableColumns,
} from 'sonar';
import type {Counter} from './LogWatcher.js';
import type {DeviceLogEntry} from '../../devices/BaseDevice.js';
import {
Text,
ManagedTable,
Button,
colors,
FlexCenter,
LoadingIndicator,
ContextMenu,
FlexColumn,
Glyph,
} from 'sonar';
import {SonarDevicePlugin, SearchableTable} from 'sonar';
import textContent from '../../utils/textContent.js';
import createPaste from '../../utils/createPaste.js';
import LogWatcher from './LogWatcher';
const LOG_WATCHER_LOCAL_STORAGE_KEY = 'LOG_WATCHER_LOCAL_STORAGE_KEY';
type Entries = Array<{
row: TableBodyRow,
entry: DeviceLogEntry,
}>;
type LogsState = {|
initialising: boolean,
rows: Array<TableBodyRow>,
entries: Entries,
key2entry: {[key: string]: DeviceLogEntry},
highlightedRows: Array<string>,
counters: Array<Counter>,
|};
const Icon = Glyph.extends({
marginTop: 5,
});
function getLineCount(str: string): number {
let count = 1;
for (let i = 0; i < str.length; i++) {
if (str[i] === '\n') {
count++;
}
}
return count;
}
function keepKeys(obj, keys) {
const result = {};
for (const key in obj) {
if (keys.includes(key)) {
result[key] = obj[key];
}
}
return result;
}
const COLUMN_SIZE = {
type: 32,
time: 120,
pid: 60,
tid: 60,
tag: 120,
app: 200,
message: 'flex',
};
const COLUMNS = {
type: {
value: '',
},
time: {
value: 'Time',
},
pid: {
value: 'PID',
},
tid: {
value: 'TID',
},
tag: {
value: 'Tag',
},
app: {
value: 'App',
},
message: {
value: 'Message',
},
};
const INITIAL_COLUMN_ORDER = [
{
key: 'type',
visible: true,
},
{
key: 'time',
visible: false,
},
{
key: 'pid',
visible: false,
},
{
key: 'tid',
visible: false,
},
{
key: 'tag',
visible: true,
},
{
key: 'app',
visible: true,
},
{
key: 'message',
visible: true,
},
];
const LOG_TYPES: {
[level: string]: {
label: string,
color: string,
icon?: React.Node,
style?: Object,
},
} = {
verbose: {
label: 'Verbose',
color: colors.purple,
},
debug: {
label: 'Debug',
color: colors.grey,
},
info: {
label: 'Info',
icon: <Icon name="info-circle" color={colors.cyan} />,
color: colors.cyan,
},
warn: {
label: 'Warn',
style: {
backgroundColor: colors.yellowTint,
color: colors.yellow,
fontWeight: 500,
},
icon: <Icon name="caution-triangle" color={colors.yellow} />,
color: colors.yellow,
},
error: {
label: 'Error',
style: {
backgroundColor: colors.redTint,
color: colors.red,
fontWeight: 500,
},
icon: <Icon name="caution-octagon" color={colors.red} />,
color: colors.red,
},
fatal: {
label: 'Fatal',
style: {
backgroundColor: colors.redTint,
color: colors.red,
fontWeight: 700,
},
icon: <Icon name="stop" color={colors.red} />,
color: colors.red,
},
};
const DEFAULT_FILTERS = [
{
type: 'enum',
enum: Object.keys(LOG_TYPES).map(value => ({
label: LOG_TYPES[value].label,
value,
})),
key: 'type',
value: [],
persistent: true,
},
];
const NonSelectableText = Text.extends({
alignSelf: 'baseline',
userSelect: 'none',
lineHeight: '130%',
marginTop: 6,
});
const LogCount = NonSelectableText.extends(
{
backgroundColor: props => props.color,
borderRadius: '999em',
fontSize: 11,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
marginTop: 4,
width: 16,
height: 16,
color: colors.white,
},
{
ignoreAttributes: ['color'],
},
);
const HiddenScrollText = NonSelectableText.extends({
'&::-webkit-scrollbar': {
display: 'none',
},
});
function pad(chunk: mixed, len: number): string {
let str = String(chunk);
while (str.length < len) {
str = `0${str}`;
}
return str;
}
export default class LogTable extends SonarDevicePlugin<LogsState> {
static id = 'DeviceLogs';
static title = 'Logs';
static icon = 'arrow-right';
static keyboardActions = ['clear', 'goToBottom', 'createPaste'];
onKeyboardAction = (action: string) => {
if (action === 'clear') {
this.clearLogs();
} else if (action === 'goToBottom') {
this.goToBottom();
} else if (action === 'createPaste') {
this.createPaste();
}
};
restoreSavedCounters = (): Array<Counter> => {
const savedCounters =
window.localStorage.getItem(LOG_WATCHER_LOCAL_STORAGE_KEY) || '[]';
return JSON.parse(savedCounters).map((counter: Counter) => ({
...counter,
expression: new RegExp(counter.label, 'gi'),
count: 0,
}));
};
state = {
rows: [],
entries: [],
key2entry: {},
initialising: true,
highlightedRows: [],
counters: this.restoreSavedCounters(),
};
tableRef: ?ManagedTable;
columns: TableColumns;
columnSizes: TableColumnSizes;
columnOrder: TableColumnOrder;
init() {
let batch: Entries = [];
let queued = false;
let counter = 0;
const supportedColumns = this.device.supportedColumns();
this.columns = keepKeys(COLUMNS, supportedColumns);
this.columnSizes = keepKeys(COLUMN_SIZE, supportedColumns);
this.columnOrder = INITIAL_COLUMN_ORDER.filter(obj =>
supportedColumns.includes(obj.key),
);
this.device.addLogListener((entry: DeviceLogEntry) => {
const {icon, style} =
LOG_TYPES[(entry.type: string)] || LOG_TYPES.verbose;
// clean message
const message = entry.message.trim();
entry.type === 'error';
let counterUpdated = false;
const counters = this.state.counters.map(counter => {
if (message.match(counter.expression)) {
counterUpdated = true;
if (counter.notify) {
new window.Notification(`${counter.label}`, {
body: 'The watched log message appeared',
});
}
return {
...counter,
count: counter.count + 1,
};
} else {
return counter;
}
});
if (counterUpdated) {
this.setState({counters});
}
// build the item, it will either be batched or added straight away
const item = {
entry,
row: {
columns: {
type: {
value: icon,
},
time: {
value: (
<HiddenScrollText code={true}>
{entry.date.toTimeString().split(' ')[0] +
'.' +
pad(entry.date.getMilliseconds(), 3)}
</HiddenScrollText>
),
},
message: {
value: <HiddenScrollText code={true}>{message}</HiddenScrollText>,
},
tag: {
value: (
<NonSelectableText code={true}>{entry.tag}</NonSelectableText>
),
isFilterable: true,
},
pid: {
value: (
<NonSelectableText code={true}>
{String(entry.pid)}
</NonSelectableText>
),
isFilterable: true,
},
tid: {
value: (
<NonSelectableText code={true}>
{String(entry.tid)}
</NonSelectableText>
),
isFilterable: true,
},
app: {
value: (
<NonSelectableText code={true}>{entry.app}</NonSelectableText>
),
isFilterable: true,
},
},
height: getLineCount(message) * 15 + 10, // 15px per line height + 8px padding
style,
type: entry.type,
filterValue: entry.message,
key: String(counter++),
},
};
// batch up logs to be processed every 250ms, if we have lots of log
// messages coming in, then calling an setState 200+ times is actually
// pretty expensive
batch.push(item);
if (!queued) {
queued = true;
setTimeout(() => {
const thisBatch = batch;
batch = [];
queued = false;
// update rows/entries
this.setState(state => {
const rows = [...state.rows];
const entries = [...state.entries];
const key2entry = {...state.key2entry};
for (let i = 0; i < thisBatch.length; i++) {
const {entry, row} = thisBatch[i];
entries.push({row, entry});
key2entry[row.key] = entry;
let previousEntry: ?DeviceLogEntry = null;
if (i > 0) {
previousEntry = thisBatch[i - 1].entry;
} else if (state.rows.length > 0 && state.entries.length > 0) {
previousEntry = state.entries[state.entries.length - 1].entry;
}
this.addRowIfNeeded(rows, row, entry, previousEntry);
}
return {
entries,
rows,
key2entry,
};
});
}, 100);
}
});
setTimeout(() => {
this.setState({
initialising: false,
});
}, 2000);
}
addRowIfNeeded(
rows: Array<TableBodyRow>,
row: TableBodyRow,
entry: DeviceLogEntry,
previousEntry: ?DeviceLogEntry,
) {
const previousRow = rows.length > 0 ? rows[rows.length - 1] : null;
if (
previousRow &&
previousEntry &&
entry.message === previousEntry.message &&
entry.tag === previousEntry.tag &&
previousRow.type != null
) {
const count = (previousRow.columns.time.value.props.count || 1) + 1;
previousRow.columns.type.value = (
<LogCount color={LOG_TYPES[previousRow.type].color}>{count}</LogCount>
);
} else {
rows.push(row);
}
}
clearLogs = () => {
this.setState({
entries: [],
rows: [],
highlightedRows: [],
key2entry: {},
counters: this.state.counters.map(counter => ({
...counter,
count: 0,
})),
});
};
createPaste = () => {
let paste = '';
const mapFn = row =>
Object.keys(COLUMNS)
.map(key => textContent(row.columns[key].value))
.join('\t');
if (this.state.highlightedRows.length > 0) {
// create paste from selection
paste = this.state.rows
.filter(row => this.state.highlightedRows.indexOf(row.key) > -1)
.map(mapFn)
.join('\n');
} else {
// create paste with all rows
paste = this.state.rows.map(mapFn).join('\n');
}
createPaste(paste);
};
setTableRef = (ref: React.ElementRef<*>) => {
this.tableRef = ref;
};
goToBottom = () => {
if (this.tableRef != null) {
this.tableRef.scrollToBottom();
}
};
onRowHighlighted = (highlightedRows: Array<string>) => {
this.setState({
...this.state,
highlightedRows,
});
};
renderSidebar = () => {
return (
<LogWatcher
counters={this.state.counters}
onChange={counters =>
this.setState({counters}, () =>
window.localStorage.setItem(
LOG_WATCHER_LOCAL_STORAGE_KEY,
JSON.stringify(this.state.counters),
),
)
}
/>
);
};
static ContextMenu = ContextMenu.extends({
flex: 1,
});
render() {
const {initialising, rows} = this.state;
const contextMenuItems = [
{
type: 'separator',
},
{
label: 'Clear all',
click: this.clearLogs,
},
];
return initialising ? (
<FlexCenter fill={true}>
<LoadingIndicator />
</FlexCenter>
) : (
<LogTable.ContextMenu items={contextMenuItems} component={FlexColumn}>
<SearchableTable
innerRef={this.setTableRef}
floating={false}
multiline={true}
columnSizes={this.columnSizes}
columnOrder={this.columnOrder}
columns={this.columns}
rows={rows}
onRowHighlighted={this.onRowHighlighted}
multiHighlight={true}
defaultFilters={DEFAULT_FILTERS}
zebra={false}
actions={<Button onClick={this.clearLogs}>Clear Logs</Button>}
/>
</LogTable.ContextMenu>
);
}
}

View File

@@ -35,16 +35,14 @@ function querySimulatorDevices(): Promise<IOSDeviceMap> {
{encoding: 'utf8'},
(err, stdout) => {
if (err) {
console.error('Failed to load iOS devices', err);
return resolve({});
reject(err);
}
try {
const {devices} = JSON.parse(stdout.toString());
resolve(devices);
} catch (err) {
console.error('Failed to parse iOS device list', err);
resolve({});
reject(err);
}
},
);
@@ -56,9 +54,11 @@ export default (store: Store) => {
if (process.platform !== 'darwin') {
return;
}
setInterval(() => {
let simulatorUpdateInterval = setInterval(() => {
const {devices} = store.getState();
querySimulatorDevices().then((simulatorDevices: IOSDeviceMap) => {
clearInterval(simulatorUpdateInterval);
querySimulatorDevices()
.then((simulatorDevices: IOSDeviceMap) => {
const simulators: Array<iOSSimulatorDevice> = Object.values(
simulatorDevices,
// $FlowFixMe
@@ -80,7 +80,11 @@ export default (store: Store) => {
// create device
store.dispatch({
type: 'REGISTER_DEVICE',
payload: new IOSDevice(simulator.udid, 'emulator', simulator.name),
payload: new IOSDevice(
simulator.udid,
'emulator',
simulator.name,
),
});
} else if (!isRunning && currentDeviceIDs.has(simulator.udid)) {
deviceIDsToRemove.add(simulator.udid);
@@ -94,6 +98,10 @@ export default (store: Store) => {
payload: deviceIDsToRemove,
});
}
})
.catch(err => {
console.error(err);
clearInterval(simulatorUpdateInterval);
});
}, 3000);
};

View File

@@ -152,7 +152,7 @@ export class Client extends EventEmitter {
try {
rawData = JSON.parse(msg);
} catch (err) {
this.app.logger.error(`Invalid JSON: ${msg}`, 'clientMessage');
console.error(`Invalid JSON: ${msg}`, 'clientMessage');
return;
}
@@ -164,14 +164,14 @@ export class Client extends EventEmitter {
error?: Object,
|} = rawData;
this.app.logger.info(data, 'message:receive');
console.log(data, 'message:receive');
const {id, method} = data;
if (id == null) {
const {error} = data;
if (error != null) {
this.app.logger.error(
console.error(
`Error received from device ${
method ? `when calling ${method}` : ''
}: ${error.message} + \nDevice Stack Trace: ${error.stacktrace}`,
@@ -266,7 +266,7 @@ export class Client extends EventEmitter {
params,
};
this.app.logger.info(data, 'message:call');
console.log(data, 'message:call');
this.startTimingRequestResponse({method, id, params});
this.connection.fireAndForget({data: JSON.stringify(data)});
});
@@ -299,7 +299,7 @@ export class Client extends EventEmitter {
method,
params,
};
this.app.logger.info(data, 'message:send');
console.log(data, 'message:send');
this.connection.fireAndForget({data: JSON.stringify(data)});
}
@@ -335,7 +335,7 @@ export class Server extends EventEmitter {
init() {
if (process.env.NODE_ENV === 'test') {
this.app.logger.warn(
console.warn(
"rsocket server has not been started as we're in test mode",
'server',
);
@@ -361,13 +361,13 @@ export class Server extends EventEmitter {
transportServer
.on('error', err => {
server.emit('error', err);
server.app.logger.error(
console.error(
`Error opening server on port ${port}`,
'server',
);
})
.on('listening', () => {
server.app.logger.warn(
console.warn(
`${
sslConfig ? 'Secure' : 'Certificate'
} server started on port ${port}`,
@@ -401,7 +401,7 @@ export class Server extends EventEmitter {
conn.connectionStatus().subscribe({
onNext(payload) {
if (payload.kind == 'ERROR' || payload.kind == 'CLOSED') {
server.app.logger.warn(
console.warn(
`Device disconnected ${client.id}`,
'connection',
);
@@ -433,7 +433,7 @@ export class Server extends EventEmitter {
try {
rawData = JSON.parse(payload.data);
} catch (err) {
this.app.logger.error(
console.error(
`Invalid JSON: ${payload.data}`,
'clientMessage',
);
@@ -446,7 +446,7 @@ export class Server extends EventEmitter {
destination: string,
|} = rawData;
if (json.method === 'signCertificate') {
this.app.logger.warn('CSR received from device', 'server');
console.warn('CSR received from device', 'server');
const {csr, destination} = json;
this.certificateProvider.processCertificateSigningRequest(
csr,
@@ -471,7 +471,7 @@ export class Server extends EventEmitter {
invariant(query, 'expected query');
const id = `${query.app}-${query.os}-${query.device}`;
this.app.logger.warn(`Device connected: ${id}`, 'connection');
console.warn(`Device connected: ${id}`, 'connection');
const client = new Client(this.app, id, query, conn);
@@ -481,7 +481,7 @@ export class Server extends EventEmitter {
};
client.init().then(() => {
this.app.logger.info(
console.log(
`Device client initialised: ${id}. Supported plugins: ${client.plugins.join(
', ',
)}`,
@@ -547,7 +547,7 @@ class ConnectionTracker {
this.connectionAttempts.set(key, entry);
if (entry.length >= this.connectionProblemThreshold) {
this.logger.error(
console.error(
`Connection loop detected with ${key}. Connected ${
entry.length
} times in ${(time - entry[0]) / 1000}s.`,

View File

@@ -44,7 +44,7 @@ export default class ErrorBoundary extends Component<
componentDidCatch(err: Error) {
this.props.logger &&
this.props.logger.error(err.toString(), 'ErrorBoundary');
console.error(err.toString(), 'ErrorBoundary');
this.setState({error: err});
}

View File

@@ -131,7 +131,7 @@ export default class CertificateProvider {
}
generateClientCertificate(csr: string): Promise<string> {
this.logger.warn('Creating new client cert', logTag);
console.warn('Creating new client cert', logTag);
const csrFile = this.writeToTempFile(csr);
// Create a certificate for the client, using the details in the CSR.
return openssl('x509', {
@@ -197,7 +197,7 @@ export default class CertificateProvider {
return {id: device.id, isMatch};
})
.catch(e => {
this.logger.error(
console.error(
`Unable to check for matching CSR in ${device.id}:${appName}`,
logTag,
);
@@ -234,7 +234,7 @@ export default class CertificateProvider {
);
})
.catch(err => {
this.logger.error(err, logTag);
console.error(err, logTag);
return false;
});
}
@@ -245,7 +245,7 @@ export default class CertificateProvider {
filename: string,
contents: string,
): Promise<void> {
this.logger.warn(`Deploying ${filename} to ${deviceId}:${app}`, logTag);
console.warn(`Deploying ${filename} to ${deviceId}:${app}`, logTag);
return this.executeCommandOnAndroid(
deviceId,
app,
@@ -282,11 +282,11 @@ export default class CertificateProvider {
return output;
})
.catch(err => {
this.logger.error(
console.error(
`Error executing command on android device ${deviceId}:${user}. Command: ${command}`,
logTag,
);
this.logger.error(err, logTag);
console.error(err, logTag);
});
}
@@ -351,7 +351,7 @@ export default class CertificateProvider {
})
.then(output => undefined)
.catch(e => {
this.logger.warn(`Certificate will expire soon: ${filename}`, logTag);
console.warn(`Certificate will expire soon: ${filename}`, logTag);
throw e;
});
}
@@ -373,7 +373,7 @@ export default class CertificateProvider {
if (!fs.existsSync(getFilePath(''))) {
fs.mkdirSync(getFilePath(''));
}
this.logger.info('Generating new CA', logTag);
console.log('Generating new CA', logTag);
return openssl('genrsa', {out: caKey, '2048': false})
.then(_ =>
openssl('req', {
@@ -406,7 +406,7 @@ export default class CertificateProvider {
generateServerCertificate(): Promise<void> {
return this.ensureCertificateAuthorityExists()
.then(_ => {
this.logger.warn('Creating new server cert', logTag);
console.warn('Creating new server cert', logTag);
})
.then(_ => openssl('genrsa', {out: serverKey, '2048': false}))
.then(_ =>

View File

@@ -16,7 +16,7 @@
#define SONAR_LOG(message) \
__android_log_print(ANDROID_LOG_INFO, "sonar", "sonar: %s", message)
#else
#define SONAR_LOG(message) printf("sonar: %s", message)
#define SONAR_LOG(message) printf("sonar: %s\n", message)
#endif
#if FB_SONARKIT_ENABLED

View File

@@ -26,7 +26,7 @@
#define SONAR_LOG(message) \
__android_log_print(ANDROID_LOG_INFO, "sonar", "sonar: %s", message)
#else
#define SONAR_LOG(message) printf("sonar: %s", message)
#define SONAR_LOG(message) printf("sonar: %s\n", message)
#endif
#define CSR_FILE_NAME "app.csr"
@@ -99,7 +99,7 @@ SonarWebSocketImpl::~SonarWebSocketImpl() {
void SonarWebSocketImpl::start() {
folly::makeFuture()
.via(worker_->getEventBase())
.delayed(std::chrono::milliseconds(0))
.delayedUnsafe(std::chrono::milliseconds(0))
.then([this]() { startSync(); });
}
@@ -185,7 +185,7 @@ void SonarWebSocketImpl::connectSecurely() {
void SonarWebSocketImpl::reconnect() {
folly::makeFuture()
.via(worker_->getEventBase())
.delayed(std::chrono::seconds(reconnectIntervalSeconds))
.delayedUnsafe(std::chrono::seconds(reconnectIntervalSeconds))
.then([this]() { startSync(); });
}