Commit Graph

1246 Commits

Author SHA1 Message Date
Alexander Udalov 19520bf29c Extract KotlinMetadataFinder interface out of KotlinClassFinder 2016-11-22 18:19:02 +03:00
Alexander Udalov 73f872172f Add multi-platform projects as experimental language feature 2016-11-22 18:19:01 +03:00
Dmitry Jemerov 5a533a521b Don't consider a directory to be a package if there's a .java or .class file with the same name in its parent directory
#KT-12664 Fixed
2016-11-18 14:00:44 +01:00
Mikhael Bogdanov 61da8be260 Generate parameters metadata for java 8 reflection 2016-11-14 14:27:08 +01:00
Alexey Tsvetkov f381f1e699 Revert default value for "main" parameter for Gradle JS plugin to "call"
#KT-14724 fixed
2016-11-11 21:25:05 +03:00
Valentin Kipyatkov e850446f17 Introduced BindingContext.DATA_FLOW_INFO_BEFORE 2016-11-08 19:14:40 +03:00
Alexander Udalov 8c65379711 Support injecting custom module into KotlinBuiltIns
Provide a command-line option to load built-ins from the module and its
dependencies instead of looking for them in kotlin-compiler.jar; built-ins must
be found this way, or an error will be reported (or, most likely at this
moment, an exception will be thrown).

Note that this does not affect whether built-ins (loaded from one place or the
other) are added to the _dependencies_ of the module, this is controlled by
another option. The option added in this commit only makes the KotlinBuiltIns
instance which is used via ModuleDescriptor throughout the compiler front-end
(and also injected in a bunch of places) a sort of "helper" which always goes
to that same module to find descriptors for built-in classes
2016-11-08 12:14:24 +03:00
Alexander Udalov 7898e2447d Minor, rename JVMConfigurationKeys.ADD_BUILT_INS_TO_DEPENDENCIES 2016-11-08 12:14:24 +03:00
Alexey Sedunov d0de9dd43c Kotlin Facet: Get rid of copy constructors for compiler arguments/settings and use reflection-based copying instead 2016-11-07 20:03:29 +03:00
Alexey Sedunov a2948a624f Kotlin Facet: Reuse JvmTarget and LanguageVersion in facet configuration 2016-11-07 20:03:28 +03:00
Alexander Udalov c49c019250 Add option to restore fallback to compiler built-ins + resurrect Maven build 2016-10-26 19:02:31 +03:00
Alexander Udalov e0989caf46 Load built-ins from module dependencies in JVM compiler
Introduce a new method KotlinClassFinder#findBuiltInsData, which is only
implemented correctly in the JvmCliVirtualFileFinder because it's only used in
the compiler code at the moment.

Introduce JvmBuiltInsPackageFragmentProvider, the purpose of which is to look
for .kotlin_builtins files in the classpath and provide definitions of
built-ins from those files.

Also exclude script.runtime from compilation because, as other excluded
modules, it has no dependency on the stdlib and is no longer compilable from
the IDE now, because it cannot resolve built-ins from anywhere
2016-10-26 16:31:09 +03:00
Alexander Udalov 8a5c8da757 Simplify module configuration and built-ins dependency in some tests
- In tests on built-ins with no sources, just call
  JvmResolve.analyze(environment) and inspect the resulting module
- In AbstractLocalClassProtoTest, create container via
  TDAForJVM.createContainer
- Inline single module container creation into AbstractDiagnosticsTest
2016-10-26 16:31:04 +03:00
Alexey Sedunov ea13456bba Kotlin Facet: Add compiler settings to facet configuration 2016-10-26 15:03:42 +03:00
Alexander Udalov d9f248ccf4 Minor refactoring in JvmDependenciesIndexImpl
Make SearchResult a sealed class, inline local function & trivial utility
2016-10-24 15:30:38 +03:00
Alexander Udalov 76523cc175 Split JvmDependenciesIndex to several files, move to 'index' package 2016-10-24 15:30:38 +03:00
Ilya Chernikov 846797ff61 Switch to templates in the separate script runtime 2016-10-12 15:38:52 +02:00
Ilya Chernikov c2b5c11781 Fix all small and medium-sized issues after review 2016-10-12 15:37:54 +02:00
Ilya Chernikov 10d259771c Refactor repl and JSR 223 support code, add separate example jars for each type of JSR 223 repl (with tests) 2016-10-12 15:37:52 +02:00
Ilya Chernikov bf0d5b6237 Add basic bindings support to IDEA JSR223 scripting, fix evaluator 2016-10-12 15:37:51 +02:00
Ilya Chernikov 439622187f Move Jsr223 engine from compiler jar to script-util.jar (libraries part) 2016-10-12 15:37:50 +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 fe69185cd4 Refactor script definition and related parts:
- simplify script definition interface, convert it to class
 - create simple definitions right from base
 - refactor (rename and simplify) script definition with annotated template
 - simplify usages of script definition in many places
2016-10-12 15:37:50 +02:00
Ilya Chernikov 1a137357e5 Add support for custom script compilation and execution to maven plugin, add simple test, relevant refactorings on the compiler side 2016-10-12 15:37:49 +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
Ilya Chernikov eaa332019a Prepare repl interfaces and generic implementation for separation into possibly remote parts 2016-10-12 15:37:48 +02:00
Ilya Chernikov 0b68f313ab minor: fix typos and terminology 2016-10-12 15:37:48 +02:00
Ilya Chernikov ba4fab56a0 Implement basic JSR 223 scripting support 2016-10-12 15:37:47 +02:00
Ilya Chernikov 63c5133167 Remove support for xml-based script configs, other minor refactorings 2016-10-12 15:37:47 +02:00
Alexander Udalov 167ab1f860 Introduce "-api-version" CLI option
The `@SinceKotlin("X.Y.Z")` annotation now hides a particular declaration from
resolution when the API version specified by the `-api-version` option is
_less_ than X.Y.Z. The comparison is performed as for versions in Maven:
MavenComparableVersion is in fact a copy of
org.apache.maven.artifact.versioning.ComparableVersion.

Also support "!API_VERSION" directive in diagnostic tests

 #KT-14298 Fixed
2016-10-11 17:46:01 +03:00
Alexander Udalov 8d660c2f6e Refactor gradle option generation mechanism
Ensure there's a statically checked dependency on LanguageVersion and
JvmTarget, so that this information is updated automatically once a new
language version or a JVM target is added
2016-10-11 17:30:15 +03:00
Sergey Mashkov dafe7e3539 KT-14003 kotlinc shebang should use env 2016-10-07 17:52:34 +03:00
Yan Zhulanow 34efaea6ea Increment PsiModificationTracker counter in a write action
(cherry picked from commit 73307a2)
2016-10-07 16:28:34 +03:00
Yan Zhulanow 0ae9a7a9d1 Add TransactionGuard application service to KotlinCoreEnvironment
(cherry picked from commit 3e0b79e)
2016-10-07 16:28:30 +03:00
Alexander Udalov 8ffe379c92 Use separate module analysis in CliReplAnalyzerEngine 2016-10-06 14:40:21 +03:00
Alexander Udalov 0905b361d0 Drop LazyTopDownAnalyzerForTopLevel
Replace it everywhere with LazyTopDownAnalyzer
2016-10-06 14:40:20 +03:00
Alexey Tsvetkov 0944e9076d Add 1.1 language version to kotlin options for Gradle 2016-10-05 22:50:46 +03:00
Alexey Tsvetkov 892fc63fd1 Generate gradle options from compiler arguments
#KT-13633 fixed
2016-10-05 22:50:46 +03: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
Michael Bogdanov dd4d5e3aa1 Generate 'DefaultImpls' for jvm 8 target only within compiler option 2016-10-03 14:05:59 +03:00
Alexander Udalov 45190d9453 Support separate modules in compiler
Unless the compatibility option "-Xsingle-module" is passed, the compiler will
create two modules instead of one now (see TopDownAnalyzerFacadeForJVM): the
main module contains Kotlin and Java sources and binaries from the previous
compilation of the given module chunk, the dependency module contains all other
Kotlin and Java binaries. This fixes some issues where the compiler couldn't
detect that the used symbol was from another module, and did not forbid some
usages which are only possible inside the module (see KT-10001).

The ideal way to deal with modules here would be to exactly recreate the
project structure, for example as it's done in JvmAnalyzerFacade and usages.
This is postponed until later

 #KT-10001 Fixed
 #KT-11840 In Progress
2016-10-02 21:15:47 +03:00
Alexander Udalov 3314725700 Pass GlobalSearchScope instance to JvmPackagePartProvider
Currently behavior is unchanged because the "all project" scope is passed,
however in the future this will allow to implement separate modules in the
compiler properly
2016-10-02 21:03:37 +03:00
Alexander Udalov 97f2051a03 Add debugName to ModuleMapping 2016-10-02 21:03:33 +03:00
Alexander Udalov 5d37fab4f5 Minor, add toString for debug 2016-10-02 21:03:29 +03:00
Alexander Udalov a5a874f23f Move module creation into TopDownAnalyzerFacadeForJVM#analyzeFilesWithJavaIntegration
The only place where the logic has changed is in AbstractDiagnosticsTest, where
modules are already created and sealed before the analysis. Copy-paste the
container creation logic there (it's almost fine because it's also present in a
bunch of other tests), and simplify it: get rid of incremental compilation and
other stuff irrelevant for diagnostic tests.

This is needed to make analyzeFilesWithJavaIntegration configure the module
properly before sealing it
2016-10-02 21:03:27 +03:00
Alexander Udalov 596fdab2f2 Extract container for single-module top-down analysis 2016-10-02 21:03:26 +03:00
Alexander Udalov 278941a8a1 Deduplicate code in container creation for JVM analysis 2016-10-02 21:03:24 +03:00
Alexander Udalov 0250ea861c Simplify return types of createContainer* functions 2016-10-02 21:03:23 +03:00
Alexander Udalov 87fe6c41df Drop ExternalDeclarationsProvider
It was added for Android extensions, but now another mechanism is used there
(PackageFragmentProviderExtension), and there were no other implementations of
ExternalDeclarationsProvider in the project
2016-10-02 21:03:19 +03:00