Commit Graph

307 Commits

Author SHA1 Message Date
cristiangarcia 540df2944b XcodeValueSource needs to return a Serializable object
Required for KTI-1553
2024-03-05 18:52:33 +00:00
Timofey Solonin 737ad3cde6 Specify broken macros in legacy testing infrastructure
^KT-65542
2024-03-05 12:15:29 +00:00
cristiangarcia 57edc413a3 Make native tasks CC compatible
This allows running with CC&native:
./gradlew assemble
./gradlew :kotlin-native:bundle
./gradlew :native:native.tests:test

Required for KTI-1553
2024-03-05 11:22:20 +00:00
Alexander Shabalin 5c2017fa5f [K/N] Fix CC in Xcode usage ^KTI-1553
- Perform all calls to xcrun in XcodeValueSource.
- Use the fully computed Xcode instance as the current Xcode instance.
- Hide all of this inside a Gradle plugin and apply it to kotlin-native
  project.
2024-02-28 17:58:41 +00:00
cristiangarcia e83d2e31d4 Fix CompileToBitcodePlugin onlyIf to make it CC compatible
Required for KTI-1553
2024-02-27 10:32:58 +00:00
Alexander Shabalin b1f59e5f0d [K/N] Make NativeDependenciesDownloader compatible with CC ^KTI-1553 2024-02-26 14:53:23 +00:00
Artem Olkov dd9332d9e1 Add kotlin runtime modulemap for swift export as part of kotlin-native dist #KT-65673 fixed
Co-authored-by: Alexander Shabalin <alexander.shabalin@ashabalin.me>

Merge-request: KT-MR-14493
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-02-26 12:51:57 +00:00
Yahor Berdnikau 6b19b8b9d0 [Repo] Don't use kotlinOptions in repo build scripts
^KT-63419 In Progress
2024-02-22 14:48:10 +00:00
Vladimir Sukharev 6c78ec88c2 [K/N][Tests] Cleanup support code for objCFrameworks in old testinfra
^KT-61259
2024-02-13 07:43:25 +00:00
Yahor Berdnikau 11fee106b2 [Gradle] Fix warnings in kotlin-native-build-tools
^KT-56904 In Progress
2024-02-12 14:39:33 +00:00
Alexander Shabalin 5bd0bbb159 [K/N][tests] Regroup runtime tests ^KT-53776 2024-02-09 11:14:56 +00:00
Vladimir Sukharev 95b1fba37f [K/N][Tests] Clean up framework testing code
^KT-61259
2024-02-05 16:06:34 +00:00
Pavel Punegov 6b409d87f5 [K/N][test] Support library for running Kotlin/Native tests with XCTest
This change adds a library with cinterop that has XCTest wrapper around
Kotlin/Native tests (that are @kotlin.test.Test marked methods).
This library can be compiled with either test code using the option
`-produce test_bundle` to make a loadable test bundle or used inside
the existing ObjC/Swift tests if compiled to a framework.

The basic idea is to make XCTest be able to resolve separate test cases
and correctly show them in test reports. This was achieved by wrapping
test cases with dynamically created invocation methods. Test listeners
are integrated with XCTest Observation to make it possible to have 
the same ability to report with GTest or TeamCity logging.

Gradle build files use MPP Gradle plugin and use a bootstrap version
of K/N. Property `kotlin.native.home` was moved to the kotlin-native
subproject to not override this project's K/N distribution, that is
being used by the KGP with the same property.

This is a part of ^KT-58928


Merge-request: KT-MR-13268
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2024-01-18 15:04:37 +00:00
Alexander Shabalin b7fbfb2fde [K/N][tests] Migrate first platform-dependent test to new testing infra
^KT-61259
2024-01-12 00:47:31 +01:00
cristiangarcia 5a1fb78fcd Declare generated SourceSets correctly
Allow Gradle to keep the track of the task generating the sources
KTI-1502 Fixed
2023-12-24 00:01:59 +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
Troels Bjerre Lund 6161f44d91 Remove needsProfileLibrary argument
Second phase of removing LLVM coverage. This had to wait until after the
bootstrap advance.


Co-authored-by: Troels Lund <troels@google.com>


Merge-request: KOTLIN-MR-838
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2023-12-15 16:44:12 +00:00
Pavel Punegov fc1d7df0bc [K/N][build] Simplify stdlib build
Build stdlib with a single task that also sets all supported targets
to the manifest file.
Remove manifest merging as it is not needed anymore.
2023-12-14 11:33:20 +00:00
Ilya Gorbunov 35aa17e1d0 Pack K/N stdlib sources into single zip
With the directory structure similar to one of a multiplatform library,
where each source set sources are placed into the directory
named after this source set.

Do not use legacy projects for building relative paths
2023-12-13 15:40:25 +00:00
Alexander.Likhachev 28dad289b3 [Build] Remove attributes setup for the dependency scope configurations
This behaviour makes no sense and is deprecated: https://docs.gradle.org/8.4/userguide/upgrading_version_8.html#deprecated_configuration_usage
^KTI-1473 In Progress
2023-12-07 18:31:07 +00:00
Alexander.Likhachev a19bd2ed2e [Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3

There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242
^KTI-1473 In Progress
2023-12-07 18:31:06 +00:00
Svyatoslav Scherbina dd55ca6ed0 Native: fix Swift compilation in tests for tvos_simulator_arm64
e5ae32c removed bitcode embedding from tests. In particular, that commit
disabled bitcode embedding when compiling Swift code (e.g. in ObjCExport
tests).

It seems that bitcode embedding also enables adhoc codesigning in the
linker.
The linker doesn't seem to do adhoc codesigning by default for tvOS
arm64 simulator target, and without a signature the binaries can't run
on the simulator.

So disabling bitcode embedding also disabled adhoc codesigning and made
the tests fail on that target.

Fix this by explicitly passing `-Xlinker -adhoc_codesign` when compiling
Swift code in tests.
2023-12-07 15:10:04 +00:00
Troels Bjerre Lund 4f77434ea5 [K/N] Remove LLVM coverage
The -Xcoverage feature has not worked and has been disabled for a while.
This fix removes it, and all of its uses.


Co-authored-by: Troels Lund <troels@google.com>


Merge-request: KOTLIN-MR-821
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2023-12-06 14:07:16 +00:00
Svyatoslav Scherbina e5ae32c37a Native: remove bitcode embedding from tests
Xcode 14 deprecates bitcode embedding, and Xcode 15 removes support
for it. Therefore, testing bitcode embedding in Kotlin doesn't make
much sense.

This commit removes most of test code that enables bitcode.

^KT-61875
2023-11-23 18:36:59 +00:00
Pavel Punegov 41477b25a1 [K/N][test] Fixup target toolchain path for swift compilation
Use a parent path in fallback framework path environment variable.
This fixes failures caused by the 3aeca1956e.
See also MR-KT-12948
2023-11-17 10:16:30 +00:00
Pavel Punegov a53c96e790 [K/N][test] Fixup target toolchain path for ExecClang
This fixes failures caused by the 3aeca1956e.
See also MR-KT-12948
2023-11-17 10:16:30 +00:00
Dmitriy Dolovov c13c917a8a [Native] Don't use KLIB repositories in K/N build infra
Don't pass KLIB repositories via '-repo' or '-r' compiler parameters.

^KT-61098
2023-11-15 19:38:25 +00:00
Dmitriy Dolovov c3da16a1d8 [Native] Use library paths instead of library names in K/N build infra
Use library paths instead of library names in K/N build infra when
passing a library through `-library` compiler argument.

^KT-61098
2023-11-15 19:38:25 +00:00
Pavel Punegov 6053c94c8a [K/N][build] Fix KT-56495: improve version manifest merge
Add missing input property to stdlib build task. This task should
consider kotlin/build version change.
Add a version check during the stdlib target task build. This check
should be done here instead of the final merge.

Fixes ^KT-56495


Merge-request: KT-MR-12906
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-11-13 14:45:06 +00:00
Pavel Punegov 5f7b1761d7 [K/N][build] Add usr subdir to absoluteTargetToolchain path
absoluteTargetToolchain has started to include the usr directory while
tests use a bootstrap version that doesn't have this change.
See commit 3aeca1956e with the change to toolchain path.
2023-11-10 18:25:04 +00:00
Pavel Punegov 3d720f9c03 [K/N][test] Add static_everywhere caching as an alias to static
To match the options in the new infrastructure, add the same option
to the old one


Merge-request: KT-MR-12949
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-11-10 13:11:03 +00:00
Alexander Shabalin fe94876d9a [K/N] Fix handling custom llvm and libffi distributions ^KT-63220 2023-11-08 09:24:20 +00:00
Pavel Punegov 9961780fbd [K/N][build] Build platform libraries without zipping/unzipping
With "-nopack" compiler option, it is possible to build unzipped klibs.
This makes it possible to get rid of install tasks that unzip them.
Also, an obsolete test for klib installation was removed.
2023-11-01 20:58:21 +00:00
Dmitriy Dolovov c34e334550 [KLIB tool] Rename "signatures" to "dump-metadata-signatures"
To make KLIB tool command names more uniform.
2023-10-27 09:28:00 +00:00
Troels Bjerre Lund 3556533d95 [K/N] Fix K2 detection in native tests
This updates how the requested language version is detected in native
tests, after language version 2 has become the default.
2023-10-24 14:00:34 +00:00
cristiangarcia 03ad981dea Make ClangFrontend cacheable
Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>


Merge-request: KT-MR-11479
Merged-by: Cristian Garcia <Cristian.Garcia-Marin@jetbrains.com>
2023-10-24 09:50:02 +00:00
Dmitrii Krasnov 10a6d8fd2c [Gradle IT] Added configuration for running IT with k/n from master
[Gradle] Updated kotlin-build-gradle-plugin to 0.0.40

#KT-45978 Ready for Review


Merge-request: KT-MR-12509
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-10-24 08:38:51 +00:00
cristiangarcia cc2280a146 Make KonanCompileLibraryTask cacheable
Merge-request: KT-MR-11117
Merged-by: Cristian Garcia <Cristian.Garcia-Marin@jetbrains.com>
2023-10-23 16:55:14 +00:00
Alexander Shabalin e4b34857c0 [K/N] Fix FrameworkTest with compileOnlyTests. 2023-10-19 21:48:33 +00:00
Pavel Punegov e01cea6669 [K/N][build] Add providers to klib install and cache tasks 2023-10-19 12:12:02 +00:00
Pavel Punegov b1a85d45c6 [K/N][build] Move old Konan plugin to native-build-tools 2023-10-19 12:12:02 +00:00
Alexander Shabalin 4922223bec [K/N] Refactor :kotlin-native:dependencies
Move K/N dependencies handling logic into gradle plugins:

`NativeDependenciesDownloader` is instantiated in
`:kotlin-native:dependencies` and provides a single configuration that
contains all directories with the dependencies. The configuration has
a variant for each target.

`NativeDependencies` is instantiated by projects that require native
dependencies (i.e. previously used to depend on
`:kotlin-native:dependencies:update`). This plugin creates a configuration
that by default depends on `:kotlin-native:dependencies`. Its extension
provides `llvmDependency`, `libffiDependency`, `hostPlatformDependency`,
`targetDependency()` to depend on the parts needed for the project and
provides accessors `llvmPath`, `libffiPath`, `hostPlatform` that are
safe to use during configuration time, but which do not automatically
resolve those dependencies.

`llvmDir`, `*LibffiDir` properties on `:kotlin-native` are removed
completely, as their use is replaced by `NativeDependencies`. As a
consequence, `evaluationDependsOn(":kotlin-native:dependencies")` is
also gone.

All direct dependencies on `:kotlin-native:dependencies:update` are
replaced with dependencies on specific parts via `NativeDependencies`
2023-10-18 10:53:12 +00:00
Alexander Shabalin 83435ccde1 [K/N] Remove workaround in FrameworkTest for old macOS
In macOS prior to 10.14.4 we needed to specify the location of
libswiftCore.dylib. That OS version is long unsupported, so we can
drop the code.
2023-10-17 16:54:34 +00:00
Alexander Shabalin 004ef267c5 [K/N] Remove check for bitcode embedding ^KT-61875
This removes the check in old testing infra for FrameworkTest.
2023-10-17 16:54:34 +00:00
Dmitriy Dolovov 4d80e0f08d [Native] Respect local.properties in build config 2023-10-02 16:14:59 +00:00
Timofey Solonin f3bc8677c5 Increase execution timeout due to slower Rosetta agents
^KT-61369
2023-10-02 10:13:57 +00:00
Mikhail Glukhikh fc2041e5b9 LV 2.0: allow unstable dependencies in kotlin-native/build-tools
Without this commit, build of this module fails during bootstrap
with FIR_COMPILED_CLASS
2023-09-19 15:46:29 +00:00
Timofey Solonin 9e7d9f3b53 Use llbuild.framework bundled with the internal toolchain
^KT-61369
2023-09-13 10:12:51 +00:00
Svyatoslav Scherbina f77f83e741 Native: fix support for cross-target filecheck tests
There was a minor mistake in the build script configuration, leading to
a missing task dependency when running the tests with
`-Pkotlin.native.home=`.

More specifically, the build script was checking if the cross-dist for
the main tests target (`-PtestTarget=`) is in place, but instead it
should have checked if the cross-dist for the test cross-target
(`test.targetName`) is in place.

This commit fixes the check, and thus adds the missing task dependency.
2023-09-11 13:49:35 +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