Merge pull request #25 from JetBrains/drop-kotlin-build
Use kotlin-compiler.jar from repo to get rid of building the Big Kotlin
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
[submodule "experiments/kotlin-ir"]
|
||||
path = backend.native/kotlin-ir
|
||||
url = https://github.com/JetBrains/kotlin.git
|
||||
branch = master
|
||||
[submodule "third-party/ios/libffi"]
|
||||
path = third-party/ios/libffi
|
||||
url = https://github.com/ksjogo/libffi
|
||||
|
||||
@@ -27,7 +27,7 @@ kotlinNativeInterop {
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
compile kotlinNativeInterop['llvm']
|
||||
compile kotlinNativeInterop['llvm'].configuration
|
||||
}
|
||||
|
||||
mainClassName = 'MainKt'
|
||||
|
||||
+45
-23
@@ -1,5 +1,4 @@
|
||||
buildscript {
|
||||
ext.kotlin_ir_path = "$projectDir/kotlin-ir/dist"
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
@@ -14,11 +13,29 @@ apply plugin: 'java'
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: org.jetbrains.kotlin.NativeInteropPlugin
|
||||
|
||||
def deps = files("$kotlin_ir_path/kotlinc/lib/kotlin-compiler.jar",
|
||||
"$kotlin_ir_path/kotlinc/lib/kotlin-runtime.jar",
|
||||
"$kotlin_ir_path/kotlinc/lib/kotlin-reflect.jar")
|
||||
//export dependencies jars
|
||||
ext['deps'] = deps
|
||||
String kotlinCompilerModule = 'org.jetbrains.kotlin:kotlin-compiler:1.1-20161025.164748-245'
|
||||
|
||||
// (gets applied to this project and all its subprojects)
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'http://oss.sonatype.org/content/repositories/snapshots'
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
// kotlin-compiler module includes Kotlin runtime bundled;
|
||||
// make Gradle aware of this to avoid multiple Kotlin runtimes in classpath:
|
||||
resolutionStrategy.dependencySubstitution {
|
||||
substitute module('org.jetbrains.kotlin:kotlin-runtime') with module(kotlinCompilerModule)
|
||||
substitute module('org.jetbrains.kotlin:kotlin-stdlib') with module(kotlinCompilerModule)
|
||||
substitute module('org.jetbrains.kotlin:kotlin-reflect') with module(kotlinCompilerModule)
|
||||
}
|
||||
// TODO: probably we should use kotlin-compiler without bundled runtime
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
compiler {
|
||||
@@ -103,27 +120,35 @@ kotlinNativeInterop {
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compilerCompile deps
|
||||
compilerCompile kotlinNativeInterop['llvm']
|
||||
compilerCompile kotlinNativeInterop['hash']
|
||||
|
||||
cli_bcCompile deps
|
||||
cli_bcCompile sourceSets.compiler.output
|
||||
|
||||
bc_frontendCompile deps
|
||||
}
|
||||
|
||||
configurations {
|
||||
cli_bcRuntime.extendsFrom compilerRuntime
|
||||
cli_bcRuntime.extendsFrom compilerRuntime
|
||||
|
||||
cli_bc {
|
||||
extendsFrom cli_bcRuntime
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compilerCompile kotlinCompilerModule
|
||||
compilerCompile kotlinNativeInterop['llvm'].configuration
|
||||
compilerCompile kotlinNativeInterop['hash'].configuration
|
||||
|
||||
cli_bcCompile "org.jetbrains.kotlin:kotlin-runtime:$kotlin_version"
|
||||
cli_bcCompile sourceSets.compiler.output
|
||||
|
||||
bc_frontendCompile kotlinCompilerModule
|
||||
|
||||
cli_bc sourceSets.cli_bc.output
|
||||
}
|
||||
|
||||
|
||||
build.dependsOn 'compilerClasses','cli_bcClasses','bc_frontendClasses'
|
||||
|
||||
|
||||
task run(type: JavaExec) {
|
||||
main 'org.jetbrains.kotlin.cli.bc.K2NativeKt'
|
||||
classpath sourceSets.cli_bc.runtimeClasspath
|
||||
classpath configurations.cli_bc
|
||||
|
||||
args 'tests/codegen/function/sum.kt'
|
||||
|
||||
@@ -144,13 +169,10 @@ task run(type: JavaExec) {
|
||||
|
||||
|
||||
task jars {
|
||||
println "kotlin-ir: $kotlin_ir_path"
|
||||
doFirst {
|
||||
project.buildscript.configurations.classpath.each {
|
||||
String jarName = it.getName();
|
||||
print jarName + ":"
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -27,7 +27,10 @@ class ModuleIndex(val module: IrModuleFragment) {
|
||||
override fun visitClass(declaration: IrClass) {
|
||||
super.visitClass(declaration)
|
||||
|
||||
map[declaration.descriptor.classId] = declaration
|
||||
val classId = declaration.descriptor.classId
|
||||
if (classId != null) {
|
||||
map[classId] = declaration
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
Submodule backend.native/kotlin-ir deleted from 82364ad3e5
@@ -1,6 +1,10 @@
|
||||
import org.gradle.api.internal.file.DefaultCompositeFileTree
|
||||
import org.gradle.api.internal.file.FileTreeInternal
|
||||
configurations {
|
||||
cli_bc
|
||||
}
|
||||
|
||||
dependencies {
|
||||
cli_bc project(path: ':backend.native', configuration: 'cli_bc')
|
||||
}
|
||||
|
||||
public class KonanTest extends DefaultTask {
|
||||
protected String source
|
||||
@@ -16,17 +20,13 @@ public class KonanTest extends DefaultTask {
|
||||
|
||||
@TaskAction
|
||||
public void compileBc() {
|
||||
def classpathSs = new DefaultCompositeFileTree(new ArrayList<FileTreeInternal>())
|
||||
project.sourceSets.each{classpathSs += it.output}
|
||||
project.project(":Interop:Runtime").sourceSets.each{ classpathSs += it.output }
|
||||
classpathSs += backendNative.ext.deps
|
||||
def sourceKt = project.file(source)
|
||||
def sourceBc = new File("${sourceKt.absolutePath}.bc")
|
||||
def runtimeBc = new File("${runtimeProject.buildDir.canonicalPath}/runtime.bc")
|
||||
println "${runtimeBc}"
|
||||
project.javaexec {
|
||||
main='org.jetbrains.kotlin.cli.bc.K2NativeKt'
|
||||
classpath = classpathSs
|
||||
classpath = project.configurations.cli_bc
|
||||
args "-output", "${sourceBc.absolutePath}",
|
||||
"-runtime", "${runtimeBc.absolutePath}",
|
||||
"${sourceKt.absolutePath}",
|
||||
|
||||
@@ -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