Commit Graph

242 Commits

Author SHA1 Message Date
Alexander Udalov a67382fdec Daemon: do not exit with internal error on invalid arguments
Invalid compiler arguments should lead to a compilation error, not
internal error. This has been fixed by splitting the
"parseArguments(...)" call (which does parsing + validation) in
CompileServiceImpl into two calls of parseCommandLineArguments +
validateArguments, and returning with a compilation error if the latter
did not succeed

 #KT-16057 Fixed
 #KT-14848 In Progress
2017-06-06 19:52:02 +03:00
Alexander Udalov 7febd846e8 Export 'intellij-core' in module 'frontend'
Remove intellij-core from dependencies of modules which already depend
on frontend or any module that exports frontend (such as frontend.java)
2017-06-06 14:29:26 +03:00
Alexander Udalov a236400785 CLI: drop CommonCompilerArguments.createDefaultInstance
Move the corresponding default value initializers to the field
declarations
2017-06-06 14:17:26 +03:00
Alexey Tsvetkov 6e07b1cd99 Gradle: set default values of languageVersion and apiVersion to null
Before the change, Gradle always explicitly set language and api
version to the latest version, preventing the compiler
from inferencing the arguments.

     #KT-18047 fixed
2017-05-31 16:59:03 +03:00
Alexey Andreev 522a56947c Add -keep command line option to JS DCE tool 2017-05-26 18:20:23 +03:00
Alexey Andreev 8a8fdf1968 Command-line tool for JS DCE 2017-05-26 18:20:17 +03:00
Alexey Tsvetkov 3de679fb23 Minor: add comment for CompilerMessageSeverity.OUTPUT 2017-05-26 15:16:41 +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
Alexander Udalov 9b85fed3c4 Fix typo in kotlinc-js help
File separator is '/', path separator is ':' or ';'
2017-05-18 13:29:03 +03:00
baratynskiy 5eea3b6569 Introduce experimental -Xuse-javac compilation mode
In this mode, javac AST and Symbol files are used during
Kotlin compilation instead of PSI / binary stuff.
Later, they are reused for Java file compilation.
javac in this mode is integrated into kotlinc.
2017-05-17 17:48:17 +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
Ilya Chernikov 732367e671 Pass earlier scripts as array, removes 255-lines repl limitation
fixes #KT-10060
2017-05-03 18:11:46 +02:00
Ilya Chernikov e384268c8b minor: unwrapping InvocationTargetException on repl line evaluation...
To provide better error diagnostics
2017-05-03 18:11:44 +02:00
Ilya Chernikov 8cc576d44f Add total reset to repl history and state interfaces 2017-05-03 18:11:43 +02: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 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
Alexander Udalov c9769ab454 Do not serialize/deserialize CommonCompilerArguments#errors
This prevents .idea/kotlinc.xml from being added with an empty
ArgumentParseErrors object and also fixes
ConfigureKotlinInTempDirTest.testKotlincExistsNoSettingsRuntime11
2017-04-22 02:17:49 +03:00
Dmitry Jemerov 4e8fe18ca8 Fix facet validation: change ArgumentParseErrors to a data class
BaseCompilerSettings.validateInheritedFieldsUnchanged() compares
old and new properties of the compiler settings, and the check requires
ArgumentParseErrors.equals() to be correctly implemented
2017-04-21 13:20:49 +02:00
Denis Zharkov a5c352dc9f Add -Xuse-old-class-files-reading CLI argument
By default we use the fast implementation in CLI compiler,
but in the most of the tests the old one is enabled

Also add tests on CompiledJava with the fast class reading
implementation
2017-04-21 12:56:29 +03:00
Alexander Udalov aee5326ca7 CLI: refactor argument validation out of parsing 2017-04-20 16:20:54 +03:00
Alexander Udalov 8aba862e97 CLI: use "--" to separate free arguments from compiler options
#KT-9370 Fixed
2017-04-20 16:20:54 +03:00
Zalim Bashorov 9783a31779 Remove kotlin-reflect.jar dependency from util module and move reflectionUtil.kt closer to "clients"
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:38 +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 b7de272884 CLI: support delimiter for array arguments
The " " delimiter is used in kotlin-native (see
K2NativeCompilerArguments)
2017-04-17 11:51:33 +03:00
Alexander Udalov 072f87ddab Introduce -Xintellij-plugin-root, deprecate CompilerJarLocator 2017-04-14 20:13:11 +03:00
Alexander Udalov ff846e787f Report warning for non-boolean CLI argument passed multiple times
Only if its values are different, see the test
2017-04-14 20:07:54 +03:00
Alexander Udalov be54e4b93b Get rid of coroutinesWarn/coroutinesEnable/coroutinesError
Use a single coroutinesState instead. Change the coroutines state in
some tests from "warn" to "enable"/"error" to test that deserialization
of older config files works ("warn" is the default value, so it wasn't
testing anything here)
2017-04-14 20:07:54 +03:00
Alexander Udalov f4b6db4dc0 Change format of -X arguments to require value after '='
Report a warning when an argument is passed in the old form (with the
whitespace)

 #KT-17264 Fixed
2017-04-14 20:07:54 +03:00
Alexander Udalov 78c0111c6e Drop cli-parser, use simple reflection-based parser instead
The main reason of this change is that major changes are required in how
command line arguments are parsed in kotlinc, and it's much easier to
make them in our own codebase (given that the code is short and simple
enough) than in a third-party library
2017-04-14 20:07:53 +03:00
Alexander Udalov cb4d2994a3 Drop CompilerMessageLocation.NO_LOCATION, use null everywhere instead 2017-04-11 12:08:31 +03:00
Alexander Udalov 861d9a1620 Use null instead of CompilerMessageLocation.NO_LOCATION in MessageCollector 2017-04-11 12:08:31 +03:00
Dmitry Jemerov 406714a1f4 Remove warning for running the compiler under Java 6/7
Now the compiler won't even start, so no need to check this manually.
2017-04-10 17:30:03 +02:00
Ilya Chernikov 0199ec18b1 Add new compiler argument for passing script resolver environment 2017-04-06 10:02:48 +02:00
Alexander Udalov 78e278ec4c Remove redundant type arguments for Java 8+ in compiler modules 2017-04-03 14:51:18 +03:00
Alexander Udalov d440f07111 Use Java 7+ diamond operator in compiler modules 2017-04-03 14:51:15 +03:00
Alexander Udalov 37f435da93 Use List.sort instead of Collections.sort 2017-04-03 14:50:33 +03:00
Alexander Udalov 5ebee6ceca Use Java 8 lambdas instead of anonymous classes in compiler modules 2017-04-03 14:49:23 +03:00
Alexander Udalov 6aa0f7bb65 Use multi-catch when possible 2017-04-03 14:26:53 +03:00
Alexander Udalov 34f0576135 Invoke "remove unnecessary final" intention in compiler modules 2017-04-03 14:26:52 +03:00
Alexander Udalov 08b50cab08 Use java.util.function.Predicate instead of Guava 2017-04-03 14:26:50 +03:00
Mikhail Zarechenskiy aec0c029e5 Display description of language version in options 2017-03-30 13:27:50 +03:00
Mikhail Zarechenskiy 20d5616d75 Introduce Kotlin language version 1.2
Wherein DEFAULT version is still 1.1, which means that version 1.2 should be configured manually
2017-03-30 13:27:45 +03:00
Anton Bannykh 9b34e21619 JS: fixed <Type>Array.iterator methods; added -Xtypedarray compiler key
The <Type>Array.iterator used to lack next<Type>() method (KT-16626).

The -Xtypedarray compiler key enables translation of primitive arrays
to TypedArrays, and primitive array`is`-checks (KT-15358, KT-14007,
KT-14614, KT-16056).
2017-03-27 23:09:34 +03:00
Ilya Chernikov c034a73d72 Extract and reuse JarFS-related IO fallback configurator function
Partly fixes #KT-16927
2017-03-23 18:11:38 +01:00
Alexey Sedunov 38f9e99d91 Kotlin Facet: Fix argument merging
#KT-16982 Fixed
2017-03-22 13:36:06 +03:00
Alexey Sedunov 5c55b9fbbe Configuration: Check that project-level common arguments are not changed through platform-specific holders 2017-03-16 03:14:34 +03:00
Mikhail Glukhikh b121bf8802 Cleanup: fix some compiler warnings (mostly deprecations, javaClass) 2017-03-15 17:35:31 +03:00
Alexander Udalov 573c6ab5d4 Move JvmTarget to frontend.java, introduce TargetPlatformVersion
Previously JvmTarget was declared in module 'util' which is accessible
for example from 'frontend', which is not very good.

Also add a superinterface named TargetPlatformVersion which is going to
be used in platform-independent injectors in 'frontend' in the following
commits. Use it in one place (LanguageVersionSettingsProviderImpl.kt)
instead of DescriptionAware because TargetPlatformVersion sounds like a
better abstraction than DescriptionAware here
2017-03-15 11:02:56 +03:00
Alexey Sedunov 6b6d7a5030 Configuration: Don't create kotlinc.xml if the settings don't differ from the defaults
#KT-16647 Fixed
2017-03-14 15:33:11 +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