diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 9c95baf..07de846 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -25,10 +25,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Setup JDK 1.8 + - name: Setup JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/.github/workflows/validate-android.yml b/.github/workflows/validate-android.yml index e705451..268135c 100644 --- a/.github/workflows/validate-android.yml +++ b/.github/workflows/validate-android.yml @@ -23,10 +23,10 @@ jobs: working-directory: ./android steps: - uses: actions/checkout@v2 - - name: Setup JDK 1.8 + - name: Setup JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -55,11 +55,17 @@ jobs: ${{ runner.os }}-gradle- - name: Run Gradle Lint run: ./gradlew lint --build-cache - + - name: Verify lint report exists + run: | + ls -R build/reports + if [ ! -f "build/reports/lint-results-debug.xml" ]; then + echo "Lint report not found!" + exit 1 + fi - name: Parse Gradle Lint Report uses: yutailang0119/action-android-lint@v1.0.2 with: - xml_path: android/build/reports/lint-results.xml + xml_path: android/build/reports/lint-results-debug.xml # ktlint: # name: Kotlin Lint # runs-on: ubuntu-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d6547d..9fdf6fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ yarn test To edit the Objective-C files, open `example/ios/BigNumberExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-bignumber`. -To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativeBigNumber` under `Android`. +To edit the Kotlin files, open `example/android` in Android studio and find the source files at `react-native-bignumber` under `Android`. ### Commit message convention diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index b08d42b..0b72181 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -1,13 +1,16 @@ project("react-native-bignumber") cmake_minimum_required(VERSION 3.9.0) -set(PACKAGE_NAME "reactnativeBigNumber") +set(PACKAGE_NAME "react-native-bignumber") set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build) set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Consume shared libraries and headers from prefabs find_package(fbjni REQUIRED CONFIG) find_package(ReactAndroid REQUIRED CONFIG) +find_package(openssl REQUIRED CONFIG) +find_library(LOG_LIB log) include_directories( "../cpp" @@ -45,24 +48,26 @@ set_target_properties( POSITION_INDEPENDENT_CODE ON ) -file(GLOB LIBRN_DIR "${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}") - -find_library( - log-lib - log -) - -find_package(openssl REQUIRED CONFIG) - target_link_libraries( ${PACKAGE_NAME} - ReactAndroid::turbomodulejsijni + ${LOG_LIB} fbjni::fbjni - ${log-lib} ReactAndroid::jsi - ReactAndroid::reactnativejni - ReactAndroid::react_nativemodule_core android openssl::crypto openssl::ssl ) + +if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) + target_link_libraries( + ${PACKAGE_NAME} + ReactAndroid::reactnative + ) +else () + target_link_libraries( + ${PACKAGE_NAME} + ReactAndroid::reactnativejni + ReactAndroid::turbomodulejsijni + ReactAndroid::react_nativemodule_core + ) +endif () \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index e5e68db..1f17091 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -90,12 +90,14 @@ android { '**/libreactnativejni.so', '**/libjsi.so', '**/libreact_nativemodule_core.so', - '**/libturbomodulejsijni.so' + '**/libturbomodulejsijni.so', + '**/libreactnative.so' ] } resources { excludes += ['**/MANIFEST.MF'] } + exclude 'META-INF/LICENSE.md' } @@ -126,6 +128,6 @@ dependencies { // https://mvnrepository.com/artifact/com.android.ndk.thirdparty/openssl implementation 'com.android.ndk.thirdparty:openssl:1.1.1l-beta-1' - implementation "com.facebook.react:react-android:" - implementation "com.facebook.react:hermes-android:" + implementation "com.facebook.react:react-android:0.71.6" + implementation "com.facebook.react:hermes-android:0.71.6" } \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 549d844..ffed3a2 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/android/src/main/java/com/margelo/bignumber/BigNumberModule.java b/android/src/main/java/com/margelo/bignumber/BigNumberModule.java index bd2fcf8..61f172d 100644 --- a/android/src/main/java/com/margelo/bignumber/BigNumberModule.java +++ b/android/src/main/java/com/margelo/bignumber/BigNumberModule.java @@ -41,7 +41,7 @@ public boolean install() { return false; } Log.i(NAME, "Loading C++ library..."); - System.loadLibrary("reactnativeBigNumber"); + System.loadLibrary("react-native-bignumber"); JavaScriptContextHolder jsContext = getReactApplicationContext().getJavaScriptContextHolder(); CallInvokerHolderImpl jsCallInvokerHolder = (CallInvokerHolderImpl) getReactApplicationContext() diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 249b58d..0c75a3d 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -166,7 +166,7 @@ dependencies { implementation jscFlavor } - implementation project(':reactnativeBigNumber') + implementation project(':react-native-bignumber') } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) diff --git a/example/android/settings.gradle b/example/android/settings.gradle index ead7d18..4b74ddb 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -3,5 +3,5 @@ apply from: file("../node_modules/@react-native-community/cli-platform-android/n include ':app' includeBuild('../node_modules/react-native-gradle-plugin') -include ':reactnativeBigNumber' -project(':reactnativeBigNumber').projectDir = new File(rootProject.projectDir, '../../android') \ No newline at end of file +include ':react-native-bignumber' +project(':react-native-bignumber').projectDir = new File(rootProject.projectDir, '../../android') \ No newline at end of file