Commit Graph

54 Commits

Author SHA1 Message Date
Pavel Punegov cdb6a06e49 [K/N][test] Move ZipTest to compiler/util-io tests
This is the last test in the Klib and was run separately.
Instead, it should be located with 'kotlin-util-io' project which it tests


Merge-request: KT-MR-13978
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2024-01-23 11:01:58 +00:00
Dmitriy Dolovov e92017f64e [KLIB Resolver] Deprecate Logger.fatal()
Invocation of Logger.fatal() may cause severe side effects such as
throwing an exception or even terminating the current JVM process
(check various implementations of this function for details).

The code that uses Logger.fatal() sometimes expects a particular kind
of side effect. This is totally a design flaw. And it's definitely not
a responsibility of Logger to influence the execution flow of
the program.
2024-01-08 13:26:24 +00:00
Dmitriy Dolovov 46081f968d [KLIB Resolver] Report KLIB resolver issues as compiler messages
The reason of this change is to make messages (especially warnings)
that are reported by the KLIB resolver become visible to the end user.
This can be achieved to forwarding such messages to the appropriate
compiler's components such as
`org.jetbrains.kotlin.cli.common.messages.MessageCollector` and
`org.jetbrains.kotlin.ir.util.IrMessageLogger`.

Also: The default `DummyLogger` should be used as minimal as possible.
Because it just forwards messages to the standard output (console)
where they can remain unattended. When the compiler is executed
from the Gradle plugin such messages appear only in DEBUG Gradle's log.

^KT-63573
2023-12-18 13:03:40 +00:00
Dmitriy Dolovov e7b8f3ecde [Native] Deprecate KLIB repositories in Kotlin/Native compiler
1. Log warnings on usage of KLIB repositories.
2. Don't block using repositories for now.

^KT-61098
2023-11-15 19:38:24 +00:00
Dave MacLachlan 722ddc9f91 Use fileKey instead of canonicalPath when deduping files
`resolveDependencies` showed up as a hotspot when profiling due to `canonicalPath` doing a lot of file system calls.
`fileKey` is more efficient and should guarantee uniqueness (`canonicalPath` may fail in the case of hardlinks).
The new code is 3x faster in our use case.
2023-11-01 13:59:13 +00:00
Alexander.Likhachev 357d12fc8e [Build] Move JUnit dependencies into the version catalog
The `kotlin-test` dependencies are left untouched as changing them affects publications, thus these versions are independent from the used inside our build
#KTI-1349 In Progress
2023-09-06 22:47:33 +00:00
Mark Mann 8a31e2ed82 [IR] Optimize a few hot spots to reduce total CPU time
^KT-61121
2023-08-10 09:57:06 +00:00
Alexander.Likhachev 44d9a2136b Bump language version for Gradle plugins' dependencies to 1.5
#KT-58569 Fixed
2023-05-12 12:59:39 +00:00
Pavel Kunyavskiy fa1b22cf31 [K/N] Make klib manifest saving platform-independent
^KT-57126
2023-05-03 12:12:58 +00:00
Nataliya.Valtman 2a391f7330 Move kotlin-build-statistic project to :compiler 2023-04-25 11:29:09 +00:00
nataliya.valtman e34dd043da Add minimal statistic report for JPS build
Fix build stat for gradle 8

#KT-56438 Fixed
2023-04-25 11:29:09 +00:00
Alexander Korepanov 8f22d6d36e [KLIB] Add a cacheable ZIP file system accessor
Creating a ZipFileSystem object is an expensive operation.
 A cacheable ZIP file system accessor caches ZipFileSystem
 objects and may improve the performance of the in place
 metadata reading operations from klibs.

Related to KT-51712
2023-03-10 09:38:52 +00:00
Alexander Korepanov e4406638bd [KLIB] Add ZIP file system accessor
The accessor interface is used for reading klib archives in place.
2023-03-10 09:38:51 +00:00
Pavel Punegov c9aeadd31f [K/N] Remove old Compiler and Meta Version ^KT-55677 Fixed
* Replace it with KotlinCompilerVersion
* K/N version should be set now with `deployVersion`.
* Cleanup deprecated functions in older versions
 of the Gradle plugin
* Cleanup tests for older versions of compiler downloader

Merge-request: KT-MR-8436
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-01-30 13:10:08 +00:00
Sergej Jaskiewicz a66950b629 [klib] Finish refactoring of ZipUtil 2023-01-05 10:13:38 +00:00
Sergej Jaskiewicz d50c072af0 [klib] Validate paths when unpacking zip archives 2022-11-29 12:21:04 +00:00
Igor Chevdar b82554dea1 [utils][K/N] Added some util functions to File 2022-08-04 14:12:05 +00:00
Pavel Punegov 3d17d476e0 [K/N][build] Define meta versions order and comparing
Move isAtLeast() from compiler downloader and test
to CompilerVersion.kt
2022-04-08 14:42:08 +03:00
Pavel Punegov 4644562e7f [K/N][build] Change MetaVersion to inline class from enum
Support meta versions strings other than pre-defined. All enum entries
were left for source-level compatibility.
2022-04-08 14:42:08 +03:00
Pavel Punegov 4d388118f8 [K/N][build] Fix CompilerVersion pattern to match RC2 2022-04-08 14:42:07 +03:00
Vyacheslav Gerasimov bc2f0936bd Build: Rename commonDep -> commonDependency 2021-12-16 21:48:19 +03:00
Dmitriy Novozhilov d46e2dd749 Fix OVERRIDE_DEPRECATION warnings in project code 2021-09-02 15:04:07 +03:00
Dmitriy Dolovov c1fb40a436 [IR] Enhance error reporting for IR linking issues
^KT-44626

Typical use case:
- There are two KLIB libraries: A and B.
- Library A has two versions: A.v1 (older) and A.v2 (newer).
- A.v2 is ABI-incompatible with A.v1.
- B depends on A and was compiled against A.v1.
- An attempt to build the application with A.v2 and B fails with weird error message. It's unclear for end user what's wrong and what needs to be done to fix the issue.

The fix improves error reporting for the following particular cases:
- A symbol that is gone (KT-41378)
- A class that became a typealias (KT-47285, KT-46697)
- A typealias that became a class (KT-46340)
2021-08-10 14:02:40 +03:00
Mikhael Bogdanov 228100ef09 Upgrade toolchain to api/lv 1.4 2021-07-29 19:45:53 +02:00
Pavel Punegov c2fe46020e Native: improve CompilerVersion to correspond to the versioning schema
* Add pub and dev-google-pr meta versions
* Allow using release versions with and without build number
* Add tests for version parsing
2021-07-05 19:43:27 +00:00
Yahor Berdnikau 13fd2a24ea Fix exposing provided by Gradle Kotlin dependencies.
Ensure that Gradle plugin dependencies do not include kotlin-stdlib,
kotlin-reflect and other dependencies that are provided by Gradle
runtime.

^KT-41142 Fixed
2021-05-12 23:28:37 +03:00
Pavel Punegov 86041096fd Return milestone property back to support older versions of plugins
Older gradle plugin's NativeCompilerDownloader uses milestone property.
2021-05-12 10:34:36 +03:00
Pavel Punegov fa525a8359 [native] Support milestones in meta versions
Add milestones to MetaVersion to replace standalone parameter in
compiler version generator. This makes native version match Kotlin one.
2021-05-12 10:34:35 +03:00
sebastian.sellmair b48850c993 [Commonizer] Logging: Implement CommonizerLogLevel and hide verbose output by default
^KT-36679 Fixed
2021-05-01 14:36:18 +03:00
Alexander Udalov 848b08a475 Minor, suppress 1.3 language version warnings 2021-03-12 11:18:57 +01:00
Alexander Likhachev 2ae7740c46 Set explicit lang version 1.3 for kotlin-native-utils & kotlin-util-io
Without explicit version we cannot use those modules in buildscripts with Gradle 6.8+ because Gradle doesn't set flag `skipPrereleaseCheck` (previously was named `skipMetadataVersionCheck`). This way we make it compatible with all supported versions of Gradle.
2021-03-11 14:12:38 +03:00
Alexander Udalov 17a8d24a84 Fix warnings in Util.kt
There were unreachable code warnings in printMillisec, and indeed the
variable assignment was never executed, so the function would always
print "0 msec".
2021-03-01 19:47:24 +01:00
Vasily Levchenko ec0f6b9ede [build][kotlin-build-gradle-plugin] bump version 0.0.25
- kotlin native versioning support
- disable metadata
- fixes of drop 0 maintanence clause
- support for kotlin.native.enabled flag to switch on/off kotlin native build
- add mode to version generatation to dump version to resourse file
2021-02-24 11:07:14 +01:00
Roman Artemev 75016bf54d [Gradle, JS] Fix bridge between Gradle and Js IR CLI 2021-01-26 19:23:25 +03:00
Sergey Bogolepov eeda48e63e Allow prefix and relative path in resolvable properties.
It allows us to move more logic to konan.properties from ClangArgs.
E.g., something like `-$absoluteTargetSysRoot/usr/include/c++/4.9.4`
2020-10-22 12:45:49 +07:00
Sergey Bogolepov 2154c94100 [Native] Add tests for resolvable properties 2020-09-15 13:54:10 +07:00
Sergey Bogolepov 5a0a853d9b [Native] Add simple symbol mechanism to konan.properties
Java Properties format is extremely trivial and does not support any
kind of references or variables. It makes konan.properties repetitive.
This commits adds support of perl-like `$` sigil which allows to
reference properties inside values.
2020-09-15 13:54:09 +07:00
Ilya Matveev 03bb9138ad [klib] Create ZipFileSystem from a Path instead of an URI
Calling FileSystems.newFileSystem(URI, ...) throws a
FileSystemAlreadyExistsException if a ZipFileSystem for this
URI is already created. We still can use a single instance
of ZipFileSystem by calling FileSystems.getFileSystem. In
this case we use reference counting to determine when this
instance can be safely closed.

But we cannot count references if the same ZipFileSystem is used
from different class loaders. This patch fixes this issue by
creating a file system from Path instead of an URI. Contract of
FileSystemProvider.newFileSystem(Path, ...) doesn't imply throwing
FileSystemAlreadyExistsException.

Issue #KT-37443 fixed
2020-06-18 14:17:59 +00:00
Nikolay Krasko 4230a17427 Revert "Force bootstrap stdlib in modules that used in composite build"
This reverts commit ad76562c
2020-04-27 15:58:38 +03:00
Nikolay Krasko ad76562cbc Force bootstrap stdlib in modules that used in composite build 2020-04-27 15:36:49 +03:00
Martin Petrov bc96e42585 Produce deterministic klib files.
Build systems like bazel rely on the output of a compilation being
deterministic. File checksums determine when an artifact is safe to
cache across builds. One can produce a klib deterministically by using a
fixed timestamp during klib compression.

Before this change:

```
$ kotlinc-native  -produce library -output /tmp/first/color.klib Color.kt
$ kotlinc-native  -produce library -output /tmp/second/color.klib Color.kt
$ shasum  /tmp/first/color.klib /tmp/second/color.klib
bc3f73678ff025cfbec9009f9a851a8ca74e1037  /tmp/first/color.klib
65aa37886fbd53285f2e449a4dab6a2ad02732e6  /tmp/second/color.klib
```

After this change:

```
$ kotlinc-native  -produce library -output /tmp/first/color.klib Color.kt
$ kotlinc-native  -produce library -output /tmp/second/color.klib Color.kt
$ shasum  /tmp/first/color.klib /tmp/second/color.klib
fcba304493916ae34d372188991f87b60a113cf3  /tmp/first/color.klib
fcba304493916ae34d372188991f87b60a113cf3  /tmp/second/color.klib
```
2020-04-23 15:53:45 +03:00
Ilya Matveev 5f53986f47 [klibs] Allow resolving klibs which names are not valid file names 2020-04-19 19:08:43 +07:00
Dmitriy Dolovov 4c6bddf6be KLIB: Fix reading property lists in Properties.propertyList()
1. If property is absent, or contains empty string or a string consisting only of whitespace characters, Properties.propertyList() should always return empty List<String>.
2. If property starts or ends with whitespace characters, Properties.propertyList() should not include empty-string values for whitespace prefix or suffix.
2020-04-06 21:36:26 +07:00
Ilya Gorbunov fcada0a5e3 Make use of contracts of time measurement functions 2020-04-03 19:36:36 +03:00
Vasily Levchenko 98ce49ba73 [build][native] version with milestone clause 2020-02-21 13:51:20 +01:00
Dmitriy Dolovov 8028a3f55b Minor: Clean-up in konan File 2020-02-01 17:03:51 +07:00
Ilya Matveev 0725a336fc Fix data race in zip FileSystem reference counting
Issue #KT-36076 Fixed
2020-01-28 13:08:40 +07:00
Alexander Gorshenev 9a12641fde Allow parallel access to klib zip filesystem 2019-12-27 18:19:48 +03:00
Alexander Gorshenev b0f077ff4b Plumbing KlibMetadataVersion and KlibIrVersion values to klib manifest 2019-11-30 18:37:38 +03:00
Alexander Gorshenev c227c13799 Commonizing klib metadata between native and js 2019-10-01 17:38:57 +03:00