Kotlin / kotlinx-cli

Pure Kotlin implementation of a generic CLI parser.
Apache License 2.0
914 stars 71 forks source link

Cannot successfully compile a multiplatform (1.7.0) project with kotlinx-cli dependency in commonMain #81

Closed young-druid closed 2 years ago

young-druid commented 2 years ago

I created a very simple project here. When I try to compile it from command line with ./gradlew clean build I get the following error.

> Task :compileCommonMainKotlinMetadata FAILED
e: /Users/whatever/projects/kotlinx-cli-test/src/commonMain/kotlin/Cli.kt: (1, 16): Unresolved reference: cli
e: /Users/whatever/projects/kotlinx-cli-test/src/commonMain/kotlin/Cli.kt: (2, 16): Unresolved reference: cli
e: /Users/whatever/projects/kotlinx-cli-test/src/commonMain/kotlin/Cli.kt: (3, 16): Unresolved reference: cli
e: /Users/whatever/projects/kotlinx-cli-test/src/commonMain/kotlin/Cli.kt: (6, 18): Unresolved reference: ArgParser
e: /Users/whatever/projects/kotlinx-cli-test/src/commonMain/kotlin/Cli.kt: (7, 32): Unresolved reference: ArgType

If there is an misconfiguration on my side can you help to identify it? At the same time if I replace kotlinx-cli dependency with clikt it compiles fine. I tried enableEndorsedLibs. It didn't help as well. I want to note that IDEA recognises kotlinx-cli dependency and doesn't report any errors.

SvyatoslavScherbina commented 2 years ago

kotlinx-cli library is published without hierarchical structure support. #82 should fix this.

Until then, please add this to your Gradle build script to workaround the problem:

tasks.matching { it.name == "compileCommonMainKotlinMetadata" }.all {
    enabled = false
}
antohaby commented 2 years ago

Created PR to enable HMPP https://github.com/Kotlin/kotlinx-cli/pull/83

SvyatoslavScherbina commented 2 years ago

Fixed with #83, published in library version 0.3.5.