Interop: make gradle plugin more friendly to complex dependency management
when representing dependencies as file collection some meta information gets lost
This commit is contained in:
@@ -27,7 +27,7 @@ kotlinNativeInterop {
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
compile kotlinNativeInterop['llvm']
|
||||
compile kotlinNativeInterop['llvm'].configuration
|
||||
}
|
||||
|
||||
mainClassName = 'MainKt'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<String> 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<File> 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user