You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(gradle-plugin): postpone build configuration errors at task execution
Build script misconfiguration will now be reported at task execution instead of during project sync. This allows to progressively configure build script.
Copy file name to clipboardExpand all lines: gradle-plugin/src/main/kotlin/io/github/manriif/supabase/functions/task/SupabaseFunctionGenerateImportMapTask.kt
kmpExtension.sourceSets.named { it =="jsMain" }.configureEach {
147
+
kotlin.srcDir(outputDir)
148
+
}
149
+
}
147
150
}
148
151
149
152
privatefun Project.registerCopyJsTask(
@@ -166,36 +169,36 @@ private fun Project.registerCopyKotlinTask(
166
169
) {
167
170
val uppercaseEnvironment = environment.uppercaseFirstChar()
168
171
val compileSyncTaskName ="js${uppercaseEnvironment}LibraryCompileSync"
169
-
170
-
if (tasks.names.none { it == compileSyncTaskName }) {
171
-
logger.error(
172
-
"""
173
-
Could not locate task `$compileSyncTaskName`, common reasons for this error are:
174
-
175
-
- The `$SUPABASE_FUNCTION_PLUGIN_NAME` plugin was applied on a build script where the kotlin multiplatform plugin was not applied (e.g., root build script)
176
-
- The kotlin multiplatform plugin was not applied on this project
177
-
- JS target was not initialized on this project
178
-
- JS target is missing `binaries.library()`
179
-
""".trimIndent()
180
-
)
181
-
182
-
error("Could not locate task `$compileSyncTaskName`, check the logs for possible causes.")
183
-
}
184
-
185
172
val taskName =TASK_GENERATE_ENVIRONMENT_TEMPLATE.format(uppercaseEnvironment)
if (tasks.names.none { it == compileSyncTaskName }) {
186
+
doFirst {
187
+
error(
188
+
"""
189
+
Task `$compileSyncTaskName` was not found during project sync, common reasons for this error are:
190
+
191
+
- The `$SUPABASE_FUNCTION_PLUGIN_NAME` plugin was applied on a build script where the kotlin multiplatform plugin was not applied (e.g., root build script)
192
+
- The kotlin multiplatform plugin was not applied on this project
193
+
- JS target was not initialized on this project
194
+
- JS target is missing `binaries.library()`
195
+
""".trimIndent()
196
+
)
197
+
}
198
+
} else {
199
+
dependsOn(compileSyncTaskName)
200
+
}
201
+
199
202
dependsOn(TASK_COPY_JS)
200
203
}
201
204
}
@@ -270,20 +273,24 @@ private fun Project.registerGenerateImportMapTask(
0 commit comments