Commit Graph

1238 Commits

Author SHA1 Message Date
Svyatoslav Scherbina 9476d4c647 Native: use Gradle exec for jsinterop invocation in jsinterop_math test
The previous implementation didn't log anything, including stdout,
stderr and the command line, and didn't detect non-zero exit code,
making it hard to investigate the test failures.
2021-11-19 11:54:46 +00:00
Pavel Punegov c5a02902a7 [K/N][build] Add artifacts depending on input in library task
Depending on noPack option compiler produces file or directory.
Artifact field that contains .klib file can't use @OutputDirectory
annotation. The same applies for @OutputFile with directory.
To workaround make an artifact field internal and use two optional
fields that return either file or directory depending on noPack option.
2021-11-19 11:29:53 +00:00
Pavel Punegov e3ac2b661a [K/N][build] Remove artifact overriding in library task
Depending on noPack option compiler produces file or directory.
Artifact field that contains .klib file can't use @OutputDirectory
annotation. The same applies for @OutputFile with directory.
2021-11-19 11:29:53 +00:00
Pavel Punegov cc7768e38f [K/N] Konan: override artifact property to use with OutputDirectory 2021-11-19 11:29:52 +00:00
Pavel Punegov f7e2572ccc [K/N][build] Add noPack option to Konan plugin
Make plugin aware of -nopack compiler option to correctly set outputs
without .klib suffix.
2021-11-19 11:29:52 +00:00
Igor Chevdar 0a4fe94717 [K/N][codegen] Removed FieldInfo.hasConstInitializer
If a property is a const val, it can't have non-const initializer
2021-11-18 17:52:57 +05:00
Igor Chevdar cb71240938 [K/N] Supported outer this references from cached inline bodies 2021-11-18 17:52:57 +05:00
Martin Petrov aedcfe78e1 [Native] Add -Xoverride-konan-properties to cinterop.
This aligns with the flag added to kotlinc in:
https://youtrack.jetbrains.com/issue/KT-40670

Hermetic builds would benefit from being able to override dependency paths or airplaneMode using this mechanism:

```
$ bin/cinterop -Xoverride-konan-properties "apple-llvm-20200714-macos-x64-essentials.default=/tmp/llvm;airplaneMode=true" -def baz.def
```
2021-11-18 13:18:14 +03:00
Nikolay Kasyanov 4dcfd38236 ObjCExport: remove KotlinUnit from suspend funs returning Unit (#4635)
With `unitSuspendFunctionObjCExport=proper` binary option,
for Unit-returning suspend functions ObjCExport now generates
completion handlers without redundant `KotlinUnit*` result parameter.

So Swift (5.5+) can import these functions as Void-returning async
functions.

^KT-47399 Fixed
2021-11-18 10:01:33 +03:00
Pavel Punegov 960ba3ffde [K/N] Excluded filecheck test on wasm32. See KT-49739 2021-11-17 09:40:52 +00:00
Svyatoslav Scherbina 2f5706597a IR: fix offsets in irTemporary
The variable generated by IrStatementBuilder.irTemporary doesn't inherit
startOffset and endOffset from the builder. In particular, as a result,
temporary variables generated for elvis operator left operand have
UNDEFINED_OFFSET.

Additionally, ProvisionalFunctionExpressionLowering copies the offsets
of a variable to lowered lambda in the variable initializer. With the
problem described above, this causes invalid debug information in
Kotlin/Native, see KT-49360.

Fix irTemporary by using builder's offsets for the variable.

^KT-49360 Fixed
2021-11-16 11:59:55 +00:00
Elena Lepilkina c06875b8e9 [K/N] Added test for exceptions behaviour in case of dynamic libs (KT-47828) 2021-11-16 10:44:53 +00:00
Pavel Kunyavskiy 21444d6be8 [K/N] Optimize and get rid of recursion in SCC search in Devirtualization 2021-11-16 08:27:41 +00:00
Dmitriy Dolovov a029b50755 [Native][tests] Enable codegen_box_callableReference/genericConstructorReference.kt 2021-11-15 18:15:42 +03:00
Elena Lepilkina 59d74b818e [K/N] Replace safe points after EnterFrame to allow LLVM reemove repeated instructions 2021-11-15 12:29:54 +00:00
Pavel Punegov 524c7c4397 [K/N][build] Use JDK17 only during stdlib builds
JDK17 can't be applied for all subprojects because it will make our
bundle require JDK17 to be used by end users.
2021-11-15 09:04:52 +00:00
Pavel Punegov 76d9692c4d [K/N][build] Fix for Class.newInstance is deprecated in Java 2021-11-15 09:04:52 +00:00
Pavel Punegov 56f6637279 [K/N][build] Use JDK17 on macOS arm64 to prevent odd failures 2021-11-15 09:04:51 +00:00
Kirill Shmakov a582504bf1 [K/N][debug] Update LLDB bundle for Linux
This is related to KTIJ-19931
2021-11-15 10:39:11 +03:00
zhelenskiy c1dc1f7e33 Diagnostics renamed
Signed-off-by: zhelenskiy <zhelenskiy2000@yandex.ru>
2021-11-13 12:38:45 +01:00
Pavel Kunyavskiy 523cb4b3e8 [K/N] Better handling of nested returns in RedundantCoercionsCleaner.kt
^KT-49356
2021-11-12 19:12:37 +00: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 Matveev 428a15397e [K/N] Suppress warnings of dsymutil in runtime tests 2021-11-12 05:42:00 +03:00
Ilya Matveev 54cdf732b4 [K/N] Enable debug info for runtime tests 2021-11-12 05:42:00 +03:00
Pavel Punegov 475b3a452e [K/N][test] Disable tests on wasm due to ^KT-48738 2021-11-11 13:34:25 +00:00
Pavel Punegov 83d31526cc [K/N][build] Fix args in klib runner task 2021-11-11 12:16:27 +00:00
Pavel Punegov 2bb5a554a8 [K/N][build] Small fix to platformLibs build script 2021-11-11 12:16:27 +00:00
Pavel Punegov 197d55e045 [K/N][build] Add common sources setting to Konan plugin
Used for stdlib build
2021-11-11 12:16:26 +00:00
Pavel Punegov e07fa31784 [K/N][build] Move KLibInstall to Konan gradle plugin 2021-11-11 12:16:26 +00:00
Pavel Punegov 151cb096ce [K/N][test] Replace genKt39548 task with doBeforeBuild closure 2021-11-11 12:16:25 +00:00
Pavel Punegov 547501865c [K/N][build] PlatformLibs project small refactorings 2021-11-11 12:16:25 +00:00
Pavel Punegov 04c6e64598 [K/N][build] KLibInstall task fix removing useless doFirst 2021-11-11 12:16:24 +00:00
Pavel Punegov 0c47ac3cd0 [K/N][build] Rewrite platforms libs to kts 2021-11-11 12:16:24 +00:00
Pavel Punegov 3abc587125 [K/N][build] KlibInstall minor fixes 2021-11-11 12:16:23 +00:00
Pavel Punegov c1ad88f1a6 [K/N][build] Move stdlib bitcode copy to runtime 2021-11-11 12:16:23 +00:00
Pavel Punegov eb5518d6d7 [K/N][build] Fixes to caching and stdlib build 2021-11-11 12:16:22 +00:00
Pavel Punegov 67eedbe03e [K/N][build] Move stdlib caching to runtime project 2021-11-11 12:16:22 +00:00
Pavel Punegov c9d203b01a [K/N][build] stdlib cross-target build
Build stdlib only for host platform and copy to cross-targets just
changing the manifest
2021-11-11 12:16:21 +00:00
Pavel Punegov e9b1f7cca1 [K/N][build] Move stdlib build to runtime project
Build stdlib with konan plugin in runtime project
2021-11-11 12:16:21 +00:00
Dmitriy Dolovov f3397dfeca [Native][tests] Fix "outputChecker cannot be serialized" Gradle issue 2021-11-11 12:32:47 +03:00
Svyatoslav Scherbina ea7160947a Native: enable lazy IR generation before running fake override builder
^KT-48816 Fixed

Native compiler uses lazy IR for declarations provided by cinterop.
The problem: `FakeOverrideBuilder` requests super types during
type checking, accessing `.owner` for them. So if a type and super type
are represented as lazy IR, and lazy IR generation is not enabled yet,
then the super type symbol won't be bound by this moment, and the access
will fail.

This happens in KT-48816: fake override builder tries to access `.owner`
for `IrClassSymbol` of `NSObject` (super type of `NSDate` and `NSUUID`).

Fix this by enabling lazy IR generation before building fake overrides.
2021-11-10 12:30:12 +00:00
Svyatoslav Scherbina c929404fa4 Native: don't treat any compiler test task as up-to-date
There are number of problems with up-to-date checks in tests, leading to
a test binary not being rebuilt or rerun when a developer expects it to.

Things became worse after updating to Gradle 7+:
test binary run tasks are considered up-to-date if the test data
has been changed, even after clean.

Even before Gradle 7+, we've observed other similar undesirable effects:
for example, if the compiler has been changed, tasks building
test binaries are still up-to-date.

There are quite a lot of different tasks related to running the tests
for Native, many of them are misused and thus don't do what we expect.
Carefully fixing each particular kind seems counterproductive and
unreliable.

So instead workaround all possible similar problems by forcing all tasks
in the :kotlin-native:backend.native:tests project to be not up-to-date.

This project should contain only test tasks, so this workaround
seems pretty natural -- it is just "tests aren't up-to-date".
2021-11-09 11:18:08 +00:00
Svyatoslav Scherbina d5bf99f80c Native: make FrameworkTest implement Serializable
Gradle requires this when using it as task input.
2021-11-09 11:18:08 +00:00
Pavel Punegov a207a3e8fa [K/N][test] Don't use assertFailsWith on wasm32 in the test 2021-11-09 09:55:13 +00:00
Martin Petrov 416d12bce8 [Native] Lazily create dependency & cache directories. (#4627)
Previously initializing the DependencyProcessor will result in file IO.

In a fully-hermetic environment where all dependencies are local, this IO is redundant and may require the build system (e.g. Bazel) to do extra setup to ensure there is a local writable directory specified for these directories. This change will instead cause the dependency processor to bail early and skip downloading dependencies if all are local anyway.

Prior to this change kicking off a clean build with local dependencies would result in:

```
rm -rf ~/.konan/cache; fswatch -ax ~/.konan
~/.konan/cache Created IsDir
~/.konan/cache/.lock Created IsFile
```

After the change no FS operations are performed.
2021-11-09 11:30:30 +03:00
Sergey Bogolepov bc144887ea [K/N] Add native test for KT-48591
We can't rely on stdlib tests now, because they are not
executed with compiler caches.
2021-11-09 08:27:58 +00:00
Ilya Matveev 8ff1d66ec9 [K/N][build] Fix up-do-date checks for cache tasks
A name of a cache directory produced by the compiler for a library is
based on the unique name of this library. The cache task, when
declaring its outputs, assumes that this unique name is equal to the
name of the library file/directory. If this is not the case, the
up-to-date check works inconsistently and Gradle doesn't rerun
the task.

This patch fixes this issue by obtaining the real unique name of
the library.
2021-11-08 11:51:42 +07:00
Elena Lepilkina 8ed4279759 [K/N] Fix wasm build 2021-11-03 10:32:27 +00:00
Pavel Kunyavskiy d127815626 Refactor DataClassMembersGenerator.kt for better work with LazyIr
^KT-49428
2021-11-03 07:22:28 +00:00
Pavel Kunyavskiy f4a88bde4e [K/N] Force static constants and boxing caches be same values
^KT-49403
2021-11-03 07:21:25 +00:00