Skip to content

Commit

Permalink
Upgrade JS+Android dependecies (#634)
Browse files Browse the repository at this point in the history
Changes:

- Upgrade js libraries in package.json.
- Use Hermes by default in the example project.
- Extract android dependencies versions to example module (Root project) build Gradle.
- Add Kotlin support.
- Bump minimum android version to 21.
- Upgrade Gradle plugin to 6.1.1 (for `NewRelic` users, should be updated to >= 5.25.2)
  • Loading branch information
swabbass committed Jul 6, 2020
1 parent 7e1c073 commit 46b50a9
Show file tree
Hide file tree
Showing 29 changed files with 1,021 additions and 319 deletions.
3 changes: 3 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ buck-out/

# Bundle artifact
*.jsbundle

# Cocoa pods
ios/Pods/
23 changes: 12 additions & 11 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 26
supportLibVersion = "28.0.3"
}
ext{
androidGradlePluginVersion = '4.0.0'
androidSdkVersion = 29
androidMinSdkVersion = 21
kotlinVersion = "1.3.61"
kotlinStdlib = "kotlin-stdlib-jdk8"
detoxKotlinVersion = kotlinVersion
googleServices = "4.3.3"
}
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.0.1'
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
classpath "com.google.gms:google-services:$googleServices"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

Expand All @@ -26,12 +29,10 @@ allprojects {
mavenCentral()
google()
jcenter()

maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../../node_modules/react-native/android"
}
maven { url "$rootDir/../../node_modules/jsc-android/dist" }
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
61 changes: 37 additions & 24 deletions example/android/myapplication/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

project.ext.react = [
root : "../../../",
entryFile: "index.js",
root : "../../../",
entryFile : "index.js",
bundleAssetName: "index.bundle",
bundleInAlpha: true,
bundleInBeta: true
enableHermes : true,
bundleInAlpha : true,
bundleInBeta : true,
hermesFlagsDebug:['-Xes6-proxy'],
hermesFlagsRelease:['-Xes6-proxy']
]

apply from: "../../../node_modules/react-native/react.gradle"

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileSdkVersion androidSdkVersion

defaultConfig {
applicationId "com.wix.reactnativenotifications.app"
minSdkVersion 16
targetSdkVersion 28
minSdkVersion androidMinSdkVersion
targetSdkVersion androidSdkVersion
versionCode 1
versionName "1.0"

ndk {
abiFilters "armeabi-v7a", "x86"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
buildTypes {
Expand All @@ -31,32 +36,40 @@ android {
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
def taskName = getGradle().getStartParameter().getTaskRequests().toString()

packagingOptions {
pickFirst '**/libjsc.so'
pickFirst '**/libc++_shared.so'
if (taskName.contains("InternalDebug")) {
// Release libs take precedence and must be removed
// to allow debugging
exclude '**/libhermes-executor-release.so'
} else {
// Reduce size by deleting the debugger/inspector
exclude '**/libhermes-inspector.so'
exclude '**/libhermes-executor-debug.so'
}
}
}


configurations.all {
resolutionStrategy {
force 'org.webkit:android-jsc:r236355'
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
def hermesPath = "../../../node_modules/hermes-engine/android/";
exec {
executable 'grep'
args "version", '../../../node_modules/hermes-engine/package.json'
}
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
implementation "org.jetbrains.kotlin:$kotlinStdlib:$kotlinVersion"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation 'com.facebook.react:react-native:+'
implementation 'org.webkit:android-jsc-intl:+'
implementation project(':react-native-notifications')

testImplementation'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'
Loading

0 comments on commit 46b50a9

Please sign in to comment.