Commit Graph

56 Commits

Author SHA1 Message Date
Zalim Bashorov 05c3e7e81d Don't export kotlin-reflect form util module and add it explicitly where it's required.
Also, remove kotlin-reflect form container module.

Main goal is get rid of kotlin-reflect.jar from modules what required for minimal compiler.jar which can compile Kotlin only to JS to make it smaller.
2017-04-17 18:18:31 +03:00
Alexey Tsvetkov 6b315259d3 Fix "Unexpected message" from daemon when CompilerMessageLocation is null
Recently the CompilerMessageLocation.NO_LOCATION was replaced with a null value.
This caused daemon clients to report "Unexpected message" for compiler messages without location.
2017-04-13 21:53:28 +03:00
Alexander Udalov 861d9a1620 Use null instead of CompilerMessageLocation.NO_LOCATION in MessageCollector 2017-04-11 12:08:31 +03:00
Alexey Tsvetkov e7e29f2651 Avoid changing java.rmi.server.hostname property 2017-04-10 20:39:34 +03:00
Ilya Chernikov 234ad39fd6 minor: improve daemon start failure diagnostic 2017-04-06 10:02:47 +02:00
Ilya Chernikov 7ceaca133a Add new artifact kotlin-compiler-client-embeddable.jar 2017-04-06 10:02:44 +02:00
Ilya Chernikov aebfc2f4a1 minor: move native platform launcher to separate file to make native-platform dependency optional 2017-04-06 10:02:43 +02:00
Alexander Udalov 3655fc02bd Support running Kotlin compiler daemon on JDK 9
This should have fixed the compiler that is run in Gradle on Java 9, but
there's another issue filed as KT-17112

 #KT-17112 Open
 #KT-14988 Fixed
2017-03-30 13:05:24 +03:00
Alexey Tsvetkov 0a4c43a5f1 Fallback to ProcessBuilder when native ProcessLauncher fails
#KT-16902 fixed
2017-03-24 19:03:41 +03:00
Alexey Tsvetkov 9d95c841a6 Use connect-and-lease when using daemon in JPS & Gradle
Relates to KT-15562 "Service is dying".

This commit includes multiple changes:
 1. JPS & Gradle daemon clients are refactored to use `connectAndLease` from `KotlinCompilerClient`.
 `connectAndLease` was introduced in previous commits
 2. `withKotlin` was removed because `connectAndLease` already covers retrying on connection error
 3. Gradle flag files creation is changed:
   * client-alive flag file lives as long as Gradle instance lives,
   * session-alive flag file lives until the end of a build.
2017-03-24 19:03:36 +03:00
Alexey Tsvetkov 9819de1abd Improve daemon client debug reports
Before this change a daemon client debug messages were printed
only when the client could not connect and the 'kotlin.daemon.verbose'
system property was set up.

Now messages are printed if the debug logging is enabled and
the 'kotlin.daemon.verbose' is set up.
2017-03-24 19:03:32 +03:00
Alexey Tsvetkov da24a99b91 Set 'java.rmi.server.hostname' property on client too
The RMI documentation (http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/javarmiproperties.html)
says it is useful to set up a `java.rmi.server.hostname`
system property on a client and a server.
When the property is set up on a client, I saw that "RenewClean" threads
stopped listening to my external IP, so all client and server threads
are now only listening the loopback interface.

I also changed the way the property is set up on the server side:
before the change it was passed in jvmargs at a process launcher.
I moved this code directly to the main method of the daemon,
because it is easy to forget to set up the property,
when running the main for debug purposes.
2017-03-24 19:03:24 +03:00
Ilya Gorbunov dce0da68c6 Cleanup: post-cleanup after deprecation cleanup in compiler
Replace `takeIf { !expr }` with `takeUnless { expr }`.
Cleanup redundant parethesis as in `listOf((expr))`.
Replace `listOf(expr)` with `expr.let(::listOf)` where the former caused significant indentation change.
2017-03-23 16:48:38 +03:00
Ilya Chernikov 4043f491da minor: replace Pair with data class in daemon client connectAndLease call
backport from 1.0.7
2017-03-21 16:30:47 +01:00
Mikhail Glukhikh b121bf8802 Cleanup: fix some compiler warnings (mostly deprecations, javaClass) 2017-03-15 17:35:31 +03:00
Mikhail Glukhikh 1375267996 Cleanup: apply redundant curly braces in string template inspection 2017-03-15 16:13:22 +03:00
Ilya Chernikov fa5728b288 Use Void instead of Unit in RMI calls, should fix EA-82064
("Could not initialize class Kotlin.Unit")

(cherry picked from commit b3a1311)
2017-02-24 16:58:25 +01:00
Ilya Chernikov 00e8dfe1be Use sessions with connection to eliminate async shutdown problems
(cherry picked from commit 78d334b)
2017-02-24 16:58:25 +01:00
Ilya Chernikov 4202bde550 Make daemon connection more reliable by retrying on certain exceptions
(cherry picked from commit 74a0711)
2017-02-24 16:58:25 +01:00
Ilya Chernikov 63aae56b11 Get rid of eval on daemon completely, fixes also JSR 223 examples 2017-02-24 16:58:24 +01:00
Ilya Chernikov a3a782613a Cleanup 2017-02-24 16:58:24 +01:00
Ilya Chernikov 75234701c7 Fix remote repl state facade 2017-02-24 16:58:24 +01:00
Ilya Chernikov b23911fd59 Reintroduce history check between compile and eval, place generation into code line and id 2017-02-24 16:58:24 +01:00
Ilya Chernikov 7b2ea001c1 Fix state conversion, fix tests 2017-02-24 16:58:24 +01:00
Ilya Chernikov c5bc58ad32 Implement remote part of the new repl state handling 2017-02-24 16:58:24 +01:00
Alexey Tsvetkov 3b222f13f3 Replace daemon's message after start with constant string
#KT-15783 fixed

When a daemon client cannot find an existing daemon, it starts a new one.
The client waits for a daemon to start and initialize.
Then the daemon is expected to signal that it is ready for compiling by printing message in stdout.
Before this change the message was the daemons' run path (a directory where all daemons store
their "flag" files).
However the path printed by the daemon was not matched by the path expected by the client somehow
on Windows for a user with a username containing non-English letters.
This commit replaces the message with the constant string.
2017-02-18 19:35:06 +03:00
Alexey Tsvetkov b2de822fd4 Start daemon with explicit server ip address to prevent host name resolution 2017-02-18 19:35:06 +03:00
Ilya Chernikov cb7de0e262 Implement more reliable daemon election, fixes KT-15562
also making shutdown more reliable
2017-02-11 16:27:25 +01:00
Ilya Chernikov 46894da981 Get rid of daemon-client dependency on openapi, making others "provided"
(cherry picked from commit 175d74c)
2017-02-10 16:02:55 +01:00
Ilya Chernikov 7c0cdf90cf Move daemon session flag files to daemon discovery dir by default + minor fixes:
- Move flag files from the temp dir, because right now JPS cleans temp dir on each build start. Should fix KT-15707, also may affect KT-15562.
- change compiler runner to allow the fix above
- Fix flag file name filtering
- Fix ifAlive handling on the new compile method in the daemon.
2017-01-28 15:36:06 +01:00
apatrida 5ad06e1e92 PR-1021: Merge Keplin project scripting code into Kotlin core.
Overhauls the scripting layers (GenericRepl and related, and JSR223 and related)
Adds repeating modes (none, only latest eval'd line, or random order)
Also adds better thread-safe IO capturing, default imports, SimpleRepl wrapper, more unit tests

NOTE: the script-util part of the pull request was rejected due to various problems and incompatibilities.
It may be incorporated into the code later.

(originally cherry picked from commit 6f7d517)
2017-01-27 22:20:44 +01:00
Alexey Tsvetkov f46217129b EA-95293: do not report OUTPUT messages to message collector if outputs collector is specified 2017-01-26 13:38:52 +03:00
Ilya Chernikov ec7e8873f4 Update daemon client with wrappers for basic compiler API
Other changes to extract results for compiler, tests.
2017-01-25 15:29:15 +01:00
Ilya Chernikov 3fcbc7bfa3 Rollback commit with native platform lib relocation - it seems breaks functionality on Windows
(cherry picked from commit d3ff19e)
2017-01-17 14:30:28 +01:00
Alexey Tsvetkov 99c72b6dff Refactor JPS daemon client 2017-01-13 15:08:12 +03:00
Ilya Chernikov 1e68b2436f Relocate non-native/jni part of net.rubygrapefruit.platform in attempt to fix #KT-15570 2017-01-13 10:48:29 +01:00
Ilya Chernikov fc416476a8 Move invokable parts to JSR223 only, remove unneeded code 2016-12-15 07:26:08 +01:00
Ilya Chernikov 1cc85df78e Refactor REPL infrastructure for passing evaluation/invoke wrapper to every eval/invoke function 2016-12-15 07:26:07 +01:00
Ilya Chernikov 7a79fff9d6 Put lines history into all data structures returned by repl, refactor storage and passing of the history for that 2016-12-15 07:26:06 +01:00
Ilya Chernikov 014e43e50a Generalize error processing on daemon connection, attempt to fix #EA-82064 again 2016-11-30 13:09:18 +01:00
Ilya Chernikov 6e96d192bf Move incremental components to compller util to reduce dependencies of compiler interface modules 2016-11-09 11:09:32 +01:00
Ilya Chernikov ea4a1df839 Refactor session accounting in daemon, add REPL to it, write a test 2016-10-12 15:37:53 +02:00
Ilya Chernikov 43037373d7 Implement params to pass args to generic and remote repls to support script templates with params 2016-10-12 15:37:50 +02:00
Ilya Chernikov 86ece30330 Add remote repl support to the daemon, refactor repl classes accordingly, simple tests 2016-10-12 15:37:49 +02:00
Ilya Chernikov 042fc4fadc Add remote input stream support, plus minor tweaks 2016-10-12 15:37:49 +02:00
Alexander Udalov 53b584f48c Simplify usages of IncrementalPackageFragment and related code
Since its scope is now empty, no descriptor now has a container that is an
instance of IncrementalPackageFragment -> a lot of code is not needed anymore
2016-10-05 11:24:30 +03:00
Ilya Chernikov 8ba9d2b75c minor: Fix daemon client diagnostic 2016-06-07 21:12:52 +02:00
Ilya Chernikov 22283be1b7 minor: Make term "canceled" uniformly spelled in identifiers and strings in the daemon 2016-05-06 13:06:38 +02:00
Ilya Chernikov 336226ac9e minor: Switch to simpler descending sort, reduce dependency 2016-05-06 13:06:37 +02:00
Alexander Udalov d85884426e Minor optimization of lookup tracker records 2016-04-29 15:21:26 +03:00