Commit Graph

1417 Commits

Author SHA1 Message Date
Zalim Bashorov 2c69198926 Make return type of KotlinScriptDefinitionProvider.getInstance nullable
For example service can be absent in Kotlin JS only compiler.
2017-04-19 20:18:20 +03:00
Anton Bannykh d5bcf18e5c JS: disable JVM specific part of internal visibility resolution 2017-04-19 18:53:27 +03:00
Ilya Chernikov ea71d57808 Use script-runtime properly in IDEA project:
use it from the installed plugin for dependent modules (frontend)
use it from bootstrap in the plugin being built
also drop unused daemon-client from the plugin

This makes it consistent with ant build and allow building idea project
without prior ant dist
2017-04-19 15:22:15 +02: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 51e84f7ce4 Move some script related part of frontend to separate module to avoid using kotlin-reflect.jar in frontend 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:35 +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 ce6676baa8 Do not print usage if wrong argument is passed, do not exit with INTERNAL_ERROR
This is a normal situation, not an internal error of the compiler, so
return COMPILATION_ERROR instead
2017-04-14 20:07:54 +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
Alexey Andreev e182290f54 Fix sorting of source files before compilation.
This should fix unstable generated JS between recompilations.
2017-04-14 11:46:52 +03:00
Zalim Bashorov 56d3f90a02 Don't log content of module.xml when Logger is not initialized
When Logger is not initialized it returns default logger which prints to stdout and stderr,
so it can lead to different results when run CLI tests locally and on TC.
2017-04-13 13:16:32 +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 a19303e121 Fix environment arg parsing regex - avoid SO on the long strings 2017-04-06 18:49:58 +02:00
Ilya Chernikov 0199ec18b1 Add new compiler argument for passing script resolver environment 2017-04-06 10:02:48 +02:00
Ilya Chernikov 88652154c9 Port compiler to the script-runtime with script base classes 2017-04-06 10:02:45 +02:00
Alexander Udalov b368da8456 Do not warn on non-JAR files in classpath
#KT-17140 Fixed
2017-04-03 18:18:40 +03:00
Alexander Udalov 64dfa6d33d Do not add current directory to "kotlin" classpath
As "java" does, do not include the current directory to the classpath if
the explicit classpath is specified. This is more stable than always
adding the current directory, and users can easily add the ".:" to the
beginning of the explicit classpath themselves

 #KT-17100 Fixed
2017-04-03 18:17:27 +03:00
Alexander Udalov 3b8110f51c Minor, use "use" to automatically close JarFile
JarFile extends Closeable on JDK 8, so we can use "use" here now
2017-04-03 18:05:04 +03:00
Alexander Udalov cbc893ed17 Minor, drop useless class in cli-runner
Use a simple List<URL> instead of Classpath
2017-04-03 18:05:04 +03: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 463bbbd386 Use try-with-resources instead of manual try/finally 2017-04-03 14:26:51 +03:00
Alexander Udalov 08b50cab08 Use java.util.function.Predicate instead of Guava 2017-04-03 14:26:50 +03:00
Alexey Sedunov 72436c1738 Light Classes: Fix origin search for KtLightSuperTypeReference
Use analyzeFully() when resolving super type references
2017-03-31 18:24:06 +03:00
Ilya Gorbunov 322ec0fa32 Do not add library with empty path when libraries argument is empty
#KT-17059

-libraries parameter without argument can be passed by maven or gradle, when there are no dependencies specified.
2017-03-30 13:43:55 +03:00
Mikhail Zarechenskiy aec0c029e5 Display description of language version in options 2017-03-30 13:27:50 +03:00
Mikhail Zarechenskiy c512453e16 Show LV=1.2 in IDE only in internal mode 2017-03-30 13:27:48 +03:00
Mikhail Zarechenskiy 5027a76ed4 Add strong warning when trying to compile with experimental LV 2017-03-30 13:27:47 +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
Alexander Udalov a5d70cfa68 Support running Kotlin compiler CLI on Java 9 on Unix
Workaround IDEA-170005, IDEA-170494 and similar issues by opening the
required packages from java.base to the unnamed module

 #KT-14988 In Progress
2017-03-30 13:04:41 +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
Alexander Udalov 1c7ac2da5a Do not use CoreJavaFileManager in KotlinCliJavaFileManagerImpl
The inheritance is still needed because of the code in intellij-core,
specifically in JavaCoreProjectEnvironment.addSourcesToClasspath and
CoreJavaDirectoryService.getPackage, which assumes that the
JavaFileManager instance in the project is a CoreJavaFileManager
2017-03-27 17:19:25 +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
Alexander Udalov f1a1ebae01 Refactor JvmDependenciesIndex
- Move collectKnownClassNamesInPackage to the only place where it's used
- Fix warnings/inspections and simplify implementation a bit
2017-03-27 17:19:24 +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
Ilya Chernikov 319440718c Add more JSR 223 and repl tests, fix double aggregation of GenericRepl state
- repl test with compilation error
- JSR 223 compilable tests
2017-03-23 18:07:45 +01:00
Alexey Sedunov 38f9e99d91 Kotlin Facet: Fix argument merging
#KT-16982 Fixed
2017-03-22 13:36:06 +03:00
Ilya Chernikov 4b430b49a7 Implement source sections compiler plugin
allows to compile only parts of the source files, denoted by top-level
"sections" (function with lambda param calls), but preserving original
file line/column numbers for easier diagnostics. Allow e.g. to compile
gradle "buildscript" section without preprocessing original file in
advance. See tests for examples.
2017-03-21 16:30:46 +01:00
Ilya Chernikov 63c276d444 Create extension points and register plugins earlier...
to allow plugins to affect source files creation
2017-03-21 16:30:45 +01:00
Dmitry Jemerov 097ba45783 Fix service and EP registration according to changes in 2017.1
Remove ControlFlowFactory (which is now registered in the platform),
register MetaLanguage (new in 2017.1)
2017-03-20 18:45:46 +01:00