Commit Graph

49343 Commits

Author SHA1 Message Date
Ilya Matveev da1fcb008b Fix -Xcommon-sources in native args 2018-09-26 15:49:47 +03:00
Mikhail Glukhikh a97f2bb992 Introduce MPP wizard for mobile (Android / iOS) applications
This mobile wizard already contains skeleton
Finally #KT-25952 Fixed
Also #KT-26786 Fixed
2018-09-26 15:41:24 +03:00
Pavel V. Talanov a258908fbb Create ModuleInfos for newmpp modules with missing roots accurately
#KT-27010 Fixed
 #KT-27133 Fixed
2018-09-26 13:46:45 +02:00
Pavel V. Talanov cc1be5f559 Introduce SourceType and use KotlinFacetSettings.isTestModule
Refactor dealing with production/test roots
Remove ad-hoc code in KotlinMultiplatformRunLocationsProvider
2018-09-26 13:46:45 +02:00
Nikolay Krasko 1be491504a Fix formatting for when with subjects (KT-27027)
#KT-27027 Fixed
2018-09-26 13:35:36 +03:00
Nikolay Krasko 0833f23d02 Make ReplaceWith work for objects (KT-16211, KT-14929)
#KT-16211 Fixed
2018-09-26 13:35:35 +03:00
Nikolay Krasko 18c181641f Return updated element after reference shortening
Fresh new expression obtained after qualified expression binding is
invalidated after shortening.
2018-09-26 13:35:34 +03:00
Sergey Igushkin c4283de9cb Mark deprecated Gradle configurations with the Kotlin platform attribute
The traditional Gradle/Java model assumes several configurations, which
are now deprecated, which are both `canBeConsumed = true` and
`canBeResolved = true`.

* compile, testCompile, etc.
* runtime, testRuntime, etc.
* default

These configurations need to somehow resolve correctly to an appropriate
platform-specific artifact when they contain an MPP library or project
dependency.

However, simply marking them with the Kotlin platform type attribute
would put these configurations under considerations during Gradle
variant aware depdendency resolution of project dependencies, which
in order would lead to ambiguity (e.g. `compile` vs `runtime` vs
`testCompile` vs ... vs `apiElements`).

To deprioritize these configurations during dependency resolution, we
mark them with a special attribute with a unique value in each project.
Given that the values are different in different projects, Gradle will
not choose a configuration marked by this attribute.

But we still need 'project(path: '...', configuration: '...')`
dependencies to work, and so, instead of rejecting those different
values of the attribute, we say that all values are compatible, but
when an ambiguity arises, choose the configurations not marked by this
attribute, so effectively eliminating them from resolution.

Issue #KT-27111 Fixed
2018-09-26 13:02:32 +03:00
Sergey Igushkin 3f24f8bd8d (minor) Transform KotlinPlatformType attribute to String, rename entries
* To avoid unexpected effects from the Gradle instantiation mechanisms
  for attribute values, use a safer String attribute type for the
  KotlinPlatformType attribute

* Rename its entries to keep enum entries naming consistent
2018-09-26 13:02:32 +03:00
Sergey Igushkin 65e3559c09 Fix resources processing configuration
* Add resources processing to the K/N compilations

* Use a proper resources output path (composed from target + compilation
  rather than just compilation name)

* Fix incorrect reassignment of the resources directory
2018-09-26 13:02:32 +03:00
Sergey Igushkin fef61eca51 Add tests for variant-aware dependency resolution between projects 2018-09-26 13:02:32 +03:00
Sergey Igushkin 81ae54c05b Show warnings for disabled targets on current host
Issue #KT-26647 Fixed
2018-09-26 13:02:32 +03:00
Sergey Igushkin 4f650bb056 Add an experimental feature warnings on MPP usage & metadata publishing
Issue #KT-25200 Fixed
2018-09-26 13:02:31 +03:00
Sergey Igushkin 54988932a3 Ensure that kapt configurations are not exposed for consumption 2018-09-26 13:02:31 +03:00
Sergey Igushkin 7c05f77cb7 Add tools for testing dependencies resolution by resolving all configs 2018-09-26 13:02:31 +03:00
Sergey Igushkin c3dd24e9b2 Rewrite project dependencies when publishing a multimodule MPP
When a new MPP is published without Gradle metadata, the project
dependencies should be replaced with specific module dependencies,
e.g. `sample-lib` with `sample-lib-jvm`, because a consumer won't be
able to resolve `sample-lib` in a variant-aware way.
2018-09-26 13:02:31 +03:00
Sergey Igushkin 05301e37d8 Fallback for publishing with no Gradle metadata
The following parts of the publications are affected:

* root publication
  * with Gradle metadata, it is published and references the
    other publications using the `available-at` mechanism
  * without metadata opt-in, it is not published

* Kotlin metadata variant
  * with Gradle metadata, it is added as an additional variant to the
    platform-specific publications to allow the IDE to discover it
  * without metadata opt-in, it is added as a dependency to the platform-
    specific modules (like in old MPP)
2018-09-26 13:02:31 +03:00
Sergey Igushkin b388f7fde0 Introduce Kotlin variants with metadata variant and metadata dependency
These two will be needed when we publish a platform-specific part of a
MPP library in order to help the consumers of that single module
(rather than the whole MPP library) find the Kotlin metadata.

`KotlinVariantWithMetadataVariant` will be used for publishing with
Gradle metadata enabled, `KotlinVariantWithMetadataDependency` for
publishing without Gradle metadata, instead adding the Kotlin metadata
as a dependency, just like we did in old MPP.
2018-09-26 13:02:31 +03:00
Sergey Igushkin 1abcfc76df Add Kotlin-specific Usage attribute values
When a non-Kotlin (JVM) project resolves an MPP library dependency,
it expects only one variant per Java Usage value ('java-api',
'java-runtime-jars'). If there's more than one, it will report
ambiguity and fail.

So we need to avoid creating non-JVM variants with Java Usage values
to ensure that non-Kotlin consumers can resolve the dependencies on
an MPP library with a single JVM target (if there's more than one
JVM target, there will still be ambiguity, but that's quite what one
would expect and what can be solved with custom attributes).

Instead, we define two Kotlin-specific Usage values, 'kotlin-api' and
'kotlin-runtime', so that:

* input configurations with these Usage values can consume plain Java
  artifacts, for compatibility with plain old Kotlin modules

* if a consumer does not request a Kotlin usage and receives the two,
  let it use the runtime one as it is more complete

We then use the two Usage values on those Kotlin input and output
configurations which are not JVM-related, and leave the Java Usages
for the JVM targets.
2018-09-26 13:02:31 +03:00
Sergey Igushkin 76b51b1058 Allow the common platform type consumers to consume platform artifacts
When a Kotlin metadata input configuration tries to resolve a module
with no Kotlin metadata (such as: plain old Maven module, a non-MPP
Kotlin project with a single platform), it should be able to resolve
successfully.

Given that the input metadata configurations extend from source set
dependencies configurations, where platform-specific dependencies may
occur, allowing the metadata configuration to resolve such dependencies
into platform artifacts seems to achieve successful dependency
resolution.

Issue #KT-26834 Fixed
2018-09-26 13:02:31 +03:00
Sergey Igushkin 269410d7aa Build source sets hierarchy in Android projects
Instead of simply adding all Kotlin source sets participating in an
Android compilation, as was appropriate until we introduced the
dependsOn relation, we should now build a proper source sets hierarchy.
2018-09-26 13:02:30 +03:00
Ilya Chernikov 43a4b84b44 Make script resolving annotations repeatable, fix multiple repos usage
Also avoid "unknown resolver central" errors on ivy resolving
#KT-27050 fixed
2018-09-26 11:49:45 +02:00
Mikhail Zarechenskiy 0d103e7f0c Allow using extensions with trivial-constraints in builder-inference
#KT-27079 Fixed
2018-09-26 11:52:23 +03:00
Mikhail Zarechenskiy 0da1b9b80f Revert "Migration change: temporarily specify type explicitly"
This reverts commit bc6e091004.

 This commit was needed to avoid bootstraping, now we can revert it
2018-09-26 11:51:57 +03:00
Mikhail Zarechenskiy 7c1d374ed5 Fix diagnostic tests about coroutine-inference 2018-09-26 11:51:55 +03:00
Alexander Podkhalyuzin 3142627269 Removed extra spaces in new MPP project template
#KT-26952  Fixed
2018-09-26 10:21:10 +03:00
Toshiaki Kameyama c1013cc198 "Convert to secondary constructor": Fix false positive with delegation #KT-27061 Fixed 2018-09-26 09:31:12 +03:00
Yuki Miida af1fc5b668 Add sample for orEmpty method 2018-09-26 05:54:40 +03:00
Mikhail Glukhikh 64b23812c0 Move CliArgumentStringBuilder: cli -> idea-jvm 2018-09-25 19:14:12 +03:00
Mikhail Glukhikh 1f4d91da1c Has actual marker: distinguish Android and JVM modules #KT-25055 Fixed 2018-09-25 19:11:30 +03:00
Dmitry Petrov fd57a43665 Update testData for ClassFileToSourceStubConverterTestGenerated 2018-09-25 17:25:02 +03:00
Simon Ogorodnik 189fe95d8a Fix type-aliases by expansion search loop
Compare type-aliases by it's fqNames instead of identity, as
multiple runs of resolveToDescriptorIfAny produces different descriptors
for one declaration
2018-09-25 16:40:03 +03:00
Nikolay Krasko 1ff12d00e4 Allow return value hint for lambda expressions (KT-26689)
#KT-26689 Fixed
2018-09-25 15:52:22 +03:00
Nikolay Krasko 07e305e5f4 Update dictionary: +infos, -kompiler 2018-09-25 15:52:21 +03:00
Nikolay Krasko 80c3e59dd5 Minor: cleanup testUtils.kt 2018-09-25 15:52:19 +03:00
Nikolay Krasko e1f746f23c Resolve "key is not found in bundle" exception from tests in AS
Android Studio idea.jar is taken from clion projects and has
IdeSpecificFeatures.xml and ProductivityFeaturesRegistry.xml files that
mention function that have to be found in ProductivityFeaturesRegistry.

Unfortunately, correspondent CLion bundle is not registered in tests, and
this causes a lot of tests fail.
2018-09-25 15:52:18 +03:00
Ilya Chernikov 127451e1d9 Add kotlin-main-kts.jar to the dist 2018-09-25 14:13:28 +02:00
Alexey Sedunov 22c77ffbb2 MPP: Do not populate content roots in the absence of ExternalProject
#KT-26900 Fixed
2018-09-25 15:05:46 +03:00
Alexey Sedunov 4f01a438c4 MPP: Add all android-targeted compilation source roots to the module 2018-09-25 15:05:43 +03:00
Alexey Sedunov 3a973973ce MPP: Create android source roots automatically when requested
#KT-26764 Fixed
2018-09-25 14:54:27 +03:00
Alexey Sedunov 391e4c2ad1 Configuration: Fix JVM target detection in the absence of Kotlin facet
#KT-27021 Fixed
2018-09-25 14:54:26 +03:00
Alexey Sedunov bd3adbd457 MPP: Reset JDK for JVM modules
#KT-26937 Fixed
2018-09-25 14:54:26 +03:00
Alexey Sedunov 6d4f927f7e Configuraion: Defer initialization of facets UI
#KT-25410 Fixed
2018-09-25 14:54:25 +03:00
Dmitriy Dolovov 5e33860652 [K/N] Stand-alone Native Application wizard in IDEA
Issue #KT-27076 Fixed
2018-09-25 17:24:59 +07:00
Dmitriy Dolovov 8e455f5a14 Merge pull request #1893 from JetBrains/rr/ddol/KT-27072
[K/N] Friendly displaying of Kotlin/Native default libraries in IDEA
2018-09-25 16:03:28 +07:00
Toshiaki Kameyama 7d89205618 Add "Remove inline modifier" quick fix for NOTHING_TO_INLINE #KT-5187 Fixed 2018-09-25 11:48:20 +03:00
Toshiaki Kameyama 65f23f3c4e Fix false positive in class literal #KT-16338 Fixed 2018-09-25 11:27:27 +03:00
Toshiaki Kameyama 6cd13341ee Add inspection for unlabeled return inside lambda #KT-26511 Fixed 2018-09-25 11:24:56 +03:00
Dmitry Petrov ba32ed7404 Test: @JvmField in inline class companion 2018-09-25 11:15:29 +03:00
Dmitry Petrov bffe9e45e8 Add accessor tests: inline class <-> companion
KT-26858 was fixed somewhere in the middle.

 #KT26858
2018-09-25 11:15:29 +03:00