Commit Graph

78 Commits

Author SHA1 Message Date
Ilya Matveev fe5badee34 build: Store kotlin-compiler repo URL in a project property 2017-05-02 18:17:27 +07:00
Ilya Matveev 3f0a273a11 build: Switch Kotlin compiler downloading to kotlin-dev bintray repo
This patch uses kotlin-dev bintray repo (dl.bintray.com/kotlin/kotlin
-dev/org/jetbrains/kotlin/kotlin-compiler/) for Kotlin compiler
downloading instead of the sonatype repo and our bintray mirror of it.
So there is not need to run ./gradlew update_kotlin_compiler on each
compiler update.

It also updates kotlin-compiler to 1.1.3-dev-1619
2017-05-02 18:17:27 +07:00
Ilya Matveev 94c1716899 build: Fix dependency uploading to bintray repo 2017-05-02 18:17:27 +07:00
Ilya Matveev 028cf6c947 build: Allow kotlin-compiler downloading from sonatype
This patch allows one to download the kotlin-compiler dependency
not only from the bintray mirror but also from the sonatype original
repo.
2017-04-28 17:15:01 +07:00
Ilya Matveev c9a344f8c7 build: Upload used kotlin-compiler builds to bintray 2017-04-28 17:15:01 +07:00
Vasily Levchenko 84d62eb471 DEBUGINFO: makes debug info stab usable from konan compiler 2017-04-19 09:52:05 +03:00
Vasily Levchenko 89ebbaeb6c DEBUGINFO: initial C bindings to debug info llvm
- support DICompileUnit
- support DIFIle
- support DISubroutine
- support DIBasicType
- support DILocation
- added gradle build
- debug info bindings are involved in kotlin build
- added binding to DIGetSubprogramLinkName
- added binding to LLVMBuilderGetCurrentFunction
- added reset location
- simple demo added (buildable with gradle)
  produces folowing output:
    Following pseudo code in sources.
     0:123456789012345678901
     1: fun main():Int {
     2:   {foo()}()
     3:   return 0
     4: }
     5  fun foo() {}

    0:b-backend-dwarf:minamoto@unit-703(0)# ./demo
    ; ModuleID = 'test'
    source_filename = "test"

    define i32 @foo(i32) !dbg !3 {
    entry:
      ret i32 %0, !dbg !7
    }

    !llvm.dbg.cu = !{!0}

    !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "konanc", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
    !1 = !DIFile(filename: "1.kt", directory: "src")
    !2 = !{}
    !3 = distinct !DISubprogram(name: "foo", linkageName: "foo:link", scope: null, file: !1, line: 66, type: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
    !4 = !DISubroutineType(types: !5)
    !5 = !{!6}
    !6 = !DIBasicType(name: "int", size: 32, align: 4)
    !7 = !DILocation(line: 42, column: 15, scope: !3)
- demo sharing debug information between several bitcode artifacts
    0:b-backend-dwarf:minamoto@unit-703(0)# llvmDebugInfoC/build/exe/demogenerated/demogenerated
    ; ModuleID = 'test'
    source_filename = "test"

    define void @foo() !dbg !3 {
    entry:
      ret void, !dbg !5
    }

    define void @"main$caller$foo"() !dbg !6 {
    entry:
      call void @foo(), !dbg !7
      ret void
    }

    define void @main() !dbg !8 {
    entry:
      call void @"main$caller$foo"(), !dbg !9
      ret void, !dbg !10
    }

    !llvm.dbg.cu = !{!0}

    !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "konanc", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
    !1 = !DIFile(filename: "<stdin>", directory: "")
    !2 = !{}
    !3 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 5, type: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
    !4 = !DISubroutineType(types: !2)
    !5 = !DILocation(line: 5, column: 14, scope: !3)
    !6 = distinct !DISubprogram(name: "main$caller$foo", linkageName: "main$caller$foo", scope: null, file: !1, line: 2, type: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
    !7 = !DILocation(line: 5, column: 2, scope: !6)
    !8 = distinct !DISubprogram(name: "main", linkageName: "main", scope: null, file: !1, line: 1, type: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
    !9 = !DILocation(line: 2, column: 12, scope: !8)
    !10 = !DILocation(line: 3, column: 4, scope: !8)
- local variables support
- demo for local variable suppor (TBD some out put here).
    ; ModuleID = 'test'
    source_filename = "test"

    define i32 @main() !dbg !3 {
    entry:
    %0 = alloca i32
    call void @llvm.dbg.declare(metadata i32* %0, metadata !5, metadata !7), !dbg !8
    store i32 42, i32* %0, !dbg !8
    %1 = load i32, i32* %0, !dbg !8
    ret i32 %1, !dbg !8
    }

    ; Function Attrs: nounwind readnone
    declare void @llvm.dbg.declare(metadata, metadata, metadata) #0

    attributes #0 = { nounwind readnone }

    !llvm.dbg.cu = !{!0}

    !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "konanc", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
    !1 = !DIFile(filename: "<stdin>", directory: "")
    !2 = !{}
    !3 = distinct !DISubprogram(name: "main", linkageName: "main", scope: null, file: !1, line: 1, type: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
    !4 = !DISubroutineType(types: !2)
    !5 = !DILocalVariable(name: "a", scope: !3, file: !1, line: 2, type: !6)
    !6 = !DIBasicType(name: "int", size: 32, align: 4)
    !7 = !DIExpression()
    !8 = !DILocation(line: 2, column: 1, scope: !3)
2017-04-14 11:39:51 +03:00
Svyatoslav Scherbina f564bd7707 Always link bitcode files specified with -nativelibrary 2017-03-30 15:55:39 +03:00
Nikolay Igotti 0cbd34086e Added JB copyright (#417) 2017-03-30 09:51:58 +03:00
Ilya Matveev a906bd0d07 Download dependencies only in dist
Don't extract dependencies in dependencies/all, only in dist/dependencies
Remove konan.dependencies property
2017-03-30 11:02:35 +07:00
Alexander Gorshenev 334d2f0ee6 Remote test execution for cross compiled tests. Run it like:
$ ./gradlew backend.native:tests:run \
    -Premote=user@111.22.33.444 -Ptest_target=raspberrypi

The new gradle command line options:

    -Pbuild_flags  renamed -Pkonanc_flags.
    -Ptest_flags   provides compiler flags to the test builds.
    -Ptest_target  properly sets up compiler as well as interop
                   to cross compile tests.
    -Premote       specifies remote host and login.
2017-03-27 15:14:57 +03:00
Ilya Matveev 4a716fbf30 backend: Use konan.dependencies property to set dependencies dir
This patch set default dependencies directory to ${konan.home}/
dependencies and allows one to override this setting using
konan.dependencies system property.
2017-03-24 19:31:23 +07:00
Alexander Gorshenev c06eeb096a Removed -compile_as_stdlib mode, as it is not needed anymore.
Moved "compiler hacker" options to use double dash. Like "--verbose linker".
2017-03-22 16:16:50 +04:00
SvyatoslavScherbina 2882e6fab7 Improve interop enums (#341)
* Update build to Kotlin 1.1.0

* Add heuristics and options for selecting C enum interop binding style

Also do some refactoring.

* Add ':Interop:Indexer:updatePrebuilt' Gradle task

* Update Interop/Indexer/prebuilt
2017-03-14 18:52:37 +03:00
Ilya Matveev 97b5bb527d backend: Generate assert call depending on the compiler key 2017-03-13 16:25:48 +03:00
Svyatoslav Scherbina 093671f549 backend: rework builtIns configuration
* Do not create separate builtIns for analyzer.
* Make builtInsModule synthetic but depending on stdlib.
2017-02-28 17:44:22 +07:00
Svyatoslav Scherbina 9a7d036b33 build, Interop/Indexer: update LLVM and clang to 3.9.0 2017-02-21 16:42:14 +07:00
Svyatoslav Scherbina d02fd5ec1b build: add Interop/Runtime to stdlib 2017-02-06 11:58:10 +07:00
Alexander Gorshenev a856b0d9ce More accurate host- and cross- target separations. 2017-01-24 02:23:08 +04:00
Alexander Gorshenev afaa50ce34 Introduced -target and -list_targets flags.
Use it like

    $ konanc hello.kt -target iphone
2017-01-23 00:17:39 +04:00
Svyatoslav Scherbina 3a9ba76d91 backend/build: rebuild stdlib and start if Kotlin sources changed 2016-12-30 14:48:51 +07:00
Svyatoslav Scherbina b531d984c8 backend/build: add hack to workaround missing interop features 2016-12-30 14:48:51 +07:00
Alexander Gorshenev 413f47fda5 Removed 'clang' invocations in favour of llvm tools and 'ld'.
Introduced LinkStage in the compiler.

Removed the link stage from 'konanc'.

Removed duplicate :stdlib and :start targets.

Simplified test run task a lot.
2016-12-28 02:13:07 +04:00
Alexander Gorshenev a1786614ea Removed Javascript serializer from Konan.
Introduced our own serializer.
2016-12-20 19:32:27 +04:00
Alexander Gorshenev f5a627f6ff Allow -Pkonanc_flags="-print_bitcode" for gradle commands. 2016-12-14 20:40:45 +04:00
Nikolay Igotti 6565a5eb23 Fix broken build. 2016-12-11 20:40:17 +03:00
Nikolay Igotti 62e08b330e Switch away from snapshots. 2016-12-11 19:47:10 +03:00
Nikolay Igotti e1b91945d0 Restore proper compiler. 2016-11-28 12:05:40 +03:00
Alexander Gorshenev c84fe7fd85 Collected or scattered means of running the compiler in a shell script.
So one can now

$ ./gradlew dist

$ ./dist/bin/konanc backend.native/tests/runtime/basic/hello0.kt -o hello

$ ./hello

or one can

$ ./gradlew demo

and have a complete dist build,
with a test program compiled and executed automatically after that
2016-12-06 17:22:34 +04:00
Alexander Gorshenev 22d748001d Added "start" function between the C launcher and Kotlin "main" 2016-12-01 19:20:12 +04:00
Alexander Gorshenev 1aa7b23853 For better incrementality, specified :stdlib output file, as it is
non-standard for that kind of gradle task.
2016-12-01 19:20:12 +04:00
Vasily Levchenko 28918f92f7 kotlin-compiler: 1.1-20161201.112229-281 2016-12-01 15:26:10 +03:00
Vasily Levchenko 90d705aae2 kotlin-compiler: 1.1-20161128.112645-274 2016-11-28 19:24:18 +03:00
Svyatoslav Scherbina 3095044420 build: use Kotlin 1.1-M02 to build all Kotlin JVM sources 2016-11-22 13:01:14 +07:00
Vasily Levchenko ce059ac54b kotlin-compiler: .1-20161121.132728-268 2016-11-21 18:41:46 +03:00
Alexander Gorshenev 1d265bc50c Here goes stdlib separation.
$ gradlew backend.native:stdlib

builds you stdlib.kt.bc now.

The test runs are taught to supply
-library stdlib.kt.bc to kotlin compiler for proper imports resolution,
and then later stdlib.kt.bc is provided to clang for the final link step.
2016-11-18 19:11:38 +04:00
Alexander Gorshenev 16e4107dee kotlin-compiler: 1.1-20161116.235936-256 2016-11-17 14:56:07 +04:00
Vasily Levchenko c99baeaf5d kotlin-compiler: 1.1-20161111.171344-253 2016-11-14 14:41:22 +03:00
Svyatoslav Scherbina 3d36973022 backend/build: improve LLVM link options
Update options according to llvm-config:

* delete "--stdlib=libc++"  (it seems to provoke runtime link errors on Linux)
* remove "-lffi" (it doesn't seem to be required)
* remove "-lc++" on macOS

Also move Linux system libs options to llvm.def (as for macOS)
2016-11-14 14:12:25 +07:00
Svyatoslav Scherbina bee2a76008 build: refactor platform checks
also improve verbosity when downloading dependencies fails
2016-11-11 19:22:34 +07:00
Vasily Levchenko 5b7d0257e8 upgrade kotlin-compiler: 20161108.133759-248 2016-11-08 17:38:09 +03:00
Alexander Gorshenev 67889cb31c Further relocation from 'native' to 'kotlin'
Moved the left behind files and renamed the package.
2016-11-08 13:22:24 +03:00
Svyatoslav Scherbina 55f8257f92 build: simplify clang(++) configuration
also introduce 'execClang' block
2016-11-08 13:51:25 +07:00
Alexander Gorshenev 62f8b31cf0 Google protobuf has been added to the build 2016-11-07 18:14:50 +03:00
Vasily Levchenko 147de5d3ad added .usr/bin path to tools chain to take right variants of binutils from our system archieve 2016-11-07 17:25:08 +03:00
Nikolay Igotti a2e4f0f467 Move compiler to new version, add primitive types. (#33) 2016-11-03 15:31:33 +03:00
Nikolay Igotti 1f90f32397 Fix backend.native:run 2016-11-03 00:22:04 +03:00
Svyatoslav Scherbina 18ae8b2311 build: switch to Sonatype snapshots repo for kotlin-compiler
it is updated automatically by every successful build
2016-10-31 17:39:15 +07:00
Svyatoslav Scherbina 394b4ce6ec backend/build: depend on kotlin-compiler.jar from repo
instead of the jars from backend.native/kotlin-ir
2016-10-31 13:32:02 +07:00
Svyatoslav Scherbina 74ab1503c3 Interop: make gradle plugin more friendly to complex dependency management
when representing dependencies as file collection
some meta information gets lost
2016-10-31 13:32:02 +07:00