diff --git a/InteropExample/build.gradle b/InteropExample/build.gradle index 4b06b429071..86dbc1c0d11 100644 --- a/InteropExample/build.gradle +++ b/InteropExample/build.gradle @@ -27,7 +27,7 @@ kotlinNativeInterop { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile kotlinNativeInterop['llvm'] + compile kotlinNativeInterop['llvm'].configuration } mainClassName = 'MainKt' diff --git a/backend.native/build.gradle b/backend.native/build.gradle index c42c9adb3cc..b5a9728561f 100644 --- a/backend.native/build.gradle +++ b/backend.native/build.gradle @@ -105,8 +105,8 @@ kotlinNativeInterop { dependencies { compilerCompile deps - compilerCompile kotlinNativeInterop['llvm'] - compilerCompile kotlinNativeInterop['hash'] + compilerCompile kotlinNativeInterop['llvm'].configuration + compilerCompile kotlinNativeInterop['hash'].configuration cli_bcCompile deps cli_bcCompile sourceSets.compiler.output diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy index 4d9a0b70307..38688fcc90c 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy @@ -4,6 +4,7 @@ import org.gradle.api.Named import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.artifacts.Configuration import org.gradle.api.file.FileCollection import org.gradle.api.internal.AbstractNamedDomainObjectContainer import org.gradle.api.internal.file.AbstractFileCollection @@ -12,7 +13,7 @@ import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.TaskDependency import org.gradle.internal.reflect.Instantiator -class NamedNativeInteropConfig extends AbstractFileCollection implements Named { +class NamedNativeInteropConfig implements Named { private final Project project final String name @@ -31,6 +32,8 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named { private FileCollection linkFiles; private List linkTasks = [] + Configuration configuration + void defFile(String value) { defFile = value genTask.inputs.file(project.file(defFile)) @@ -117,6 +120,7 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named { interopStubs = project.sourceSets.create(name + "InteropStubs") genTask = project.task(interopStubs.getTaskName("gen", ""), type: JavaExec) + configuration = project.configurations.create(interopStubs.name) this.configure() } @@ -178,22 +182,9 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named { } } } - } - @Override - String getDisplayName() { - return "Native interop config $name" - } - - @Override - Set getFiles() { - return interopStubs.output.getFiles() + - interopStubs.compileClasspath.files // TODO: workaround to add Interop:Runtime - } - - @Override - TaskDependency getBuildDependencies() { - return interopStubs.output.getBuildDependencies() + this.configuration.extendsFrom project.configurations[interopStubs.runtimeConfigurationName] + project.dependencies.add(this.configuration.name, interopStubs.output) } }