Skip to content

Commit

Permalink
fix: declare support for react-native 0.69 (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Jun 13, 2022
1 parent 09e61fd commit 9145b17
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 40 deletions.
44 changes: 29 additions & 15 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plugins {
buildDir = "${rootDir}/${name}/build"

def reactNativeDir = findNodeModulesPath(rootDir, "react-native")
def reactNativeVersion = getReactNativeVersionNumber(rootDir)

repositories {
maven {
Expand All @@ -26,7 +27,7 @@ repositories {
google()

// TODO: Remove this block when we drop support for 0.64.
if (getReactNativeVersionNumber(rootDir) < 6500) {
if (reactNativeVersion < 6500) {
// Artifacts for 0.65+ are published to Maven Central. If we're on an
// older version, we still need to use JCenter.
// noinspection JcenterRepositoryObsolete
Expand Down Expand Up @@ -69,14 +70,20 @@ android {

// TODO: Remove this block when minSdkVersion >= 24. See
// https://stackoverflow.com/q/53402639 for details.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
if (reactNativeVersion < 6900) {
compileOptions {
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
}
}

kotlinOptions {
allWarningsAsErrors = true
jvmTarget = JavaVersion.VERSION_1_8
if (reactNativeVersion < 6900) {
jvmTarget = JavaVersion.VERSION_1_8
} else {
jvmTarget = JavaVersion.VERSION_11
}
}

defaultConfig {
Expand Down Expand Up @@ -149,7 +156,7 @@ android {

// TODO: Remove this block when we drop support for 0.67.
// https://github.com/facebook/react-native/commit/ce74aa4ed335d4c36ce722d47937b582045e05c4
if (getReactNativeVersionNumber(rootDir) < 6800) {
if (reactNativeVersion < 6800) {
main.java.srcDirs += "src/reactinstanceeventlistener-pre-0.68/java"
} else {
main.java.srcDirs += "src/reactinstanceeventlistener-0.68/java"
Expand All @@ -161,16 +168,23 @@ dependencies {
implementation project(":support")

if (project.ext.react.enableHermes) {
def hermesEngineDir =
findNodeModulesPath(file(reactNativeDir), "hermes-engine")
?: findNodeModulesPath(file(reactNativeDir), "hermesvm")
if (hermesEngineDir == null) {
throw new GradleException("Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'.")
}
// TODO: Remove this block when we drop support for 0.68.
if (reactNativeVersion < 6900) {
def hermesEngineDir =
findNodeModulesPath(file(reactNativeDir), "hermes-engine")
?: findNodeModulesPath(file(reactNativeDir), "hermesvm")
if (hermesEngineDir == null) {
throw new GradleException("Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'.")
}

def hermesAndroidDir = "${hermesEngineDir}/android"
releaseImplementation files("${hermesAndroidDir}/hermes-release.aar")
debugImplementation files("${hermesAndroidDir}/hermes-debug.aar")
def hermesAndroidDir = "${hermesEngineDir}/android"
releaseImplementation files("${hermesAndroidDir}/hermes-release.aar")
debugImplementation files("${hermesAndroidDir}/hermes-debug.aar")
} else {
implementation("com.facebook.react:hermes-engine:+") {
exclude(group: "com.facebook.fbjni")
}
}
}

if (buildReactNativeFromSource(rootDir)) {
Expand Down
8 changes: 0 additions & 8 deletions android/build.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
google()
}
}
Expand Down
6 changes: 3 additions & 3 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"windows": "react-native run-windows --no-packager"
},
"peerDependencies": {
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2",
"react-native": "^0.0.0-0 || 0.62 - 0.68 || 1000.0.0",
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0",
"react-native": "^0.0.0-0 || 0.62 - 0.69 || 1000.0.0",
"react-native-macos": "^0.0.0-0 || 0.62 - 0.66",
"react-native-windows": "^0.0.0-0 || 0.62 - 0.68"
"react-native-windows": "^0.0.0-0 || 0.62 - 0.69"
},
"devDependencies": {
"@babel/core": "^7.0.0",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
"@react-native-community/cli-platform-android": ">=4.10.0",
"@react-native-community/cli-platform-ios": ">=4.10.0",
"mustache": "^4.0.0",
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2",
"react-native": "^0.0.0-0 || 0.62 - 0.68 || 1000.0.0",
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0",
"react-native": "^0.0.0-0 || 0.62 - 0.69 || 1000.0.0",
"react-native-macos": "^0.0.0-0 || 0.62 - 0.66",
"react-native-windows": "^0.0.0-0 || 0.62 - 0.68"
"react-native-windows": "^0.0.0-0 || 0.62 - 0.69"
},
"peerDependenciesMeta": {
"@react-native-community/cli": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ const getConfig = (() => {
"pluginManagement {",
" repositories {",
" gradlePluginPortal()",
" mavenLocal()",
" mavenCentral()",
" google()",
" }",
"}",
Expand Down
6 changes: 3 additions & 3 deletions test/configure/__snapshots__/gatherConfig.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ allprojects {
"android/settings.gradle": "pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
google()
}
}
Expand Down Expand Up @@ -410,7 +410,7 @@ allprojects {
"android/settings.gradle": "pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
google()
}
}
Expand Down Expand Up @@ -556,7 +556,7 @@ allprojects {
"android/settings.gradle": "pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
google()
}
}
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5339,10 +5339,10 @@ __metadata:
react-native-test-app: "workspace:."
react-native-windows: ^0.66.11
peerDependencies:
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2
react-native: ^0.0.0-0 || 0.62 - 0.68 || 1000.0.0
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0
react-native: ^0.0.0-0 || 0.62 - 0.69 || 1000.0.0
react-native-macos: ^0.0.0-0 || 0.62 - 0.66
react-native-windows: ^0.0.0-0 || 0.62 - 0.68
react-native-windows: ^0.0.0-0 || 0.62 - 0.69
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -10509,10 +10509,10 @@ __metadata:
"@react-native-community/cli-platform-android": ">=4.10.0"
"@react-native-community/cli-platform-ios": ">=4.10.0"
mustache: ^4.0.0
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2
react-native: ^0.0.0-0 || 0.62 - 0.68 || 1000.0.0
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0
react-native: ^0.0.0-0 || 0.62 - 0.69 || 1000.0.0
react-native-macos: ^0.0.0-0 || 0.62 - 0.66
react-native-windows: ^0.0.0-0 || 0.62 - 0.68
react-native-windows: ^0.0.0-0 || 0.62 - 0.69
peerDependenciesMeta:
"@react-native-community/cli":
optional: true
Expand Down

0 comments on commit 9145b17

Please sign in to comment.