Commit Graph

2408 Commits

Author SHA1 Message Date
Alexey Tsvetkov cb549cba00 Create kapt configurations before gradle script is evaluated
We cannot create kapt configurations in `KotlinGradleSubplugin.apply`,
because `apply` is invoked after a script is evaluated, so user cannot
refer to kapt configurations in script.

We cannot call `apply` before script's evaluation, because
then we might not be able to determine
if a Gradle plugin corresponding to a subplugin is appled.
For example in case of the following script:
```
apply plugin: "kotlin"
apply plugin: "kotlin-kapt"
```
subplugin's apply will exit early because Gradle plugin "kotlin-kapt"
is not applied yet, when "kotlin"'s apply is evaluated.
2018-05-30 20:24:11 +03:00
Ilya Chernikov a46dd5b30e Avoid using reflected types in the scripting API
since it causes numerous classloading issues. Using the wrapping types
and reload them in the proper context when needed.
Note: this version supports only classes, but the wrapping type could
be extended to support other types in the future.
+ numerous fixes related to proper loading and handling of the templates.
2018-05-28 22:10:56 +02:00
Ilya Gorbunov 418db53ba4 Array.copyOf docs: do not use 'primitive default' term, rewrite description
#KT-22298
2018-05-25 21:52:36 +03:00
Valeriy Zhirnov 9239de9a02 KT-22298 Improve docs for Array.copyOf(newSize: Int)
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
2018-05-25 21:52:36 +03:00
Alexander Udalov bf3419c3bd Introduce OptionalExpectation for annotations missing on some platforms
This commits adds a new annotation OptionalExpectation to the standard
library, which is experimental. To enable its usage, either pass
'-Xuse-experimental=kotlin.ExperimentalMultiplatform' as a compiler
argument, or '-Xuse-experimental=kotlin.Experimental' and also annotate
each usage with `@UseExperimental(ExperimentalMultiplatform::class)`

 #KT-18882 Fixed
2018-05-24 13:14:51 +02:00
Yan Zhulanow 0b0089711a Android Extensions: Avoid duplicating variants in compiler plugin options 2018-05-24 01:01:52 +03:00
Yan Zhulanow aa8c266940 Pill: Add kotlin-scripting-gradle and kotlin-gradle-plugin-integration-tests to JPS model (in 'full' variant) 2018-05-24 01:01:52 +03:00
Yan Zhulanow dd40b3a15c Kapt: Remove obsolete kapt1-related tests 2018-05-24 01:01:51 +03:00
Yan Zhulanow 662b79780d Kapt: Remove kapt1 support from Gradle and incremental compilation 2018-05-24 01:01:51 +03:00
Yan Zhulanow 58643ea99d Kapt: Remove annotation processor wrappers for kapt1 (it's obsolete now) 2018-05-24 01:01:51 +03:00
Sergey Igushkin 721d9df4e0 (minor) Fix testApplyWithFeaturePlugin 2018-05-23 18:41:10 +03:00
Sergey Igushkin 571905824d Add AP option providers of Android Gradle plugin as @Nested to Kapt
Also remove these option providers from the javac task compiler argument
providers so as to avoid output intersections of javac vs kapt.

The options generated by the providers are added to the Kapt subplugin
options as well in order to be passed to Kapt. Since these options
are a list, not a map, pass them without name (Kapt should decode them
into plain arguments). Remove the '-A' prefix as it is there for
command line annotation processor options, but we don't need it, it
is added by Kapt internally.

Issue #KT-23964 Fixed
Issue #KT-24420 Fixed
2018-05-23 18:41:10 +03:00
Ilya Gorbunov d9656a939b Do not produce libraries json declarations dump
It's no longer needed for checking binary compatibility.
Clean build of these libraries is no longer required too.

Cleanup build.gradle of binary-compatibility-validator.
2018-05-23 05:00:57 +03:00
Ilya Gorbunov ad8c64e127 bcv: refactor: do not convert flags to string representation 2018-05-23 05:00:57 +03:00
Ilya Gorbunov 66a9a90455 bcv: cleanup the old way of reading kotlin visibilities 2018-05-23 05:00:57 +03:00
Ilya Gorbunov 84d96d9537 Use asm:6.0 in kotlinp
Some class files can't be read with asm:4.0.

Make shadowJar when assembling the project.
2018-05-23 05:00:57 +03:00
Ilya Gorbunov fcf323851e bcv: use kotlinx-metadata-jvm to read kotlin visibilities
It's no longer required to dump kotlin-to-java declaration mapping to json
before using binary-compatibility-validator.

@JvmOverloads are not supported yet, so remove them from test.

Use asm:6.0 in bcv
2018-05-23 05:00:56 +03:00
Ilya Gorbunov 1872550f25 binary-compatibility-validator: add test case for parameters with default values
Move JvmOverloads test there.
2018-05-23 05:00:56 +03:00
Alexey Tsvetkov 55b61bdc53 Turn off inter-project IC when unknown task writes to java output dir 2018-05-17 20:55:27 +03:00
Alexey Tsvetkov ea255ac854 Rebuild when dependency was built non-incrementally 2018-05-17 20:55:27 +03:00
Alexey Tsvetkov 53266300d4 Implement module detection for Gradle IC with Android
#KT-22431 fixed
2018-05-17 20:55:26 +03:00
Alexey Tsvetkov e5cdc64f4f Track changes for jar files for non-Android Gradle projects 2018-05-17 20:55:26 +03:00
Alexey Tsvetkov 61e330fa57 Track inter-project IC changes for Java 2018-05-17 20:46:52 +03:00
Alexey Tsvetkov 6a45310830 Remove global artifact history cache in Gradle
Each Kotlin task now writes build history to separate file.
A map of output directories to history files is used to get changes for
modified files.

    #KT-22623 fixed
2018-05-17 20:46:52 +03:00
Alexey Tsvetkov f9af48c19e Test Java is up-to-date when Kotlin ABI is unchanged 2018-05-16 21:36:48 +03:00
Alexey Tsvetkov b2d13ac89b Fix Kapt incremental test with Gradle >= 4.3 2018-05-16 21:36:48 +03:00
Alexander Udalov e1a4bd01f5 Add anonymousObjectOriginName/lambdaClassOriginName to kotlinx-metadata
#KT-21320
 #KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov e5a5d834ab Add "-verbose" to kotlinp tool, change type parameter name rendering
Only render the actual name of the type parameter in the verbose mode

 #KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov c42001f550 Refactor flags in kotlinx-metadata
- rename object Flags to Flag and merge it with MetadataFlag
- use typealias Flags instead of Int
- use top level function "flagsOf" instead of "Flags.invoke" to
  construct a bitmask

 #KT-23198
2018-05-16 17:16:22 +02:00
Alexander Udalov 9dbeb79340 Test kotlinx-metadata and kotlinp on compiler test data
#KT-23198
2018-05-16 17:16:21 +02:00
Alexander Udalov bef759161f Support .kotlin_module files in kotlinx-metadata
#KT-23198
2018-05-16 17:16:21 +02:00
Alexander Udalov a751d02306 Implement writing visitors for kotlinx-metadata
#KT-23198
2018-05-16 17:16:21 +02:00
Alexander Udalov 4b284a4890 Add kotlinp, a tool to print Kotlin metadata in class/module files
At the moment, it's not published anywhere, but that may change soon

 #KT-23198
2018-05-16 17:16:21 +02:00
Alexey Tsvetkov ea1a4f75ba Fix incremental android extensions test
Weirdly merge resource task was failing when run incrementally
if support library is present
2018-05-15 18:40:54 +03:00
Alexey Tsvetkov 6edba56adb Fix Android IC test
Previously some Kotlin files were recompiled, because Java files
were regenerated.
However this is no longer true for some time since
precise Java tracking was implemented.
2018-05-15 18:40:54 +03:00
Yan Zhulanow ba5836d666 Pill: Introduce pill{} extension to set extended Pill configuration
Also introduce the flavor concept which allows to specify what part of Kotlin project should be imported.
2018-05-15 16:29:45 +03:00
Alexey Tsvetkov 38ffd6f85e Add test for missing lz4 dependency
Adds Gradle test for the exception:
`java.lang.ClassNotFoundException: net.jpountz.lz4.LZ4Factory`

The exception breaks IC in Gradle. Gradle compiles non-incrementally as
a fallback strategy, so the build succeeds, but IC is not working.

IC uses persistent hash tables from Intellij as caches.
These tables's buffers are compressed when full.
Previously snappy was used for compression, but 181 platform switched to
LZ4, which was cut out by proguard.

The problem could only be reproduced with Gradle,
since in JPS plugin all caches are managed by JPS process,
which contains the necessary library.

To reproduce the compiler needs to be processed by proguard
(which always happens on TeamCity).
Many classes are needed to trigger the compression.
2018-05-12 19:02:04 +02:00
Sergey Igushkin 2a46648e3e In Android MPP target, add common module dependency to api configuration
Since Android considers the `compile` configuration as deprecated and
reports a warning when a dependency is added to it, use the `api`
configuration when dealing with an Android platform module.

Issue #KT-23719 Fixed
2018-05-11 16:03:33 +03:00
Sergey Igushkin 284b5b9860 (minor fix) Remove extra underscore from module names 2018-05-11 15:37:17 +03:00
Alexey Tsvetkov c026c7f24b Filter out non-Java files from kapt inputs
#KT-23878 fixed
2018-05-10 22:01:06 +03:00
Alexey Tsvetkov 5f3c57e69a Filter out generated Java files from stubs generation inputs 2018-05-10 21:58:35 +03:00
Sergey Igushkin 093842932f Filter some characters out of module names passed to Kotlin from Gradle
This addresses the cases when a module name contains a slash
 (e.g. when the Gradle project name was set this way to point
Gradle to the directory), which led to Kotlin module file being placed
under a subdirectory of META-INF and thus undiscoverable for the
compiler and reflect.

Additionally, this fix removes characters \n, \r, \t whose
presence in a module name caused compilation failures.

Issue #KT-20608 Fixed
2018-05-10 19:17:03 +03:00
Alexey Tsvetkov 89da660186 Replace assertContains with assertTasksExecuted/assertTasksUpToDate 2018-05-08 15:24:45 +03:00
Alexey Tsvetkov f00e243822 Reformat :kotlin-gradle-plugin-integration-tests 2018-05-08 15:24:45 +03:00
Alexey Tsvetkov 39c000bb4d Add vararg overloads for Gradle test utils 2018-05-08 15:24:45 +03:00
Sergey Igushkin 8fda174fb0 Add the compiler classpath of the KotlinCompile task as KaptTask's input
KaptTask was not declaring the compiler classpath (which it takes from
compileKotlin task for calling the compiler) as input. This commit fixes
that and adds a test that checks compiler classpath input checks for the
kapt tasks.

Issue #KT-23879 Fixed
2018-05-07 15:55:55 +03:00
Sergey Igushkin 352fb4a1c8 Add a user-friendly report that the JDK tools are missing
Issue #KT-20214 Fixed
2018-05-07 15:47:11 +03:00
Ilmir Usmanov 5e4ce4f880 Remove coroutineContext from kotlin.coroutines.experimental.intrinsics package
#KT-22400: Fixed
2018-05-07 10:28:54 +03:00
Sergey Igushkin e82170a04e Tracks and match source sets for MPP after the plugins are applied
Since the custom source sets may be added after the plugins are applied in both common and platform module, we need to handle `.all { ... }` source sets in both modules and add common sources to the platform module once a match is found.

Issue #KT-22510 Fixed
2018-05-04 15:37:08 +03:00
Alexander Udalov c57864e46c Require "-Xuse-experimental=kotlin.Experimental" on usages of Experimental
Since we're not yet sure of the design of Experimental/UseExperimental,
we're making them "experimental" themselves in some sense, in that the
user is required to provide the magic argument
"-Xuse-experimental=kotlin.Experimental" to be allowed to use either
Experimental or UseExperimental. This is more convenient than the
previous approach of "-language-version 1.3
-Xskip-metadata-version-check" because it's simpler and does not cause
pre-release binaries to be produced
2018-05-04 13:48:24 +02:00