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

Commit dec9398

Browse files
author
max-mironov
committed
2 parents 23808ca + 3761d9e commit dec9398

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

CodePush.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async function checkForUpdate(deploymentKey = null) {
4646
queryPackage = localPackage;
4747
} else {
4848
queryPackage = { appVersion: config.appVersion };
49-
if (Platform.OS === "ios" && config.packageHash) {
49+
if (config.packageHash) {
5050
queryPackage.packageHash = config.packageHash;
5151
}
5252
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ And that's it! Now when you run or build your app, your staging builds will auto
386386

387387
*Note: If you encounter the error message `ld: library not found for ...`, please consult [this issue](https://github.com/Microsoft/react-native-code-push/issues/426) for a possible solution.*
388388

389-
Additionally, if you want to give them seperate names and/or icons, you can modify the `Product Name` and `Asset Catalog App Icon Set Name` build settings, which will allow your staging builds to be distinguishable from release builds when installed on the same device.
389+
Additionally, if you want to give them seperate names and/or icons, you can modify the `Product Bundle Identifier`, `Product Name` and `Asset Catalog App Icon Set Name` build settings, which will allow your staging builds to be distinguishable from release builds when installed on the same device.
390390

391391
### Dynamic Deployment Assignment
392392

android/codepush.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ gradle.projectsEvaluated {
5252

5353
def jsBundleFile = file("$jsBundleDir/$bundleAssetName")
5454

55+
def resourcesMapTempFileName = "CodePushResourcesMap-" + java.util.UUID.randomUUID().toString().substring(0,8) + ".json"
56+
57+
// Additional node commandline arguments
58+
def nodeExecutableAndArgs = config.nodeExecutableAndArgs ?: ["node"]
59+
5560
// Make this task run right before the bundle task
5661
def recordFilesBeforeBundleCommand = tasks.create(
5762
name: "recordFilesBeforeBundleCommand${targetName}",
5863
type: Exec) {
59-
commandLine "node", "${nodeModulesPath}/react-native-code-push/scripts/recordFilesBeforeBundleCommand.js", resourcesDir
64+
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/react-native-code-push/scripts/recordFilesBeforeBundleCommand.js", resourcesDir, resourcesMapTempFileName)
6065
}
6166

6267
recordFilesBeforeBundleCommand.dependsOn("merge${targetName}Resources")
@@ -67,7 +72,7 @@ gradle.projectsEvaluated {
6772
def generateBundledResourcesHash = tasks.create(
6873
name: "generateBundledResourcesHash${targetName}",
6974
type: Exec) {
70-
commandLine "node", "${nodeModulesPath}/react-native-code-push/scripts/generateBundledResourcesHash.js", resourcesDir, "$jsBundleDir/$bundleAssetName", jsBundleDir
75+
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/react-native-code-push/scripts/generateBundledResourcesHash.js", resourcesDir, "$jsBundleDir/$bundleAssetName", jsBundleDir, resourcesMapTempFileName)
7176
}
7277

7378
generateBundledResourcesHash.dependsOn("bundle${targetName}JsAndAssets")

scripts/generateBundledResourcesHash.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@ var CODE_PUSH_FOLDER_PREFIX = "CodePush";
2121
var CODE_PUSH_HASH_FILE_NAME = "CodePushHash";
2222
var CODE_PUSH_HASH_OLD_FILE_NAME = "CodePushHash.json";
2323
var HASH_ALGORITHM = "sha256";
24-
var TEMP_FILE_PATH = path.join(require("os").tmpdir(), "CodePushResourcesMap.json");
2524

2625
var resourcesDir = process.argv[2];
2726
var jsBundleFilePath = process.argv[3];
2827
var assetsDir = process.argv[4];
28+
var tempFileName = process.argv[5];
29+
30+
var tempFileLocalPath = path.join(require("os").tmpdir(), tempFileName);
2931
var resourceFiles = [];
3032

3133
getFilesInFolder(resourcesDir, resourceFiles);
3234

33-
var oldFileToModifiedTimeMap = require(TEMP_FILE_PATH);
35+
var oldFileToModifiedTimeMap = require(tempFileLocalPath);
3436
var newFileToModifiedTimeMap = {};
3537

3638
resourceFiles.forEach(function(resourceFile) {
@@ -114,4 +116,4 @@ function fileExists(file) {
114116
catch (e) { return false; }
115117
}
116118

117-
fs.unlinkSync(TEMP_FILE_PATH);
119+
fs.unlinkSync(tempFileLocalPath);

scripts/recordFilesBeforeBundleCommand.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ var path = require("path");
1111

1212
var getFilesInFolder = require("./getFilesInFolder");
1313

14-
var TEMP_FILE_PATH = path.join(require("os").tmpdir(), "CodePushResourcesMap.json");
1514

1615
var resourcesDir = process.argv[2];
16+
var tempFileName = process.argv[3];
17+
18+
var tempFileLocalPath = path.join(require("os").tmpdir(), tempFileName);
1719
var resourceFiles = [];
1820

1921
try {
@@ -32,7 +34,7 @@ resourceFiles.forEach(function(resourceFile) {
3234
fileToModifiedTimeMap[resourceFile.path.substring(resourcesDir.length)] = resourceFile.mtime.getTime();
3335
});
3436

35-
fs.writeFile(TEMP_FILE_PATH, JSON.stringify(fileToModifiedTimeMap), function(err) {
37+
fs.writeFile(tempFileLocalPath, JSON.stringify(fileToModifiedTimeMap), function(err) {
3638
if (err) {
3739
throw err;
3840
}

0 commit comments

Comments
 (0)