Matija Sokol
11/13/2024, 11:14 AM-PkobwebEnv
to PROD
when exporting site using
./gradlew kobwebExport -PkobwebReuseServer=false -PkobwebEnv=PROD -PkobwebRunLayout=STATIC -PkobwebBuildTarget=RELEASE -PkobwebExportLayout=STATIC
From docs it seems that it should be set when running exported site using
./gradlew kobwebStart -PkobwebEnv=PROD -PkobwebRunLayout=STATIC
If I set PROD
when exporting I got following error
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':web'.
at org.gradle.execution.TaskNameResolver.getExistingTask(TaskNameResolver.java:118)
at org.gradle.execution.TaskNameResolver.access$000(TaskNameResolver.java:34)
...
...
...
Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':web:kobwebExport'.
at org.gradle.api.internal.tasks.DefaultTaskContainer.taskCreationException(DefaultTaskContainer.java:721)
at org.gradle.api.internal.tasks.DefaultTaskContainer.access$600(DefaultTaskContainer.java:77)
...
...
...
Caused by: java.lang.IllegalStateException: Check failed.
at com.varabyte.kobweb.gradle.application.KobwebApplicationPlugin$apply$7$10.execute(KobwebApplicationPlugin.kt:326)
at com.varabyte.kobweb.gradle.application.KobwebApplicationPlugin$apply$7$10.execute(KobwebApplicationPlugin.kt:322)
When I set it to DEV
it works fine.
My usecase is to retrieve kobwebEnv
value and then use it in the rest of app and because of that I need it in exporting phase (below example in build.gradle.kts
)
val env: String = project.findProperty("kobwebEnv")?.toString() ?: "DEV"
David Herman
11/13/2024, 8:37 PMDavid Herman
11/13/2024, 8:37 PMDavid Herman
11/13/2024, 8:38 PMval ctx = rememberPageContext()
if (ctx.isExporting) { ... }
Matija Sokol
11/13/2024, 9:14 PM-PkobwebEnv
which seems useful to me to do that. If there is any different way of doing this, I'm open for suggestions.David Herman
11/13/2024, 9:16 PMDavid Herman
11/13/2024, 9:17 PMDavid Herman
11/13/2024, 9:19 PMMatija Sokol
11/13/2024, 9:21 PMDavid Herman
11/13/2024, 9:22 PMDavid Herman
11/13/2024, 9:23 PMMatija Sokol
11/13/2024, 9:27 PMDavid Herman
11/13/2024, 9:28 PMDavid Herman
11/13/2024, 9:29 PMDavid Herman
11/13/2024, 9:29 PMMatija Sokol
11/13/2024, 9:32 PMDavid Herman
11/13/2024, 9:32 PMDavid Herman
11/13/2024, 9:32 PMDavid Herman
11/13/2024, 9:35 PMDavid Herman
11/13/2024, 9:52 PMgradle/libs.versions.toml
fileDavid Herman
11/13/2024, 9:53 PMAppGlobals
should no longer crash for you in your initApp blockMatija Sokol
11/13/2024, 9:54 PMDavid Herman
11/13/2024, 9:55 PMDavid Herman
11/13/2024, 9:55 PMDavid Herman
11/13/2024, 9:55 PMDavid Herman
11/13/2024, 9:56 PMMatija Sokol
11/13/2024, 9:56 PMMatija Sokol
11/13/2024, 9:57 PMDavid Herman
11/13/2024, 9:58 PMDavid Herman
11/13/2024, 9:58 PMMatija Sokol
11/13/2024, 10:12 PMMatija Sokol
11/13/2024, 10:13 PMMatija Sokol
11/13/2024, 10:14 PMMatija Sokol
11/13/2024, 10:16 PMDavid Herman
11/13/2024, 10:19 PMkobweb run --gradle -Pkey=value
) and then check for that value in my build scriptDavid Herman
11/13/2024, 10:20 PMDavid Herman
11/13/2024, 10:21 PMMatija Sokol
11/13/2024, 10:24 PMdebug
and release
build target both obfuscate generated JS file?David Herman
11/13/2024, 10:24 PMDavid Herman
11/13/2024, 10:24 PMMatija Sokol
11/13/2024, 10:26 PMweb.js
I think it was obfuscated with debug target, but I will check again later. Btw this is a reason why I ask anyway because it also looks strange to meDavid Herman
11/13/2024, 10:27 PMDavid Herman
11/13/2024, 10:28 PM