Ayfri
11/25/2022, 4:25 PMVampire
11/25/2022, 4:29 PMsrcDir
for the source set.mbonnin
11/25/2022, 4:35 PMmbonnin
11/25/2022, 4:35 PMmbonnin
11/25/2022, 4:36 PMmbonnin
11/25/2022, 4:38 PMVampire
11/25/2022, 4:40 PMYou don't want to download from the network every time you buildI don't think it is relevant for that whether you use one or two tasks. The input is a network location, so the question is how to define that in a way that Gradle knows whether it needs to redownload. But you are right, two tasks are better either way, because even if you redownload in every build, the actual generation could stay up-to-date.
Ayfri
11/25/2022, 4:43 PMmbonnin
11/25/2022, 4:44 PMAyfri
11/25/2022, 4:45 PM*.main.kts
?Vampire
11/25/2022, 4:46 PMmbonnin
11/25/2022, 4:47 PM#!/usr/bin/env kscript
with
#!/usr/bin/env kotlin
and name your file with a .main.kts
extension and you should be good to goAyfri
11/25/2022, 5:16 PMmbonnin
11/25/2022, 5:17 PMmbonnin
11/25/2022, 5:17 PMmbonnin
11/25/2022, 5:18 PM@file:DependsOn("com.example:lib-jvm:1.0")
instead of just
@file:DependsOn("com.example:lib:1.0")
mbonnin
11/25/2022, 5:18 PMAyfri
11/25/2022, 5:20 PMAyfri
11/25/2022, 6:01 PMkotlinx.serialization compiler plugin is not applied to the module, so this annotation would not be processed. Make sure that you've setup your buildscript correctly and re-import project.
mbonnin
11/25/2022, 6:02 PMmbonnin
11/25/2022, 6:03 PMfun JsonElement.toAny(): Any? = when (this) {
is JsonObject -> this.mapValues { it.value.toAny() }
is JsonArray -> this.map { it.toAny() }
is JsonPrimitive -> {
when {
isString -> this.content
this is JsonNull -> null
else -> booleanOrNull ?: intOrNull ?: longOrNull ?: doubleOrNull ?: error("cannot decode $this")
}
}
else -> error("cannot convert $this to Any")
}
mbonnin
11/25/2022, 6:04 PMJson.parseToJsonElement(responseText)
mbonnin
11/25/2022, 6:05 PMmbonnin
11/25/2022, 6:06 PMAyfri
11/25/2022, 6:14 PMJavier
11/25/2022, 6:33 PM