Repository navigation
Support RN 0.71.0 #2419
Support RN 0.71.0 #2419
Changes from all commits
6b1a599
cdca0be
bcf4935
80b826d
b1ef7a3
578b18a
86a98d6
6a91843
2e0adb8
283e5d8
bbff9cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,8 @@ | |
|
|
||
| import java.nio.file.Paths; | ||
|
|
||
| def config = project.hasProperty("react") ? project.react : []; | ||
| def bundleAssetName = config.bundleAssetName ?: "index.android.bundle" | ||
| def config = project.extensions.findByName("react") ?: [] | ||
| def bundleAssetName = config.bundleAssetName.get() ?: "index.android.bundle" | ||
|
|
||
| // because elvis operator | ||
| def elvisFile(thing) { | ||
|
|
@@ -23,11 +23,18 @@ android.buildTypes.each { buildType -> | |
| buildType.resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis()) | ||
| } | ||
|
|
||
| gradle.projectsEvaluated { | ||
| gradle.projectsEvaluated { | ||
| def debuggableVariants = config.debuggableVariants.get() ?: ['debug'] | ||
|
|
||
| android.applicationVariants.all { variant -> | ||
| // No code push for debuggable variants | ||
| if (debuggableVariants.contains(variant.name)) { | ||
| return; | ||
| } | ||
|
|
||
| def nodeModulesPath; | ||
| if (config.root) { | ||
| nodeModulesPath = Paths.get(config.root, "/node_modules"); | ||
| nodeModulesPath = Paths.get(config.root.asFile.get().absolutePath, "/node_modules"); | ||
| } else if (project.hasProperty('nodeModulesPath')) { | ||
| nodeModulesPath = project.nodeModulesPath | ||
| } else { | ||
|
|
@@ -42,40 +49,38 @@ gradle.projectsEvaluated { | |
| def jsBundleFile; | ||
|
|
||
| // Additional node commandline arguments | ||
| def nodeExecutableAndArgs = config.nodeExecutableAndArgs ?: ["node"] | ||
| def extraPackagerArgs = config.extraPackagerArgs ?: [] | ||
| def nodeExecutableAndArgs = config.nodeExecutableAndArgs.get() ?: ["node"] | ||
| def extraPackagerArgs = config.extraPackagerArgs.get() ?: [] | ||
|
|
||
| // Make this task run right after the bundle task | ||
| def generateBundledResourcesHash; | ||
|
|
||
| if (variant.hasProperty("bundleJsAndAssets")) { | ||
| def reactBundleTask = variant.bundleJsAndAssets | ||
| jsBundleDir = reactBundleTask.generatedAssetsFolders[0].absolutePath | ||
| resourcesDir = reactBundleTask.generatedResFolders[0].absolutePath | ||
| def reactBundleTask = tasks.findByName("createBundle${targetName}JsAndAssets") | ||
| if (reactBundleTask) { | ||
| jsBundleDir = reactBundleTask.property('jsBundleDir').asFile.get() | ||
| resourcesDir = reactBundleTask.property('resourcesDir').asFile.get() | ||
| jsBundleFile = file("$jsBundleDir/$bundleAssetName") | ||
|
|
||
| generateBundledResourcesHash = tasks.create( | ||
| name: "generateBundledResourcesHash${targetName}", | ||
| type: Exec) { | ||
| commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/react-native-code-push/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir) | ||
|
|
||
| enabled config."bundleIn${targetName}" || | ||
| config."bundleIn${variant.buildType.name.capitalize()}" ?: | ||
| targetName.toLowerCase().contains("release") | ||
| enabled !debuggableVariants.contains(variant.name) ?: targetName.toLowerCase().contains("release") | ||
| } | ||
|
|
||
| runBefore("merge${targetName}Resources", generateBundledResourcesHash) | ||
| runBefore("merge${targetName}Assets", generateBundledResourcesHash) | ||
| runBefore("merge${targetName}Assets", generateBundledResourcesHash) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like there is a build error due to duplicate assets
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the change above only removes whitespace and I believe it is only setting dependencies I've quickly run that test locally and it's fine on my system. I'll dig deeper later tonight MikhailSuendukov is there any way to whitelist me so my pushes can run the GitHub tests without needing approval? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. John Ferlito (@johnf) Just a thought, would it be possible to run GitHub tests on your personal repo to check what's wrong?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gurupad Mamadapur (@Protino) Thanks for reminding me of the obvious!! 😄 trying that now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've experienced
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sergey Smyshlyaev (@sesm) were you switching between old and new versions? The old react native grade code and the new plugin seem to use different directories for flavours. debugUat vs debug/uat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. John Ferlito (@johnf) I've been switching between old and new versions, but I've done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can resolve the issue The issue happen when start building project second time. |
||
| } else { | ||
| def jsBundleDirConfigName = "jsBundleDir${targetName}" | ||
| jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?: | ||
| jsBundleDir = elvisFile(config."$jsBundleDirConfigName").get() ?: | ||
| file("$buildDir/intermediates/assets/${targetPath}") | ||
|
|
||
| def resourcesDirConfigName = "resourcesDir${targetName}" | ||
| resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?: | ||
| resourcesDir = elvisFile(config."${resourcesDirConfigName}").get() ?: | ||
| file("$buildDir/intermediates/res/merged/${targetPath}") | ||
|
|
||
| // In case version of 'Android Plugin for Gradle'' is lower than 1.3.0 | ||
| // In case version of 'Android Plugin for Gradle'' is lower than 1.3.0 | ||
| // '$buildDir' has slightly different structure - 'merged' folder | ||
| // does not exists so '${targetPath}' folder contains directly in 'res' folder. | ||
| if (!resourcesDir.exists() && file("$buildDir/intermediates/res/${targetPath}").exists()) { | ||
|
|
@@ -107,7 +112,8 @@ gradle.projectsEvaluated { | |
| generateBundledResourcesHash.dependsOn("recordFilesBeforeBundleCommand${targetName}") | ||
| } | ||
|
|
||
| generateBundledResourcesHash.dependsOn("bundle${targetName}JsAndAssets") | ||
| generateBundledResourcesHash.dependsOn("createBundle${targetName}JsAndAssets") | ||
|
|
||
| runBefore("processArmeabi-v7a${targetName}Resources", generateBundledResourcesHash) | ||
| runBefore("processX86${targetName}Resources", generateBundledResourcesHash) | ||
| runBefore("processUniversal${targetName}Resources", generateBundledResourcesHash) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #import "AppDelegate.h" | ||
|
|
||
| #import <CodePush/CodePush.h> | ||
|
|
||
| #import <React/RCTBundleURLProvider.h> | ||
| #import <React/RCTBridge.h> | ||
| #import <React/RCTRootView.h> | ||
|
|
||
| @implementation AppDelegate | ||
|
|
||
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
| { | ||
| RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; | ||
| RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge | ||
| moduleName:@"CODE_PUSH_TEST_APP_NAME" | ||
| initialProperties:nil]; | ||
|
|
||
| self.moduleName = @"TestCodePush"; | ||
| // You can add your custom initial props in the dictionary below. | ||
| // They will be passed down to the ViewController used by React Native. | ||
| self.initialProps = @{}; | ||
|
|
||
| return [super application:application didFinishLaunchingWithOptions:launchOptions]; | ||
| } | ||
|
|
||
| - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge | ||
| { | ||
| return [CodePush bundleURL]; | ||
| } | ||
|
|
||
| /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. | ||
| /// | ||
| /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html | ||
| /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). | ||
| /// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`. | ||
| - (BOOL)concurrentRootEnabled | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| @end |
Uh oh!
There was an error while loading. Please reload this page.