Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions examples/SampleApp/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ ext.REACT_NATIVE_NODE_MODULES_DIR = file("$rootDir/../node_modules/react-native"
ext.REACT_NATIVE_WORKLETS_NODE_MODULES_DIR =
file("$rootDir/../node_modules/react-native-worklets").absolutePath

subprojects { subproject ->
if (subproject.path != ":app") {
evaluationDependsOn(":app")
project(":app").tasks.matching { task ->
task.name.startsWith("configureCMake")
}.configureEach {
dependsOn(subproject.tasks.matching { it.name == "preBuild" })
}
}
}

allprojects {
repositories {
maven {
Expand All @@ -53,10 +42,4 @@ allprojects {
}
}

project(':app') {
tasks.matching { it.name == "preBuild" || it.name.startsWith("configureCMake") }.configureEach {
dependsOn("generateCodegenArtifactsFromSchema")
}
}

apply plugin: "com.facebook.react.rootproject"
30 changes: 30 additions & 0 deletions package/expo-package/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,33 @@ if (isNewArchitectureEnabled()) {
codegenJavaPackageName = "com.streamchatexpo"
}
}

if (isNewArchitectureEnabled()) {
gradle.projectsEvaluated {
if (rootProject.ext.has("streamChatReactNativeCodegenHookInstalled")) {
return
}

def androidAppProject = rootProject.subprojects.find { it.plugins.hasPlugin("com.android.application") }
if (androidAppProject == null) {
return
}

def dependencyCodegenTasks = rootProject.subprojects
.findAll { it != androidAppProject }
.collect { it.tasks.findByName("generateCodegenArtifactsFromSchema") }
.findAll { it != null }

if (dependencyCodegenTasks.isEmpty()) {
return
}

rootProject.ext.set("streamChatReactNativeCodegenHookInstalled", true)

androidAppProject.tasks.matching { task ->
task.name.startsWith("configureCMake")
}.configureEach {
dependsOn(dependencyCodegenTasks)
}
}
}
3 changes: 3 additions & 0 deletions package/expo-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
"name": "StreamChatExpoSpec",
"type": "all",
"jsSrcsDir": "src/native",
"android": {
"javaPackageName": "com.streamchatexpo"
},
"ios": {
"modulesProvider": {
"StreamVideoThumbnail": "StreamVideoThumbnail"
Expand Down
30 changes: 30 additions & 0 deletions package/native-package/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,33 @@ if (isNewArchitectureEnabled()) {
codegenJavaPackageName = "com.streamchatreactnative"
}
}

if (isNewArchitectureEnabled()) {
gradle.projectsEvaluated {
if (rootProject.ext.has("streamChatReactNativeCodegenHookInstalled")) {
return
}

def androidAppProject = rootProject.subprojects.find { it.plugins.hasPlugin("com.android.application") }
if (androidAppProject == null) {
return
}

def dependencyCodegenTasks = rootProject.subprojects
.findAll { it != androidAppProject }
.collect { it.tasks.findByName("generateCodegenArtifactsFromSchema") }
.findAll { it != null }

if (dependencyCodegenTasks.isEmpty()) {
return
}

rootProject.ext.set("streamChatReactNativeCodegenHookInstalled", true)

androidAppProject.tasks.matching { task ->
task.name.startsWith("configureCMake")
}.configureEach {
dependsOn(dependencyCodegenTasks)
}
}
}
4 changes: 4 additions & 0 deletions package/native-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"android/gradle",
"ios",
"*.podspec",
"react-native.config.js",
"package.json"
],
"license": "SEE LICENSE IN LICENSE",
Expand Down Expand Up @@ -92,6 +93,9 @@
"name": "StreamChatReactNativeSpec",
"type": "all",
"jsSrcsDir": "src/native",
"android": {
"javaPackageName": "com.streamchatreactnative"
},
"ios": {
"modulesProvider": {
"StreamChatReactNative": "StreamChatReactNative",
Expand Down
13 changes: 13 additions & 0 deletions package/native-package/react-native.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
dependency: {
platforms: {
android: {
packageImportPath: 'import com.streamchatreactnative.StreamChatReactNativePackage;',
packageInstance: 'new StreamChatReactNativePackage()',
},
ios: {
podspecPath: 'stream-chat-react-native.podspec',
},
},
},
};
Loading