https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
gradle
  • v

    Vivek Modi

    11/12/2021, 1:06 PM
    I am facing this issue when i running the application to install my emulator
    k
    • 2
    • 10
  • c

    christophsturm

    11/15/2021, 1:51 PM
    does kotlin 1.6.0 work with gradle 7.3?
    j
    k
    +2
    • 5
    • 10
  • c

    Carlos Hernandez

    11/15/2021, 3:25 PM
    I’m struggling to understand what versions gradle choose when there is no version specified but multiple versions available. Any pointers?
    v
    j
    • 3
    • 2
  • e

    egorand

    11/15/2021, 10:57 PM
    Hey! I’ve been debugging remote cache misses in our project, and noticed that a
    compileDebugKotlin
    build performed by CI that populated the cache and a local build that consumed the cache print out different task class names, which seemingly results in a miss - CI says it ran
    KotlinCompileWithWorkers
    and the dev machine says it ran
    KotlinCompile
    (see the screenshot). Upon some investigation I landed on this code that seems to pick a different task based on whether build parallelization is enabled (controlled by
    kotlin.parallel.tasks.in.project
    before 1.5.20 and IIUC by
    org.gradle.parallel
    after that - please correct me if I’m wrong): https://github.com/JetBrains/kotlin/blob/v1.5.31/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/TasksProvider.kt#L165-L166 I’m not sure if this is a red herring and our cache misses have a different cause, but I’m curious if it’s a known issue. I also noticed that the following commit removes the
    KotlinCompileWithWorkers
    task, which seemingly will ship in 1.6.20: https://github.com/JetBrains/kotlin/commit/904f9c72f2a8996511def90d76e054a2f9f98b0e So far we’re planning to enable parallelization for our CI builds, but would love to know more about this issue.
    t
    • 2
    • 10
  • j

    Jason5lee

    11/16/2021, 1:44 AM
    Is there any tool for converting a piece of gradle script into gradle kts script? For a lot of times I can only find solution for gradle script online and have some troubles when converting it into kts script.
    👀 1
    a
    m
    n
    • 4
    • 5
  • s

    Scott Kruse

    11/18/2021, 6:43 PM
    Do we need to include the kotlin std library in our gradle dependencies if we're using kotlin gradle plugin? does the plugin know which std lib to load based on the jvmTarget we set in kotlinOptions? Currently the android app's minSdk is 24
    c
    • 2
    • 2
  • p

    plastiv

    11/19/2021, 6:50 PM
    Could not perform incremental compilation: Could not connect to Kotlin compile daemon
    Could not connect to kotlin daemon. Using fallback strategy.
    Is there a way to prevent switching to fallback strategy and just abort the build instead?
    a
    p
    • 3
    • 4
  • a

    Arpan Sarkar

    11/21/2021, 2:59 PM
    I migrated one of my project i replaced groovy build scripts with kts in many places i am getting
    marked with @Incubating
    warining is there any way to disable those warning project wide without using the
    @file:Suppress("UnstableApiUsage")
    f
    • 2
    • 1
  • c

    Ch8n

    11/22/2021, 6:00 AM
    Hi Im trying to add CLI framework of https://github.com/JakeWharton/mosaic into KMP project, Issue Im facing is the framework uses
    classpath(kotlin("gradle-plugin", version = "1.5.10"))
    and other KMP modules uses
    1.5.31
    Im trying to figure out if I can put a conditional if/else in buildscript depending on the module name or create new buildscript for cli module. if there is any resource/example please share
    m
    • 2
    • 4
  • a

    Alex Spence

    11/22/2021, 6:13 PM
    I'm trying to get Gradle JVM toolchain working for a multi module project. I was never able to get it working without specifying custom launcher for every task.. now I'm having issues getting KSP to use a custom launcher so I'm trying the global approach again. I'm setting this in my root build.gradle.kts:
    kotlin {
        jvmToolchain {
            (this as JavaToolchainSpec).apply {
                languageVersion.set(JavaLanguageVersion.of(17))
            }
        }
    }
    
    java {
        toolchain {
            languageVersion.set(JavaLanguageVersion.of(17))
        }
    }
    but I'm getting errors like this When I run gradle using Java 8
    No matching variant of csdisco.athena.common:data:1.5.1 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
                 - Variant 'apiElements' capability csdisco.athena.common:data:1.5.1 declares an API of a library, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                     - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 8
                 - Variant 'runtimeElements' capability csdisco.athena.common:data:1.5.1 declares a runtime of a library, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                     - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 8
    I've tried to specify the kotlin / java toolchain blocks above per project, in allProjects or subProjects but those result in compile errors What is the proper way to configure the toolchain for multi module projects?
    h
    t
    • 3
    • 61
  • r

    Roeniss Moon

    11/23/2021, 4:43 AM
    Hello! I’m looking for official/semi-official guide to setup querydsl to my latest-version SpringBoot. Some article mentioned about kapt but suspicious because kotlin official docs said it is in maintainance now Any good resource? Thank you ahead!
    e
    • 2
    • 3
  • a

    andylamax

    11/23/2021, 10:31 AM
    Hi there, my gradle plugins are stuck in
    Pending Approval
    since I submitted an update. Is there a known hiccup??
    :not-kotlin: 2
    t
    • 2
    • 4
  • r

    Roeniss Moon

    11/23/2021, 3:04 PM
    what is
    kotlin-gradle-plugin
    ? https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin I can’t find sort of documentation of it….
    r
    t
    p
    • 4
    • 8
  • s

    Slackbot

    11/25/2021, 12:17 PM
    This message was deleted.
    p
    • 2
    • 1
  • m

    Miquel Àngel Román

    11/26/2021, 10:14 PM
    I am unable to package a CLI app. Once i do
    ./gradlew installDist
    and call
    bin/app
    it just exists successfully without doing anything else...
    v
    • 2
    • 2
  • a

    Alexander Suraphel

    11/27/2021, 1:07 PM
    Hi everyone. i’m about to setup a multiplatform project and I realized that a firm grasp of Gradle. Can any one suggest a good starting point or a crash course? Thanks!
    e
    • 2
    • 1
  • e

    edwinRNDR

    11/28/2021, 8:22 PM
    I have problems when publishing to maven central. Occasionally I see that two (or more) repositories are created. I thought I had worked around it by setting the number of Gradle workers to 1.
    :not-kotlin: 2
    v
    z
    k
    • 4
    • 12
  • u

    ursus

    11/29/2021, 12:33 AM
    I'd like some opinions on module layout I have a
    :fcm
    module which hosts FcmService, which is a basically a callback for receiving push messages. There I route the messages to my push handlers from
    :push
    I have 2 apps in a monorepo, both of which depend on the
    :fcm
    module, ie. their push handling was identital However, a new requirment came, for which I need to proxy push messages to a analytics library just for app A (app B fcm usage remains the same) So I created a FcmServiceDelegate interface, and implement it differently in each app as needed. (or rather include a different delegate module) My question is how to modularize this would you either have root level
    :internal-fcm-delegate
    ,
    :analytics-fcm-delegate
    which depends on
    :fcm
    or, turn
    :fcm
    into a plain folder, and nest the two delegates + module for original code inside it, i.e.
    :fcm:internal-delegate
    ,
    :fcm:analytics-delegate
    ,
    fcm:service
    I do like nesting in general as it scales well, however I dont like that I have to create this "base" module under the folder, where the original impl will be moved to. Is there a way I could still have
    :fcm
    as a proper module, so it has the original FcmService class, and yet nest the
    :internal-delegate, analytics-delegate
    under it?
    (Because let's say a new requirement comes which needs app C to be created and use huawei push .. and there is no need for delegates as there is only one impl, the module would be naturally called
    :hcm
    ...and that's it..but thats not super symetrical with the fcm modules now..basically I'd want
    :fcm
    module here as well, and only add the delegate module which give app uses (semantically) something along the lines of
    -- appA
    implementation :fcm
    implementation :fcm:internal-delegate
    
    -- appB
    implementation :fcm
    implementation :fcm:analytics-delegate
    
    -- appC
    implementation :hcm
    what I'm not so keen on
    -- appA
    implementation :fcm:service
    implementation :fcm:internal-delegate
    
    -- appB
    implementation :fcm:service
    implementation :fcm:analytics-delegate
    
    -- appC
    implementation :hcm
    or maybe this? But it blows up root imo, i dont think its important to know theres multiple fcm impls when viewing root level
    -- appA
    implementation :fcm
    implementation :fcm-delegate-internal
    
    -- appB
    implementation :fcm
    implementation :fcm-delegate-analytics
    
    -- appC
    implementation :hcm
    Thoughts? What's idiomatic? I see retrofit is doing option 3 https://github.com/square/retrofit .. but it has just a few root folders, no a monorepo really
    :not-kotlin: 2
    z
    s
    • 3
    • 2
  • c

    Christian Dräger

    11/30/2021, 6:27 AM
    Hey, Since i am currently creating a lot of projects that are using "my basic gradle setup" (meaning a bunch of plugins that I always add because the projects look similar every time), I decided to create a gradle plugin unclutter the build file and only have to mentiontion the things that differ from my standard setup. My plugin will mostly apply other plugins. So far so good. Some of the 3rd party plugins my plugin applies need extra config by extentions. Now the question, how to call this extensions? Here's what I got so far https://github.com/christian-draeger/ok-bro-gradle-plugin/blob/main/src/main/kotlin/tech/draeger/OkBroPlugin.kt#L16
    z
    • 2
    • 3
  • p

    Paul Woitaschek

    11/30/2021, 2:57 PM
    I have a composite build containing precompiled script plugins. However some code does not compile because it can't find
    replaceFirstChar
    . It seems that gradle (7.3) bundles an older kotlin version. Is it possible to change that version so the new functions are usable?
    v
    • 2
    • 7
  • m

    Michael Grigoryan

    11/30/2021, 8:21 PM
    Hey everyone 👋 This felt like a proper channel to ask for help. Is there is a way to build and run Kotlin directly from Gradle CLI without defining separate tasks for each script in a centralized directory such as
    src
    with the following
    build.gradle.kts
    fi
    le?
    plugins {
        kotlin("jvm") version "1.6.0"
    }
    repositories {
        mavenCentral()
    }
    tasks {
        sourceSets {
            main {
                java.srcDirs("src")
            }
        }
    }
    ✅ 1
    t
    c
    • 3
    • 12
  • b

    Ben Tilford

    12/02/2021, 5:26 PM
    Anyone have experience with the “java-test-fixtures” plugin? Having issues using the
    src/testFixtures/kotlin
    code from within the same project. Other projects declaring it as a dependency seem to work but examples of managing sourceSets that I’ve found don’t seem to work.
    t
    • 2
    • 1
  • e

    eygraber

    12/02/2021, 10:57 PM
    I have a project that has multiple KMP, JVM, and Android modules, and I configure them with a single precompiled script plugin. Is there a base plugin class I can use with
    plugins.withType
    to configure them all in one place?
    t
    • 2
    • 1
  • t

    Tomas Kormanak

    12/03/2021, 10:01 AM
    Hi, I have an issue with IDEA saying
    Kotlin not configured
    some times (usually after changing git branch). Sometime I can fix it by random things like clearing cache/reload gradle project/ remove the whole project. Any idea why IDEA can't load the gradle project correctly? We have multiplatform project witin multiproject gradle structure.
    t
    • 2
    • 10
  • r

    Rhiad Jaffar

    12/03/2021, 2:02 PM
    Hi all - using vanilla npm you can:
    npm install <git-host>:<git-user>/<repo-name>
    npm install <git repo url>
    … and this will result in npm installing a dependency from a github repo/ref as if it was a standard npm module: https://docs.npmjs.com/cli/v8/commands/npm-install I’ve tried lots of different permutations of this in gradle + npm and no matter what I try it always errors in various ways e.g.
    implementation(npm("username/repo#branchname"))
    implementation(npm("username/repo#branchname", "*"))
    implementation(npm("username/repo", "commitref"))
    So question: Is it possible to use gradle + npm to install npm dependencies from github locations? Many thanks!
    • 1
    • 1
  • n

    Nick Halase

    12/03/2021, 8:23 PM
    Is there a reason kotlin serialization is not included in the kotlin-bom artifact?
    c
    • 2
    • 5
  • j

    Joost Klitsie

    12/04/2021, 10:09 AM
    Hi all! I have a project, consisting of multiple (KMP) modules. I am using VERSION_CATALOGS and TYPESAFE_PROJECT_ACCESSORS, and codewise there is not so much happening (yet). However, a simple gradle sync takes almost 20 minutes. If I enable offline mode, it takes less than a minute (I guess 10 or 20 seconds). If I remove all modules, except for 1 KMP module, from the settings.gradle, the waiting is still crazy. Does anyone have any tips as to where to look how to cut down the sync time to a reasonable level?
    v
    • 2
    • 6
  • p

    Paul Woitaschek

    12/06/2021, 1:53 PM
    Use precompiled script plugins they said 🙈
    🙈 2
    😑 1
    m
    t
    +2
    • 5
    • 4
  • c

    Colm Murphy

    12/07/2021, 11:37 AM
    Hi, i want to use kotlin for my next project but im not sure how i should configure the project. The plan is to make a Minecraft plugin that would run in bith Fabric and Spigot servers, using mostly common code with a few platform-specific classes. How can I set this up in Gradle?
    v
    b
    • 3
    • 2
  • t

    Tomasz Krakowiak

    12/08/2021, 5:02 AM
    I have an issue with kotlin project targeting js node and browser - generateMetadataFileForKotlinMultiplatformPublication task. Details in thread.
    v
    • 2
    • 4
Powered by Linen
Title
t

Tomasz Krakowiak

12/08/2021, 5:02 AM
I have an issue with kotlin project targeting js node and browser - generateMetadataFileForKotlinMultiplatformPublication task. Details in thread.
Project configuration(simplified):
kotlin {
    js("browser", IR) {

        compilations["main"].defaultSourceSet.dependsOn(js(IR).compilations["main"].defaultSourceSet)
        configurations[compilations["main"].apiConfigurationName].attributes.attribute(jsPlatformType, "browser")
        configurations[compilations["main"].runtimeOnlyConfigurationName].attributes.attribute(jsPlatformType, "browser")

        binaries.executable()
    }
    js("node", IR) {
        nodejs { }
        compilations["main"].defaultSourceSet.dependsOn(js(IR).compilations["main"].defaultSourceSet)
        configurations[compilations["main"].apiConfigurationName].attributes.attribute(jsPlatformType, "node")
        configurations[compilations["main"].runtimeOnlyConfigurationName].attributes.attribute(jsPlatformType, "node")
        binaries.executable()
    }
}
Error I am getting:
Execution failed for task ':app:generateMetadataFileForKotlinMultiplatformPublication'.
> Invalid publication 'kotlinMultiplatform':
    - Variants 'browserApiElements-published' and 'jsApiElements-published' have the same attributes and capabilities. Please make sure either attributes or capabilities are different.
    - Variants 'browserRuntimeElements-published' and 'jsRuntimeElements-published' have the same attributes and capabilities. Please make sure either attributes or capabilities are different.
    - Variants 'browserApiElements-published' and 'nodeApiElements-published' have the same attributes and capabilities. Please make sure either attributes or capabilities are different.
    - Variants 'browserRuntimeElements-published' and 'nodeRuntimeElements-published' have the same attributes and capabilities. Please make sure either attributes or capabilities are different.
Any ideas on how to solve it are welcome.
When I try:
kotlin {
    js("browser", IR) {

        compilations["main"].defaultSourceSet.dependsOn(js(IR).compilations["main"].defaultSourceSet)
        configurations.all { if(name == compilations["main"].apiConfigurationName + "Elements-published") attributes.attribute(jsPlatformType, "browser") }
        configurations.all { if(name == compilations["main"].runtimeOnlyConfigurationName + "Elements-published") attributes.attribute(jsPlatformType, "browser") }

        binaries.executable()
    }
    js("node", IR) {
        nodejs { }
        compilations["main"].defaultSourceSet.dependsOn(js(IR).compilations["main"].defaultSourceSet)
        configurations.all { if(name == compilations["main"].apiConfigurationName + "Elements-published") attributes.attribute(jsPlatformType, "node") }
        configurations.all { if(name == compilations["main"].runtimeOnlyConfigurationName + "Elements-published") attributes.attribute(jsPlatformType, "node") }
        binaries.executable()
    }
}
I am getting slightly different error:
Execution failed for task ':app:generateMetadataFileForKotlinMultiplatformPublication'.
> Invalid publication 'kotlinMultiplatform':
    - Variants 'browserRuntimeElements-published' and 'jsRuntimeElements-published' have the same attributes and capabilities. Please make sure either attributes or capabilities are different.
    - Variants 'browserRuntimeElements-published' and 'nodeRuntimeElements-published' have the same attributes and capabilities. Please make sure either attributes or capabilities are different.
Variants 'browserRuntimeElements-published' and 'nodeRuntimeElements-published' have the same attributes and capabilities.
is now most confusing.
v

Vampire

12/08/2021, 10:50 AM
Maybe output of task
outgoingVariants
can help you shed some light on it
t

Tomasz Krakowiak

12/08/2021, 5:51 PM
@Vampire Thanks, managed to make it work with:
kotlin {
    js("browser", IR) {
        compilations["main"].defaultSourceSet.dependsOn(js(IR).compilations["main"].defaultSourceSet)
        configurations.all { if(name == compilations["main"].apiConfigurationName + "Elements") attributes.attribute(jsPlatformType, "browser") }
        configurations.all { if(name == "browserRuntimeElements") attributes.attribute(jsPlatformType, "browser") }
        binaries.executable()
    }
    js("node", IR) {
        nodejs { }
        compilations["main"].defaultSourceSet.dependsOn(js(IR).compilations["main"].defaultSourceSet)
        configurations.all { if(name == compilations["main"].apiConfigurationName + "Elements") attributes.attribute(jsPlatformType, "node") }
        configurations.all { if(name == "nodeRuntimeElements") attributes.attribute(jsPlatformType, "node") }
        binaries.executable()
    }
}
View count: 46