Commit Graph

2528 Commits

Author SHA1 Message Date
Sergey Igushkin 1a3dd67176 Enable metadata publishing for new MPP and consumption from source sets
* Add configurations for consuming source sets metadata (extending the
  source set's dependency configurations). These configurations will be
  used by the IDE to pick up the dependencies metadata.

* Remove the universal preset from the default presets, create a
  metadata target by default for compiling and publishing the metadata
  of `commonMain` (in the future, we will publish and consume the
  metadata of the other source sets as well).

* Make the classpath configurations of common modules consume the
  metadata and thus ensure compatibility of 1.2.x MPP with the new MPP
  model.
2018-08-17 15:12:44 +03:00
Jonathan Lermitage 66bb744e3c Update Maven central repository url to latest version 2018-08-17 09:46:07 +02:00
Sergey Igushkin 6af6834966 (minor) Fix source set resources filtering broken by refactoring
Before the last change in this logic, the resources filtering used
the original Kotlin source directories, not those with Java filtered
out.

Make sure that the Java source directories that are added to the Kotlin
source set are excluded from the resources, and all the related
configuration works lazily, i.e. supports source sets modification
after configuration took place.
2018-08-17 03:22:30 +03:00
Sergey Igushkin d1a5794d36 (minor) Move source set configuration creation
It was placed in the new MPP plugin and was therefore not used for
the 'KotlinSourceSet's with the old plugin. Move this logic to the
KotlinSourceSetFactory so that it is applied to all source sets
2018-08-17 03:18:32 +03:00
Alexander Udalov 3345dc81fd Do not return field signature if there's none in the metadata
Otherwise this code behaves incorrectly on getter-only properties: it
returns a meaningless field signature whereas the property has no field.
It's hard to come up with an example of when this could matter in
compiler code, but it's very noticeable in kotlinx-metadata-jvm

 #KT-26188 Fixed
2018-08-16 15:05:19 +02:00
Alexander Udalov 3f32e1cce9 Do not serialize empty property signature to JVM metadata
This should have no effect on the correct code currently because all
properties have at least a getter, but may help in debugging problems
with serialized metadata for properties
2018-08-16 14:11:09 +02:00
Sergey Igushkin d13ca38296 Relax some restrictions on Gradle dependency configurations in new MPP
* Set canBeConsumed = false only on those configurations that have this
  flag according to the Gradle Java plugins. This saves us from breaking
  existing build scripts but introduces ambiguity between consumable
  configurations (e.g. between `apiElements`, `compile`, `runtime`). See
  the solution in the next point.

* Don't set the Kotlin platform attribute on configurations that are
  not meant for consuming in other projects or resolving directly. This
  change hides these configurations from Gradle's variant aware
  dependency resolution and therefore prevents ambiguity

(cherry-picked from 81f2c48f)
2018-08-15 17:48:44 +03:00
Leonid Startsev 0ac969a617 Attempt to make loading of compiler plugins from kotlin-platform-native Gradle plugin
Moved SubpluginEnviroment to separate file and made public some methods
KotlinNativeCompile task now extends AbstractCompile so it could be passed to SubpluginEnviroment.loadSubplugins
KotlinNativeBasePlugin now declares kotlinCompilerPluginClasspath configuration
2018-08-15 12:19:04 +03:00
Alexander Udalov c011bf61fe Support multiple version requirements on single element 2018-08-13 11:02:35 +02:00
Sergey Igushkin 5815d6a70c Implement language settings API for Kotlin source sets 2018-08-11 23:16:03 +03:00
Sergey Igushkin 2c04e2b95c Fix: create a compilation's default source set for Android as well 2018-08-11 23:16:03 +03:00
Alexander Udalov f663b8f554 Fix kotlin-maven-plugin compilation 2018-08-10 18:34:40 +02:00
Sergey Igushkin caec846330 Improve Android libraries support: allow project dependency on a lib
* Add a platform type androidJvm that is one-way compatible (can
  consume but cannot be consumed) with jvm, register the matching
  strategy

* Write our attributes to Android's output configurations (this uses
  a naming convention that Android inherits from Java, but there's no
  public API at the moment for that)
2018-08-07 15:55:46 +03:00
Sergey Igushkin 3f60798848 Fix the use case of an old-style project depending on an MPP lib
* Setup the attributes for the resolvable and output configurations
2018-08-07 15:55:46 +03:00
Sergey Igushkin 3ff61f59a7 Implement dependsOn relation for Kotlin source sets
* Setup configurations' extendsFrom and inherit sources of source sets.
  This make it unnecessary to restore transitive dependencies of a
  source set at its use sites, since their sources and dependencies are
  already included.

* Use dependsOn during default configuration instead of compilation.source()
2018-08-07 15:55:45 +03:00
Sergey Igushkin 93943a565c Refactor Kotlin tasks provider & fix friend task matching with new MPP
* Parameterize with the target name and use it in the task names
* Get rid of separate task providers for common and js, use the default
  with an appropriate target name
2018-08-07 15:55:45 +03:00
Sergey Igushkin d4f44e63cd Create runtime software component usage only for runnables;
Also make Kotlin2JsCompilation a compilation to runnable files
2018-08-07 15:55:45 +03:00
Sergey Igushkin 209d0cf6a1 Add a few integration tests for the new MPP plugin 2018-08-07 15:55:45 +03:00
Sergey Igushkin 1e95e4d427 Allow resolution for compileOnly and compileClasspath configurations
This is required by the old IDE importer, which needs to resolve these configurations, and there seems to be no easy way to prevent that.
2018-08-07 15:55:44 +03:00
Sergey Igushkin 19fd706d98 Fixes for Android single-target projects
1. Kapt resolves runtime classpath during configuration, and because of
that we are unable to setup configurations that already took part in
dependency resolution. To fix that, run Kapt configuration as a separate
step out of the main loop over the variants

2. Old Android projects (< 3.0.0) don't have `api` and `implementation`
configurations. To stay compatible with those, ignore these
configurations being absent during configurations hierarchy setup.
2018-08-07 15:55:44 +03:00
Sergey Igushkin 7b6764c9ae Add test tasks to targets configured with KotlinTargetConfigurator 2018-08-07 15:55:44 +03:00
Sergey Igushkin cb99f43033 Implement new MPP plugin 2018-08-07 15:55:44 +03:00
Sergey Igushkin dc7d488deb Update existing plugin implementations to use KotlinCompilation
Add default implementations for KotlinTarget and KotlinCompilation
(some of them are used in code added by further commits).

Refactor AbstractKotlinPlugin so that parts of its logic can be easily
applied outside the plugin (needed for MPP plugin later).

The single platform Kotlin plugins having Kotlin compiled along with
Java will now create a KotlinCompilation and a KotlinSourceSet per Java
source set or per Android variant.
The build configuration logic will use KotlinCompilation
objects rather than Java or Android plugin entities.

Subplugins API and implementations are updated to use KotlinCompilation.
2018-08-07 15:55:44 +03:00
Sergey Igushkin 25eb93b136 (partial) Replace the KotlinSourceSet implementation and its factory
(Note: this commit leaves the repository in a non-compilable state as it
leaves some of the old API usages unchanged; they are replaced with new
implementations in further commits where more appropriate)

The new implementation covers the wider interface, and the factory
should now be used not on its own but in a named domain object container
(the API for creating a source set is now provided through the
source sets container rather than the factory, so that source sets are
also properly registered).
2018-08-07 15:55:43 +03:00
Sergey Igushkin 3828c26fa9 Introduce new API
These interfaces are needed for both new MPP design and getting rid of
the Java plugin source sets in favor of Kotlin source sets
2018-08-07 15:55:43 +03:00
Alexander Udalov 5da8ce844a Minor, move ContentRoot and KotlinSourceRoot to module 'cli'
Also move CONTENT_ROOTS from JVMConfigurationKeys to
CLIConfigurationKeys since it's used on all platforms, not just JVM
2018-08-07 13:38:30 +02:00
Yan Zhulanow 769a0d7701 Pill: Add extra stdlib jars as dist libraries 2018-08-07 11:55:23 +03:00
Ilya Chernikov f71909ee73 Fix classpath calculation for scripts, e.g. in JSR-223 setting
#KT-25814 fixed
2018-08-01 13:09:05 +02:00
Lucas Smaira 49292cd26c Move model interfaces code from Java to Kotlin 2018-07-30 19:08:04 +03:00
Lucas Smaira 52990c9eb1 Set JAVA and ANDROID_HOME when fetching Gradle models
In BaseGradleIT
2018-07-30 19:08:04 +03:00
Lucas Smaira 8cb03fcdec Fix model tests in Windows
By comparing files instead of paths, avoiding problems with separator
'/' or '\'.
2018-07-30 19:08:04 +03:00
Lucas Smaira 5e515590cb Restrict methos in Tasks.kt to internal 2018-07-30 19:08:04 +03:00
Lucas Smaira 3588547d8c Remove *ImplTest for Kotlin Gradle Models
Equality should already be guaranteed by Kotlin data classes.
2018-07-30 19:08:04 +03:00
Lucas Smaira 3c88f761a6 Introduce tooling model for Android extensions plugin
Introduce Gradle models for plugins 'kotlin-android-extensions'.
2018-07-30 19:08:04 +03:00
Lucas Smaira 5a423e8dcd Introduce tooling model for annotation based projects
Introduce Gradle models for plugins 'kotlin-allopen', 'kotlin-noarg' and
'kotlin-sam-with-receiver'. Corresponding model builders are registered
in each one of those plugin main classes.
2018-07-30 19:08:04 +03:00
Lucas Smaira 5671dbb929 Introduce tooling model for Kapt gradle projects
A Kapt model for Gradle projects including 'kotlin-kapt'plugin is
introduced. Its model builder KaptModelBuilder produces an
implementation of these models and can be queried through the Gradle
Tooling API when needed. Model builder is registered in
Kapt3GradleSubplugin.
2018-07-30 19:08:04 +03:00
Lucas Smaira 9def6f020f Introduce tooling model for Kotlin gradle projects
A KotlinProject model for Gradle projects including Kotlin (JVM, JS or
common) plugins is introduced. Its model builder KotlinModelBuilder
produces an implementation of these models and can be queried through
the Gradle Tooling API when needed. Model builder is registered in the
corresponding Kotlin Gradle plugins.

Model definition should be published as a separate artifact in public
repositories so it can be consumed when needed.
2018-07-30 19:08:04 +03:00
Dmitry Petrov 6fb913a463 KT-22274 report error/warning on incorrect return target label 2018-07-25 12:08:20 +03:00
Yan Zhulanow 7803294546 PrePush hook (temporary): Do nothing on a download failure 2018-07-20 22:17:45 +03:00
Yan Zhulanow 314cc5c2f5 Add support for Android Studio 3.3 Canary 1 2018-07-19 19:09:40 +03:00
Yan Zhulanow 1eb69a6960 Kapt: Do not add JDK jars if the 'no-jdk' option is set (KT-25258) 2018-07-19 17:31:25 +03:00
Ilya Chernikov 70eaa0ec75 Cleanup annotations in script-util:
remove unused targets and runtime retention
2018-07-18 13:11:32 +02:00
Yan Zhulanow 02ee3aef3f Kapt: Fix "Unknown option: infoAsWarnings" (#KT-25396) 2018-07-17 20:54:28 +03:00
Yan Zhulanow f6afab1226 Minor: Remove an obsolete warning in Android subplugin 2018-07-12 20:36:41 +03:00
Yan Zhulanow 6e3c2e8015 Revert "Android Extensions: Allow to access library project resources in Gradle setup (#KT-22430)"
This reverts commit a70707b
2018-07-12 20:36:39 +03:00
Raluca Sauciuc e7c1f578d1 Recognize Instant Apps plugin
Tested with sample project and Studio 3.2 Canary 18:
https://github.com/googlesamples/android-instant-apps/tree/master/hello-kotlin

(cherry picked from commit 528d66d5840cc8f584270c516e85da1a632df8b8)
2018-07-12 20:36:39 +03:00
Yan Zhulanow 392460e426 Kapt: Allow to disable info->warning mapping in logger (#KT-24985) 2018-07-12 20:36:39 +03:00
Yan Zhulanow 8d9c53da92 Kapt: Allow to disable warning for 'annotationProcessor' dependencies (#KT-24883) 2018-07-12 20:36:38 +03:00
Alexey Tsvetkov 93e183c2e4 Test for KT-25051 2018-07-09 15:50:06 +03:00
Alexey Tsvetkov f735586819 Remove redundant test
`testMultiModuleICNonAndroidModuleIsChanged` already tested
android and non-android change
2018-07-09 15:50:05 +03:00