Commit Graph

8379 Commits

Author SHA1 Message Date
Sebastian Sellmair afec974df2 [Gradle][Minor] Format GranularMetadataTransformation.kt
KT-49933
2023-01-20 20:15:30 +00:00
Sebastian Sellmair e498499858 [Gradle] Implement LazyResolvedConfigurationTest
KT-49933
2023-01-20 20:15:30 +00:00
Sebastian Sellmair 3162769b96 [Gradle] Simplify LazyResolvedConfiguration
By:
- Removing unused `moduleArtifacts` function
- Removing bad documentation (replaced by simpler function names)+
- Using .withClosure util function

KT-49933
2023-01-20 20:15:29 +00:00
Anton Lakotka 674e7aa480 [Gradle] Remove ResolvedMppVariantsProvider and all related code in KPM
Mark places where ResolvedMppVariantsProvide were used with TODOs

^KT-49933
2023-01-20 20:15:29 +00:00
Anton Lakotka 25dbfb10b8 [Gradle] Replace legacy ProjectMetadataProviderImpl with new version
New version relies on information about metadata compilation outputs of
common source sets. That is known before ProjectMetadataProvider
is created. This makes such implementation easier to use with
Configuration Cache, since getSourceSetCompiledMetadata doesn't use
Project.

^KT-49933
2023-01-20 20:15:29 +00:00
Anton Lakotka 44f2394d94 [Gradle] Mark properties that shouldn't be used in public API as internal
^KT-49933
2023-01-20 20:15:28 +00:00
Anton Lakotka a2276f9c21 [Gradle] Create separate hostSpecificMetadataConfiguration for Native
Previously this configuration was created on ad-hoc basis by copying
the compileDependenciesConfiguration. This creates bunch of copies
which are practically doing the same thing. Extracting it on
compilation level makes it more controllable and prevents any duplicates

^KT-49933
2023-01-20 20:15:28 +00:00
Anton Lakotka c03e0f96d2 [Gradle] Use ProjectLayout in KotlinMetadataLibraryDirectories
^KT-49933
2023-01-20 20:15:28 +00:00
Anton Lakotka 20a94b80be [Gradle] Add unit tests for mergeWith
^KT-49933
2023-01-20 20:15:27 +00:00
Anton Lakotka fbbd1d737a [Gradle] Transform only composite metadata artifacts
^KT-49933
2023-01-20 20:15:27 +00:00
Anton Lakotka 4210e13103 [Gradle] Remove duplication logic from metadata transformation task
^KT-49933
2023-01-20 20:15:27 +00:00
Anton Lakotka c392f87019 [Gradle] Update ResolvedDependencyResult.toModuleDependencyIdentifier
It should work as its counterpart:

```
ModuleIds.fromComponent(
    thisProject: Project,
    component: ResolvedComponentResult
)
```

^KT-49933
2023-01-20 20:15:26 +00:00
Anton Lakotka 5094ac945c [Gradle] Fix code review NITs
* rename parentVisibleSourceSetsProvider -> visibleSourceSetsFromParentsProvider
* use flatMap.toSet() instead flatMapTo(mutableSetOf())
* Use `extraProperties` instead of extensions
* KotlinMultiplatformExtension.metadat() instead of finding it by type
* rename PlatformCompilationData.sourceSets to allSourceSets for clarity
* Use FileCollection instead of Provider<Set<File>>
* Use System.lineSeparator() instead of `\n` for better platform support
* Report meaningful error when `participatingSourceSets` is accessed
  in execution state when Task state is loaded from Configuration Cache
* Mark newly added API as internal since there is no use of them in
  user's build scripts.

^KT-49933
2023-01-20 20:15:26 +00:00
Anton Lakotka 608760e32b [Gradle] Pass lambda directly to project.files instead of wrapping it
with project.provider(). This prevents from extra evaluation during task
execution. And makes tasks compatible with configuration cache
2023-01-20 20:15:26 +00:00
Anton Lakotka 1ba199761c [Gradle] Provide meaningful error message for toSingleKpmModuleIdentifier 2023-01-20 20:15:25 +00:00
Anton Lakotka 1d8fd0bd55 [Gradle] Update IdeResolveDependenciesTask to depend on...
...TRANSFORM_ALL_SOURCESETS_DEPENDENCIES_METADATA in an idiomatic way
2023-01-20 20:15:25 +00:00
Anton Lakotka 9ff9fa35ec [Gradle] Make CInterop[MDT]Task compatible with Configuration Cache
^KT-49933
2023-01-20 20:15:25 +00:00
Anton Lakotka 458e69f698 [Gradle] Evaluate commonizedOutputLibraries in a changing provider
Add `changing` provider for Configuration Cache compatibility.
This makes AbstractCInteropCommonizerTask be compatible
with Configuration Cache.

^KT-49933
2023-01-20 20:15:24 +00:00
Anton Lakotka 15f2179557 [Gradle] prepareKotlinIdeaImportTask should depend on transformation tasks
For cases when included build is use, we no longer consumer
kotlin project structure from Global storage but consume JAR files as
with regular external dependencies.

^KT-49933
2023-01-20 20:15:24 +00:00
Anton Lakotka d33c9d7912 [Gradle] resolveIdeDependencies should depend on transformation tasks
^KT-49933
2023-01-20 20:15:24 +00:00
Anton Lakotka 1777fc58e7 [Gradle] Use transformDependenciesMetadata task name directly
Using internal TRANSFORM_ALL_SOURCESETS_DEPENDENCIES_METADATA doesn't
work well with K2 compiler

^KT-49933
2023-01-20 20:15:23 +00:00
Anton Lakotka be3e3332d5 [Gradle] Don't create another transformation task for commonMain source set
when compatibility variant enabled. commonMain have to be compiled
at least two times. One time to klib and second time to legacy metadata.
In both cases it should have correct classpath.

^KT-49933
2023-01-20 20:15:23 +00:00
Anton Lakotka 007a2411cc [Gradle] Break cycles when iterating over all dependencies
Gradle DependencyResult can have cycles in its dependencies. So
keep track of visited dependencies.

^KT-49933
2023-01-20 20:15:23 +00:00
Anton Lakotka 32cb38e0d4 [Gradle] Disable KPM tests that is faling due to changes about GCC+HMPP
^KT-49933
2023-01-20 20:15:22 +00:00
Anton Lakotka b689c07b01 [Gradle] Fix tests after supporting GCC for HMPP
^KT-49933
2023-01-20 20:15:22 +00:00
Anton Lakotka 02e97dcbc1 [Gradle] Update ConfigurationCacheIT tests after supporting GCC for HMPP
^KT-49933
2023-01-20 20:15:22 +00:00
Anton Lakotka 1f895e5a36 [Gradle] Prettify result of ComponentIdentifier.uniqueKey for projects
^KT-49933
2023-01-20 20:15:21 +00:00
Anton Lakotka 357e14dc04 [Gradle] Add support Configuration Cache for MetadataDependencyTransformationTask
* Write transformedLibraries to a file after Task execution
* Write visible source sets to a file after Task execution
* Rearrange task properties, inputs outputs in the way that task state
  is serializable to configuration cache.
* Introduce transformDependenciesMetadata task to be an umbrella for
  other transform tasks. This will be convinient for tests and other
  development purposes

^KT-49933
2023-01-20 20:15:21 +00:00
Anton Lakotka 4941e8b7de [Gradle] Provide transformed libraries from transformation task itself
Remove `createMetadataDependencyTransformationClasspath` that were using
`ResolvedMetadataFilesProvider` which is no longer used by
GranularMetadataTransformation. The transformed files
can be requested directly from resolution results.

^KT-49933
2023-01-20 20:15:21 +00:00
Anton Lakotka 72f8c8399d [Gradle] Decouple GranularMetadataTransformation from Gradle Project
Introduce GranularMetadataTransformation.Params that can be serialized
to Configuration Cache, and it contains all required data for
Metadata Transformations.

^KT-49933
2023-01-20 20:15:20 +00:00
Anton Lakotka 84287557d7 [Gradle] Remove applyToConfiguration
After removing scoped metadata configurations
method GranularMetadataTransformation.applyToConfiguration is no longer
used.

^KT-49933
2023-01-20 20:15:20 +00:00
Anton Lakotka 7290947fe8 [Gradle] Add PreExtractedProjectMetadataProvider
It is decoupled from Gradle Project and can be stored in
Gradle Configuration cache safely.

^KT-49933
2023-01-20 20:15:20 +00:00
Anton Lakotka 84d7139a12 [Gradle] Add MppDependency[PSM]Factory
Since ProjectMppDependency[PMS]Extractor is decoupled
from Project it is possible to create MppDependency[PSM]Extractor just
from `ResolvedArtifactResult` using its ComponentIdentifier and file.

^KT-49933
2023-01-20 20:15:19 +00:00
Anton Lakotka ceefc4f1ee [Gradle] Decouple ProjectMppDependency[PSM]Extractor from Gradle Project
^KT-49933
2023-01-20 20:15:19 +00:00
Anton Lakotka 6b2111c2a5 [Gradle] Decouple SourceSetVisibilityProvider from Gradle Project
And related ResolvedMppVariantsProvider.

* Introduce PlatformCompilationData that is Configuration Cache friendly
  And contain all needed data to infer visible source sets
* Add factory-methods that can collect PlatformCompilationData from
  project that has Multiplatform Extension.
* hostSpecificMetadataConfiguration collection has parity with related
  ResolvedMppVariantsProvider.resolveArtifacts() part where attributes
  are changed to KOTLIN_METADATA.

ResolvedMppVariantsProvider will be deprecated and removed shortly

^KT-49933
2023-01-20 20:15:19 +00:00
Anton Lakotka 504ee1fbb1 [Gradle] Enhance LazyResolvedConfiguration API
* Add configurationName and provide `toString()` implementation for
  better debugging experience;
* Update `dependencyArtifacts` and `moduleArtifacts` API to work in the
  same way as original Gradle's counterparts
* Add helper extension functions `allResolvedDependencies`
  and `dependencyArtifactsOrNull` for better developer experience

^KT-49933
2023-01-20 20:15:18 +00:00
Anton Lakotka bf8ef74b37 [Gradle] Rename ResolvedDependencyGraph to LazyResolvedConfiguration
This give better understanding of the purpose of the class

^KT-49933
2023-01-20 20:15:18 +00:00
Anton Lakotka 396ed3642e [Gradle] Pass only parent's visible source sets instead of entire...
...GranularMetadataTransformation object

^KT-49933
2023-01-20 20:15:18 +00:00
Pavel Kirpichenkov 3b9aac067a Mark API for direct access to declared project properties with opt-in
KT-55891
2023-01-20 17:42:52 +00:00
Pavel Kirpichenkov 26e160d4ce [MPP] Add a flag to disable warnings about deprecated HMPP properties
KT-55891
2023-01-20 17:42:52 +00:00
Pavel Kirpichenkov ec5f56584c [MPP] Report deprecation warnings for HMPP-related Gradle properties
KT-55891
2023-01-20 17:42:51 +00:00
Ilya Goncharov 4e13b7a202 [Gradle, JS] Add nullable custom fields
^KT-42395 fixed
2023-01-20 17:40:05 +00:00
Yahor Berdnikau a90664574c Fix jvm target validation does not work for MPP JVM withJava target
Related KotlinCompile to JavaCompile wiring is happening on
KotlinJvmTarget initialization before 'withJava' configuration runs. At
that point linked JavaCompile task is null. Fix delays wiring to
execution phase when such task should be available.

^KT-55119 Fixed
2023-01-20 13:13:58 +00:00
Yahor Berdnikau c65b689fa0 Provide approximate stacktrace to freeCompilerArgs modification
Will help users to understand where exactly 'kotlinOptions
.freeCompilerArgs' were modified on execution phase.

^KT-55544 Fixed
2023-01-20 10:01:04 +00:00
Ilya Goncharov f4cda71d9e [Gradle, JS] Add possibility to not add js compiler attribute on publish 2023-01-19 22:11:01 +00:00
Ilya Goncharov 843805d771 [Gradle, JS] Update detecting of platform and architecture
[Gradle, JS] Make hash codes compatible with previous kotlin

^KT-38015 fixed
^KT-48631 fixed
^KT-43305 fixed
2023-01-19 10:23:09 +00:00
Ilmir Usmanov d18672bfb1 Wrap continuation with ContinuationImpl on callable references
in startCoroutineUninterceptedOrReturn. Otherwise, the coroutine will
not be interceptable later.

Add a test, which checks, that intercepted continuation is released.

 #KT-55869
2023-01-19 00:35:36 +00:00
Alexander.Likhachev da24e5559b [Gradle] Mention related tickets in BuildServiceDeclarationIT
#KT-55563
#KT-55740
2023-01-18 15:29:10 +00:00
Alexander.Likhachev 278229d2fa [Gradle] Inverse usesService declaration
KT-52149 Fixed
2023-01-18 15:29:10 +00:00
Alexander.Likhachev 36a6809d55 [Gradle] Declare build services usages for the Kotlin/JS plugin
#KT-52149 In Progress
2023-01-18 15:29:09 +00:00