Skip to content

Commit

Permalink
(Android) Example proj: Various dep upgrades, code clean-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
d4vidi committed Jul 10, 2022
1 parent 870cdc6 commit 2d56457
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
38 changes: 12 additions & 26 deletions examples/demo-react-native/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,8 @@ android {
}

dependencies {
if (rnInfo.isRN60OrHigher) {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
} else {
implementation 'com.android.support:appcompat-v7:28.0.0'
}
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'

// noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
Expand All @@ -77,25 +73,15 @@ dependencies {
androidTestImplementation 'com.linkedin.testbutler:test-butler-library:2.2.1'
}

if (rnInfo.isRN60OrHigher) {
// refs: https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.6
// https://react-native-community.github.io/upgrade-helper/?from=0.60.6&to=0.61.4
dependencies {
def enableHermes = project.ext.react.get('enableHermes', false)
if (enableHermes) {
def hermesModuleName = rnInfo.isRN61OrHigher ? 'hermes-engine' : 'hermesvm'
def hermesPath = "../../node_modules/$hermesModuleName/android/"
debugImplementation files(hermesPath + 'hermes-debug.aar')
releaseImplementation files(hermesPath + 'hermes-release.aar')
} else {
implementation 'org.webkit:android-jsc:+'
}
// refs: https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.6
// https://react-native-community.github.io/upgrade-helper/?from=0.60.6&to=0.61.4
dependencies {
def enableHermes = project.ext.react.get('enableHermes', false)
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/"
debugImplementation files(hermesPath + 'hermes-debug.aar')
releaseImplementation files(hermesPath + 'hermes-release.aar')
} else {
implementation 'org.webkit:android-jsc:+'
}
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
2 changes: 1 addition & 1 deletion examples/demo-react-native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
println "[$project] Resorted to Android Gradle-plugin version $androidGradlePluginVersion"

ext {
kotlinVersion = '1.4.21'
kotlinVersion = '1.6.20'
buildToolsVersion = '31.0.0'
compileSdkVersion = 31
targetSdkVersion = 31
Expand Down
3 changes: 0 additions & 3 deletions examples/demo-react-native/android/rninfo.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ println "[$project] rn-info: detected React Native version (major) $rnMajorVer"

project.ext.rnInfo = [
majorVersion: rnMajorVer,
isRN60OrHigher: rnMajorVer >= 60,
isRN61OrHigher: rnMajorVer >= 61,
isRN62OrHigher: rnMajorVer >= 62,
isRN64OrHigher: rnMajorVer >= 64,
isRN66OrHigher: rnMajorVer >= 66,
isRN68OrHigher: rnMajorVer >= 68
Expand Down

0 comments on commit 2d56457

Please sign in to comment.