Nicholas Bilyk
08/23/2019, 5:43 PMconfigurations.create("myConfig") {
dependencies.apply {
add(project.dependencies.create("com.example:foo:version"))
}
}
// In the task:
getExecActionFactory().newJavaExecAction().apply {
classpath = project.configurations.getByName("myConfig")
}
But I don't know how to do the equivalent if the dependency is a kotlin multi-platform library.
I get an exception such as:
Caused by: org.gradle.internal.component.AmbiguousConfigurationSelectionException: Cannot choose between the following variants of com.example:foo:version:
- js-api
- js-runtime
- jvm-api
- jvm-runtime
- metadata-api
packTexturesCompilation = kotlinExt.targets.getByName("jvm").compilations.create("packTextures") {
dependencies {
runtimeOnly("com.acornui:acornui-texture-packer:$acornVersion")
}
} as KotlinCompilationToRunnableFiles<KotlinCommonOptions>
getExecActionFactory().newJavaExecAction().apply {
main = "com.acornui.texturepacker.PackAssetsKt"
args = listOf(it.sourceDir.absolutePath, it.destinationDir.parentFile.absolutePath, suffix)
classpath = packTexturesCompilation.runtimeDependencyFiles
execute()
}