Commit Graph

1156 Commits

Author SHA1 Message Date
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 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
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
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 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
Pavel V. Talanov 32daf048c2 PlatformConfigurator: create container for each platform (it contains static services, mostly checkers) ahead of time 2016-09-26 14:42:57 +03:00
Denis Zharkov a7dedfab70 Move JvmBuiltIns initialization after container setup
It will be used in the further commits to initilize built-ins instance
with components as arguments
2016-09-22 15:40:37 +03:00
Mikhail Zarechenskiy 8a0107ea5f Move property with template to script definition interface 2016-09-20 16:23:42 +03:00
Nikolay Krasko a471d8907a Register TypeAnnotationModifier as extension point 2016-09-20 15:26:34 +03:00
Nikolay Krasko 99a75021e1 Problem: manually shutdown AppScheduledExecutorService to allow compiler stop properly
Without such shutdown console program that gets PSI file will hang forever.

Introduced in https://github.com/JetBrains/intellij-community/commit/446b80077aed71e2384301ae993cf44416bf9a83

Stack example:

 java.lang.Thread.State: RUNNABLE
	  at com.intellij.util.concurrency.AppDelayQueue.<init>(AppDelayQueue.java:37)
	  at com.intellij.util.concurrency.AppScheduledExecutorService.<init>(AppScheduledExecutorService.java:50)
	  at com.intellij.util.concurrency.AppScheduledExecutorService$Holder.<clinit>(AppScheduledExecutorService.java:41)
	  at com.intellij.util.concurrency.AppScheduledExecutorService.getInstance(AppScheduledExecutorService.java:46)
	  at com.intellij.util.concurrency.AppExecutorUtil.getAppScheduledExecutorService(AppExecutorUtil.java:39)
	  at com.intellij.concurrency.JobScheduler.getScheduler(JobScheduler.java:43)
	  at com.intellij.psi.impl.source.AstPathPsiMap.<clinit>(AstPathPsiMap.java:45)
	  at com.intellij.psi.impl.source.PsiFileImpl.<init>(PsiFileImpl.java:76)
	  at com.intellij.extapi.psi.PsiFileBase.<init>(PsiFileBase.java:39)
	  at org.jetbrains.kotlin.psi.KtFile.<init>(KtFile.java:48)
	  at org.jetbrains.kotlin.parsing.KotlinParserDefinition.createFile(KotlinParserDefinition.kt:73)
	  at com.intellij.psi.SingleRootFileViewProvider.createFile(SingleRootFileViewProvider.java:407)
	  at com.intellij.psi.SingleRootFileViewProvider.createFile(SingleRootFileViewProvider.java:348)
	  at com.intellij.psi.SingleRootFileViewProvider.createFile(SingleRootFileViewProvider.java:326)
	  at com.intellij.psi.SingleRootFileViewProvider.getPsiInner(SingleRootFileViewProvider.java:171)
	  at com.intellij.psi.SingleRootFileViewProvider.getPsi(SingleRootFileViewProvider.java:155)
	  at com.intellij.psi.impl.PsiFileFactoryImpl.trySetupPsiForFile(PsiFileFactoryImpl.java:121)
	  at com.intellij.psi.impl.PsiFileFactoryImpl.createFileFromText(PsiFileFactoryImpl.java:100)
	  at com.intellij.psi.impl.PsiFileFactoryImpl.createFileFromText(PsiFileFactoryImpl.java:56)
	  at org.jetbrains.kotlin.psi.KtPsiFactory.doCreateFile(KtPsiFactory.kt:174)
	  at org.jetbrains.kotlin.psi.KtPsiFactory.createFile(KtPsiFactory.kt:178)
	  at org.jetbrains.kotlin.preprocessor.Preprocessor.processFileSingleEvaluator(Preprocessor.kt:82)
	  at org.jetbrains.kotlin.preprocessor.Preprocessor.processDirectorySingleEvaluator(Preprocessor.kt:105)
	  at org.jetbrains.kotlin.preprocessor.Preprocessor.processDirectorySingleEvaluator(Preprocessor.kt:135)
	  at org.jetbrains.kotlin.preprocessor.Preprocessor.processSources(Preprocessor.kt:74)
	  at org.jetbrains.kotlin.preprocessor.PreprocessorCLI.main(PreprocessorCLI.kt:35)
2016-09-20 15:25:37 +03:00
Nikolay Krasko bfef8726bb Mock implementation for ExternalAnnotationsManager and InferredAnnotationsManager services 2016-09-20 15:10:56 +03:00
Nikolay Krasko b05105e849 Problem: define idea.plugins.compatible.build setting explicitly to avoid exception about bad idea home path 2016-09-20 15:10:49 +03:00
Alexander Udalov c91f77f2a4 Rename LanguageFeatureSettings -> LanguageVersionSettings 2016-09-19 15:21:24 +03:00
Alexander Udalov aec31bd88f Uninherit LanguageVersion from LanguageFeatureSettings
Introduce LanguageVersionSettingsImpl to store everything related to the
selected language version
2016-09-19 15:20:47 +03:00
Alexey Tsvetkov 6ebb50751c Remove source annotations when copy class with kapt2
Writing source annotations enables incremental compilation for kapt2.
However they are not needed in bytecode, so we remove them when
copying classes.

# Conflicts:
#	compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt
#	compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java
2016-09-14 13:52:56 +03:00
Yan Zhulanow 015130832b Kapt: allow to use Kapt from compileBunchOfSources() 2016-09-10 17:36:53 +03:00
Yan Zhulanow 471ddc5a93 Kapt: Write annotations with the "SOURCE" retention if kapt2 is enabled
(cherry picked from commit 6177b2b)
2016-09-10 17:36:15 +03:00
Yan Zhulanow 824b778a7b Kapt: support multiple annotation processing steps (KT-13651)
(cherry picked from commit 880e183)
2016-09-10 17:36:15 +03:00
Yan Zhulanow 84d62f37eb Kapt: Analyze sources again if the received analysis result is 'RetryWithAdditionalJavaRoots'. ->
Add additional Java roots to Java source roots and clear diagnostic messages before the next analysis round.
(cherry picked from commit 17ad807)
2016-08-29 16:31:16 +03:00
Ilya Chernikov 46a7c706e1 Fixes and refactorings after review 2016-08-11 09:11:11 +02:00
Ilya Chernikov 295f2fd40a Fix GeneratedClassloader creation in scripts compilation, fixes test 2016-08-11 09:11:11 +02:00
Ilya Chernikov 6c0b78fb01 Add script-templates option to compiler options, fix templates and definitions loading in compiler 2016-08-11 09:08:40 +02:00
Alexander Udalov 0d26087040 CLI, Ant: add kotlin-reflect.jar to classpath by default, support "-no-reflect"
Note that now "-no-stdlib" implies "-no-reflect".

 #KT-13237 Fixed
2016-08-09 11:24:24 +03:00
Ilya Chernikov f73b8e80be Fixes after review 2016-08-03 09:51:40 +02:00
Ilya Chernikov 59712d4bf8 Implement updatable dependencies index with usage API in the environment for using in REPL 2016-08-03 09:51:40 +02:00
Pavel V. Talanov 999c8e7486 Refactor: rename KtLightClassForExplicitDeclaration -> KtLightClassForSourceDeclaration 2016-07-28 18:00:50 +03:00
Pavel V. Talanov cdbd7fbab0 Refactor: split classes in 'asJava' package into several subpackages to reflect their structure 2016-07-28 18:00:47 +03:00