From 84a8033deea796dfdbde23109f2f9c713f9b11de Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Mon, 3 Feb 2025 11:35:42 -0300 Subject: [PATCH 1/8] chore: rename android library name --- CONTRIBUTING.md | 2 +- android/CMakeLists.txt | 2 +- .../src/main/java/com/margelo/bignumber/BigNumberModule.java | 2 +- example/android/app/build.gradle | 2 +- example/android/settings.gradle | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) 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..3011682 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -1,7 +1,7 @@ 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) 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 From 0a47a464d5c1bc456f80588b7fbeccefacc56aab Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Mon, 3 Feb 2025 12:26:48 -0300 Subject: [PATCH 2/8] fix: android CMakeLists.txt --- android/CMakeLists.txt | 32 +++++++++++-------- android/build.gradle | 4 ++- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index 3011682..bc8062b 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -4,10 +4,14 @@ cmake_minimum_required(VERSION 3.9.0) set(PACKAGE_NAME "react-native-bignumber") set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build) set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_VERBOSE_MAKEFILE 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 +49,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..5660875 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' } 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 From 2f1888b5f17c363d7e34eb130f3aee3ec76aed65 Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Mon, 3 Feb 2025 12:33:12 -0300 Subject: [PATCH 3/8] chore: use java 11 on CI --- .github/workflows/build-android.yml | 4 ++-- .github/workflows/validate-android.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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..6e621a0 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 From de9acafcc01647fde7ddaf727a74525eacd7904e Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Mon, 3 Feb 2025 23:56:55 -0300 Subject: [PATCH 4/8] chore: attempt to fix android CI --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 5660875..1f17091 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -128,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 From 172692b2c1b3f67b57fcf7b2a8f7924a34e513b3 Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Tue, 4 Feb 2025 00:10:25 -0300 Subject: [PATCH 5/8] chore: no verbose makefile and no specific version for android implementations --- android/CMakeLists.txt | 1 - android/build.gradle | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index bc8062b..0b72181 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -5,7 +5,6 @@ set(PACKAGE_NAME "react-native-bignumber") set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_VERBOSE_MAKEFILE ON) # Consume shared libraries and headers from prefabs find_package(fbjni REQUIRED CONFIG) diff --git a/android/build.gradle b/android/build.gradle index 1f17091..3ec4b9b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -128,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:0.71.6" - implementation "com.facebook.react:hermes-android:0.71.6" + implementation "com.facebook.react:react-android:+" + implementation "com.facebook.react:hermes-android:+" } \ No newline at end of file From 8806cd06e012dd469893c034014273753c80ff42 Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Tue, 4 Feb 2025 00:28:57 -0300 Subject: [PATCH 6/8] chore: verify lint report --- .github/workflows/validate-android.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-android.yml b/.github/workflows/validate-android.yml index 6e621a0..2c6252f 100644 --- a/.github/workflows/validate-android.yml +++ b/.github/workflows/validate-android.yml @@ -54,7 +54,15 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - name: Run Gradle Lint - run: ./gradlew lint --build-cache + run: ./gradlew lint --build-cache --stacktrace + + - name: Verify lint report exists + run: | + ls -R build/reports + if [ ! -f "build/reports/lint-results.xml" ]; then + echo "Lint report not found!" + exit 1 + fi - name: Parse Gradle Lint Report uses: yutailang0119/action-android-lint@v1.0.2 From 1880962d78b892c9d1382677ba81d88678aa1753 Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Tue, 4 Feb 2025 00:36:06 -0300 Subject: [PATCH 7/8] revert: specific version 0.71.6 on android/build.gradle --- .github/workflows/validate-android.yml | 3 +-- android/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validate-android.yml b/.github/workflows/validate-android.yml index 2c6252f..3174fce 100644 --- a/.github/workflows/validate-android.yml +++ b/.github/workflows/validate-android.yml @@ -54,8 +54,7 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - name: Run Gradle Lint - run: ./gradlew lint --build-cache --stacktrace - + run: ./gradlew lint --build-cache - name: Verify lint report exists run: | ls -R build/reports diff --git a/android/build.gradle b/android/build.gradle index 3ec4b9b..1f17091 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -128,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 From 0f1f71fa6266dcfb8812d4d5b21a983f8f41f7bd Mon Sep 17 00:00:00 2001 From: Renan Mav Date: Tue, 4 Feb 2025 00:41:33 -0300 Subject: [PATCH 8/8] chore: android/build/reports/lint-results-debug.xml --- .github/workflows/validate-android.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate-android.yml b/.github/workflows/validate-android.yml index 3174fce..268135c 100644 --- a/.github/workflows/validate-android.yml +++ b/.github/workflows/validate-android.yml @@ -58,15 +58,14 @@ jobs: - name: Verify lint report exists run: | ls -R build/reports - if [ ! -f "build/reports/lint-results.xml" ]; then + 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