Commit Graph

6505 Commits

Author SHA1 Message Date
Yahor Berdnikau 2766dc938b Disabled compiler plugin tests on Windows.
Kotlin compiler is leaking file descriptor to plugin jar file.

^KT-38570 Fixed
2021-11-25 15:10:23 +01:00
Sergey Igushkin 844876a974 KT-49835: Exclude org.gradle.jvm.environment attribute from publishing
Not publishing this attribute fixes the consumers that don't set it.
Those may encounter either a conflict of Kotlin <= 1.5.31 rule on
{JVM, Android} -> Android vs Gradle rule
{standard-jvm, android} -> standard-jvm (causing disambiguation
failures). Or they may run Gradle < 7.0 which doesn't have
disambiguation rules for `org.gradle.jvm.environment` and therefore
treats it as an ordinary extra attribute, thus eventually preferring
variants which don't have it if no other disambiguation rule worked
(again causing disambiguation failures since some rules may prefer the
variants where this attribute *is* set).

Also set a "non-jvm" value of this attribute for non-JVM variants for
project-to-project dependencies in order to "align" them so that Gradle
doesn't prefer variants not marked with this attribute.

Extend the set of dependency resolution tests which check
compatibility of different kinds of Android & JVM consumers against
project and published library: add Kotlin 1.5.31 consumers, also check
consumption with different Gradle version than the one which did the
publication.

Issue #KT-49835
2021-11-25 13:10:27 +00:00
Yahor Berdnikau d253f9ba0e Add test to validate incremental changes in compiler plugin.
If compiler plugin was recompiled incrementally, other projects in the
same build should pick it up and regenerate sources.

^KT-38570 Fixed
2021-11-25 12:45:29 +01:00
Yahor Berdnikau d205c376a7 Move JavaUpToDateIT tests into 'JvmGradlePluginTests'.
^KT-45745 In Progress
2021-11-25 11:03:14 +01:00
Yahor Berdnikau b6c11b544e Move kapt tests into 'OtherGradlePluginTests'.
^KT-45745 In Progress
2021-11-25 10:57:23 +01:00
Igor Chevdar d3d21f072a [K/N][gradle] Added a test for KT-49248 2021-11-25 12:37:01 +05:00
Nikolay Krasko 7457d54360 Drop junit 3.8.1 dependency
junit:junit:3.8.1
  org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1
    org.apache.maven:maven-artifact-manager:2.2.0
      org.apache.maven:maven-project:2.2.0
        org.apache.maven.shared:maven-dependency-tree:2.1
          org.jetbrains.kotlin:jcabi-aether:1.0-dev-3
            :kotlin-script-util compileClasspath
2021-11-24 19:35:34 +03:00
Nikolay Krasko 317b0b4495 Update junit dependency 4.12 -> 4.13.2 in tests 2021-11-24 19:35:32 +03:00
Nikolay Krasko af8faadca5 Update internal project junit dependency 4.12 -> 4.13.2 2021-11-24 19:35:31 +03:00
Nikolay Krasko 58d7bd0baf Minor: clean up warnings in ScriptUtilIT 2021-11-24 19:35:24 +03:00
Nikolay Krasko af185ab870 Remove couple scripting tests commented for 2 years
There're similiar tests:
hello-resolve-junit-dynver.main.kts
hello-resolve-junit-dynver-error.main.kts
2021-11-24 19:35:23 +03:00
Yahor Berdnikau 9d686165fc Add test tag and task for KGP Android tests.
^KT-45747 In Progress
2021-11-24 17:20:24 +01:00
Yahor Berdnikau 2c7913627d Add test tag and task for KGP MPP tests.
^KT-45749 In Progress
2021-11-24 17:20:21 +01:00
Alexander Likhachev 4181429c7e [Gradle, JS] Add missing dependsOn on kotlinNpmCachesSetup task
It's already was not causing the build failure because of changes related to persisted yarn.lock but this fix is more reliable.
Also hidden `kotlinNpmCachesSetup` task by unsetting task group as it's not supposed to be executed directly and moreover direct execution makes no sense.
#KT-47215 Fixed
2021-11-24 14:49:28 +03:00
Igor Chevdar 8b859e6558 [gradle] Added option to customize class loaders map
This will be used in the K/N build for automatic cleaning of the daemon
2021-11-24 16:08:33 +05:00
Ilya Goncharov ffbf2ea1a5 [Gradle, JS] Remove redundant build.gradle modification in test 2021-11-23 18:48:33 +03:00
Ilya Goncharov 01deac5e5c [Gradle, JS]Run kotlinNodeJsSetup ad kotlinYarnSetup instead of assemble 2021-11-23 11:41:20 +00:00
Ilya Goncharov e32a1ca562 [Gradle, JS] Not resolve configuration with nodejs and yarn if it should not be downloaded 2021-11-23 11:41:19 +00:00
Viacheslav Kormushkin a695d9bf59 KT-49771 - podInstall task is not executed after adding a pod dependency to the shared module
#KT-49771
2021-11-22 13:19:03 +00:00
sebastian.sellmair d5a081bf03 [MPP] [Android] KotlinAndroidTarget: filter AgpVersionAttr attribute
Ensure that the attribute com.android.build.api.attributes.AgpVersionAttr
is not published when creating the android usage contexts.

^KT-49798 Verification Pending
2021-11-22 10:48:43 +00:00
sebastian.sellmair 95018a9de0 [MPP] [Android] implement testAndroidMultiplatformPublicationAGPCompatibility
This test publishes a Multiplatform/Android library locally with
a given AGP version (7.1-*+) and tests the compatibility with older
AGP consumer versions.

Two projects will be tested:

multiplatformAndroidConsumer:
kotlin("multiplatform") + android target depending on
the previous publication as 'commonMainImplementation' dependency

plainAndroidConsumer:
kotlin("android") depending on the previous publication
as 'implementation' dependency.

Both projects will test the 'assemble' umbrella task to ensure,
compatibility with the given publication.

^KT-49798 implicitly covered as well
2021-11-22 10:48:43 +00:00
sebastian.sellmair 8c5f980c16 [MPP] [Android] implement testKT49798AgpVersionAttrNotPublished
This test covers ^KT-49798 by publishing an Android library and
checking that 'AgpVersionAttr' is not mentioned in any .module files
of those publications.
2021-11-22 10:48:42 +00:00
sebastian.sellmair f864e19d95 [Android] Add Gradle integration tests for AGP 7.1
^KT-49798
2021-11-22 10:48:42 +00:00
Aleksei.Cherepanov 8e21e954ad Disable functionalTest source set for JPS build
Exclude functionalTest from :kotlin-gradle-plugin module for JPS build
2021-11-22 08:15:37 +00:00
Steven Schäfer 4b4ee78e5d kotlinx-metadata: Fix parsing of inlineClassUnderlyingType 2021-11-20 12:39:15 +01:00
Ilya Goncharov 7aef45d5cf [JS] Implement strategy with adapterTransformer on global object to mutate adapter of kotlin-test 2021-11-19 21:39:23 +00:00
Anton Bannykh b684c2f8d7 Revert "JS IR gradle plugin: don't run IC for the main module"
This reverts commit 525c5b886f.
2021-11-19 00:38:48 +03:00
Zac Sweers 7f5eb3f5ff Fix incorrect kapt classpath error message.
The correct value is `kapt.include.compile.classpath`

^KT-47002 Fixed
2021-11-18 16:43:45 +01:00
Ivan Gavrilovic 684273783f Kotlin Gradle Plugin - clean caches for in-process compilation
This is to prevent file handle leaks on Windows. This
commit disposes KotlinCoreEnvironment used during
in-process compilation.

^KT-49772 Fixed
2021-11-18 16:20:10 +01:00
Yahor Berdnikau 4c3404888a Set minimal supported Gradle version to 6.7.1.
^KT-49733 Fixed
2021-11-17 14:10:24 +00:00
Ilya Goncharov fb6eb414ad [Gradle, JS] Fix afterEvaluate not inside task configuration 2021-11-17 12:19:39 +03:00
sebastian.sellmair bec2f89a07 [Gradle, MPP] Fix 'getCommonizerTarget' for source sets participating in multiple compilations of the same konanTarget
The previous implementation would return a 'SharedCommonizerTarget'
containing just a single leaf target. This would trigger the commonizer.
The new implementation will correctly return just a single
LeafCommonizerTarget instead.

^KT-49735 Verification Pending
2021-11-16 23:07:47 +00:00
konstantin.tskhovrebov cb37424831 Update K/N to "1.6.20-dev-5356". 2021-11-16 23:10:10 +03:00
sebastian.sellmair 7d56ef1925 [Gradle, MPP] Implement kotlin.mpp.absentAndroidTarget.nowarn flag
^KT-41641 Verification Pending
2021-11-15 16:15:18 +00:00
sebastian.sellmair c56c503426 [Gradle] Implement 'Project.kotlinPropertiesProvider' extension
This extension should increase discoverability over the previous
'PropertiesProvider(project)' API
2021-11-15 16:15:17 +00:00
sebastian.sellmair 373dcef45d [Gradle, MPP] Mention multiplatform in absent android target warning
^KT-41641 Verification Pending
2021-11-15 16:15:17 +00:00
sebastian.sellmair bf04f821d6 [Gradle, MPP] Print warning on absent 'android' targets
^KT-41641 Verification Pending
2021-11-15 16:15:16 +00:00
sebastian.sellmair db21bfe13b [Gradle, MPP] findAndroidTarget: Return null when missing
Prior to this change a 'Collection is empty.' error was reported
when the Android plugin was applied without an Android Kotlin target
being registered.

^KT-41641 Verification Pending
2021-11-15 16:15:16 +00:00
Igor Chevdar 03d8a3927b [gradle] Made KotlinToolRunner public to use in K/N build 2021-11-15 12:42:24 +05:00
Andrey Uskov 9826984c4a Report flag use-fir in Gradle statistics
#KT-49633 Fixed
2021-11-12 18:13:41 +03:00
Andrey Uskov b5456539aa More stable reporting of compilation in statistics 2021-11-12 18:13:40 +03:00
Andrey Uskov 2fe337f58a Fixed flakiness of BuildSessionLoggerTest 2021-11-12 18:13:39 +03:00
Igor Chevdar b474b570a4 [K/N][gradle] Supported friend modules for two stage compilation
Fixes https://youtrack.jetbrains.com/issue/KT-49248
2021-11-12 17:40:26 +05:00
Ilya Goncharov 3ef5e36425 [Gradle, JS] Use formal check of klibs in gradle plugin 2021-11-11 10:25:53 +00:00
Yahor Berdnikau 18ff64a28f Move jvm toolchain tests under jvm platform test tag.
^KT-45745 In Progress
2021-11-11 10:46:35 +01:00
sebastian.sellmair 1a0e2ad074 [Gradle][MPP] Composite metadata jar: Use "$sourceSetName-cinterop" directory for cinterops
This convention seems to be more robust against clashes against user
specified source set names. We could potentially foresee users to
use "cinterop" as source set name, but the pattern
 $sourceSetName-cinterop seems robust enough.

^KT-49596 Verification Pending
2021-11-09 16:34:33 +00:00
sebastian.sellmair ea669ce076 [Gradle][MPP] Assert sourceSetCInteropMetadataDirectory on deserialized older metadata files
^KT-49596 Verification Pending
2021-11-09 16:34:33 +00:00
sebastian.sellmair bd8aa8ae3d [Gradle][MPP] Include cinterop metadata directory in kotlin-project-structure-metadata.json
- Also increase the KotlinProjectStructureMetadata's format
version to 0.3.2

- Move new default location into /cinterop/{sourceSetName}

^KT-49596 Verification Pending
2021-11-09 16:34:32 +00:00
Alexander Udalov f5dd0abb76 Render JVM default flags in kotlinp 2021-11-09 15:09:29 +01:00
Hung Nguyen bd7c2ae6d7 KT-45777: Snapshot Java classes using ASM analysis directly
This is faster than the current approach which creates
`JavaClassDescriptor`s, converts them to protos, and then snapshots
these protos.

- Refactor unit tests to faciliate further changes
- moves test data to a directory that matches the tests' package name
- moves expected snapshots to a separate directory
- adds public and private fields/properties to sample class
- Compute changes between ASM-based Java class snapshots
- Don't collect members of an added Java class as changes
as it's enough to report the name of the added Java class as changed (we
also do that for added Kotlin classes and Kotlin/Java removed classes).
- Add unit tests for impact analysis in advance
- Compute impacted symbols of changed symbols
Also do not collect added classes/class members as they don't impact
recompilation.
-Use ClassId when computing Java class changes
It is more precise than JvmClassName, which can be ambiguous around the
`$` character (e.g., ClassId "com/example/A$B.C" and "com/example/A.B$C"
both have the same JvmClassName "com/example/A$B$C").
- Compute impacted set of changed symbols across Kotlin and Java
- Add unit tests for impact analysis across Kotlin and Java
- Compute supertypes of Kotlin classes during snapshotting
- Handle inner classes when computing list of changed symbols.
For the reported symbols, always check all options:
class member, inner class, top level class, top level member.

Test: IncrementalJavaChangeClasspathSnapshotIT.testAddingInnerClass
2021-11-09 13:57:56 +03:00