-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more gha fun, start android build fixes
- Loading branch information
Showing
7 changed files
with
40 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
rootProject.name = 'QuickCryptoExample' | ||
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) | ||
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) | ||
include ':app' | ||
includeBuild('../node_modules/@react-native/gradle-plugin') | ||
includeBuild('../../node_modules/@react-native/gradle-plugin') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { fixupPluginRules } from '@eslint/compat'; | ||
import js from '@eslint/js'; | ||
import eslintReactNative from 'eslint-plugin-react-native'; | ||
import typescriptEslint from 'typescript-eslint'; | ||
|
||
export default typescriptEslint.config( | ||
js.configs.recommended, | ||
...typescriptEslint.configs.recommendedTypeChecked, | ||
// react-native | ||
{ | ||
name: 'eslint-plugin-react-native', | ||
plugins: { | ||
'react-native': fixupPluginRules({ | ||
rules: eslintReactNative.rules, | ||
}), | ||
}, | ||
rules: { | ||
...eslintReactNative.configs.all.rules, | ||
'react-native/sort-styles': 'off', | ||
'react-native/no-inline-styles': 'warn', | ||
}, | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,28 @@ | ||
project(QuickCrypto) | ||
cmake_minimum_required(VERSION 3.10.2) | ||
cmake_minimum_required(VERSION 3.9.0) | ||
|
||
set(PACKAGE_NAME "QuickCrypto") | ||
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build) | ||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD 20) | ||
|
||
# set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") | ||
# set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") | ||
# Add Nitrogen specs :) | ||
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroImage+autolinking.cmake) | ||
|
||
# Third party libraries (Prefabs) | ||
find_package(fbjni REQUIRED CONFIG) | ||
find_package(ReactAndroid REQUIRED CONFIG) | ||
find_package(openssl REQUIRED CONFIG) | ||
find_library(LOG_LIB log) | ||
|
||
add_library( | ||
${PACKAGE_NAME} | ||
SHARED | ||
"src/main/cpp/cpp-adapter.cpp" | ||
"../cpp/HybridRandom.cpp" | ||
) | ||
|
||
target_include_directories( | ||
${PACKAGE_NAME} | ||
PRIVATE | ||
"../cpp" | ||
"src/main/cpp" | ||
"${NODE_MODULES_DIR}/react-native/ReactCommon" | ||
"${NODE_MODULES_DIR}/react-native/ReactCommon/callinvoker" | ||
"${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/react/turbomodule" | ||
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi" | ||
"${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule/core" | ||
"${NODE_MODULES_DIR}/react-native/ReactCommon/react/nativemodule/core" | ||
) | ||
|
||
#file(GLOB LIBRN_DIR "${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}") | ||
|
||
# Link all libraries together | ||
target_link_libraries( | ||
${PACKAGE_NAME} | ||
ReactAndroid::turbomodulejsijni | ||
fbjni::fbjni # <-- fbjni | ||
${LOG_LIB} # <-- Logcat logger | ||
ReactAndroid::jsi # <-- RN: JSI | ||
ReactAndroid::reactnativejni # <-- RN: React Native JNI bindings | ||
ReactAndroid::react_nativemodule_core # <-- RN: React Native native module core | ||
android # <-- Android JNI core | ||
android # <-- Android core | ||
openssl::crypto # <-- OpenSSL (Crypto) | ||
) |
28 changes: 7 additions & 21 deletions
28
packages/react-native-quick-crypto/android/src/main/cpp/cpp-adapter.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,13 @@ | ||
#include <fbjni/fbjni.h> | ||
#include <jni.h> | ||
|
||
using namespace facebook; | ||
#include "HybridRandom.hpp" | ||
#include <NitroModules/HybridObjectRegistry.hpp> | ||
|
||
class CryptoCppAdapter : public jni::HybridClass<CryptoCppAdapter> { | ||
public: | ||
static auto constexpr kJavaDescriptor = "Lcom/margelo/quickcrypto/QuickCryptoModule;"; | ||
|
||
static jni::local_ref<jni::HybridClass<CryptoCppAdapter>::jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis) { | ||
return makeCxxInstance(); | ||
} | ||
|
||
CryptoCppAdapter() {} | ||
|
||
static void registerNatives() { | ||
registerHybrid( | ||
{makeNativeMethod("initHybrid", CryptoCppAdapter::initHybrid), makeNativeMethod("nativeInstall", CryptoCppAdapter::nativeInstall)}); | ||
} | ||
|
||
private: | ||
friend HybridBase; | ||
}; | ||
using namespace margelo::nitro::crypto; | ||
|
||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) { | ||
return facebook::jni::initialize(vm, [] { CryptoCppAdapter::registerNatives(); }); | ||
HybridObjectRegistry::registerHybridObjectConstructor( | ||
"Random", []() -> std::shared_ptr<HybridObject> { return std::make_shared<HybridRandom>(); }); | ||
|
||
return JNI_VERSION_1_2; | ||
} |