Commit Graph

989 Commits

Author SHA1 Message Date
Alexander Udalov a802e7fb71 CLI: fix non-XML rendering of argument parse error, simplify code
If the compiler is invoked through JPS, an instance of
XmlMessageRenderer is used and the output should be a valid XML.
Previously, we reported the argument parse error (and the note to try
"-help") before calling messageRenderer.renderPreamble, which resulted
in invalid XML. The same was happening for the usage printed on "-help".
Both of these problems are fixed

 #KT-14848 Fixed
2017-06-06 19:52:04 +03:00
Alexey Tsvetkov b06b18de07 Set destination to null when module is set in JPS
This fixes the warning "The '-d' option with a directory destination
is ignored because '-module' is specified", when a project imported
from Gradle is built with JPS.

    #KT-17665 fixed
2017-05-31 16:59:03 +03:00
Alexey Andreev 8a8fdf1968 Command-line tool for JS DCE 2017-05-26 18:20:17 +03:00
Dmitry Petrov c83b764c73 Update testData after changes in diagnostics 2017-05-26 13:58:46 +03:00
Dmitry Petrov 7979663e6c Update testData for changed diagnostic messages 2017-05-26 13:58:46 +03:00
Alexander Udalov 965b4199f4 Fix compilation against JRE 9 on JPS
Write the modular JDK (9+) path to the module.xml file passed to the
compiler from the JPS plugin. This path is then recorded in the compiler
configuration in KotlinToJVMBytecodeCompiler.configureSourceRoots. This
is needed because in JPS plugin, we pass "-no-jdk" and thus no JDK home
path was recorded in the compiler configuration in
K2JVMCompiler.setupJdkClasspathRoots. Presence of JDK home path in the
configuration is crucial for JDK 9 support (see
KotlinCoreEnvironment.Companion.createApplicationEnvironment), because
classes there can only be loaded with the special "jrt" file system, not
as .class files in .jar files

 #KT-17801 Fixed
2017-05-24 15:46:57 +03:00
Valentin Kipyatkov 1fe6886a33 Fixed error message to quote parameter name 2017-05-20 23:44:20 +03:00
Dmitry Petrov a2db4dc0d5 Fix incremental compilation problems related to type alias constructors
1. Determine source element for descriptors with NO_SOURCE recursively.

2. Always provide type abbreviation for type alias constructor
return type.

 #KT-15495 Fixed
2017-05-18 10:55:16 +03:00
baratynskiy 91412b0ee9 Add tools.jar for JPS plugin 2017-05-17 17:48:59 +03:00
Zalim Bashorov fb9d88315a Don't print unnecessary empty line separators when generate tests 2017-05-16 19:42:47 +03:00
Dmitry Petrov 8903504334 Update test for incremental compilation after new DCE
Previous test had an inline setter that didn't produce any effect,
thus, corresponding code was removed by new DCE.
Make sure that changes made in the inline property are caught up by IC.
2017-05-16 17:28:43 +03:00
Anton Bannykh 2e9a59819a JS: support internal visibility from friend modules
Friend modules should be provided using the -Xfriend-modules flag
in the same format as -libraries. No manual configuration required for
JPS, Gradle and Maven plugins.

Friend modules could be switched off using the -Xfriend-modules-disabled
flag. Doing that will
  * prevent internal declarations from being exported,
  * values provided by -Xfriend-modules ignored,
  * raise a compilation error on attemps to use internal declarations from other modules

Fixes #KT-15135 and #KT-16568.
2017-05-04 21:44:17 +03:00
Alexander Udalov fcf44af294 Change how kotlinc and tools display their version
- Display the Kotlin version in kotlin-gradle-plugin. This is needed
  because if "-version" is specified in compiler arguments, the "info"
  level of the message printed by the compiler in CLICompiler prevents
  it from being displayed by default (unless "--debug" is passed to
  Gradle).
- Display the version of JRE the compiler is running on. This will be
  helpful to diagnose Java 9 related issues in the future.
- In CLI, also display the executable name (kotlinc-jvm or kotlinc-js)
2017-04-28 20:49:54 +03:00
Alexander Udalov bb01ca038a Improve messages printed by JPS plugin in Messages view
- Don't print "Loaded plugin: KotlinAndroidJpsPlugin" and "Using
  kotlin-home = ..." for every build. They are rarely useful; they can
  be found in the build log now
- Instead of potentially confusing for the user "Kotlin JPS plugin
  version ..." output simply "Kotlin version ...". Also add the version
  of the JRE, where the compiler is being run
- Do not treat messages reported with severity LOGGING as BuildMessage
  with kind PROGRESS. Such build messages are displayed to the user in
  the progress/status bar when IDEA Make process is running, but LOGGING
  messages never had this meaning. In particular, users could be
  confused by the progress bar message "Kotlin: Configuring the
  compilation environment" visible for a very long time during
  compilation. This message just happens to be the last LOGGING message
  reported by the compiler before the actual compilation; its presence
  there created an illusion that Kotlin spends most of the time
  configuring the compilation environment

 #KT-17387 Fixed
2017-04-28 20:49:29 +03:00
Alexander Udalov d8d3bafbe9 Introduce "-Xreport-output-files" to report source-output mapping for JPS
This makes "-verbose" not required for JPS to run correctly and
therefore allows to print more useful debugging stuff in the compiler
and read them in CLI, for example. The output will also be more readable
because there'll be no "output" messages
2017-04-28 20:49:28 +03:00
Alexey Tsvetkov 50085722d1 Fix internal visibility check for deserialized typealiases
#KT-15495 fixed
2017-04-25 16:27:23 +03:00
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
Alexander Udalov dc5e51f4ac Do not parse/serialize additional compiler arguments in JPS
This is mostly a revert of e5a128ab, where the issue of the compiler
failing on repeated command line arguments was worked around. Now the
compiler behaves more properly: it uses the last passed argument and its
value, and prints a warning that several values have been passed. With
this behavior, the workaround is no longer necessary
2017-04-17 15:51:43 +03:00
Zalim Bashorov 712b2c8117 Add tests for KT-12199 to prevent regression
#KT-12199 Obsolete
2017-04-11 15:46:13 +03:00
Nikolay Krasko cee54a4111 Revert "Workaround for building against jars from both JDK 6 and JDK 8 on TeamCity"
This reverts commit 0cf1c8d900.
2017-04-11 12:33:07 +03:00
Alexander Udalov 861d9a1620 Use null instead of CompilerMessageLocation.NO_LOCATION in MessageCollector 2017-04-11 12:08:31 +03:00
Anton Bannykh 4086a84622 JS: add suffix '_test' to test module output files to avoid name conflicts (KT-16979)
Also stop setting AMD module ids explicitly.
2017-03-28 21:44:56 +03:00
Alexander Udalov c67eb84369 Support nested classes in KotlinCliJavaFileManagerImpl.findClass
findClass(String, GlobalSearchScope) is invoked for example when we're
resolving supertypes of classes in Java libraries. Previously, it never
found nested classes and falled back to CoreJavaFileManager's
implementation, which lacks a fix for the original issue (KT-12664,
which was fixed in JvmDependenciesIndex in 5a533a52 and 164c72e8)

 #KT-16931 Fixed
2017-03-27 17:19:24 +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 Sedunov 38f9e99d91 Kotlin Facet: Fix argument merging
#KT-16982 Fixed
2017-03-22 13:36:06 +03:00
Alexey Tsvetkov 40574d31ac JPS tests: avoid using deprecated API 2017-03-20 18:46:00 +01:00
Dmitry Jemerov 12fc89f35d Update to 171.SNAPSHOT to pick up fix for IDEA-169570; fix compilation 2017-03-20 18:45:41 +01:00
Nikolay Krasko 1d29c81346 ! (TODO) Update build test data in 171 2017-03-20 18:45:40 +01:00
Nikolay Krasko 95061885b0 Update after separating JPS builders into two modules 2017-03-20 18:45:35 +01:00
Alexey Tsvetkov 05f278ce20 JPS: implement tracking of null annotations
#KT-12933 fixed
    #KT-14266 fixed
2017-03-20 18:45:21 +01:00
Dmitry Jemerov a2b0b3d6eb fix compilation against branch 163 2017-03-20 18:45:15 +01:00
Alexander Udalov bf90cb5cc0 JS: support -Xskip-metadata-version-check for incompatible ABI libraries
Allow the compiler to read such libraries without any errors, at the
risk of crashing with an exception.

Also fix a minor bug in the diagnostic message in LibrarySourcesConfig
and in the corresponding test in KotlinJpsBuildTest
2017-03-20 17:22:29 +03:00
Alexey Sedunov 505a6bcbf2 JPS: Copy project-level settings before use
Sharing these settings for reading/writing
between different module during JPS build
may lead to compiler settings
(plugionOptions, in particular) of several
modules to be mixed

 #KT-16888 Fixed
2017-03-19 17:19:40 +03:00
Mikhail Glukhikh 045a23ae10 Cleanup: apply "Convert lambda to reference" 2017-03-15 17:36:02 +03:00
Mikhail Glukhikh b121bf8802 Cleanup: fix some compiler warnings (mostly deprecations, javaClass) 2017-03-15 17:35:31 +03:00
Alexey Sedunov e5a128ab2e JPS: Parse and merge additional arguments with primary ones instead of
appending them (to avoid duplication)
 #KT-16788 Fixed
2017-03-14 15:33:07 +03:00
Alexey Sedunov 73b879ea89 Misc: Include cli-parser 1.1.2 sources into the project under different package and drop original library dependency
This would allow building the project with Kotlin JPS plugin on TeamCity where older library takes precendence due to appearing earlier in JPS classpath
2017-03-14 15:33:06 +03:00
Alexey Sedunov e8640b441d JPS: Fix earlier configurations with incorrect combination of language and API version 2017-03-09 23:06:42 +03:00
Alexey Sedunov 811b8978c2 Kotlin Facet: Escape additional compiler arguments when converting them to string and unescape before parsing
#KT-16700 Fixed
2017-03-09 23:06:38 +03:00
Alexey Sedunov 278cc71c4a Kotlin Facet: Reuse configuration serialization in JPS (previous implementation is not usable after configuration refactoring) 2017-03-09 23:06:18 +03:00
Alexey Sedunov 641a9a7153 Kotlin Facet: Get rid of duplicating data in facet configuration 2017-03-09 23:06:12 +03:00
Anton Bannykh 6608e97d35 JPS JS: simplified the code and added tests for the missing meta.js case (e.g. empty sourceroot; fixed by yole in 00ed0248d9a23701dbef52da02259d174a9999e7) 2017-02-28 16:05:16 +03:00
Dmitry Jemerov 3225c93ce0 Don't pass paths to non-existing metadata files from dependent modules 2017-02-16 19:16:19 +01:00
Alexander Udalov 4c9afb9d20 Move testable IS_PRE_RELEASE flag to KotlinCompilerVersion
It'll be used in the JS back-end as well soon, so
DeserializedDescriptorResolver is not the best place for it
2017-02-13 12:11:15 +03:00
Alexey Andreev 7192529733 JS: drop support of old library format 2017-02-10 21:04:50 +03:00
Stanislav Erokhin b616ef0a40 Do not force resolve descriptors for explicit imports. Create lazy scope instead. 2017-02-09 15:42:30 +03:00
Alexey Sedunov 4325632b3e Kotlin Facet: Always parse argument string to proper compiler arguments bean
#KT-16137 Fixed
 #KT-16157 Fixed
 #KT-16206 Fixed
2017-02-08 11:56:59 +03:00
Alexander Udalov b780e6d374 Do not import "kotlin.comparisons" by default for language version 1.0
#KT-16199 Fixed
2017-02-07 10:15:57 +03:00
Anton Bannykh f0e3c87b84 JPS: fixed duplicate meta.js in case of multiple source roots in the same module. 2017-02-03 13:03:12 +03:00