Skip to content

Commit d1e87eb

Browse files
committed
fix: misconfigured build.gradle files
1 parent 608eadd commit d1e87eb

5 files changed

Lines changed: 80 additions & 0 deletions

File tree

package/expo-package/android/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,33 @@ if (isNewArchitectureEnabled()) {
137137
codegenJavaPackageName = "com.streamchatexpo"
138138
}
139139
}
140+
141+
if (isNewArchitectureEnabled()) {
142+
gradle.projectsEvaluated {
143+
if (rootProject.ext.has("streamChatReactNativeCodegenHookInstalled")) {
144+
return
145+
}
146+
147+
def androidAppProject = rootProject.subprojects.find { it.plugins.hasPlugin("com.android.application") }
148+
if (androidAppProject == null) {
149+
return
150+
}
151+
152+
def dependencyCodegenTasks = rootProject.subprojects
153+
.findAll { it != androidAppProject }
154+
.collect { it.tasks.findByName("generateCodegenArtifactsFromSchema") }
155+
.findAll { it != null }
156+
157+
if (dependencyCodegenTasks.isEmpty()) {
158+
return
159+
}
160+
161+
rootProject.ext.set("streamChatReactNativeCodegenHookInstalled", true)
162+
163+
androidAppProject.tasks.matching { task ->
164+
task.name.startsWith("configureCMake")
165+
}.configureEach {
166+
dependsOn(dependencyCodegenTasks)
167+
}
168+
}
169+
}

package/expo-package/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
"name": "StreamChatExpoSpec",
9494
"type": "all",
9595
"jsSrcsDir": "src/native",
96+
"android": {
97+
"javaPackageName": "com.streamchatexpo"
98+
},
9699
"ios": {
97100
"modulesProvider": {
98101
"StreamVideoThumbnail": "StreamVideoThumbnail"

package/native-package/android/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,33 @@ if (isNewArchitectureEnabled()) {
155155
codegenJavaPackageName = "com.streamchatreactnative"
156156
}
157157
}
158+
159+
if (isNewArchitectureEnabled()) {
160+
gradle.projectsEvaluated {
161+
if (rootProject.ext.has("streamChatReactNativeCodegenHookInstalled")) {
162+
return
163+
}
164+
165+
def androidAppProject = rootProject.subprojects.find { it.plugins.hasPlugin("com.android.application") }
166+
if (androidAppProject == null) {
167+
return
168+
}
169+
170+
def dependencyCodegenTasks = rootProject.subprojects
171+
.findAll { it != androidAppProject }
172+
.collect { it.tasks.findByName("generateCodegenArtifactsFromSchema") }
173+
.findAll { it != null }
174+
175+
if (dependencyCodegenTasks.isEmpty()) {
176+
return
177+
}
178+
179+
rootProject.ext.set("streamChatReactNativeCodegenHookInstalled", true)
180+
181+
androidAppProject.tasks.matching { task ->
182+
task.name.startsWith("configureCMake")
183+
}.configureEach {
184+
dependsOn(dependencyCodegenTasks)
185+
}
186+
}
187+
}

package/native-package/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"android/gradle",
2222
"ios",
2323
"*.podspec",
24+
"react-native.config.js",
2425
"package.json"
2526
],
2627
"license": "SEE LICENSE IN LICENSE",
@@ -92,6 +93,9 @@
9293
"name": "StreamChatReactNativeSpec",
9394
"type": "all",
9495
"jsSrcsDir": "src/native",
96+
"android": {
97+
"javaPackageName": "com.streamchatreactnative"
98+
},
9599
"ios": {
96100
"modulesProvider": {
97101
"StreamChatReactNative": "StreamChatReactNative",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
dependency: {
3+
platforms: {
4+
android: {
5+
packageImportPath: 'import com.streamchatreactnative.StreamChatReactNativePackage;',
6+
packageInstance: 'new StreamChatReactNativePackage()',
7+
},
8+
ios: {
9+
podspecPath: 'stream-chat-react-native.podspec',
10+
},
11+
},
12+
},
13+
};

0 commit comments

Comments
 (0)