Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit d26464b

Browse files
johnfMikhailSuendukovDmitriyKirakosyan
authored
Support RN 0.71.0 (#2419)
* Fix contributing instructions Should refer to react-native. react-native-cli was deprecated years ago. * Support RN 0.71.0 (Closes #2418) React native now uses react-native-gradle-plugin, which works a bit differently. * bump react-native test app version to 0.71.3 * bump ruby version to 2.7.6 * Fix tests to work on case sensitive file system * Add initial Linux support to the tests * Fix inclusion of codepush.gradle in tests * Fix iOS template project for tests * Put entry-file back * Release 7.2.0 * add clean to build android function --------- Co-authored-by: Mikhail Suendukov <[email protected]> Co-authored-by: Dmitriy Kirakosyan <[email protected]>
1 parent a97df22 commit d26464b

File tree

13 files changed

+89
-80
lines changed

13 files changed

+89
-80
lines changed

.github/workflows/react-native-code-push-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Setup Ruby
3939
uses: ruby/setup-ruby@v1
4040
with:
41-
ruby-version: '2.7.4'
41+
ruby-version: '2.7.6'
4242
bundler-cache: true
4343
- name: Package Installation
4444
run: npm install
@@ -58,7 +58,7 @@ jobs:
5858
- name: Setup Ruby
5959
uses: ruby/setup-ruby@v1
6060
with:
61-
ruby-version: '2.7.4'
61+
ruby-version: '2.7.6'
6262
bundler-cache: true
6363
- name: Install dependencies
6464
run: npm install

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ Follow these steps to test your modifications to the plugin manually:
3737

3838
First, make sure you have installed the dependencies for the plugin by following the steps above.
3939

40-
Then, make sure you have installed `react-native-cli`.
40+
Then, make sure you have installed `react-native`.
4141

4242
```
43-
npm install -g react-native-cli
43+
npm install -g react-native
4444
```
4545

4646
To run Android tests, make sure you have `sdk\tools`, `sdk\emulator` and `sdk\platform-tools` in your PATH.
@@ -131,4 +131,4 @@ To run the core unit tests on Android and pull the plugin from NPM:
131131
NPM=true CORE=true npm run test:android
132132
```
133133

134-
...and so on!
134+
...and so on!

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ We try our best to maintain backwards compatibility of our plugin with previous
7575
| v0.59 | v5.6+ *(RN refactored js bundle loader code)* |
7676
| v0.60-v0.61 | v6.0+ *(RN migrated to Autolinking)* |
7777
| v0.62-v0.64 | v6.2+ *(RN removed LiveReload)* |
78-
| v0.65-v0.69 | v7.2+ *(RN updated iPhone-target-version)* |
78+
| v0.65-v0.70 | v7.0+ *(RN updated iPhone-target-version)* |
79+
| v0.71 | v7.2+ *(RN moved to react-native-gradle-plugin)* |
7980

8081
*NOTE: `react-native-code-push` versions lower than **[v5.7.0](https://github.com/microsoft/react-native-code-push/releases/tag/v5.7.0)** will stop working in the near future. You can find more information in our [documentation](https://github.com/microsoft/code-push/blob/master/migration-notice.md).*
8182

android/codepush.gradle

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import java.nio.file.Paths;
44

5-
def config = project.hasProperty("react") ? project.react : [];
6-
def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"
5+
def config = project.extensions.findByName("react") ?: []
6+
def bundleAssetName = config.bundleAssetName.get() ?: "index.android.bundle"
77

88
// because elvis operator
99
def elvisFile(thing) {
@@ -23,11 +23,18 @@ android.buildTypes.each { buildType ->
2323
buildType.resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
2424
}
2525

26-
gradle.projectsEvaluated {
26+
gradle.projectsEvaluated {
27+
def debuggableVariants = config.debuggableVariants.get() ?: ['debug']
28+
2729
android.applicationVariants.all { variant ->
30+
// No code push for debuggable variants
31+
if (debuggableVariants.contains(variant.name)) {
32+
return;
33+
}
34+
2835
def nodeModulesPath;
2936
if (config.root) {
30-
nodeModulesPath = Paths.get(config.root, "/node_modules");
37+
nodeModulesPath = Paths.get(config.root.asFile.get().absolutePath, "/node_modules");
3138
} else if (project.hasProperty('nodeModulesPath')) {
3239
nodeModulesPath = project.nodeModulesPath
3340
} else {
@@ -42,40 +49,38 @@ gradle.projectsEvaluated {
4249
def jsBundleFile;
4350

4451
// Additional node commandline arguments
45-
def nodeExecutableAndArgs = config.nodeExecutableAndArgs ?: ["node"]
46-
def extraPackagerArgs = config.extraPackagerArgs ?: []
52+
def nodeExecutableAndArgs = config.nodeExecutableAndArgs.get() ?: ["node"]
53+
def extraPackagerArgs = config.extraPackagerArgs.get() ?: []
4754

4855
// Make this task run right after the bundle task
4956
def generateBundledResourcesHash;
5057

51-
if (variant.hasProperty("bundleJsAndAssets")) {
52-
def reactBundleTask = variant.bundleJsAndAssets
53-
jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath
54-
resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath
58+
def reactBundleTask = tasks.findByName("createBundle${targetName}JsAndAssets")
59+
if (reactBundleTask) {
60+
jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get()
61+
resourcesDir = reactBundleTask.property('resourcesDir').asFile.get()
5562
jsBundleFile = file("$jsBundleDir/$bundleAssetName")
5663

5764
generateBundledResourcesHash = tasks.create(
5865
name: "generateBundledResourcesHash${targetName}",
5966
type: Exec) {
6067
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/react-native-code-push/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir)
6168

62-
enabled config."bundleIn${targetName}" ||
63-
config."bundleIn${variant.buildType.name.capitalize()}" ?:
64-
targetName.toLowerCase().contains("release")
69+
enabled !debuggableVariants.contains(variant.name) ?: targetName.toLowerCase().contains("release")
6570
}
66-
71+
6772
runBefore("merge${targetName}Resources", generateBundledResourcesHash)
68-
runBefore("merge${targetName}Assets", generateBundledResourcesHash)
73+
runBefore("merge${targetName}Assets", generateBundledResourcesHash)
6974
} else {
7075
def jsBundleDirConfigName = "jsBundleDir${targetName}"
71-
jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?:
76+
jsBundleDir = elvisFile(config."$jsBundleDirConfigName").get() ?:
7277
file("$buildDir/intermediates/assets/${targetPath}")
7378

7479
def resourcesDirConfigName = "resourcesDir${targetName}"
75-
resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?:
80+
resourcesDir = elvisFile(config."${resourcesDirConfigName}").get() ?:
7681
file("$buildDir/intermediates/res/merged/${targetPath}")
7782

78-
// In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
83+
// In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
7984
// '$buildDir' has slightly different structure - 'merged' folder
8085
// does not exists so '${targetPath}' folder contains directly in 'res' folder.
8186
if (!resourcesDir.exists() && file("$buildDir/intermediates/res/${targetPath}").exists()) {
@@ -107,7 +112,8 @@ gradle.projectsEvaluated {
107112
generateBundledResourcesHash.dependsOn("recordFilesBeforeBundleCommand${targetName}")
108113
}
109114

110-
generateBundledResourcesHash.dependsOn("bundle${targetName}JsAndAssets")
115+
generateBundledResourcesHash.dependsOn("createBundle${targetName}JsAndAssets")
116+
111117
runBefore("processArmeabi-v7a${targetName}Resources", generateBundledResourcesHash)
112118
runBefore("processX86${targetName}Resources", generateBundledResourcesHash)
113119
runBefore("processUniversal${targetName}Resources", generateBundledResourcesHash)

code-push-plugin-testing-framework/script/testConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// IMPORTS //
33
var os = require("os");
44
var path = require("path");
5-
var TestUtil_1 = require("./TestUtil");
5+
var TestUtil_1 = require("./testUtil");
66
//////////////////////////////////////////////////////////////////////////////////////////
77
// Configuration variables.
88
// What plugin to use, what project directories to use, etc.

docs/setup-android.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ In order to integrate CodePush into your Android project, please perform the fol
2727
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
2828
```
2929
30-
2. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition underneath `react.gradle`:
30+
2. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition to the end of the file:
3131
3232
```gradle
3333
...
34-
apply from: "../../node_modules/react-native/react.gradle"
3534
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
3635
...
3736
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-code-push",
3-
"version": "7.1.0",
3+
"version": "7.2.0",
44
"description": "React Native plugin for the CodePush service",
55
"main": "CodePush.js",
66
"typings": "typings/react-native-code-push.d.ts",

test/template/index.android.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/template/index.ios.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)