Commit Graph

3058 Commits

Author SHA1 Message Date
Yahor Berdnikau de8d4e9e3c Fix reflection call is not working on older Gradle versions.
It happens, older Gradle versions has two functions with the same name,
but different parameters.
2021-09-30 18:55:42 +02:00
Hung Nguyen b5f74ef9a6 KT-45777: Add tests for top-level functions
Address review + Minor changes
Fix error when building with -Pbootstrap.local=true
Fix tests failing on Windows due to '/' character
2021-09-30 17:57:47 +03:00
Hung Nguyen e26dc4d574 KT-45777: Compute classpath changes based on changed snapshots only
to avoid unnecessarily loading unchanged ones.

Duplicate classes will make this a bit tricky. This commit outlines the
algorithm to handle them, the full implementation will follow later.

Also handle removed classes when computing classpath changes.

Test: New tests in ClasspathChangesComputerTest
2021-09-30 17:57:47 +03:00
Denis.Zharkov 7c3383bb39 Fix warnings after KT-48899
All API ToolingModelBuilder is marked as NonNullApi
https://github.com/gradle/gradle/commit/f93bf949486e73655810ab49ad316100b1c2804c#diff-76e89b92025ccef4e2763c5ee8d30bde939c4a9db26bfc913eac88069cbf5d36
2021-09-30 14:36:27 +03:00
Ilya Gorbunov 47adc4fdaa Prolong -no-stdlib option lifetime and regenerate Gradle compilation options
-no-stdlib may still be required internally for kotlin gradle plugin
to launch the compiler with the correct options.
2021-09-29 21:46:52 +03:00
Alexander Likhachev c6e1e4fd8e [Gradle] Make compileOnly/compile/runtime configurations not resolvable
#KT-48245 Fixed
2021-09-29 16:34:10 +00:00
Yahor Berdnikau 60cbfbf107 Change KotlinGradleSubplugin deprecation level to ERROR.
^KT-48830 Fixed
2021-09-29 12:13:02 +00:00
Svyatoslav Kuzmich 841f5a583e [Wasm] Support wasm target in multiplatform plugin 2021-09-28 18:26:07 +03:00
sebastian.sellmair 4eaabe54ee [Gradle] Finalize naming of 'runProjectConfigurationHealthCheckWhenEvaluated' API
^KT-48823
2021-09-28 12:11:10 +00:00
sebastian.sellmair 5430b19262 [Gradle] Add 'gradleKotlinDsl' dependency to 'functionalTestImplementation'
^KT-48823
2021-09-28 12:11:10 +00:00
sebastian.sellmair 29fb74d27d [Gradle] Don't run post-evaluation-checks on projects that failed to configure
When in 'lenient' or 'classpath' mode, Gradle will catch exceptions
during project evaluation and collect them into the
'ClassPathModeExceptionCollector'.

Running checks on the project after evaluation should only happen
if the project is properly configured (aka no such exceptions collected)
to prevent false positive error reports (that will then fail
the Gradle process and swallow the real cause)

^KT-48823 Verification Pending
2021-09-28 12:11:09 +00:00
Yahor Berdnikau e4827efb4a Remove WorkersIT test.
Now all compilations are using workers and issues should be covered
by other tests.

^KT-46406 Fixed
2021-09-28 11:41:09 +00:00
Yahor Berdnikau 3dc69495f9 Restore tasks outputs to pre-execution state in worker.
Workers usually execute later than task action and does not raise
exception to the task. Such behaviour skips task outputs restoration to
the pre-execution state.

Kotlin compiler on incremental compilation error leaves 'dirty*' files
in the build output, forcing Gradle to run non-incrementally on the
next build. Fixed it by moving task outputs reset logic into worker as
well.

^KT-46406 In Progress
2021-09-28 11:41:09 +00:00
Yahor Berdnikau 904f9c72f2 Remove 'kotlin.parallel.tasks.in.project' property.
^KT-46406 In Progress
2021-09-28 11:41:08 +00:00
Vyacheslav Karpukhin 5530080a7d KMA-271 Android dependencies are not imported with AGP 7 2021-09-28 10:51:28 +00:00
Dmitriy Novozhilov 4f7103b2a1 Add ApiVersion for 1.7 2021-09-28 10:16:51 +03:00
Yahor Berdnikau ac164c2bff Fix 'verbose' argument was not excluded from task inputs.
^KT-48134 Fixed
2021-09-27 13:48:12 +00:00
Ilya Matveev cbe5dc40ef [Gradle] Improve UP-TO-DATE checks for K/N binary options 2021-09-27 11:53:11 +00:00
Ilya Matveev 6ad9af972e [Gradle] Move K/N binary options retrieving to PropertiesProvider 2021-09-27 11:53:11 +00:00
sebastian.sellmair 7f67ce96a0 [Gradle, MPP] CInteropProcess: Relax up-to-date condition to "outputFile.exists"
^KT-48882 Verification Pending
2021-09-27 11:17:20 +00:00
sebastian.sellmair dcd19f41b9 [Gradle, MPP] Only warn on failed cinterop generation during idea sync
^KT-48882 Verification Pending
2021-09-27 11:17:20 +00:00
Yahor Berdnikau 8b594e295c Don't validate JVM target on empty Java sources.
When toolchain is not configured, Kotlin sets by default JVM target to
"1.8". Compiling Kotlin project on JDK 9+ produces JVM target mismatch
warning even if Java sources are empty.

Skip the jvm validation check if associated Java task sources are empty.

^KT-48745 Fixed
2021-09-27 08:31:00 +00:00
Sergey Bogolepov 708931b404 [K/N][Gradle] Use build service to read konan.properties
Also pass additionalCacheFlags when compiling compiler caches.
2021-09-27 11:21:25 +03:00
Vyacheslav Gerasimov 8b5db6473b Fix deprecated ConfigureUtil usages in KGP
Required for Gradle 7+ #KTI-559
2021-09-26 23:36:40 +03:00
Yahor Berdnikau c1ba586c96 Replace removed Gradle methods with reflection call.
This is required to update Kotlin repo to Gradle 7.1.
2021-09-26 23:36:40 +03:00
Vyacheslav Gerasimov f91d6958a8 Build: Rework runtimeJar helper and drop redundant configuration
#KTI-559
2021-09-26 20:10:29 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
sebastian.sellmair c51d37d65d [Gradle] [MPP] CInteropPropagatedDependencies: Consider associate compilations
^KT-48856 Verification Pending
2021-09-24 13:13:01 +00:00
sebastian.sellmair 440856f593 [Gradle] [MPP] Add TODO comment for post-commit review ^KT-48885
^KT-46273
2021-09-23 18:48:52 +00:00
sebastian.sellmair 70fde9700f [Gradle] [MPP] Add further explicit check for orphan source sets
^KT-46273 Verification Pending
2021-09-23 18:48:52 +00:00
sebastian.sellmair da361a030e [Gradle] [MPP] Fix 'getDependenciesTransformation' for ^KT-46273
This setup requires a 'jvm like' target and an orphan source set, which
depends on 'commonTest'. This orphan will not participate in any
compilation and therefore will not have any platform.

The code expected at least one test task for this source set
and therefore at least one test framework.

^KT-46273 Verification Pending
2021-09-23 18:48:51 +00:00
Hung Nguyen aea693e309 KT-45777: Ignore faulty groovy-2.5.11 jar
Test: The following should pass
    - Step 1: ./gradlew publish
    - Step 2: ./gradlew publish compileTestKotlin -Pbootstrap.local=true
        -Pbootstrap.local.path=/path/to/kotlin/build/repo
        -Pkotlin.incremental.useClasspathSnapshot=true
2021-09-23 12:51:06 +03:00
Hung Nguyen a6d0fcc676 KT-45777: Support compile avoidance
Test: Updated existing incremental compilation integration tests
2021-09-23 12:51:03 +03:00
Hung Nguyen f400305cc6 KT-45777: Handle problematic classes when taking snapshots
There are certain classes that we are not yet able to take snapshots of,
either because the class is faulty, or there is a bug in our code.

For these classes, we will use a special snapshot and fall back to the
existing approach to compute classpath changes.

In the short run, we will update this list of cases as they arise. In
the long run, we will:
  - Fix all cases that are caused by bugs in our code.
  - Decide what to with the faulty jars in general and remove the list.

Test: The following should pass
  - Step 1: ./gradlew publish
  - Step 2: ./gradlew publish -Pbootstrap.local=true
              -Pbootstrap.local.path=/path/to/kotlin/build/repo
              -Pkotlin.incremental.useClasspathSnapshot=true
2021-09-23 12:47:51 +03:00
Alexander Likhachev aa52a60f45 [Gradle, JVM] Validate JVM targets even if compiler isn't called
Previously the validation was inconsistent allowing non-incremental builds without Kotlin sources to pass successfully with JVM target misconfiguraiton but fail incremental builds
#KT-48408 Fixed
2021-09-16 13:26:13 +00:00
Yahor Berdnikau 03db8e9c43 Fix 'kotlinOptions.jdkHome' deprecation message typo.
Use proper DSL example how-to set toolchain.

^KT-48768 Fixed
2021-09-16 11:51:32 +02:00
nataliya.valtman 130fd8311e KT-48620: add readable output size metric into build scan 2021-09-14 17:56:11 +03:00
nataliya.valtman b603f99863 KT-48620: Fix host name exception 2021-09-14 12:10:39 +03:00
Hung Nguyen 97e9e4efe7 KT-45777: Address review comments - use InputChanges instead of ChangedFiles 2021-09-14 12:10:39 +03:00
Hung Nguyen a48bf63630 KT-45777: Compute classpath changes for incremental Kotlin compile
Test: Updated unit tests + incremental compilation integration tests
2021-09-14 12:10:38 +03:00
sebastian.sellmair 1076654bd9 [Gradle] Shared Native compilations: Don't explicitly add stdlib dependency
Shared Native Compilations seem to already implicitly add a
dependency on the stdlib. Adding it again will result in a
'library included more than once' warning.

^KT-46257 Verification Pending
2021-09-07 14:17:40 +00:00
Ilya Goncharov ee1d2ecb4b [Gradle, JS] Delete recursively tmp directory in up-to-date case 2021-09-03 14:10:58 +03:00
Dmitriy Novozhilov d46e2dd749 Fix OVERRIDE_DEPRECATION warnings in project code 2021-09-02 15:04:07 +03:00
nataliya.valtman 862f8cdad8 KT-48264 Create dir before kotlin-build-report publish 2021-09-02 13:49:57 +03:00
sebastian.sellmair 97d71dc160 [Gradle] Ensure enableGranularSourceSetsMetadata property being populated
Previously it was only populated when KGP was applied to the root project.
CLI compilation would still work, since it also checks for the
new hmpp properties, whereas the IDE import is still 'just' checking
on the old property (while defining its own defaults)

^KT-48513 Verification Pending
2021-09-02 09:27:49 +00:00
Sergey Bogolepov 9620279201 [K/N] Fix KT-48552 2021-09-02 06:34:39 +00:00
Sergey Igushkin 8b37b5f259 Fix localToProject=public not set for K/N configurations, KT-48370 2021-09-01 14:44:33 +00:00
Svyatoslav Scherbina 751914ca4d [Gradle, Native] Make useEmbeddableCompilerJar input of compile tasks
to make the tasks not up-to-date when switching the flag
2021-09-01 13:43:29 +00:00
Svyatoslav Scherbina e65f2e465e [Gradle] Fix switching in-process to Native embeddable compiler jar
Compiler runner used incorrect cache key for isolated classloader:
it didn't take the actually used compiler jar into account,
only the K/N home dir.

Fix this by using the entire classpath as a key.
2021-09-01 13:43:28 +00:00
Svyatoslav Scherbina 1c052ad448 [Gradle, Native] When running tool in-process, log the actual classpath
When running tool in-process, log the actual classpath extracted from
the classloader, not the one that was intended.
This helps to detect the cases when these two don't match.
2021-09-01 13:43:28 +00:00