├── .gitmodules ├── samples ├── uikit │ ├── .gitignore │ ├── gradle.properties │ └── konan.xcodeproj │ │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── calculator │ ├── .gitignore │ ├── arithmeticParser │ │ └── gradle.properties │ ├── cliApp │ │ └── gradle.properties │ ├── androidApp │ │ ├── gradle.properties │ │ └── src │ │ │ └── main │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ │ └── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ ├── build.sh │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── iosApp │ │ └── calculator.xcodeproj │ │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── androidNativeActivity │ ├── gradle.properties │ ├── build.sh │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ └── src │ │ ├── arm32Main │ │ ├── assets │ │ │ └── kotlin_logo.bmp │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── konan_activity.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── konan_activity.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── konan_activity.png │ │ │ └── mipmap-xxhdpi │ │ │ │ └── konan_activity.png │ │ └── kotlin │ │ │ └── BMPHeader.kt │ │ └── nativeInterop │ │ └── cinterop │ │ └── bmpformat.def ├── torch │ ├── src │ │ └── nativeInterop │ │ │ └── cinterop │ │ │ └── torch.def │ └── gradle.properties ├── tensorflow │ ├── src │ │ └── nativeInterop │ │ │ └── cinterop │ │ │ └── tensorflow.def │ └── gradle.properties ├── tetris │ ├── src │ │ ├── tetrisMain │ │ │ └── resources │ │ │ │ ├── config.txt │ │ │ │ └── tetris_all.bmp │ │ └── nativeInterop │ │ │ └── cinterop │ │ │ └── sdl.def │ └── gradle.properties ├── curl │ └── gradle.properties ├── objc │ ├── gradle.properties │ └── build.gradle ├── csvparser │ └── gradle.properties ├── gitchurn │ ├── gradle.properties │ ├── src │ │ └── nativeInterop │ │ │ └── cinterop │ │ │ └── libgit2.def │ └── README.md ├── libcurl │ ├── gradle.properties │ └── src │ │ └── nativeInterop │ │ └── cinterop │ │ └── libcurl.def ├── opengl │ ├── gradle.properties │ └── build.gradle ├── win32 │ ├── gradle.properties │ └── README.md ├── workers │ ├── gradle.properties │ └── build.gradle ├── echoServer │ ├── gradle.properties │ └── README.md ├── globalState │ ├── gradle.properties │ ├── src │ │ └── nativeInterop │ │ │ └── cinterop │ │ │ └── global.def │ └── README.md ├── html5Canvas │ ├── gradle.properties │ └── index.html ├── videoplayer │ ├── gradle.properties │ └── src │ │ ├── nativeInterop │ │ └── cinterop │ │ │ └── sdl.def │ │ └── videoPlayerMain │ │ └── kotlin │ │ └── Dimensions.kt ├── nonBlockingEchoServer │ └── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── zephyr │ ├── prj.conf │ └── c_interop │ │ └── platforms │ │ └── stm32f4_disco.def ├── gtk │ └── gradle.properties ├── weather_function │ ├── weather.yml │ ├── function │ │ ├── curl.def │ │ └── cjson.def │ └── .gitignore └── gradle.properties ├── shared ├── settings.gradle └── src │ ├── main │ └── kotlin │ │ └── org │ │ └── jetbrains │ │ └── kotlin │ │ └── konan │ │ ├── util │ │ ├── WithLogger.kt │ │ └── TargetDefFile.kt │ │ └── KonanAbiVersion.kt │ └── library │ └── kotlin │ └── org │ └── jetbrains │ └── kotlin │ └── konan │ └── library │ ├── KonanMetadataReader.kt │ └── UnresolvedLibrary.kt ├── extracted ├── konan.metadata │ └── settings.gradle └── konan.serializer │ ├── settings.gradle │ └── src │ └── org │ └── jetbrains │ └── kotlin │ ├── konan │ └── library │ │ └── ResolverUtils.kt │ └── descriptors │ └── konan │ └── KonanModuleDescriptorUtils.kt ├── performance └── src │ └── main │ ├── kotlin-jvm │ ├── cleanup.kt │ └── FakeKonanNamespace.kt │ └── kotlin-native │ └── cleanup.kt ├── backend.native ├── tests │ ├── link │ │ ├── versioning │ │ │ ├── empty.kt │ │ │ └── hello.kt │ │ ├── omit │ │ │ ├── lib.kt │ │ │ └── hello.kt │ │ ├── purge1 │ │ │ ├── prog.kt │ │ │ └── lib.kt │ │ ├── lib │ │ │ ├── foo.kt │ │ │ └── foo2.kt │ │ ├── src │ │ │ └── bar.kt │ │ └── default │ │ │ └── default.kt │ ├── runtime │ │ ├── basic │ │ │ ├── entry4.kt │ │ │ ├── assert_failed.kt │ │ │ ├── assert_passed.kt │ │ │ ├── entry2.kt │ │ │ ├── readline1.kt │ │ │ ├── readline0.kt │ │ │ ├── args0.kt │ │ │ ├── driver0.kt │ │ │ ├── hello0.kt │ │ │ ├── main_exception.kt │ │ │ ├── libentry2.kt │ │ │ ├── tostring1.kt │ │ │ ├── initializers3.kt │ │ │ ├── empty_substring.kt │ │ │ ├── exit.kt │ │ │ ├── initializers5.kt │ │ │ ├── hello1.kt │ │ │ ├── hello4.kt │ │ │ ├── hello2.kt │ │ │ ├── hello3.kt │ │ │ ├── for0.kt │ │ │ ├── initializers4.kt │ │ │ ├── entry1.kt │ │ │ └── enum_equals.kt │ │ ├── memory │ │ │ ├── only_gc.kt │ │ │ ├── basic0.kt │ │ │ └── escape1.kt │ │ ├── collections │ │ │ ├── range0.kt │ │ │ ├── sort0.kt │ │ │ ├── moderately_large_array.kt │ │ │ └── array2.kt │ │ ├── exceptions │ │ │ └── extend0.kt │ │ └── text │ │ │ └── string_builder1.kt │ ├── interop │ │ ├── basics │ │ │ ├── cstdio.def │ │ │ ├── structs.kt │ │ │ ├── 2.kt │ │ │ ├── cstructs.def │ │ │ ├── unsupported.kt │ │ │ ├── sockets.def │ │ │ ├── 5.kt │ │ │ ├── 0.kt │ │ │ └── 1.kt │ │ └── objc │ │ │ └── objcSmoke.def │ ├── helpers.kt │ ├── external │ │ └── codegen │ │ │ └── box │ │ │ └── properties │ │ │ └── lateinit │ │ │ └── accessor.kt │ ├── serialization │ │ ├── char_const.kt │ │ ├── prop.kt │ │ ├── use.kt │ │ ├── use_char_const.kt │ │ ├── do_while.kt │ │ ├── default_args.kt │ │ ├── vararg.kt │ │ ├── enum_ordinal │ │ │ └── library.kt │ │ └── regression │ │ │ └── no_type_map.kt │ ├── codegen │ │ ├── function │ │ │ ├── extension.kt │ │ │ ├── sum_mixed.kt │ │ │ ├── sum_imm.kt │ │ │ ├── boolean.kt │ │ │ ├── sum_func.kt │ │ │ ├── sum_silly.kt │ │ │ ├── defaults6.kt │ │ │ ├── named.kt │ │ │ ├── defaults10.kt │ │ │ ├── plus_eq.kt │ │ │ ├── minus_eq.kt │ │ │ ├── sum_3const.kt │ │ │ ├── defaults9.kt │ │ │ ├── defaultsWithVarArg2.kt │ │ │ ├── defaults8.kt │ │ │ ├── sum_foo_bar.kt │ │ │ ├── defaultsWithInlineClasses.kt │ │ │ └── defaults1.kt │ │ ├── propertyCallableReference │ │ │ ├── linkTest_lib.kt │ │ │ ├── linkTest_main.kt │ │ │ ├── valModule.kt │ │ │ ├── varModule.kt │ │ │ └── valClass.kt │ │ ├── inline │ │ │ ├── defaultArgs_linkTest_lib.kt │ │ │ ├── defaultArgs_linkTest_main.kt │ │ │ ├── lambdaAsAny.kt │ │ │ ├── defaultArgs.kt │ │ │ ├── inline24.kt │ │ │ ├── inline23.kt │ │ │ ├── inline26.kt │ │ │ ├── localFunctionInInitializerBlock.kt │ │ │ └── inline2.kt │ │ ├── basics │ │ │ ├── companion.kt │ │ │ ├── unit1.kt │ │ │ ├── unit3.kt │ │ │ ├── typealias1.kt │ │ │ ├── unit2.kt │ │ │ ├── array_to_any.kt │ │ │ ├── local_variable.kt │ │ │ └── concatenation.kt │ │ ├── innerClass │ │ │ ├── linkTest_lib.kt │ │ │ ├── linkTest_main.kt │ │ │ ├── simple.kt │ │ │ └── getOuterVal.kt │ │ ├── enum │ │ │ ├── linkTest_lib.kt │ │ │ ├── linkTest_main.kt │ │ │ ├── varargParam.kt │ │ │ ├── nested.kt │ │ │ ├── lambdaInDefault.kt │ │ │ ├── loop.kt │ │ │ ├── test1.kt │ │ │ ├── test0.kt │ │ │ └── isFrozen.kt │ │ ├── object │ │ │ ├── constructor.kt │ │ │ ├── globalInitializer.kt │ │ │ ├── init0.kt │ │ │ ├── constructor0.kt │ │ │ └── method_call.kt │ │ ├── bridges │ │ │ ├── linkTest2_main.kt │ │ │ ├── linkTest_lib.kt │ │ │ └── linkTest_main.kt │ │ ├── delegatedProperty │ │ │ ├── correctFieldsOrder_lib.kt │ │ │ ├── correctFieldsOrder_main.kt │ │ │ └── lazy.kt │ │ ├── controlflow │ │ │ ├── for_loops_array_mutation.kt │ │ │ ├── for_loops_array_nullable.kt │ │ │ ├── break1.kt │ │ │ ├── unreachable1.kt │ │ │ └── for_loops_array_indices.kt │ │ ├── mpp │ │ │ ├── mpp2.kt │ │ │ └── mpp_optional_expectation.kt │ │ ├── boxing │ │ │ ├── boxing15.kt │ │ │ ├── boxing14.kt │ │ │ ├── boxing12.kt │ │ │ ├── boxing1.kt │ │ │ ├── boxing0.kt │ │ │ ├── boxing13.kt │ │ │ ├── boxing5.kt │ │ │ ├── boxing3.kt │ │ │ ├── boxing6.kt │ │ │ ├── boxing8.kt │ │ │ ├── boxing10.kt │ │ │ └── boxing4.kt │ │ ├── branching │ │ │ ├── when6.kt │ │ │ ├── when8.kt │ │ │ ├── when9.kt │ │ │ ├── if_else.kt │ │ │ ├── when7.kt │ │ │ ├── when2.kt │ │ │ └── when4.kt │ │ ├── lateinit │ │ │ ├── localInitialized.kt │ │ │ ├── localCapturedInitialized.kt │ │ │ ├── initialized.kt │ │ │ └── globalIsInitialized.kt │ │ ├── lambda │ │ │ ├── lambda5.kt │ │ │ ├── lambda1.kt │ │ │ ├── lambda7.kt │ │ │ ├── lambda3.kt │ │ │ ├── lambda12.kt │ │ │ ├── lambda13.kt │ │ │ ├── lambda10.kt │ │ │ ├── lambda6.kt │ │ │ ├── lambda2.kt │ │ │ └── lambda11.kt │ │ ├── try │ │ │ ├── try1.kt │ │ │ ├── try3.kt │ │ │ ├── finally1.kt │ │ │ ├── try2.kt │ │ │ ├── try4.kt │ │ │ └── finally10.kt │ │ ├── dataflow │ │ │ └── scope1.kt │ │ ├── classDelegation │ │ │ ├── linkTest_lib.kt │ │ │ └── linkTest_main.kt │ │ ├── initializers │ │ │ ├── correctOrder1.kt │ │ │ └── correctOrder2.kt │ │ ├── kclass │ │ │ └── kClassEnumArgument.kt │ │ └── cycles │ │ │ └── cycle_for.kt │ ├── datagen │ │ └── literals │ │ │ ├── empty_string.kt │ │ │ ├── strdedup1.kt │ │ │ ├── strdedup2.kt │ │ │ └── listof1.kt │ ├── lower │ │ ├── vararg.kt │ │ ├── immutable_blob_in_lambda.kt │ │ └── vararg_of_literals.kt │ ├── testLibrary │ │ └── kotlin │ │ │ └── test_platform_lib.kt │ └── testing │ │ └── custom_main.kt └── compiler │ └── ir │ └── backend.native │ ├── resources │ └── META-INF │ │ └── services │ │ └── org.jetbrains.kotlin.resolve.ExternalOverridabilityCondition │ └── src │ └── org │ └── jetbrains │ └── kotlin │ └── backend │ └── konan │ └── TestRunnerKind.kt ├── platformLibs └── src │ └── platform │ ├── linux │ └── iconv.def │ ├── osx │ ├── set_depends.sh │ ├── iconv.def │ ├── CommonCrypto.def │ ├── GLUT.def │ ├── OpenGLCommon.def │ ├── OpenGL.def │ ├── IOKit.def │ ├── OpenGL3.def │ ├── ImageIO.def │ ├── libkern.def │ ├── CoreText.def │ ├── Contacts.def │ ├── CoreGraphics.def │ ├── DiskArbitration.def │ ├── CoreFoundation.def │ ├── CoreData.def │ ├── CoreML.def │ ├── Foundation.def │ ├── CoreVideo.def │ ├── IOSurface.def │ ├── Metal.def │ ├── CoreImage.def │ ├── Accelerate.def │ ├── AppKit.def │ ├── CFNetwork.def │ └── QuartzCore.def │ ├── ios │ ├── iconv.def │ ├── set_depends.sh │ ├── CommonCrypto.def │ ├── OpenAL.def │ ├── GSS.def │ ├── OpenGLESCommon.def │ ├── Network.def │ ├── CFNetwork.def │ ├── ImageIO.def │ ├── CoreAudio.def │ ├── CoreText.def │ ├── Metal.def │ ├── AddressBook.def │ ├── CallKit.def │ ├── CoreNFC.def │ ├── OpenGLES.def │ ├── PushKit.def │ ├── CoreGraphics.def │ ├── CoreServices.def │ ├── OpenGLES2.def │ ├── OpenGLES3.def │ ├── Security.def │ ├── Accounts.def │ ├── ClassKit.def │ ├── Contacts.def │ ├── CoreData.def │ ├── CoreMIDI.def │ ├── Foundation.def │ ├── AdSupport.def │ ├── HealthKit.def │ ├── Intents.def │ ├── ModelIO.def │ ├── CoreMotion.def │ ├── EAGL.def │ ├── CoreML.def │ ├── CloudKit.def │ ├── DeviceCheck.def │ ├── CoreLocation.def │ ├── NewsstandKit.def │ ├── MetalPerformanceShaders.def.disabled │ ├── CoreBluetooth.def │ ├── CoreSpotlight.def │ ├── EventKit.def │ ├── QuartzCore.def │ ├── FileProvider.def │ ├── IdentityLookup.def │ ├── Accelerate.def │ ├── AssetsLibrary.def │ ├── SystemConfiguration.def │ ├── CoreFoundation.def │ ├── CoreVideo.def │ ├── MobileCoreServices.def │ ├── NetworkExtension.def │ ├── ExternalAccessory.def │ ├── JavaScriptCore.def.disabled │ ├── UserNotifications.def │ ├── WatchConnectivity.def │ ├── CoreImage.def │ ├── Vision.def │ ├── LocalAuthentication.def │ ├── VideoSubscriberAccount.def │ ├── CoreMedia.def │ ├── NaturalLanguage.def │ ├── PDFKit.def │ ├── Social.def │ ├── WebKit.def │ ├── HomeKit.def │ ├── UIKit.def │ ├── GLKit.def │ ├── MediaAccessibility.def │ ├── MapKit.def │ ├── Messages.def │ ├── StoreKit.def │ ├── Twitter.def │ ├── VideoToolbox.def │ ├── IOSurface.def │ ├── MediaToolbox.def │ ├── MessageUI.def │ ├── MetalKit.def │ ├── QuickLook.def │ ├── SceneKit.def │ ├── CarPlay.def │ ├── SpriteKit.def │ ├── objc.def │ ├── IntentsUI.def │ ├── PassKit.def │ ├── Speech.def │ ├── ContactsUI.def │ ├── WatchKit.def │ ├── BusinessChat.def │ ├── GameController.def │ ├── HealthKitUI.def │ ├── FileProviderUI.def │ ├── SafariServices.def │ ├── iAd.def │ ├── AVKit.def │ ├── AddressBookUI.def │ ├── EventKitUI.def │ ├── GameplayKit.def │ ├── MediaPlayer.def │ ├── CoreAudioKit.def │ ├── Photos.def │ ├── ARKit.def │ ├── IdentityLookupUI.def │ ├── NotificationCenter.def │ ├── ReplayKit.def │ ├── UserNotificationsUI.def │ └── PhotosUI.def │ ├── android │ ├── glesCommon.def │ ├── egl.def │ ├── gles.def │ ├── gles3.def │ ├── gles2.def │ ├── omxal.def │ ├── sles.def │ └── media.def │ └── mingw │ ├── opengl32.def │ └── gdiplus.def ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── licenses ├── third_party │ ├── xcode_license.pdf │ └── harmony_LICENSE.txt └── NOTICE.txt ├── tools ├── kotlin-native-gradle-plugin │ └── settings.gradle └── docker │ └── Dockerfile ├── MULTIPLATFORM.md ├── runtime └── src │ ├── main │ ├── cpp │ │ └── snprintf │ │ │ ├── COPYING │ │ │ └── AUTHORS │ └── kotlin │ │ └── kotlin │ │ ├── reflect │ │ ├── KFunction.kt │ │ ├── KDeclarationContainer.kt │ │ └── KClassifier.kt │ │ ├── native │ │ └── internal │ │ │ ├── KonanRuntimeTypes.kt │ │ │ ├── DefaultConstructorMarker.kt │ │ │ ├── Ref.kt │ │ │ ├── Undefined.kt │ │ │ └── ValueTypes.kt │ │ ├── test │ │ └── Utils.kt │ │ ├── io │ │ └── Serializable.kt │ │ ├── collections │ │ └── RandomAccess.kt │ │ ├── Experimental.kt │ │ ├── Unit.kt │ │ ├── text │ │ └── Appendable.kt │ │ └── Annotation.kt │ └── launcher │ └── js │ └── index.html └── Interop └── Indexer └── prebuilt └── nativeInteropStubs └── cpp └── disable-abi-checks.cpp /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/uikit/.gitignore: -------------------------------------------------------------------------------- 1 | xcuserdata 2 | -------------------------------------------------------------------------------- /samples/calculator/.gitignore: -------------------------------------------------------------------------------- 1 | xcuserdata 2 | -------------------------------------------------------------------------------- /shared/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "kotlin-native-shared" -------------------------------------------------------------------------------- /samples/androidNativeActivity/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | -------------------------------------------------------------------------------- /extracted/konan.metadata/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "konan.metadata" 2 | -------------------------------------------------------------------------------- /extracted/konan.serializer/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "konan.serializer" 2 | -------------------------------------------------------------------------------- /samples/calculator/arithmeticParser/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | -------------------------------------------------------------------------------- /samples/torch/src/nativeInterop/cinterop/torch.def: -------------------------------------------------------------------------------- 1 | headers = TH/TH.h THNN/THNN.h 2 | -------------------------------------------------------------------------------- /performance/src/main/kotlin-jvm/cleanup.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.ring 2 | 3 | fun cleanup() { } -------------------------------------------------------------------------------- /samples/tensorflow/src/nativeInterop/cinterop/tensorflow.def: -------------------------------------------------------------------------------- 1 | headers = tensorflow/c/c_api.h 2 | -------------------------------------------------------------------------------- /samples/tetris/src/tetrisMain/resources/config.txt: -------------------------------------------------------------------------------- 1 | width = 10 2 | height = 30 3 | startLevel = 0 -------------------------------------------------------------------------------- /samples/curl/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/objc/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /backend.native/tests/link/versioning/empty.kt: -------------------------------------------------------------------------------- 1 | /* This file has intentionally been left blank */ 2 | 3 | -------------------------------------------------------------------------------- /samples/csvparser/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/gitchurn/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/libcurl/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/opengl/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/torch/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/uikit/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/win32/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/workers/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/entry4.kt: -------------------------------------------------------------------------------- 1 | fun main() { 2 | println("This is main without args") 3 | } 4 | -------------------------------------------------------------------------------- /platformLibs/src/platform/linux/iconv.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | package = platform.iconv 3 | headers = iconv.h 4 | -------------------------------------------------------------------------------- /samples/echoServer/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/globalState/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/html5Canvas/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/tensorflow/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/videoplayer/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/calculator/cliApp/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/calculator/androidApp/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /samples/nonBlockingEchoServer/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /backend.native/tests/link/versioning/hello.kt: -------------------------------------------------------------------------------- 1 | fun main(args: Array) { 2 | println("Hello, versioned world!") 3 | } 4 | -------------------------------------------------------------------------------- /licenses/third_party/xcode_license.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/licenses/third_party/xcode_license.pdf -------------------------------------------------------------------------------- /tools/kotlin-native-gradle-plugin/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "kotlin-native-gradle-plugin" 2 | includeBuild '../../shared' 3 | -------------------------------------------------------------------------------- /licenses/third_party/harmony_LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/licenses/third_party/harmony_LICENSE.txt -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/set_depends.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ../../../../dist/bin/run_konan defFileDependencies -target macos_x64 *.def 3 | -------------------------------------------------------------------------------- /samples/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /performance/src/main/kotlin-jvm/FakeKonanNamespace.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.ring 2 | 3 | class konan { 4 | annotation class ThreadLocal 5 | } -------------------------------------------------------------------------------- /samples/zephyr/prj.conf: -------------------------------------------------------------------------------- 1 | CONFIG_CPLUSPLUS=n 2 | CONFIG_PRINTK=y 3 | CONFIG_BOOT_BANNER=y 4 | CONFIG_BUILD_OUTPUT_BIN=y 5 | CONFIG_NEWLIB_LIBC=y 6 | -------------------------------------------------------------------------------- /performance/src/main/kotlin-native/cleanup.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.ring 2 | 3 | import kotlin.native.internal.GC 4 | 5 | fun cleanup() { GC.collect() } -------------------------------------------------------------------------------- /samples/gtk/gradle.properties: -------------------------------------------------------------------------------- 1 | org.jetbrains.kotlin.native.jvmArgs=-Xmx8g 2 | kotlin.code.style=official 3 | kotlin.import.noCommonSourceSets=true 4 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/iconv.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | package = platform.iconv 3 | headers = iconv.h 4 | headerFilter = ** 5 | linkerOpts = -liconv 6 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/iconv.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | package = platform.iconv 3 | headers = iconv.h 4 | headerFilter = ** 5 | linkerOpts = -liconv 6 | -------------------------------------------------------------------------------- /samples/calculator/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) 4 | 5 | $DIR/../gradlew -p $DIR assemble 6 | -------------------------------------------------------------------------------- /platformLibs/src/platform/android/glesCommon.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | package = platform.glescommon 3 | headers = KHR/khrplatform.h 4 | headerFilter = KHR/** 5 | -------------------------------------------------------------------------------- /samples/calculator/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | 3 | # Use custom Kotlin/Native home: 4 | org.jetbrains.kotlin.native.home=../../../dist 5 | -------------------------------------------------------------------------------- /samples/calculator/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /MULTIPLATFORM.md: -------------------------------------------------------------------------------- 1 | Please refer to the tutorial at https://kotlinlang.org/docs/reference/multiplatform.html for documentation on how to create multiplatform project. 2 | -------------------------------------------------------------------------------- /samples/androidNativeActivity/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd ) 4 | 5 | $DIR/../gradlew -p $DIR assemble 6 | -------------------------------------------------------------------------------- /samples/tetris/src/tetrisMain/resources/tetris_all.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/tetris/src/tetrisMain/resources/tetris_all.bmp -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/set_depends.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ../../../../dist/bin/run_konan defFileDependencies -target ios_arm32 -target ios_arm64 -target ios_x64 *.def 3 | -------------------------------------------------------------------------------- /samples/videoplayer/src/nativeInterop/cinterop/sdl.def: -------------------------------------------------------------------------------- 1 | package = sdl 2 | headers = SDL.h 3 | entryPoint = SDL_main 4 | 5 | headerFilter = SDL* 6 | 7 | linkerOpts = -lSDL2 8 | -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/cstdio.def: -------------------------------------------------------------------------------- 1 | headers = stdio.h 2 | compilerOpts.osx = -D_ANSI_SOURCE 3 | 4 | --- 5 | 6 | static inline FILE* getStdout() { 7 | return stdout; 8 | } -------------------------------------------------------------------------------- /samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/arm32Main/assets/kotlin_logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/androidNativeActivity/src/arm32Main/assets/kotlin_logo.bmp -------------------------------------------------------------------------------- /backend.native/compiler/ir/backend.native/resources/META-INF/services/org.jetbrains.kotlin.resolve.ExternalOverridabilityCondition: -------------------------------------------------------------------------------- 1 | org.jetbrains.kotlin.backend.konan.ObjCOverridabilityCondition 2 | -------------------------------------------------------------------------------- /platformLibs/src/platform/android/egl.def: -------------------------------------------------------------------------------- 1 | depends = glesCommon posix 2 | package = platform.egl 3 | headers = EGL/egl.h EGL/eglext.h EGL/eglplatform.h 4 | headerFilter = EGL/** 5 | linkerOpts = -lEGL -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/arm32Main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | KonanActivity 4 | 5 | -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /platformLibs/src/platform/android/gles.def: -------------------------------------------------------------------------------- 1 | depends = glesCommon posix 2 | package = platform.gles 3 | headers = GLES/gl.h GLES/glext.h GLES/glplatform.h 4 | headerFilter = GLES/** 5 | linkerOpts = -lGLESv1_CM -------------------------------------------------------------------------------- /platformLibs/src/platform/mingw/opengl32.def: -------------------------------------------------------------------------------- 1 | package = platform.opengl32 2 | headers = GL/gl.h GL/glext.h 3 | headerFilter = GL/gl.h GL/glext.h 4 | compilerOpts = -DUNICODE 5 | linkerOpts = -lopengl32 6 | -------------------------------------------------------------------------------- /runtime/src/main/cpp/snprintf/COPYING: -------------------------------------------------------------------------------- 1 | UNLESS SPECIFIED OTHERWISE IN THE INDIVIDUAL SOURCE FILES INCLUDED WITH 2 | THIS PACKAGE, they may freely be used, modified and/or redistributed for 3 | any purpose. 4 | -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/tetris/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlin.import.noCommonSourceSets=true 3 | 4 | # Uncomment if you would like to build for RaspberryPi: 5 | #tetris.raspberrypi.build=true 6 | -------------------------------------------------------------------------------- /platformLibs/src/platform/android/gles3.def: -------------------------------------------------------------------------------- 1 | depends = glesCommon posix 2 | package = platform.gles3 3 | headers = GLES3/gl3.h GLES3/gl3ext.h GLES3/gl3platform.h 4 | headerFilter = GLES3/** 5 | linkerOpts = -lGLESv3 -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /backend.native/tests/helpers.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package helpers -------------------------------------------------------------------------------- /platformLibs/src/platform/android/gles2.def: -------------------------------------------------------------------------------- 1 | depends = glesCommon posix 2 | package = platform.gles2 3 | headers = GLES2/gl2.h GLES2/gl2ext.h GLES2/gl2platform.h 4 | headerFilter = GLES2/** 5 | linkerOpts = -lGLESv2 6 | -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/arm32Main/res/mipmap-hdpi/konan_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/androidNativeActivity/src/arm32Main/res/mipmap-hdpi/konan_activity.png -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/arm32Main/res/mipmap-mdpi/konan_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/androidNativeActivity/src/arm32Main/res/mipmap-mdpi/konan_activity.png -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/arm32Main/res/mipmap-xhdpi/konan_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/androidNativeActivity/src/arm32Main/res/mipmap-xhdpi/konan_activity.png -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/calculator/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/arm32Main/res/mipmap-xxhdpi/konan_activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjoernQ/kotlin-native/master/samples/androidNativeActivity/src/arm32Main/res/mipmap-xxhdpi/konan_activity.png -------------------------------------------------------------------------------- /samples/weather_function/weather.yml: -------------------------------------------------------------------------------- 1 | provider: 2 | name: faas 3 | gateway: http://127.0.0.1:8080 4 | 5 | functions: 6 | function: 7 | lang: dockerfile 8 | handler: function 9 | image: weather 10 | -------------------------------------------------------------------------------- /samples/win32/README.md: -------------------------------------------------------------------------------- 1 | # WIN32 Hello World 2 | 3 | To build use `..\gradlew assemble`. 4 | 5 | To run use `..\gradlew runProgram` or execute the program directly: 6 | 7 | `.\build\exe\main\release\MessageBox.exe`. 8 | -------------------------------------------------------------------------------- /platformLibs/src/platform/android/omxal.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | package = platform.omxal 3 | headers = OMXAL/OpenMAXAL.h OMXAL/OpenMAXAL_Android.h OMXAL/OpenMAXAL_Platform.h 4 | headerFilter = OMXAL/** 5 | linkerOpts = -lOpenMAXAL -------------------------------------------------------------------------------- /samples/weather_function/function/curl.def: -------------------------------------------------------------------------------- 1 | package = curl 2 | headers = curl.h 3 | linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -lcurl 4 | compilerOpts = -std=c89 5 | compilerOpts.linux = -I/usr/include/x86_64-linux-gnu/curl 6 | -------------------------------------------------------------------------------- /samples/gradle.properties: -------------------------------------------------------------------------------- 1 | # Run parallel builds in Gradle: 2 | org.gradle.parallel=true 3 | 4 | # Pin Kotlin version: 5 | kotlin_version=1.3.10 6 | 7 | # Use custom Kotlin/Native home: 8 | org.jetbrains.kotlin.native.home=../../dist 9 | -------------------------------------------------------------------------------- /backend.native/tests/link/omit/lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package foo 7 | fun foo() {} 8 | -------------------------------------------------------------------------------- /samples/gitchurn/src/nativeInterop/cinterop/libgit2.def: -------------------------------------------------------------------------------- 1 | headers = git2.h 2 | linkerOpts.osx = -L/opt/local/lib -L/usr/local/lib -lgit2 3 | linkerOpts.linux = -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lgit2 4 | headerFilter = git2/** git2.h 5 | -------------------------------------------------------------------------------- /backend.native/tests/external/codegen/box/properties/lateinit/accessor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | -------------------------------------------------------------------------------- /backend.native/tests/interop/objc/objcSmoke.def: -------------------------------------------------------------------------------- 1 | language = Objective-C 2 | headers = Foundation/NSArray.h Foundation/NSValue.h Foundation/NSString.h 3 | headerFilter = **/smoke.h Foundation/NSArray.h Foundation/NSValue.h Foundation/NSString.h 4 | -------------------------------------------------------------------------------- /platformLibs/src/platform/mingw/gdiplus.def: -------------------------------------------------------------------------------- 1 | depends = windows posix 2 | package = platform.gdiplus 3 | headers = wtypes.h minwindef.h wtypes.h gdiplus/gdiplus.h 4 | headerFilter = gdiplus/** 5 | compilerOpts = -DUNICODE 6 | linkerOpts = -lgdiplus -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Konan Calculator 3 | Enter mathematical expression: 4 | 5 | -------------------------------------------------------------------------------- /samples/weather_function/function/cjson.def: -------------------------------------------------------------------------------- 1 | package = cjson 2 | headers = cJSON.h 3 | compilerOpts = -std=c89 4 | compilerOpts.linux = -I/app/lib/cJSON-1.7.7/include 5 | staticLibraries = libcjson.a 6 | libraryPaths = /app/lib/cJSON-1.7.7/lib 7 | -------------------------------------------------------------------------------- /samples/uikit/konan.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CommonCrypto.def: -------------------------------------------------------------------------------- 1 | depends = darwin posix 2 | language = Objective-C 3 | package = platform.CoreCrypto 4 | headers = CommonCrypto/CommonCrypto.h 5 | 6 | headerFilter = CommonCrypto/** 7 | 8 | compilerOpts = -D_XOPEN_SOURCE 9 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CommonCrypto.def: -------------------------------------------------------------------------------- 1 | depends = darwin posix 2 | language = Objective-C 3 | package = platform.CoreCrypto 4 | headers = CommonCrypto/CommonCrypto.h 5 | 6 | headerFilter = CommonCrypto/** 7 | 8 | compilerOpts = -D_XOPEN_SOURCE 9 | -------------------------------------------------------------------------------- /backend.native/tests/serialization/char_const.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | inline fun foo(x: Char = '\u042b') = x 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/OpenAL.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | language = Objective-C 3 | package = platform.OpenAL 4 | headers = OpenAL/OpenAL.h 5 | 6 | headerFilter = OpenAL/** 7 | 8 | compilerOpts = -framework OpenAL 9 | linkerOpts = -framework OpenAL 10 | -------------------------------------------------------------------------------- /samples/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/extension.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | class B(val a: Int) 7 | 8 | fun B.foo() = this.a -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/GSS.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.GSS 4 | headers = GSS/GSS.h 5 | 6 | headerFilter = GSS/** 7 | 8 | compilerOpts = -framework GSS 9 | linkerOpts = -framework GSS 10 | -------------------------------------------------------------------------------- /backend.native/tests/link/omit/hello.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | println("Hello") 8 | } 9 | -------------------------------------------------------------------------------- /samples/calculator/iosApp/calculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/libcurl/src/nativeInterop/cinterop/libcurl.def: -------------------------------------------------------------------------------- 1 | headers = curl/curl.h 2 | headerFilter = curl/* 3 | linkerOpts.osx = -L/opt/local/lib -L/usr/local/opt/curl/lib -lcurl 4 | linkerOpts.linux = -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lcurl 5 | linkerOpts.mingw = -lcurl 6 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/propertyCallableReference/linkTest_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package a 7 | 8 | class A(val x: Int) -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/structs.kt: -------------------------------------------------------------------------------- 1 | import kotlinx.cinterop.* 2 | import kotlin.test.* 3 | import cstructs.* 4 | 5 | fun main() { 6 | getStructWithConstFields().useContents { 7 | assertEquals(111, x) 8 | assertEquals(222, y) 9 | } 10 | } -------------------------------------------------------------------------------- /backend.native/tests/link/purge1/prog.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | 7 | fun main(args: Array) { 8 | foo() 9 | } 10 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/assert_failed.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | assert(false) 8 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/assert_passed.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | assert(true) 8 | } -------------------------------------------------------------------------------- /backend.native/tests/serialization/prop.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | println(666.prop) 8 | } 9 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/GLUT.def: -------------------------------------------------------------------------------- 1 | depends = OpenGL OpenGLCommon darwin posix 2 | language = Objective-C 3 | package = platform.GLUT 4 | headers = GLUT/glut.h 5 | 6 | headerFilter = GLUT/** 7 | 8 | compilerOpts = -framework GLUT 9 | linkerOpts = -framework GLUT 10 | -------------------------------------------------------------------------------- /samples/calculator/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/WithLogger.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.konan.util 2 | 3 | typealias Logger = (String) -> Unit 4 | 5 | interface WithLogger { 6 | val logger: Logger 7 | } 8 | 9 | fun dummyLogger(message: String) {} 10 | 11 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/entry2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | fail() 8 | } 9 | 10 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/readline1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | print(readLine()!!) 8 | } -------------------------------------------------------------------------------- /backend.native/tests/serialization/use.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | 7 | fun main(args: Array) { 8 | foo() 9 | } 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/OpenGLCommon.def: -------------------------------------------------------------------------------- 1 | depends = darwin posix 2 | language = Objective-C 3 | package = platform.OpenGLCommon 4 | headers = OpenGL/OpenGL.h 5 | 6 | headerFilter = OpenGL/** 7 | 8 | compilerOpts = -framework OpenGL 9 | linkerOpts = -framework OpenGL 10 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/readline0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | print(readLine()!!.toInt()) 8 | } -------------------------------------------------------------------------------- /backend.native/tests/serialization/use_char_const.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | println(foo()) 8 | } 9 | -------------------------------------------------------------------------------- /runtime/src/launcher/js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /samples/tetris/src/nativeInterop/cinterop/sdl.def: -------------------------------------------------------------------------------- 1 | headers = SDL.h stdlib.h time.h 2 | entryPoint = SDL_main 3 | 4 | headerFilter = SDL* stdlib.h time.h 5 | 6 | compilerOpts = -D_POSIX_SOURCE 7 | compilerOpts.osx = 8 | compilerOpts.linux = -D_REENTRANT 9 | compilerOpts.ios = 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/defaultArgs_linkTest_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package a 7 | 8 | inline fun foo(x: Int, y: Int = 117) = x + y -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/OpenGLESCommon.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | language = Objective-C 3 | package = platform.glescommon 4 | headers = OpenGLES/gltypes.h 5 | 6 | headerFilter = OpenGLES/gltypes.h 7 | 8 | compilerOpts = -framework OpenGLES 9 | linkerOpts = -framework OpenGLES 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/reflect/KFunction.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.reflect 7 | 8 | interface KFunction : KCallable 9 | -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import cstdio.* 7 | 8 | fun main(args: Array) { 9 | puts("Hello") 10 | } -------------------------------------------------------------------------------- /backend.native/tests/link/lib/foo.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package qwerty 7 | 8 | fun foo(a: Int): Int { 9 | return a 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /backend.native/tests/link/lib/foo2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package qwerty 7 | 8 | fun foo2(a: Int): Int { 9 | return a 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /platformLibs/src/platform/android/sles.def: -------------------------------------------------------------------------------- 1 | depends = posix 2 | package = platform.sles 3 | headers = SLES//OpenSLES.h SLES/OpenSLES_Android.h SLES/OpenSLES_AndroidConfiguration.h \ 4 | SLES/OpenSLES_AndroidMetadata.h SLES/OpenSLES_Platform.h 5 | headerFilter = SLES/** 6 | linkerOpts = -lOpenSLES 7 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Network.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation Security darwin posix 2 | language = Objective-C 3 | package = platform.Network 4 | headers = Network/Network.h 5 | 6 | headerFilter = Network/** 7 | 8 | compilerOpts = -framework Network 9 | linkerOpts = -framework Network 10 | -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/arm32Main/kotlin/BMPHeader.kt: -------------------------------------------------------------------------------- 1 | package sample.androidnative 2 | 3 | import kotlinx.cinterop.* 4 | import sample.androidnative.bmpformat.BMPHeader 5 | 6 | val BMPHeader.data 7 | get() = (ptr.reinterpret() + sizeOf()) as CArrayPointer 8 | -------------------------------------------------------------------------------- /samples/globalState/src/nativeInterop/cinterop/global.def: -------------------------------------------------------------------------------- 1 | package = sample.globalstate 2 | 3 | --- 4 | typedef struct { 5 | int x; 6 | float f; 7 | char* string; 8 | void* kotlinObject; 9 | void* frozenKotlinObject; 10 | } SharedDataStruct; 11 | 12 | SharedDataStruct sharedData; 13 | -------------------------------------------------------------------------------- /shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/TargetDefFile.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.konan.util 2 | 3 | import org.jetbrains.kotlin.konan.target.KonanTarget 4 | import java.io.File 5 | 6 | fun DefFile(file: File?, target: KonanTarget) = DefFile(file, defaultTargetSubstitutions(target)) 7 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/companion.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | class A { 7 | companion object { 8 | fun foo() = "comp" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/cstructs.def: -------------------------------------------------------------------------------- 1 | --- 2 | // KT-28065 3 | struct StructWithConstFields { 4 | int x; 5 | const int y; 6 | }; 7 | 8 | struct StructWithConstFields getStructWithConstFields() { 9 | struct StructWithConstFields result = { 111, 222 }; 10 | return result; 11 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CFNetwork.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.CFNetwork 4 | headers = CFNetwork/CFNetwork.h 5 | 6 | headerFilter = CFNetwork/** 7 | 8 | compilerOpts = -framework CFNetwork 9 | linkerOpts = -framework CFNetwork 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/ImageIO.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation CoreGraphics darwin posix 2 | language = Objective-C 3 | package = platform.ImageIO 4 | headers = ImageIO/ImageIO.h 5 | 6 | headerFilter = ImageIO/** 7 | 8 | compilerOpts = -framework ImageIO 9 | linkerOpts = -framework ImageIO 10 | -------------------------------------------------------------------------------- /samples/weather_function/.gitignore: -------------------------------------------------------------------------------- 1 | # Additional files/dirs to unignore. 2 | 3 | # Additional files/dirs to ignore. 4 | c_interop/ 5 | *.kexe 6 | *.bak 7 | openweathermap_key.txt 8 | temp.txt 9 | temp.json 10 | .gradle/ 11 | build/ 12 | weather 13 | .konan/ 14 | gradle/ 15 | gradlew 16 | template/ 17 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreAudio.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.CoreAudio 4 | headers = CoreAudio/CoreAudioTypes.h 5 | 6 | headerFilter = CoreAudio/** 7 | 8 | compilerOpts = -framework CoreAudio 9 | linkerOpts = -framework CoreAudio 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreText.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation CoreGraphics darwin posix 2 | language = Objective-C 3 | package = platform.CoreText 4 | headers = CoreText/CoreText.h 5 | 6 | headerFilter = CoreText/** 7 | 8 | compilerOpts = -framework CoreText 9 | linkerOpts = -framework CoreText 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/OpenGL.def: -------------------------------------------------------------------------------- 1 | depends = OpenGLCommon darwin posix 2 | language = Objective-C 3 | package = platform.OpenGL 4 | headers = OpenGL/glu.h 5 | 6 | headerFilter = OpenGL/gl.h OpenGL/glext.h OpenGL/glu.h 7 | 8 | compilerOpts = -framework OpenGL 9 | linkerOpts = -framework OpenGL 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/native/internal/KonanRuntimeTypes.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.native.internal 7 | 8 | 9 | internal class FunctionReference -------------------------------------------------------------------------------- /backend.native/tests/codegen/innerClass/linkTest_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | open class A { 7 | open inner class Inner { 8 | val x = 42 9 | } 10 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/args0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args : Array) { 7 | for (s in args) { 8 | println(s) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/memory/only_gc.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | kotlin.native.internal.GC.collect() 8 | } 9 | 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Metal.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation IOSurface Security darwin posix 2 | language = Objective-C 3 | package = platform.Metal 4 | headers = Metal/Metal.h 5 | 6 | headerFilter = Metal/** 7 | 8 | compilerOpts = -framework Metal 9 | linkerOpts = -framework Metal 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/IOKit.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin libkern posix 2 | language = Objective-C 3 | package = platform.IOKit 4 | headers = IOKit/IOKitLib.h IOKit/hidsystem/IOLLEvent.h 5 | 6 | headerFilter = IOKit/** 7 | 8 | compilerOpts = -framework IOKit 9 | linkerOpts = -framework IOKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/OpenGL3.def: -------------------------------------------------------------------------------- 1 | depends = OpenGLCommon darwin posix 2 | language = Objective-C 3 | package = platform.OpenGL3 4 | headers = OpenGL/gl3.h OpenGL/gl3ext.h 5 | 6 | headerFilter = OpenGL/gl3.h OpenGL/gl3ext.h 7 | 8 | compilerOpts = -framework OpenGL 9 | linkerOpts = -framework OpenGL 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/AddressBook.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.AddressBook 4 | headers = AddressBook/AddressBook.h 5 | 6 | headerFilter = AddressBook/** 7 | 8 | compilerOpts = -framework AddressBook 9 | linkerOpts = -framework AddressBook 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CallKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CallKit 4 | headers = CallKit/CallKit.h 5 | 6 | headerFilter = CallKit/** 7 | 8 | compilerOpts = -framework CallKit 9 | linkerOpts = -framework CallKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreNFC.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreNFC 4 | headers = CoreNFC/CoreNFC.h 5 | 6 | headerFilter = CoreNFC/** 7 | 8 | compilerOpts = -framework CoreNFC 9 | linkerOpts = -framework CoreNFC 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/OpenGLES.def: -------------------------------------------------------------------------------- 1 | depends = EAGL OpenGLESCommon darwin posix 2 | language = Objective-C 3 | package = platform.gles 4 | headers = OpenGLES/ES1/gl.h OpenGLES/ES1/glext.h 5 | 6 | headerFilter = OpenGLES/ES1/** 7 | 8 | compilerOpts = -framework OpenGLES 9 | linkerOpts = -framework OpenGLES 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/PushKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.PushKit 4 | headers = PushKit/PushKit.h 5 | 6 | headerFilter = PushKit/** 7 | 8 | compilerOpts = -framework PushKit 9 | linkerOpts = -framework PushKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/ImageIO.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation CoreGraphics IOKit darwin libkern posix 2 | language = Objective-C 3 | package = platform.ImageIO 4 | headers = ImageIO/ImageIO.h 5 | 6 | headerFilter = ImageIO/** 7 | 8 | compilerOpts = -framework ImageIO 9 | linkerOpts = -framework ImageIO 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/libkern.def: -------------------------------------------------------------------------------- 1 | depends = darwin posix 2 | language = Objective-C 3 | package = platform.libkern 4 | headers = libkern/OSTypes.h libkern/OSAtomic.h device/device_types.h device/device_types.h 5 | 6 | headerFilter = libkern/** device/** 7 | 8 | compilerOpts = -DIOKIT 9 | linkerOpts = 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/linkTest_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package a 7 | 8 | enum class A(val x: Int) { 9 | Z1(42), 10 | Z2(117), 11 | Z3(-1) 12 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/android/media.def: -------------------------------------------------------------------------------- 1 | depends = android posix 2 | package = platform.media 3 | headers = media/NdkMediaCodec.h media/NdkMediaCrypto.h media/NdkMediaDrm.h media/NdkMediaError.h \ 4 | media/NdkMediaExtractor.h media/NdkMediaFormat.h media/NdkMediaMuxer.h 5 | headerFilter = media/** 6 | linkerOpts = -lmediandk -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreGraphics.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.CoreGraphics 4 | headers = CoreGraphics/CoreGraphics.h 5 | 6 | headerFilter = CoreGraphics/** 7 | 8 | compilerOpts = -framework CoreGraphics 9 | linkerOpts = -framework CoreGraphics 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreServices.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.CoreServices 4 | headers = CoreServices/CoreServices.h 5 | 6 | headerFilter = CoreServices/** 7 | 8 | compilerOpts = -framework CoreServices 9 | linkerOpts = -framework CoreServices 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/OpenGLES2.def: -------------------------------------------------------------------------------- 1 | depends = EAGL OpenGLESCommon darwin posix 2 | language = Objective-C 3 | package = platform.gles2 4 | headers = OpenGLES/ES2/gl.h OpenGLES/ES2/glext.h 5 | 6 | headerFilter = OpenGLES/ES2/** 7 | 8 | compilerOpts = -framework OpenGLES 9 | linkerOpts = -framework OpenGLES 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/OpenGLES3.def: -------------------------------------------------------------------------------- 1 | depends = EAGL OpenGLESCommon darwin posix 2 | language = Objective-C 3 | package = platform.gles3 4 | headers = OpenGLES/ES3/gl.h OpenGLES/ES3/glext.h 5 | 6 | headerFilter = OpenGLES/ES3/** 7 | 8 | compilerOpts = -framework OpenGLES 9 | linkerOpts = -framework OpenGLES 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Security.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.Security 4 | headers = Security/Security.h Security/SecureTransport.h 5 | 6 | headerFilter = Security/** 7 | 8 | compilerOpts = -framework Security 9 | linkerOpts = -framework Security 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CoreText.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation CoreGraphics IOKit darwin libkern posix 2 | language = Objective-C 3 | package = platform.CoreText 4 | headers = CoreText/CoreText.h 5 | 6 | headerFilter = CoreText/** 7 | 8 | compilerOpts = -framework CoreText 9 | linkerOpts = -framework CoreText 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Accounts.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.Accounts 4 | headers = Accounts/Accounts.h 5 | 6 | headerFilter = Accounts/** 7 | 8 | compilerOpts = -framework Accounts 9 | linkerOpts = -framework Accounts 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/ClassKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.ClassKit 4 | headers = ClassKit/ClassKit.h 5 | 6 | headerFilter = ClassKit/** 7 | 8 | compilerOpts = -framework ClassKit 9 | linkerOpts = -framework ClassKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Contacts.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.Contacts 4 | headers = Contacts/Contacts.h 5 | 6 | headerFilter = Contacts/** 7 | 8 | compilerOpts = -framework Contacts 9 | linkerOpts = -framework Contacts 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreData.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreData 4 | headers = CoreData/CoreData.h 5 | 6 | headerFilter = CoreData/** 7 | 8 | compilerOpts = -framework CoreData 9 | linkerOpts = -framework CoreData 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreMIDI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreMIDI 4 | headers = CoreMIDI/CoreMIDI.h 5 | 6 | headerFilter = CoreMIDI/** 7 | 8 | compilerOpts = -framework CoreMIDI 9 | linkerOpts = -framework CoreMIDI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Foundation.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Security darwin posix 2 | language = Objective-C 3 | package = platform.Foundation 4 | headers = Foundation/Foundation.h 5 | 6 | headerFilter = Foundation/** 7 | 8 | compilerOpts = -framework Foundation 9 | linkerOpts = -framework Foundation 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/Contacts.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.Contacts 4 | headers = Contacts/Contacts.h 5 | 6 | headerFilter = Contacts/** 7 | 8 | compilerOpts = -framework Contacts 9 | linkerOpts = -framework Contacts 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/AdSupport.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.AdSupport 4 | headers = AdSupport/AdSupport.h 5 | 6 | headerFilter = AdSupport/** 7 | 8 | compilerOpts = -framework AdSupport 9 | linkerOpts = -framework AdSupport 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/HealthKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.HealthKit 4 | headers = HealthKit/HealthKit.h 5 | 6 | headerFilter = HealthKit/** 7 | 8 | compilerOpts = -framework HealthKit 9 | linkerOpts = -framework HealthKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Intents.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreLocation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.Intents 4 | headers = Intents/Intents.h 5 | 6 | headerFilter = Intents/** 7 | 8 | compilerOpts = -framework Intents 9 | linkerOpts = -framework Intents 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/ModelIO.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.ModelIO 4 | headers = ModelIO/ModelIO.h 5 | 6 | headerFilter = ModelIO/** 7 | 8 | compilerOpts = -framework ModelIO 9 | linkerOpts = -framework ModelIO 10 | -------------------------------------------------------------------------------- /Interop/Indexer/prebuilt/nativeInteropStubs/cpp/disable-abi-checks.cpp: -------------------------------------------------------------------------------- 1 | #ifdef __linux__ 2 | namespace llvm { 3 | /** 4 | * http://lists.llvm.org/pipermail/llvm-dev/2017-January/109621.html 5 | * We can't rebuild llvm, but we can define symbol missed in llvm build. 6 | */ 7 | int DisableABIBreakingChecks = 1; 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreMotion.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreMotion 4 | headers = CoreMotion/CoreMotion.h 5 | 6 | headerFilter = CoreMotion/** 7 | 8 | compilerOpts = -framework CoreMotion 9 | linkerOpts = -framework CoreMotion 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/EAGL.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.EAGL 4 | headers = OpenGLES/EAGL.h OpenGLES/EAGLDrawable.h 5 | 6 | headerFilter = OpenGLES/** 7 | 8 | compilerOpts = -framework OpenGLES 9 | linkerOpts = -framework OpenGLES 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CoreGraphics.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation IOKit darwin libkern posix 2 | language = Objective-C 3 | package = platform.CoreGraphics 4 | headers = CoreGraphics/CoreGraphics.h 5 | 6 | headerFilter = CoreGraphics/** 7 | 8 | compilerOpts = -framework CoreGraphics 9 | linkerOpts = -framework CoreGraphics 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/object/constructor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`object`.constructor 7 | 8 | class A() 9 | 10 | class B(val a:Int) 11 | 12 | class C(val a:Int, b:Int) -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreML.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreVideo Foundation IOSurface Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreML 4 | headers = CoreML/CoreML.h 5 | 6 | headerFilter = CoreML/** 7 | 8 | compilerOpts = -framework CoreML 9 | linkerOpts = -framework CoreML 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/test/Utils.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.test 7 | 8 | @PublishedApi 9 | internal fun messagePrefix(message: String?) = if (message == null) "" else "$message. " -------------------------------------------------------------------------------- /backend.native/tests/codegen/bridges/linkTest2_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | val test: TagBoolean = TagBoolean.True 8 | println(test.value()) 9 | } 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/defaultArgs_linkTest_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import a.* 7 | 8 | fun main(args: Array) { 9 | println(foo(5)) 10 | println(foo(5, 42)) 11 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/driver0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | // TODO: remove kotlin_native.io once overrides are in place. 7 | fun main(args : Array) { 8 | println("Hello, world!") 9 | } -------------------------------------------------------------------------------- /backend.native/tests/serialization/do_while.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | 7 | inline fun foo() { 8 | do { 9 | var x: Int = 999 10 | println(x) 11 | } while (x != 999) 12 | } 13 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CloudKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork Contacts CoreFoundation CoreLocation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CloudKit 4 | headers = CloudKit/CloudKit.h 5 | 6 | headerFilter = CloudKit/** 7 | 8 | compilerOpts = -framework CloudKit 9 | linkerOpts = -framework CloudKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/DeviceCheck.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.DeviceCheck 4 | headers = DeviceCheck/DeviceCheck.h 5 | 6 | headerFilter = DeviceCheck/** 7 | 8 | compilerOpts = -framework DeviceCheck 9 | linkerOpts = -framework DeviceCheck 10 | -------------------------------------------------------------------------------- /samples/uikit/konan.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /backend.native/tests/link/src/bar.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import qwerty.* 7 | 8 | fun main(args: Array) { 9 | val size = foo(foo2(args.size)) 10 | println(size.toString()) 11 | } 12 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/hello0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.hello0 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | println("Hello, world!") 12 | } 13 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreLocation.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreLocation 4 | headers = CoreLocation/CoreLocation.h 5 | 6 | headerFilter = CoreLocation/** 7 | 8 | compilerOpts = -framework CoreLocation 9 | linkerOpts = -framework CoreLocation 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/NewsstandKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.NewsstandKit 4 | headers = NewsstandKit/NewsstandKit.h 5 | 6 | headerFilter = NewsstandKit/** 7 | 8 | compilerOpts = -framework NewsstandKit 9 | linkerOpts = -framework NewsstandKit 10 | -------------------------------------------------------------------------------- /samples/globalState/README.md: -------------------------------------------------------------------------------- 1 | # Shared global state 2 | 3 | This example shows how one could implement global shared state using interop mechanisms. 4 | 5 | To build use `../gradlew assemble`. 6 | 7 | To run use `../gradlew runProgram` or execute the program directly: 8 | 9 | ./build/bin/globalState/main/release/executable/globalState.kexe 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/sum_mixed.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.sum_mixed 7 | 8 | import kotlin.test.* 9 | 10 | // FIXME: has no checks 11 | fun sum(a:Float, b:Int) = a + b -------------------------------------------------------------------------------- /backend.native/tests/codegen/object/globalInitializer.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | // Does not fail with TR. 7 | 8 | public val z: Any = Z 9 | 10 | private object Z 11 | 12 | fun main(args: Array) { } -------------------------------------------------------------------------------- /backend.native/tests/datagen/literals/empty_string.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package datagen.literals.empty_string 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | println("") 12 | } 13 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MetalPerformanceShaders.def.disabled: -------------------------------------------------------------------------------- 1 | language = Objective-C 2 | package = platform.MetalPerformanceShaders 3 | headers = MetalPerformanceShaders/MetalPerformanceShaders.h 4 | 5 | headerFilter = MetalPerformanceShaders/** 6 | 7 | compilerOpts = -framework MetalPerformanceShaders 8 | linkerOpts = -framework MetalPerformanceShaders 9 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/DiskArbitration.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation IOKit darwin libkern posix 2 | language = Objective-C 3 | package = platform.DiskArbitration 4 | headers = DiskArbitration/DiskArbitration.h 5 | 6 | headerFilter = DiskArbitration/** 7 | 8 | compilerOpts = -framework DiskArbitration 9 | linkerOpts = -framework DiskArbitration 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/native/internal/DefaultConstructorMarker.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.native.internal 7 | 8 | @ExportForCompiler 9 | internal object DefaultConstructorMarker; 10 | -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/unit1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.basics.unit1 7 | 8 | import kotlin.test.* 9 | 10 | @Test 11 | fun runTest() { 12 | println(println("First").toString()) 13 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package zzz 7 | 8 | open class B { 9 | val z by lazy { "qzz" } 10 | val x = 117 11 | val zzz = "zzz" 12 | } -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/unsupported.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import kotlin.test.* 7 | import cunsupported.* 8 | 9 | fun main(args: Array) { 10 | noAttr() 11 | noTargetAttr() 12 | } 13 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreBluetooth.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreBluetooth 4 | headers = CoreBluetooth/CoreBluetooth.h 5 | 6 | headerFilter = CoreBluetooth/** 7 | 8 | compilerOpts = -framework CoreBluetooth 9 | linkerOpts = -framework CoreBluetooth 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreSpotlight.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreSpotlight 4 | headers = CoreSpotlight/CoreSpotlight.h 5 | 6 | headerFilter = CoreSpotlight/** 7 | 8 | compilerOpts = -framework CoreSpotlight 9 | linkerOpts = -framework CoreSpotlight 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/EventKit.def: -------------------------------------------------------------------------------- 1 | depends = AddressBook CFNetwork CoreFoundation CoreGraphics CoreLocation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.EventKit 4 | headers = EventKit/EventKit.h 5 | 6 | headerFilter = EventKit/** 7 | 8 | compilerOpts = -framework EventKit 9 | linkerOpts = -framework EventKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/QuartzCore.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics EAGL Foundation Metal Security darwin posix 2 | language = Objective-C 3 | package = platform.QuartzCore 4 | headers = QuartzCore/QuartzCore.h 5 | 6 | headerFilter = QuartzCore/** 7 | 8 | compilerOpts = -framework QuartzCore 9 | linkerOpts = -framework QuartzCore 10 | -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/KonanMetadataReader.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.konan.library 2 | 3 | interface MetadataReader { 4 | fun loadSerializedModule(libraryLayout: KonanLibraryLayout): ByteArray 5 | fun loadSerializedPackageFragment(libraryLayout: KonanLibraryLayout, fqName: String, partName: String): ByteArray 6 | } 7 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/bridges/linkTest_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package a 7 | 8 | interface A { 9 | fun foo(): T 10 | } 11 | 12 | open class C: A { 13 | override fun foo(): Int = 42 14 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/controlflow/for_loops_array_mutation.kt: -------------------------------------------------------------------------------- 1 | package codegen.controlflow.for_loops_array_mutation 2 | 3 | import kotlin.test.* 4 | 5 | @Test fun runTest() { 6 | val intArray = arrayOf(4, 0, 3, 5) 7 | 8 | for (element in intArray) { 9 | intArray[2] = 0 10 | intArray[3] = 0 11 | print(element) 12 | } 13 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/innerClass/linkTest_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | open class B : A() { 7 | open inner class Inner : A.Inner() 8 | } 9 | 10 | fun main(args: Array) { 11 | B().Inner() 12 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/main_exception.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.main_exception 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | throw Error("Hello!") 12 | } 13 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/FileProvider.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.FileProvider 4 | headers = FileProvider/FileProvider.h 5 | 6 | headerFilter = FileProvider/** 7 | 8 | compilerOpts = -framework FileProvider 9 | linkerOpts = -framework FileProvider 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/IdentityLookup.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.IdentityLookup 4 | headers = IdentityLookup/IdentityLookup.h 5 | 6 | headerFilter = IdentityLookup/** 7 | 8 | compilerOpts = -framework IdentityLookup 9 | linkerOpts = -framework IdentityLookup 10 | -------------------------------------------------------------------------------- /samples/calculator/iosApp/calculator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/linkTest_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import a.* 7 | 8 | fun main(args: Array) { 9 | println(A.Z1.x) 10 | println(A.valueOf("Z2").x) 11 | println(A.values()[2].x) 12 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/mpp/mpp2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun main(args: Array) { 7 | println(C(42)) 8 | println(C(42) is T) 9 | println(f(1)) 10 | 11 | p = "h" 12 | println(p) 13 | } 14 | -------------------------------------------------------------------------------- /backend.native/tests/lower/vararg.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package lower.vararg 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(vararg x: Any?) {} 11 | fun bar() = foo() 12 | 13 | @Test fun runTest() { 14 | bar() 15 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Accelerate.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation CoreGraphics CoreVideo IOSurface darwin posix 2 | language = Objective-C 3 | package = platform.Accelerate 4 | headers = Accelerate/Accelerate.h 5 | 6 | headerFilter = Accelerate/** vecLib/** **/vecLib.h vImage/** 7 | 8 | compilerOpts = -framework Accelerate 9 | linkerOpts = -framework Accelerate 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/AssetsLibrary.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.AssetsLibrary 4 | headers = AssetsLibrary/AssetsLibrary.h 5 | 6 | headerFilter = AssetsLibrary/** 7 | 8 | compilerOpts = -framework AssetsLibrary 9 | linkerOpts = -framework AssetsLibrary 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/SystemConfiguration.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.SystemConfiguration 4 | headers = SystemConfiguration/SystemConfiguration.h 5 | 6 | headerFilter = SystemConfiguration/** 7 | 8 | compilerOpts = -framework SystemConfiguration 9 | linkerOpts = -framework SystemConfiguration 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreFoundation.def: -------------------------------------------------------------------------------- 1 | depends = darwin posix 2 | language = Objective-C 3 | package = platform.CoreFoundation 4 | headers = CoreFoundation/CoreFoundation.h CoreFoundation/CFPlugIn.h CoreFoundation/CFPlugInCOM.h 5 | 6 | headerFilter = CoreFoundation/** 7 | 8 | compilerOpts = -framework CoreFoundation 9 | linkerOpts = -framework CoreFoundation 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreVideo.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics Foundation IOSurface Metal OpenGLESCommon Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreVideo 4 | headers = CoreVideo/CoreVideo.h 5 | 6 | headerFilter = CoreVideo/** 7 | 8 | compilerOpts = -framework CoreVideo 9 | linkerOpts = -framework CoreVideo 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MobileCoreServices.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation CoreServices darwin posix 2 | language = Objective-C 3 | package = platform.MobileCoreServices 4 | headers = MobileCoreServices/MobileCoreServices.h 5 | 6 | headerFilter = MobileCoreServices/** 7 | 8 | compilerOpts = -framework MobileCoreServices 9 | linkerOpts = -framework MobileCoreServices 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CoreFoundation.def: -------------------------------------------------------------------------------- 1 | depends = darwin posix 2 | language = Objective-C 3 | package = platform.CoreFoundation 4 | headers = CoreFoundation/CoreFoundation.h CoreFoundation/CFPlugIn.h CoreFoundation/CFPlugInCOM.h 5 | 6 | headerFilter = CoreFoundation/** 7 | 8 | compilerOpts = -framework CoreFoundation 9 | linkerOpts = -framework CoreFoundation 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/io/Serializable.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.io 7 | 8 | // TODO: This interface is a temporary solution for common collections and not used in Native. 9 | internal actual interface Serializable -------------------------------------------------------------------------------- /shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/UnresolvedLibrary.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.konan.library 2 | 3 | data class UnresolvedLibrary( 4 | val path: String, 5 | val libraryVersion: String?) { 6 | 7 | fun substitutePath(newPath: String): UnresolvedLibrary { 8 | return UnresolvedLibrary(newPath, libraryVersion) 9 | } 10 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/object/init0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`object`.init0 7 | 8 | import kotlin.test.* 9 | 10 | class A(a:Int) { 11 | var i:Int = 0 12 | init { 13 | if (a == 0) i = 1 14 | } 15 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/NetworkExtension.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.NetworkExtension 4 | headers = NetworkExtension/NetworkExtension.h 5 | 6 | headerFilter = NetworkExtension/** 7 | 8 | compilerOpts = -framework NetworkExtension 9 | linkerOpts = -framework NetworkExtension 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing15.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing15 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | println(foo(17)) 12 | } 13 | 14 | fun foo(x: T): Int = x -------------------------------------------------------------------------------- /backend.native/tests/codegen/branching/when6.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.branching.when6 7 | 8 | import kotlin.test.* 9 | 10 | fun foo() { 11 | } 12 | 13 | @Test fun runTest() { 14 | if (true) foo() else foo() 15 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/libentry2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun fail() { 7 | println("Test failed, this is a wrong main() function.") 8 | } 9 | 10 | fun foo(args: Array) { 11 | println("Hello.") 12 | } 13 | 14 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/ExternalAccessory.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.ExternalAccessory 4 | headers = ExternalAccessory/ExternalAccessory.h 5 | 6 | headerFilter = ExternalAccessory/** 7 | 8 | compilerOpts = -framework ExternalAccessory 9 | linkerOpts = -framework ExternalAccessory 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/JavaScriptCore.def.disabled: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.JavaScriptCore 4 | headers = JavaScriptCore/JavaScriptCore.h 5 | 6 | headerFilter = JavaScriptCore/** 7 | 8 | compilerOpts = -framework JavaScriptCore 9 | linkerOpts = -framework JavaScriptCore 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/UserNotifications.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.UserNotifications 4 | headers = UserNotifications/UserNotifications.h 5 | 6 | headerFilter = UserNotifications/** 7 | 8 | compilerOpts = -framework UserNotifications 9 | linkerOpts = -framework UserNotifications 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/WatchConnectivity.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.WatchConnectivity 4 | headers = WatchConnectivity/WatchConnectivity.h 5 | 6 | headerFilter = WatchConnectivity/** 7 | 8 | compilerOpts = -framework WatchConnectivity 9 | linkerOpts = -framework WatchConnectivity 10 | -------------------------------------------------------------------------------- /runtime/src/main/cpp/snprintf/AUTHORS: -------------------------------------------------------------------------------- 1 | Patrick Powell 2 | Brandon Long 3 | Thomas Roessler 4 | Michael Elkins 5 | Andrew Tridgell 6 | Russ Allbery 7 | Hrvoje Niksic 8 | Damien Miller 9 | Holger Weiss 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/mpp/mpp_optional_expectation.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("EXPERIMENTAL_API_USAGE_ERROR") 2 | 3 | import kotlin.js.* 4 | 5 | @OptionalExpectation 6 | expect annotation class Optional() 7 | 8 | @Optional 9 | fun foo() { println(42) } 10 | 11 | @JsName("jsBar") 12 | fun bar() { println(43) } 13 | 14 | fun main(args: Array) { 15 | foo() 16 | bar() 17 | } -------------------------------------------------------------------------------- /backend.native/tests/serialization/default_args.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | 7 | inline val Int.prop get() = SomeDataClass(second = this) 8 | 9 | data class SomeDataClass(val first: Int = 17, val second: Int = 19, val third: Int = 23) 10 | 11 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing14.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing14 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | 42.println() 12 | } 13 | 14 | fun T.println() = println(this.toString()) -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreImage.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreVideo EAGL Foundation IOSurface ImageIO Metal OpenGLESCommon Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreImage 4 | headers = CoreImage/CoreImage.h 5 | 6 | headerFilter = CoreImage/** 7 | 8 | compilerOpts = -framework CoreImage 9 | linkerOpts = -framework CoreImage 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Vision.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreML CoreVideo EAGL Foundation IOSurface ImageIO Metal OpenGLESCommon Security darwin posix 2 | language = Objective-C 3 | package = platform.Vision 4 | headers = Vision/Vision.h 5 | 6 | headerFilter = Vision/** 7 | 8 | compilerOpts = -framework Vision 9 | linkerOpts = -framework Vision 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/unit3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.basics.unit3 7 | 8 | import kotlin.test.* 9 | 10 | @Test 11 | fun runTest() { 12 | foo(Unit) 13 | } 14 | 15 | fun foo(x: Any) { 16 | println(x.toString()) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing12.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing12 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(x: Number) { 11 | println(x.toByte()) 12 | } 13 | 14 | @Test fun runTest() { 15 | foo(18) 16 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/sum_imm.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.sum_imm 7 | 8 | import kotlin.test.* 9 | 10 | fun sum(a:Int): Int = a + 33 11 | 12 | @Test fun runTest() { 13 | if (sum(2) != 35) throw Error() 14 | } -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/sockets.def: -------------------------------------------------------------------------------- 1 | headers = sys/socket.h sys/errno.h netdb.h stdio.h string.h unistd.h stdlib.h netinet/in.h 2 | compilerOpts.osx = -D_ANSI_SOURCE -D_POSIX_SOURCE 3 | excludeFunctions.osx = addrsel_policy_init 4 | --- 5 | 6 | static int interop_errno() { 7 | return errno; 8 | } 9 | 10 | static short interop_htons(short x) { 11 | return htons(x); 12 | } 13 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/LocalAuthentication.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.LocalAuthentication 4 | headers = LocalAuthentication/LocalAuthentication.h 5 | 6 | headerFilter = LocalAuthentication/** 7 | 8 | compilerOpts = -framework LocalAuthentication 9 | linkerOpts = -framework LocalAuthentication 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/VideoSubscriberAccount.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation Foundation darwin posix 2 | language = Objective-C 3 | package = platform.VideoSubscriberAccount 4 | headers = VideoSubscriberAccount/VideoSubscriberAccount.h 5 | 6 | headerFilter = VideoSubscriberAccount/** 7 | 8 | compilerOpts = -framework VideoSubscriberAccount 9 | linkerOpts = -framework VideoSubscriberAccount 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/boolean.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.boolean 7 | 8 | import kotlin.test.* 9 | 10 | fun bool_yes(): Boolean = true 11 | 12 | @Test fun runTest() { 13 | if (!bool_yes()) throw Error() 14 | } 15 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/sum_func.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.sum_func 7 | 8 | import kotlin.test.* 9 | 10 | fun foo():Int = 1 11 | //fun bar():Int = 2 12 | //fun sum():Int = foo() + bar() 13 | 14 | // FIXME: has no checks -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/tostring1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.tostring1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val hello = "Hello world" 12 | println(hello.subSequence(1, 5).toString()) 13 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreMedia.def: -------------------------------------------------------------------------------- 1 | depends = AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreVideo Foundation IOSurface Metal OpenGLESCommon Security darwin posix 2 | language = Objective-C 3 | package = platform.CoreMedia 4 | headers = CoreMedia/CoreMedia.h 5 | 6 | headerFilter = CoreMedia/** 7 | 8 | compilerOpts = -framework CoreMedia 9 | linkerOpts = -framework CoreMedia 10 | -------------------------------------------------------------------------------- /backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/TestRunnerKind.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | 7 | package org.jetbrains.kotlin.backend.konan 8 | 9 | enum class TestRunnerKind { 10 | NONE, 11 | MAIN_THREAD, 12 | WORKER 13 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/typealias1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.basics.typealias1 7 | 8 | import kotlin.test.* 9 | 10 | @Test 11 | fun runTest() { 12 | println(Bar(42).x) 13 | } 14 | 15 | class Foo(val x: Int) 16 | typealias Bar = Foo -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/sum_silly.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.sum_silly 7 | 8 | import kotlin.test.* 9 | 10 | // FIXME: has no checks 11 | 12 | fun sum(a:Int, b:Int):Int { 13 | var c:Int 14 | c = a + b 15 | return c 16 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lateinit/localInitialized.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lateinit.localInitialized 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | lateinit var s: String 12 | s = "zzz" 13 | println(s) 14 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/initializers3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.initializers3 7 | 8 | import kotlin.test.* 9 | 10 | class Foo(val bar: Int) 11 | 12 | var x = Foo(42) 13 | 14 | @Test fun runTest() { 15 | println(x.bar) 16 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/NaturalLanguage.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreML CoreVideo Foundation IOSurface Security darwin posix 2 | language = Objective-C 3 | package = platform.NaturalLanguage 4 | headers = NaturalLanguage/NaturalLanguage.h 5 | 6 | headerFilter = NaturalLanguage/** 7 | 8 | compilerOpts = -framework NaturalLanguage 9 | linkerOpts = -framework NaturalLanguage 10 | -------------------------------------------------------------------------------- /shared/src/main/kotlin/org/jetbrains/kotlin/konan/KonanAbiVersion.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.konan 2 | 3 | fun String.parseKonanAbiVersion(): KonanAbiVersion { 4 | return KonanAbiVersion(this.toInt()) 5 | } 6 | 7 | data class KonanAbiVersion(val version: Int) { 8 | companion object { 9 | val CURRENT = KonanAbiVersion(4) 10 | } 11 | override fun toString() = "$version" 12 | } 13 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/defaults6.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.defaults6 7 | 8 | import kotlin.test.* 9 | 10 | open class Foo(val x: Int = 42) 11 | class Bar : Foo() 12 | 13 | @Test fun runTest() { 14 | println(Bar().x) 15 | } -------------------------------------------------------------------------------- /backend.native/tests/lower/immutable_blob_in_lambda.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package lower.immutable_blob_in_lambda 7 | 8 | import kotlin.test.* 9 | 10 | @Test 11 | fun runTest() = run { 12 | val golden = immutableBlobOf(123) 13 | println(golden[0]) 14 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/empty_substring.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.empty_substring 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val hello = "Hello world" 12 | println(hello.subSequence(1, 1).toString()) 13 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/exit.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import kotlin.system.* 7 | 8 | fun main(args: Array) { 9 | exitProcess(42) 10 | @Suppress("UNREACHABLE_CODE") 11 | throw RuntimeException("Exit function call returned normally") 12 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/initializers5.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.initializers5 7 | 8 | import kotlin.test.* 9 | 10 | object A { 11 | val a = 42 12 | val b = A.a 13 | } 14 | 15 | @Test fun runTest() { 16 | println(A.b) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/serialization/vararg.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun bar(vararg x: Int) { 7 | x.forEach { 8 | println(it) 9 | } 10 | println("size: ${x.size}") 11 | } 12 | 13 | inline fun foo() = bar(17, 19, 23, *intArrayOf(29, 31)) 14 | 15 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/unit2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.basics.unit2 7 | 8 | import kotlin.test.* 9 | 10 | @Test 11 | fun runTest() { 12 | val x = foo() 13 | println(x.toString()) 14 | } 15 | 16 | fun foo() { 17 | return Unit 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/named.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.named 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(a:Int, b:Int) = a - b 11 | 12 | @Test fun runTest() { 13 | if (foo(b = 24, a = 42) != 18) 14 | throw Error() 15 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/object/constructor0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`object`.constructor0 7 | 8 | import kotlin.test.* 9 | 10 | class A { 11 | var field0:Int = 0; 12 | constructor(arg0:Int) { 13 | field0 = arg0 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/5.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import platform.posix.printf 7 | 8 | val golden = immutableBlobOf(0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x21, 0x00).asCPointer(0) 9 | 10 | fun main(args: Array) { 11 | printf("%s\n", golden) 12 | } 13 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/hello1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | // TODO: TestRuner should be able to pass input to stdin 7 | // TODO: remove kotlin_native.io once overrides are in place. 8 | fun main(args: Array) { 9 | print(readLine().toString()) 10 | } 11 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CoreData.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.CoreData 4 | headers = CoreData/CoreData.h 5 | 6 | headerFilter = CoreData/** 7 | 8 | compilerOpts = -framework CoreData 9 | linkerOpts = -framework CoreData 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/collections/RandomAccess.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.collections 7 | 8 | /** 9 | * Marker interface indicating that the [List] implementation supports fast indexed access. 10 | */ 11 | public actual interface RandomAccess 12 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/native/internal/Ref.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.native.internal 7 | 8 | /** 9 | * This class is used to allocate closure-captured variables in the heap. 10 | */ 11 | class Ref { 12 | var element: T = undefined() 13 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda5.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda5 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | foo { 12 | println(it) 13 | } 14 | } 15 | 16 | fun foo(f: (Int) -> Unit) { 17 | f(42) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/propertyCallableReference/linkTest_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import a.A 7 | 8 | fun main(args: Array) { 9 | val p1 = A::x 10 | println(p1.get(A(42))) 11 | val a = A(117) 12 | val p2 = a::x 13 | println(p2.get()) 14 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/propertyCallableReference/valModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.propertyCallableReference.valModule 7 | 8 | import kotlin.test.* 9 | 10 | val x = 42 11 | 12 | @Test fun runTest() { 13 | val p = ::x 14 | println(p.get()) 15 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/PDFKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.PDFKit 4 | headers = PDFKit/PDFKit.h 5 | 6 | headerFilter = PDFKit/** 7 | 8 | compilerOpts = -framework PDFKit 9 | linkerOpts = -framework PDFKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Social.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.Social 4 | headers = Social/Social.h 5 | 6 | headerFilter = Social/** 7 | 8 | compilerOpts = -framework Social 9 | linkerOpts = -framework Social 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/WebKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.WebKit 4 | headers = WebKit/WebKit.h 5 | 6 | headerFilter = WebKit/** 7 | 8 | compilerOpts = -framework WebKit 9 | linkerOpts = -framework WebKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CoreML.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.CoreML 4 | headers = CoreML/CoreML.h 5 | 6 | headerFilter = CoreML/** 7 | 8 | compilerOpts = -framework CoreML 9 | linkerOpts = -framework CoreML 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/Foundation.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration IOKit ImageIO Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.Foundation 4 | headers = Foundation/Foundation.h 5 | 6 | headerFilter = Foundation/** 7 | 8 | compilerOpts = -framework Foundation 9 | linkerOpts = -framework Foundation 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | run { 12 | println("lambda") 13 | } 14 | } 15 | 16 | fun run(f: () -> Unit) { 17 | f() 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/try/try1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`try`.try1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val x = try { 12 | 5 13 | } catch (e: Throwable) { 14 | 6 15 | } 16 | 17 | println(x) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/hello4.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.hello4 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val x = 2 12 | println(if (x == 2) "Hello" else "Привет") 13 | println(if (x == 3) "Bye" else "Пока") 14 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/HomeKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.HomeKit 4 | headers = HomeKit/HomeKit.h 5 | 6 | headerFilter = HomeKit/** 7 | 8 | compilerOpts = -framework HomeKit 9 | linkerOpts = -framework HomeKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/UIKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security darwin posix 2 | language = Objective-C 3 | package = platform.UIKit 4 | headers = UIKit/UIKit.h 5 | 6 | headerFilter = UIKit/** DocumentManager/** 7 | 8 | compilerOpts = -framework UIKit 9 | linkerOpts = -framework UIKit 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/array_to_any.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.basics.array_to_any 7 | 8 | import kotlin.test.* 9 | 10 | @Test 11 | fun runTest() { 12 | foo().hashCode() 13 | } 14 | 15 | fun foo(): Any { 16 | return Array(0, { i -> null }) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/branching/when8.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.branching.when8 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | when (true) { 12 | true -> println("true") 13 | false -> println("false") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/controlflow/for_loops_array_nullable.kt: -------------------------------------------------------------------------------- 1 | package codegen.controlflow.for_loops_array_nullable 2 | 3 | import kotlin.test.* 4 | 5 | private fun nullableArray(a: Array): Array? { 6 | return a 7 | } 8 | 9 | @Test fun nullable() { 10 | val array = arrayOf(1, 2, 3) 11 | nullableArray(array)?.let { 12 | for (elem in it) { 13 | print(elem) 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/varargParam.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.enum.varargParam 7 | 8 | import kotlin.test.* 9 | 10 | enum class Piece(vararg val states: Int) { 11 | I(3, 4, 5) 12 | } 13 | 14 | @Test fun runTest() { 15 | println(Piece.I.states[0]) 16 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/defaults10.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.defaults10 7 | 8 | import kotlin.test.* 9 | 10 | enum class A(one: Int, val two: Int = one) { 11 | FOO(42) 12 | } 13 | 14 | @Test fun runTest() { 15 | println(A.FOO.two) 16 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/lambdaAsAny.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.inline.lambdaAsAny 7 | 8 | import kotlin.test.* 9 | 10 | inline fun foo(x: Any) { 11 | println(if (x === x) "Ok" else "Fail") 12 | } 13 | 14 | @Test fun runTest() { 15 | foo { 42 } 16 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda7.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda7 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val x = foo { 12 | it + 1 13 | } 14 | println(x) 15 | } 16 | 17 | fun foo(f: (Int) -> Int) = f(42) -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/hello2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | // TODO: TestRuner should be able to pass input to stdin 7 | // TODO: remove kotlin_native.io once overrides are in place. 8 | fun main(args : Array) { 9 | print("you entered '" + readLine() + "'") 10 | } 11 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/collections/range0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.collections.range0 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | for (i in 1..3) print(i) 12 | println() 13 | for (i in 'a'..'d') print(i) 14 | println() 15 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/GLKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal ModelIO OpenGLES2 OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.GLKit 4 | headers = GLKit/GLKit.h 5 | 6 | headerFilter = GLKit/** 7 | 8 | compilerOpts = -framework GLKit 9 | linkerOpts = -framework GLKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MediaAccessibility.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreText EAGL Foundation Metal QuartzCore Security darwin posix 2 | language = Objective-C 3 | package = platform.MediaAccessibility 4 | headers = MediaAccessibility/MediaAccessibility.h 5 | 6 | headerFilter = MediaAccessibility/** 7 | 8 | compilerOpts = -framework MediaAccessibility 9 | linkerOpts = -framework MediaAccessibility 10 | -------------------------------------------------------------------------------- /samples/androidNativeActivity/src/nativeInterop/cinterop/bmpformat.def: -------------------------------------------------------------------------------- 1 | package = sample.androidnative.bmpformat 2 | 3 | --- 4 | #include 5 | 6 | typedef struct __attribute__((packed)) { 7 | uint16_t magic; 8 | uint32_t size; 9 | uint32_t zero; 10 | uint8_t padding1[8]; 11 | int32_t width; 12 | int32_t height; 13 | uint8_t padding2[2]; 14 | uint16_t bits; 15 | uint8_t padding3[24]; 16 | } BMPHeader; 17 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/dataflow/scope1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.dataflow.scope1 7 | 8 | import kotlin.test.* 9 | 10 | var b = true 11 | 12 | @Test fun runTest() { 13 | var x = 1 14 | if (b) { 15 | var x = 2 16 | } 17 | println(x) 18 | } 19 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/nested.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.enum.nested 7 | 8 | import kotlin.test.* 9 | 10 | enum class Foo { 11 | A; 12 | enum class Bar { C } 13 | } 14 | 15 | @Test fun runTest() { 16 | println(Foo.A) 17 | println(Foo.Bar.C) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/try/try3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`try`.try3 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val x = try { 12 | throw Error() 13 | } catch (e: Throwable) { 14 | 6 15 | } 16 | 17 | println(x) 18 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MapKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreLocation CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.MapKit 4 | headers = MapKit/MapKit.h 5 | 6 | headerFilter = MapKit/** 7 | 8 | compilerOpts = -framework MapKit 9 | linkerOpts = -framework MapKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Messages.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.Messages 4 | headers = Messages/Messages.h 5 | 6 | headerFilter = Messages/** 7 | 8 | compilerOpts = -framework Messages 9 | linkerOpts = -framework Messages 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/StoreKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.StoreKit 4 | headers = StoreKit/StoreKit.h 5 | 6 | headerFilter = StoreKit/** 7 | 8 | compilerOpts = -framework StoreKit 9 | linkerOpts = -framework StoreKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Twitter.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security Social UIKit darwin posix 2 | language = Objective-C 3 | package = platform.Twitter 4 | headers = Twitter/Twitter.h 5 | 6 | headerFilter = Twitter/** 7 | 8 | compilerOpts = -framework Twitter 9 | linkerOpts = -framework Twitter 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/VideoToolbox.def: -------------------------------------------------------------------------------- 1 | depends = AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreMedia CoreVideo Foundation IOSurface Metal OpenGLESCommon Security darwin posix 2 | language = Objective-C 3 | package = platform.VideoToolbox 4 | headers = VideoToolbox/VideoToolbox.h 5 | 6 | headerFilter = VideoToolbox/** 7 | 8 | compilerOpts = -framework VideoToolbox 9 | linkerOpts = -framework VideoToolbox 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/reflect/KDeclarationContainer.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.reflect 7 | 8 | /** 9 | * Represents an entity which may contain declarations of any other entities, 10 | * such as a class or a package. 11 | */ 12 | public interface KDeclarationContainer -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing1 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(arg: Any) { 11 | println(arg.toString()) 12 | } 13 | 14 | @Test fun runTest() { 15 | foo(1) 16 | foo(false) 17 | foo("Hello") 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/branching/when9.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.branching.when9 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | foo(0) 12 | println("Ok") 13 | } 14 | 15 | fun foo(x: Int) { 16 | when (x) { 17 | 0 -> 0 18 | } 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/controlflow/break1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.controlflow.break1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | loop@ while (true) { 12 | println("Body") 13 | break 14 | } 15 | println("Done") 16 | } 17 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/controlflow/unreachable1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.controlflow.unreachable1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | println(foo()) 12 | } 13 | 14 | fun foo(): Int { 15 | return 1 16 | println("After return") 17 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/IOSurface.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation Foundation Security darwin posix 2 | language = Objective-C 3 | package = platform.IOSurface 4 | headers.ios_arm32 = IOSurface/IOSurfaceRef.h IOSurface/IOSurfaceObjC.h 5 | headers.ios_arm64 = IOSurface/IOSurfaceRef.h IOSurface/IOSurfaceObjC.h 6 | 7 | headerFilter = IOSurface/** 8 | 9 | compilerOpts = -framework IOSurface 10 | linkerOpts = -framework IOSurface 11 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MediaToolbox.def: -------------------------------------------------------------------------------- 1 | depends = AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreMIDI CoreMedia CoreVideo Foundation IOSurface Metal OpenGLESCommon Security darwin posix 2 | language = Objective-C 3 | package = platform.MediaToolbox 4 | headers = MediaToolbox/MediaToolbox.h 5 | 6 | headerFilter = MediaToolbox/** 7 | 8 | compilerOpts = -framework MediaToolbox 9 | linkerOpts = -framework MediaToolbox 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MessageUI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.MessageUI 4 | headers = MessageUI/MessageUI.h 5 | 6 | headerFilter = MessageUI/** 7 | 8 | compilerOpts = -framework MessageUI 9 | linkerOpts = -framework MessageUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MetalKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal ModelIO OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.MetalKit 4 | headers = MetalKit/MetalKit.h 5 | 6 | headerFilter = MetalKit/** 7 | 8 | compilerOpts = -framework MetalKit 9 | linkerOpts = -framework MetalKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/QuickLook.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.QuickLook 4 | headers = QuickLook/QuickLook.h 5 | 6 | headerFilter = QuickLook/** 7 | 8 | compilerOpts = -framework QuickLook 9 | linkerOpts = -framework QuickLook 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/SceneKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation GLKit IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.SceneKit 4 | headers = SceneKit/SceneKit.h 5 | 6 | headerFilter = SceneKit/** 7 | 8 | compilerOpts = -framework SceneKit 9 | linkerOpts = -framework SceneKit 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/bridges/linkTest_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import a.* 7 | 8 | class B: C() 9 | 10 | fun main(args: Array) { 11 | val b = B() 12 | println(b.foo()) 13 | val c: C = b 14 | println(c.foo()) 15 | val a: A = b 16 | println(a.foo()) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/classDelegation/linkTest_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package zzz 7 | 8 | interface I { 9 | fun foo(): Int 10 | } 11 | 12 | open class A : I { 13 | override fun foo() = 42 14 | } 15 | 16 | open class B : I by A() { 17 | val x = 117 18 | val y = "zzz" 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda3 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | var str = "lambda" 12 | run { 13 | println(str) 14 | } 15 | } 16 | 17 | fun run(f: () -> Unit) { 18 | f() 19 | } -------------------------------------------------------------------------------- /backend.native/tests/datagen/literals/strdedup1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package datagen.literals.strdedup1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val str1 = "Hello" 12 | val str2 = "Hello" 13 | println(str1 == str2) 14 | println(str1 === str2) 15 | } 16 | -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import sysstat.* 7 | import kotlinx.cinterop.* 8 | 9 | fun main(args: Array) { 10 | val statBuf = nativeHeap.alloc() 11 | val res = stat("/", statBuf.ptr) 12 | println(res) 13 | println(statBuf.st_uid) 14 | } -------------------------------------------------------------------------------- /backend.native/tests/serialization/enum_ordinal/library.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | enum class Color { 7 | RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW 8 | } 9 | 10 | fun determineColor(code: Int): Color = when (code) { 11 | 0 -> Color.BLUE 12 | 1 -> Color.MAGENTA 13 | else -> Color.CYAN 14 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CarPlay.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreLocation CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO MapKit Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.CarPlay 4 | headers = CarPlay/CarPlay.h 5 | 6 | headerFilter = CarPlay/** 7 | 8 | compilerOpts = -framework CarPlay 9 | linkerOpts = -framework CarPlay 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/SpriteKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation GLKit IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.SpriteKit 4 | headers = SpriteKit/SpriteKit.h 5 | 6 | headerFilter = SpriteKit/** 7 | 8 | compilerOpts = -framework SpriteKit 9 | linkerOpts = -framework SpriteKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/objc.def: -------------------------------------------------------------------------------- 1 | depends = darwin posix 2 | language = Objective-C 3 | package = platform.objc 4 | headers = objc/NSObjCRuntime.h objc/NSObject.h objc/message.h objc/objc-api.h \ 5 | objc/objc-exception.h objc/objc-sync.h objc/objc.h objc/runtime.h 6 | 7 | headerFilter = objc/** 8 | 9 | compilerOpts = -D_XOPEN_SOURCE 10 | linkerOpts = -lobjc 11 | 12 | --- 13 | // objc-auto.h is excluded so far due to interop issues. 14 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/reflect/KClassifier.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.reflect 7 | 8 | /** 9 | * A classifier is either a class or a type parameter. 10 | * 11 | * @see [KClass] 12 | * @see [KTypeParameter] 13 | */ 14 | @SinceKotlin("1.1") 15 | public interface KClassifier 16 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/lambdaInDefault.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.enum.lambdaInDefault 7 | 8 | import kotlin.test.* 9 | 10 | enum class Zzz(val value: String.() -> Int = { 11 | length 12 | }) { 13 | Q() 14 | } 15 | 16 | @Test fun runTest() { 17 | println(Zzz.Q) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/loop.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.enum.loop 7 | 8 | import kotlin.test.* 9 | 10 | enum class Zzz { 11 | Z { 12 | init { 13 | println(Z.name) 14 | } 15 | } 16 | } 17 | 18 | @Test fun runTest() { 19 | println(Zzz.Z) 20 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/test1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.enum.test1 7 | 8 | import kotlin.test.* 9 | 10 | enum class Zzz(val zzz: String, val x: Int) { 11 | Z1("z1", 1), 12 | Z2("z2", 2) 13 | } 14 | 15 | @Test fun runTest() { 16 | println(Zzz.Z1.zzz + Zzz.Z2.x) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/plus_eq.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.plus_eq 7 | 8 | import kotlin.test.* 9 | 10 | fun plus_eq(a: Int): Int { 11 | var b = 11 12 | b += a 13 | return b 14 | } 15 | 16 | @Test fun runTest() { 17 | if (plus_eq(3) != 14) throw Error() 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/try/finally1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`try`.finally1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | 12 | try { 13 | println("Try") 14 | } finally { 15 | println("Finally") 16 | } 17 | 18 | println("Done") 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/try/try2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`try`.try2 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val x = try { 12 | throw Error() 13 | 5 14 | } catch (e: Throwable) { 15 | 6 16 | } 17 | 18 | println(x) 19 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/memory/basic0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.memory.basic0 7 | 8 | import kotlin.test.* 9 | 10 | class A { 11 | var field: B? = null 12 | } 13 | 14 | class B(var field: Int) 15 | 16 | @Test fun runTest() { 17 | val a = A() 18 | a.field = B(2) 19 | } 20 | -------------------------------------------------------------------------------- /backend.native/tests/serialization/regression/no_type_map.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import kotlinx.cinterop.* 7 | fun main(args: Array) { 8 | memScoped { 9 | val bufferLength = 100L 10 | val buffer = allocArray(bufferLength) 11 | } 12 | println("OK") 13 | } 14 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/IntentsUI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Intents Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.IntentsUI 4 | headers = IntentsUI/IntentsUI.h 5 | 6 | headerFilter = IntentsUI/** 7 | 8 | compilerOpts = -framework IntentsUI 9 | linkerOpts = -framework IntentsUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/PassKit.def: -------------------------------------------------------------------------------- 1 | depends = AddressBook CFNetwork Contacts CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.PassKit 4 | headers = PassKit/PassKit.h 5 | 6 | headerFilter = PassKit/** 7 | 8 | compilerOpts = -framework PassKit 9 | linkerOpts = -framework PassKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Speech.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreMIDI CoreMedia CoreVideo EAGL Foundation IOSurface ImageIO MediaToolbox Metal OpenGLESCommon QuartzCore Security darwin posix 2 | language = Objective-C 3 | package = platform.Speech 4 | headers = Speech/Speech.h 5 | 6 | headerFilter = Speech/** 7 | 8 | compilerOpts = -framework Speech 9 | linkerOpts = -framework Speech 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CoreVideo.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.CoreVideo 4 | headers = CoreVideo/CoreVideo.h 5 | 6 | headerFilter = CoreVideo/** 7 | 8 | compilerOpts = -framework CoreVideo 9 | linkerOpts = -framework CoreVideo 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/IOSurface.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit ImageIO Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.IOSurface 4 | headers = IOSurface/IOSurface.h IOSurface/IOSurfaceObjC.h 5 | 6 | headerFilter = IOSurface/** 7 | 8 | compilerOpts = -framework IOSurface 9 | linkerOpts = -framework IOSurface 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/Metal.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText DiskArbitration Foundation IOKit IOSurface ImageIO Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.Metal 4 | headers = Metal/Metal.h 5 | 6 | headerFilter = Metal/** 7 | excludedFunctions = MTLRenderPipelineErrorDomain 8 | compilerOpts = -framework Metal 9 | linkerOpts = -framework Metal 10 | -------------------------------------------------------------------------------- /samples/html5Canvas/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Draw something using the mouse!

12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing0 7 | 8 | import kotlin.test.* 9 | 10 | class Box(t: T) { 11 | var value = t 12 | } 13 | 14 | @Test fun runTest() { 15 | val box: Box = Box(17) 16 | println(box.value) 17 | } 18 | 19 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/test0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.enum.test0 7 | 8 | import kotlin.test.* 9 | 10 | val TOP_LEVEL = 5 11 | 12 | enum class MyEnum(value: Int) { 13 | VALUE(TOP_LEVEL) 14 | } 15 | 16 | @Test fun runTest() { 17 | println(MyEnum.VALUE.toString()) 18 | } 19 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/minus_eq.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.minus_eq 7 | 8 | import kotlin.test.* 9 | 10 | fun minus_eq(a: Int): Int { 11 | var b = 11 12 | b -= a 13 | return b 14 | } 15 | 16 | @Test fun runTest() { 17 | if (minus_eq(23) != -12) throw Error() 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/sum_3const.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.sum_3const 7 | 8 | import kotlin.test.* 9 | 10 | fun sum3():Int = sum(1, 2, 33) 11 | fun sum(a:Int, b:Int, c:Int): Int = a + b + c 12 | 13 | @Test fun runTest() { 14 | if (sum3() != 36) throw Error() 15 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/defaultArgs.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.inline.defaultArgs 7 | 8 | import kotlin.test.* 9 | 10 | class Z 11 | 12 | inline fun Z.foo(x: Int = 42, y: Int = x) { 13 | println(y) 14 | } 15 | 16 | @Test fun runTest() { 17 | val z = Z() 18 | z.foo() 19 | } -------------------------------------------------------------------------------- /backend.native/tests/datagen/literals/strdedup2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package datagen.literals.strdedup2 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val str1 = "" 12 | val str2 = "hello".subSequence(2, 2) 13 | println(str1 == str2) 14 | println(str1 === str2) 15 | } 16 | -------------------------------------------------------------------------------- /backend.native/tests/link/default/default.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import kotlinx.cinterop.convert 7 | import platform.posix.* 8 | 9 | fun main(args: Array) { 10 | // Just check the typealias is in scope. 11 | val sizet: size_t = 0.convert() 12 | println("sizet = $sizet") 13 | } 14 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/collections/sort0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.collections.sort0 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | println(arrayOf("x", "a", "b").sorted().toString()) 12 | println(intArrayOf(239, 42, -1, 100500, 0).sorted().toString()); 13 | } 14 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/ContactsUI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork Contacts CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.ContactsUI 4 | headers = ContactsUI/ContactsUI.h 5 | 6 | headerFilter = ContactsUI/** 7 | 8 | compilerOpts = -framework ContactsUI 9 | linkerOpts = -framework ContactsUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/WatchKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreLocation CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO MapKit Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.WatchKit 4 | headers = WatchKit/WatchKit.h 5 | 6 | headerFilter = WatchKit/** 7 | 8 | compilerOpts = -framework WatchKit 9 | linkerOpts = -framework WatchKit 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing13.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing13 7 | 8 | import kotlin.test.* 9 | 10 | fun is42(x: Any?) { 11 | println(x == 42) 12 | println(42 == x) 13 | } 14 | 15 | @Test fun runTest() { 16 | is42(16) 17 | is42(42) 18 | is42("42") 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing5.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing5 7 | 8 | import kotlin.test.* 9 | 10 | fun printInt(x: Int) = println(x) 11 | 12 | fun foo(arg: Int?) { 13 | printInt(arg ?: 16) 14 | } 15 | 16 | @Test fun runTest() { 17 | foo(null) 18 | foo(42) 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/branching/if_else.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.branching.if_else 7 | 8 | import kotlin.test.* 9 | 10 | fun if_else(b: Boolean): Int { 11 | if (b) return 42 12 | else return 24 13 | } 14 | 15 | @Test fun runTest() { 16 | if (if_else(false) != 24) throw Error() 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda12.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda12 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val lambda = { s1: String, s2: String -> 12 | println(s1) 13 | println(s2) 14 | } 15 | 16 | lambda("one", "two") 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lateinit/localCapturedInitialized.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lateinit.localCapturedInitialized 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | lateinit var s: String 12 | 13 | fun foo() = s 14 | 15 | s = "zzz" 16 | println(foo()) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/propertyCallableReference/varModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.propertyCallableReference.varModule 7 | 8 | import kotlin.test.* 9 | 10 | var x = 42 11 | 12 | @Test fun runTest() { 13 | val p = ::x 14 | p.set(117) 15 | println(x) 16 | println(p.get()) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/try/try4.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`try`.try4 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val x = try { 12 | println("Try") 13 | 5 14 | } catch (e: Throwable) { 15 | throw e 16 | } 17 | 18 | println(x) 19 | } -------------------------------------------------------------------------------- /extracted/konan.serializer/src/org/jetbrains/kotlin/konan/library/ResolverUtils.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.konan.library 2 | 3 | import org.jetbrains.kotlin.konan.library.resolver.KonanLibraryResolver 4 | import org.jetbrains.kotlin.konan.library.resolver.impl.KonanLibraryResolverImpl 5 | import org.jetbrains.kotlin.konan.KonanAbiVersion 6 | 7 | fun SearchPathResolverWithTarget.libraryResolver(): KonanLibraryResolver = 8 | KonanLibraryResolverImpl(this) 9 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/BusinessChat.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.BusinessChat 4 | headers = BusinessChat/BusinessChat.h 5 | 6 | headerFilter = BusinessChat/** 7 | 8 | compilerOpts = -framework BusinessChat 9 | linkerOpts = -framework BusinessChat 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CoreImage.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.CoreImage 4 | headers = CoreImage/CoreImage.h 5 | 6 | headerFilter = CoreImage/** 7 | 8 | compilerOpts = -framework CoreImage 9 | linkerOpts = -framework CoreImage 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing3 7 | 8 | import kotlin.test.* 9 | 10 | fun printInt(x: Int) = println(x) 11 | 12 | fun foo(arg: Int?) { 13 | if (arg != null) 14 | printInt(arg) 15 | } 16 | 17 | @Test fun runTest() { 18 | foo(42) 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/delegatedProperty/correctFieldsOrder_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import zzz.* 7 | 8 | class C : B() { 9 | val a = "qxx" 10 | } 11 | 12 | fun main(args: Array) { 13 | val c = C() 14 | println(c.a) 15 | println(c.x) 16 | println(c.zzz) 17 | println(c.z) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/inline24.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.inline.inline24 7 | 8 | import kotlin.test.* 9 | 10 | fun foo() = println("foo") 11 | fun bar() = println("bar") 12 | 13 | inline fun baz(x: Unit = foo(), y: Unit) {} 14 | 15 | @Test fun runTest() { 16 | baz(y = bar()) 17 | } 18 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda13.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda13 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | apply("foo") { 12 | println(this) 13 | } 14 | } 15 | 16 | fun apply(str: String, block: String.() -> Unit) { 17 | str.block() 18 | } -------------------------------------------------------------------------------- /backend.native/tests/lower/vararg_of_literals.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package lower.vararg_of_literals 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | foo() 12 | foo() 13 | } 14 | 15 | fun foo() { 16 | val array = arrayOf("a", "b") 17 | println(array[0]) 18 | array[0] = "42" 19 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/hello3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.hello3 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | println(239) 12 | // TODO: enable, once override by name is implemented. 13 | println(true) 14 | println(3.14159) 15 | println('A') 16 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/GameController.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.GameController 4 | headers = GameController/GameController.h 5 | 6 | headerFilter = GameController/** 7 | 8 | compilerOpts = -framework GameController 9 | linkerOpts = -framework GameController 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/HealthKitUI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation HealthKit IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.HealthKitUI 4 | headers = HealthKitUI/HealthKitUI.h 5 | 6 | headerFilter = HealthKitUI/** 7 | 8 | compilerOpts = -framework HealthKitUI 9 | linkerOpts = -framework HealthKitUI 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing6.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing6 7 | 8 | import kotlin.test.* 9 | 10 | fun printInt(x: Int) = println(x) 11 | 12 | fun foo(arg: Any) { 13 | printInt(arg as? Int ?: 16) 14 | } 15 | 16 | @Test fun runTest() { 17 | foo(42) 18 | foo("Hello") 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing8.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing8 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(vararg args: Any?) { 11 | for (arg in args) { 12 | println(arg.toString()) 13 | } 14 | } 15 | 16 | @Test fun runTest() { 17 | foo(1, null, true, "Hello") 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/branching/when7.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.branching.when7 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | main(emptyArray()) 12 | } 13 | 14 | fun main(args: Array) { 15 | val b = args.size < 1 16 | val x = if (b) Any() else throw Error() 17 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/enum/isFrozen.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.enum.isFrozen 7 | 8 | import kotlin.test.* 9 | import kotlin.native.concurrent.* 10 | 11 | enum class Zzz(val zzz: String) { 12 | Z1("z1"), 13 | Z2("z2") 14 | } 15 | 16 | @Test fun runTest() { 17 | println(Zzz.Z1.isFrozen) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/defaults9.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.defaults9 7 | 8 | import kotlin.test.* 9 | 10 | class Foo { 11 | inner class Bar(x: Int, val y: Int = 1) { 12 | constructor() : this(42) 13 | } 14 | } 15 | 16 | @Test fun runTest() = println(Foo().Bar().y) 17 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/defaultsWithVarArg2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.defaultsWithVarArg2 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(vararg arr: Int = intArrayOf(1, 2)) { 11 | arr.forEach { println(it) } 12 | } 13 | 14 | @Test fun runTest() { 15 | foo() 16 | foo(42) 17 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/exceptions/extend0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.exceptions.extend0 7 | 8 | import kotlin.test.* 9 | 10 | class C : Exception("OK") 11 | 12 | @Test fun runTest() { 13 | try { 14 | throw C() 15 | } catch (e: Throwable) { 16 | println(e.message!!) 17 | } 18 | } -------------------------------------------------------------------------------- /backend.native/tests/testLibrary/kotlin/test_platform_lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package test.konan.platform 7 | 8 | fun produceMessage() { 9 | println("""This is a side effect of a test library linked into the binary. 10 | You should not be seeing this. 11 | """) 12 | } 13 | 14 | val x: Unit = produceMessage() 15 | -------------------------------------------------------------------------------- /extracted/konan.serializer/src/org/jetbrains/kotlin/descriptors/konan/KonanModuleDescriptorUtils.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.descriptors.konan 2 | 3 | import org.jetbrains.kotlin.descriptors.ModuleDescriptor 4 | import org.jetbrains.kotlin.konan.library.KONAN_STDLIB_NAME 5 | import org.jetbrains.kotlin.name.Name 6 | 7 | private val STDLIB_MODULE_NAME = Name.special("<$KONAN_STDLIB_NAME>") 8 | 9 | fun ModuleDescriptor.isKonanStdlib() = name == STDLIB_MODULE_NAME 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/Accelerate.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreServices CoreText CoreVideo DiskArbitration IOKit IOSurface ImageIO Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.Accelerate 4 | headers = Accelerate/Accelerate.h 5 | 6 | headerFilter = Accelerate/** vecLib/** **/vecLib.h vImage/** 7 | 8 | compilerOpts = -framework Accelerate 9 | linkerOpts = -framework Accelerate 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/AppKit.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreData CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon QuartzCore Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.AppKit 4 | headers = AppKit/AppKit.h 5 | 6 | headerFilter = AppKit/** 7 | 8 | compilerOpts = -framework AppKit 9 | linkerOpts = -framework AppKit 10 | -------------------------------------------------------------------------------- /samples/zephyr/c_interop/platforms/stm32f4_disco.def: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | # that can be found in the license/LICENSE.txt file. 4 | # 5 | 6 | # Keep this one board independent. 7 | 8 | headers = autoconf.h zephyr.h board.h device.h gpio.h 9 | compilerOpts = -DKERNEL -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -D_FORTIFY_SOURCE=2 -D__ZEPHYR__=1 -ffreestanding -std=c99 -nostdinc 10 | 11 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing10.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing10 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val FALSE: Boolean? = false 12 | 13 | if (FALSE != null) { 14 | do { 15 | println("Ok") 16 | } while (FALSE) 17 | } 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/branching/when2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.branching.when2 7 | 8 | import kotlin.test.* 9 | 10 | fun when2(i: Int): Int { 11 | when (i) { 12 | 0 -> return 42 13 | else -> return 24 14 | } 15 | } 16 | 17 | @Test fun runTest() { 18 | if (when2(0) != 42) throw Error() 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/branching/when4.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.branching.when4 7 | 8 | import kotlin.test.* 9 | 10 | fun when5(i: Int): Int { 11 | when (i) { 12 | 0 -> return 42 13 | 1 -> return 4 14 | 2 -> return 3 15 | 3 -> return 2 16 | 4 -> return 1 17 | } 18 | return 24 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/controlflow/for_loops_array_indices.kt: -------------------------------------------------------------------------------- 1 | package codegen.controlflow.for_loops_array_indices 2 | 3 | import kotlin.test.* 4 | 5 | @Test fun runTest() { 6 | val intArray = intArrayOf(4, 0, 3, 5) 7 | 8 | val emptyArray = arrayOf() 9 | 10 | for (index in intArray.indices) { 11 | print(index) 12 | } 13 | println() 14 | for (index in emptyArray.indices) { 15 | print(index) 16 | } 17 | println() 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/defaults8.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.defaults8 7 | 8 | import kotlin.test.* 9 | 10 | class Foo { 11 | fun test(x: Int = 1) = x 12 | } 13 | 14 | class Bar { 15 | fun test(x: Int = 2) = x 16 | } 17 | 18 | @Test fun runTest() { 19 | println(Bar().test()) 20 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/object/method_call.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`object`.method_call 7 | 8 | import kotlin.test.* 9 | 10 | class A(val a:Int) { 11 | fun foo(i:Int) = a + i 12 | } 13 | 14 | fun fortyTwo() = A(41).foo(1) 15 | 16 | @Test fun runTest() { 17 | if (fortyTwo() != 42) throw Error() 18 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/FileProviderUI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.FileProviderUI 4 | headers = FileProviderUI/FileProviderUI.h 5 | 6 | headerFilter = FileProviderUI/** 7 | 8 | compilerOpts = -framework FileProviderUI 9 | linkerOpts = -framework FileProviderUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/SafariServices.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.SafariServices 4 | headers = SafariServices/SafariServices.h 5 | 6 | headerFilter = SafariServices/** 7 | 8 | compilerOpts = -framework SafariServices 9 | linkerOpts = -framework SafariServices 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/iAd.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation AVKit AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO MediaToolbox Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.iAd 4 | headers = iAd/iAd.h 5 | 6 | headerFilter = iAd/** 7 | 8 | compilerOpts = -framework iAd 9 | linkerOpts = -framework iAd 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/Experimental.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | /** 7 | * Empty package to avoid unresolved reference errors in bitwiseOp tests 8 | * (e.g. external_codegen_box_binaryOp/bitwiseOp.kt). 9 | * Byte/Short bitwise operations are supported in Kotlin Native by default. 10 | */ 11 | 12 | package kotlin.experimental -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/Unit.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin 7 | 8 | import kotlin.native.internal.ExportTypeInfo 9 | 10 | /** 11 | * The type with only one value: the `Unit` object. 12 | */ 13 | @ExportTypeInfo("theUnitTypeInfo") 14 | public object Unit { 15 | override fun toString() = "kotlin.Unit" 16 | } -------------------------------------------------------------------------------- /tools/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN apt-get update 3 | RUN apt-get install -y wget 4 | RUN apt-get install -y default-jdk 5 | ENV version 0.8.1 6 | ENV kotlin_native kotlin-native-linux-${version} 7 | RUN wget https://download-cf.jetbrains.com/kotlin/native/builds/releases/${version}/linux/${kotlin_native}.tar.gz 8 | RUN tar xzf ${kotlin_native}.tar.gz 9 | RUN echo "export PATH=\$PATH:/${kotlin_native}/bin" > /.rc.entry 10 | ENTRYPOINT /bin/bash --rcfile /.rc.entry -------------------------------------------------------------------------------- /backend.native/tests/codegen/boxing/boxing4.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.boxing.boxing4 7 | 8 | import kotlin.test.* 9 | 10 | fun printInt(x: Int) = println(x) 11 | 12 | fun foo(arg: Any?) { 13 | if (arg is Int? && arg != null) 14 | printInt(arg) 15 | } 16 | 17 | @Test fun runTest() { 18 | foo(16) 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/delegatedProperty/lazy.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.delegatedProperty.lazy 7 | 8 | import kotlin.test.* 9 | 10 | val lazyValue: String by lazy { 11 | println("computed!") 12 | "Hello" 13 | } 14 | 15 | @Test fun runTest() { 16 | println(lazyValue) 17 | println(lazyValue) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda10.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda10 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | var str = "original" 12 | 13 | val lambda = { 14 | println(str) 15 | } 16 | 17 | lambda() 18 | 19 | str = "changed" 20 | lambda() 21 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda6.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda6 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val str = "captured" 12 | foo { 13 | println(it) 14 | println(str) 15 | } 16 | } 17 | 18 | fun foo(f: (Int) -> Unit) { 19 | f(42) 20 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lateinit/initialized.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lateinit.initialized 7 | 8 | import kotlin.test.* 9 | 10 | class A { 11 | lateinit var s: String 12 | 13 | fun foo() = s 14 | } 15 | 16 | @Test fun runTest() { 17 | val a = A() 18 | a.s = "zzz" 19 | println(a.foo()) 20 | } -------------------------------------------------------------------------------- /backend.native/tests/link/purge1/lib.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import kotlinx.cinterop.convert 7 | import platform.posix.* 8 | 9 | fun foo() { 10 | println("linked library") 11 | val size: size_t = 17.convert() 12 | val e = fabs(1.toDouble()) 13 | println("and symbols from posix available: $size; $e") 14 | } 15 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/text/string_builder1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.text.string_builder1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val a = StringBuilder() 12 | a.append("Hello").appendln("Kotlin").appendln(42).appendln(0.1).appendln(true) 13 | println(a.toString()) 14 | } 15 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/AVKit.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO MediaToolbox Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.AVKit 4 | headers = AVKit/AVKit.h 5 | 6 | headerFilter = AVKit/** 7 | 8 | compilerOpts = -framework AVKit 9 | linkerOpts = -framework AVKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/AddressBookUI.def: -------------------------------------------------------------------------------- 1 | depends = AddressBook CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.AddressBookUI 4 | headers = AddressBookUI/AddressBookUI.h 5 | 6 | headerFilter = AddressBookUI/** 7 | 8 | compilerOpts = -framework AddressBookUI 9 | linkerOpts = -framework AddressBookUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/EventKitUI.def: -------------------------------------------------------------------------------- 1 | depends = AddressBook CFNetwork CoreFoundation CoreGraphics CoreImage CoreLocation CoreText CoreVideo EAGL EventKit FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.EventKitUI 4 | headers = EventKitUI/EventKitUI.h 5 | 6 | headerFilter = EventKitUI/** 7 | 8 | compilerOpts = -framework EventKitUI 9 | linkerOpts = -framework EventKitUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/GameplayKit.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation GLKit IOSurface ImageIO Metal OpenGLESCommon QuartzCore SceneKit Security SpriteKit UIKit darwin posix 2 | language = Objective-C 3 | package = platform.GameplayKit 4 | headers = GameplayKit/GameplayKit.h 5 | 6 | headerFilter = GameplayKit/** 7 | 8 | compilerOpts = -framework GameplayKit 9 | linkerOpts = -framework GameplayKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/MediaPlayer.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation CFNetwork CoreFoundation CoreGraphics CoreImage CoreMedia CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.MediaPlayer 4 | headers = MediaPlayer/MediaPlayer.h 5 | 6 | headerFilter = MediaPlayer/** 7 | 8 | compilerOpts = -framework MediaPlayer 9 | linkerOpts = -framework MediaPlayer 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/CFNetwork.def: -------------------------------------------------------------------------------- 1 | depends = CoreFoundation darwin posix 2 | language = Objective-C 3 | package = platform.CFNetwork 4 | headers = CFNetwork/CFNetwork.h 5 | 6 | headerFilter = CFNetwork/** 7 | excludedFunctions = kCFHTTPAuthenticationSchemeKerberos kCFHTTPAuthenticationSchemeOAuth1 kCFNetworkProxiesProxyAutoConfigJavaScript kCFProxyAutoConfigurationHTTPResponseKey 8 | 9 | 10 | compilerOpts = -framework CFNetwork 11 | linkerOpts = -framework CFNetwork 12 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/native/internal/Undefined.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.native.internal 7 | 8 | /** 9 | * Returns undefined value of type `T`. 10 | * This method is unsafe and should be used with care. 11 | */ 12 | @SymbolName("Kotlin_native_internal_undefined") 13 | internal external fun undefined(): T -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/text/Appendable.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.text 7 | 8 | public actual interface Appendable { 9 | actual fun append(c: Char): Appendable 10 | actual fun append(csq: CharSequence?): Appendable 11 | actual fun append(csq: CharSequence?, start: Int, end: Int): Appendable 12 | } 13 | -------------------------------------------------------------------------------- /samples/calculator/androidApp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/echoServer/README.md: -------------------------------------------------------------------------------- 1 | # Sockets demo 2 | 3 | To build use `../gradlew assemble`. 4 | 5 | To run use `../gradlew runProgram` or execute the program directly: 6 | 7 | ./build/bin/echoServer/main/release/executable/echoServer.kexe 3000 & 8 | 9 | Test the server by connecting to it, for example with telnet: 10 | 11 | telnet localhost 3000 12 | 13 | Write something to console and watch server echoing it back. 14 | 15 | ~~Quit telnet by pressing ctrl+] ctrl+D~~ 16 | -------------------------------------------------------------------------------- /samples/videoplayer/src/videoPlayerMain/kotlin/Dimensions.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the license/LICENSE.txt file. 4 | */ 5 | 6 | package sample.videoplayer 7 | 8 | data class Dimensions(val w: Int, val h: Int) { 9 | operator fun minus(other: Dimensions) = Dimensions(w - other.w, h - other.h) 10 | operator fun div(b: Int) = Dimensions(w / b, h / b) 11 | } 12 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/local_variable.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.basics.local_variable 7 | 8 | import kotlin.test.* 9 | 10 | fun local_variable(a: Int) : Int { 11 | var b = 0 12 | b = a + 11 13 | return b 14 | } 15 | 16 | @Test 17 | fun runTest() { 18 | if (local_variable(3) != 14) throw Error() 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lateinit/globalIsInitialized.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lateinit.globalIsInitialized 7 | 8 | import kotlin.test.* 9 | 10 | lateinit var s: String 11 | 12 | fun foo() { 13 | println(::s.isInitialized) 14 | } 15 | 16 | @Test fun runTest() { 17 | foo() 18 | s = "zzz" 19 | foo() 20 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/CoreAudioKit.def: -------------------------------------------------------------------------------- 1 | depends = AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.CoreAudioKit 4 | headers = CoreAudioKit/CoreAudioKit.h 5 | 6 | headerFilter = CoreAudioKit/** 7 | 8 | compilerOpts = -framework CoreAudioKit 9 | linkerOpts = -framework CoreAudioKit 10 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/innerClass/simple.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.innerClass.simple 7 | 8 | import kotlin.test.* 9 | 10 | class Outer { 11 | inner class Inner { 12 | fun box() = "OK" 13 | } 14 | } 15 | 16 | fun box() = Outer().Inner().box() 17 | 18 | @Test fun runTest() 19 | { 20 | println(box()) 21 | } -------------------------------------------------------------------------------- /backend.native/tests/datagen/literals/listof1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package datagen.literals.listof1 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val list = foo() 12 | println(list === foo()) 13 | println(list.toString()) 14 | } 15 | 16 | fun foo(): List { 17 | return listOf("a", "b", "c") 18 | } -------------------------------------------------------------------------------- /backend.native/tests/interop/basics/1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import cstdlib.* 7 | import kotlinx.cinterop.* 8 | 9 | fun main(args: Array) { 10 | println(atoi("257")) 11 | 12 | val divResult = div(-5, 3) 13 | val (quot, rem) = divResult.useContents { Pair(quot, rem) } 14 | println(quot) 15 | println(rem) 16 | 17 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/for0.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.for0 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val byteArray = ByteArray(3) 12 | byteArray[0] = 2 13 | byteArray[1] = 3 14 | byteArray[2] = 4 15 | for (item in byteArray) { 16 | println(item) 17 | } 18 | } -------------------------------------------------------------------------------- /backend.native/tests/testing/custom_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.test.tests 7 | 8 | import kotlin.test.* 9 | import kotlin.native.internal.test.* 10 | 11 | @Test 12 | fun test() { 13 | println("test") 14 | } 15 | 16 | fun main(args: Array) { 17 | println("Custom main") 18 | testLauncherEntryPoint(args) 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/sum_foo_bar.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.sum_foo_bar 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(a:Int):Int = a 11 | fun bar(a:Int):Int = a 12 | 13 | fun sumFooBar(a:Int, b:Int):Int = foo(a) + bar(b) 14 | 15 | @Test fun runTest() { 16 | if (sumFooBar(2, 3) != 5) throw Error() 17 | } -------------------------------------------------------------------------------- /samples/workers/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'kotlin-multiplatform' 3 | } 4 | 5 | // Determine host preset. 6 | def hostPreset = MPPTools.defaultHostPreset(project) 7 | 8 | kotlin { 9 | targets { 10 | fromPreset(hostPreset, 'workers') { 11 | compilations.main.outputKinds 'EXECUTABLE' 12 | compilations.main.entryPoint 'sample.workers.main' 13 | } 14 | } 15 | } 16 | 17 | MPPTools.createRunTask(project, 'runProgram', kotlin.targets.workers) 18 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/classDelegation/linkTest_main.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | import zzz.* 7 | 8 | class C : B() { 9 | val a = "qxx" 10 | val b = 123 11 | } 12 | 13 | fun main(args: Array) { 14 | val c = C() 15 | println(c.a) 16 | println(c.b) 17 | println(c.foo()) 18 | println(c.x) 19 | println(c.y) 20 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/initializers/correctOrder1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.initializers.correctOrder1 7 | 8 | import kotlin.test.* 9 | 10 | class TestClass { 11 | val x: Int 12 | 13 | init { 14 | x = 42 15 | } 16 | 17 | val y = x 18 | } 19 | 20 | @Test fun runTest() { 21 | println(TestClass().y) 22 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/initializers/correctOrder2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.initializers.correctOrder2 7 | 8 | import kotlin.test.* 9 | 10 | class TestClass { 11 | val x: Int 12 | 13 | val y = 42 14 | 15 | init { 16 | x = y 17 | } 18 | } 19 | 20 | @Test fun runTest() { 21 | println(TestClass().x) 22 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/inline23.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.inline.inline23 7 | 8 | import kotlin.test.* 9 | 10 | inline fun foo(i2: Any): T { 11 | return i2 as T 12 | } 13 | 14 | fun bar(i1: Int): Int { 15 | return foo(i1) 16 | } 17 | 18 | @Test fun runTest() { 19 | println(bar(33)) 20 | } 21 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/memory/escape1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.memory.escape1 7 | 8 | import kotlin.test.* 9 | 10 | class B(val s: String) 11 | 12 | class A { 13 | val b = B("zzz") 14 | } 15 | 16 | fun foo(): B { 17 | val a = A() 18 | return a.b 19 | } 20 | 21 | @Test fun runTest() { 22 | println(foo().s) 23 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/Photos.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO MediaToolbox Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.Photos 4 | headers = Photos/Photos.h 5 | 6 | headerFilter = Photos/** 7 | 8 | compilerOpts = -framework Photos 9 | linkerOpts = -framework Photos 10 | -------------------------------------------------------------------------------- /samples/gitchurn/README.md: -------------------------------------------------------------------------------- 1 | # GIT frequency analyzer 2 | 3 | This example shows how one could perform statistics on Git repository. 4 | libgit2 is required for this to work (`apt-get install libgit2-dev`). 5 | 6 | To build use `../gradlew assemble`. 7 | 8 | To run use `../gradlew runProgram` or execute the program directly: 9 | 10 | ./build/bin/gitChurn/main/release/executable/gitchurn.kexe ../../ 11 | 12 | It will print most frequently modified (by number of commits) files in repository. 13 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/basics/concatenation.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.basics.concatenation 7 | 8 | import kotlin.test.* 9 | 10 | @Test 11 | fun runTest() { 12 | val s = "world" 13 | val i = 1 14 | println("Hello $s $i ${2*i}") 15 | 16 | for (item in listOf("a", "b")) { 17 | println("Hello, $item") 18 | } 19 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda2 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | main(arrayOf("arg0")) 12 | } 13 | 14 | fun main(args : Array) { 15 | run { 16 | println(args[0]) 17 | } 18 | } 19 | 20 | fun run(f: () -> Unit) { 21 | f() 22 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/ARKit.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreText CoreVideo EAGL FileProvider Foundation GLKit IOSurface ImageIO MediaToolbox Metal OpenGLESCommon QuartzCore SceneKit Security SpriteKit UIKit darwin posix 2 | language = Objective-C 3 | package = platform.ARKit 4 | headers = ARKit/ARKit.h 5 | 6 | headerFilter = ARKit/** 7 | 8 | compilerOpts = -framework ARKit 9 | linkerOpts = -framework ARKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/IdentityLookupUI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface IdentityLookup ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.IdentityLookupUI 4 | headers = IdentityLookupUI/IdentityLookupUI.h 5 | 6 | headerFilter = IdentityLookupUI/** 7 | 8 | compilerOpts = -framework IdentityLookupUI 9 | linkerOpts = -framework IdentityLookupUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/NotificationCenter.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.NotificationCenter 4 | headers = NotificationCenter/NotificationCenter.h 5 | 6 | headerFilter = NotificationCenter/** 7 | 8 | compilerOpts = -framework NotificationCenter 9 | linkerOpts = -framework NotificationCenter 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/Annotation.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin 7 | 8 | /** 9 | * Base interface implicitly implemented by all annotation interfaces. 10 | * See [Kotlin language documentation](http://kotlinlang.org/docs/reference/annotations.html) for more information 11 | * on annotations. 12 | */ 13 | public interface Annotation 14 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/defaultsWithInlineClasses.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.defaultsWithInlineClasses 7 | 8 | import kotlin.test.* 9 | 10 | inline class Foo(val value: Int) 11 | fun foo(x: Foo = Foo(42)) = x.value 12 | 13 | @Test fun runTest() { 14 | assertEquals(foo(), 42) 15 | assertEquals(foo(Foo(17)), 17) 16 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/propertyCallableReference/valClass.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.propertyCallableReference.valClass 7 | 8 | import kotlin.test.* 9 | 10 | class A(val x: Int) 11 | 12 | @Test fun runTest() { 13 | val p1 = A::x 14 | println(p1.get(A(42))) 15 | val a = A(117) 16 | val p2 = a::x 17 | println(p2.get()) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/initializers4.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.initializers4 7 | 8 | import kotlin.test.* 9 | 10 | const val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1 11 | val DOUBLE = Double.MAX_VALUE - 1.0 12 | 13 | @Test fun runTest() { 14 | println(INT_MAX_POWER_OF_TWO) 15 | println(DOUBLE > 0.0) 16 | } 17 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/collections/moderately_large_array.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.collections.moderately_large_array 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val a = ByteArray(1000000) 12 | 13 | var sum = 0 14 | for (b in a) { 15 | sum += b 16 | } 17 | 18 | println(sum) 19 | } 20 | 21 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/ReplayKit.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO MediaToolbox Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.ReplayKit 4 | headers = ReplayKit/ReplayKit.h 5 | 6 | headerFilter = ReplayKit/** 7 | 8 | compilerOpts = -framework ReplayKit 9 | linkerOpts = -framework ReplayKit 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/UserNotificationsUI.def: -------------------------------------------------------------------------------- 1 | depends = CFNetwork CoreFoundation CoreGraphics CoreImage CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO Metal OpenGLESCommon QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.UserNotificationsUI 4 | headers = UserNotificationsUI/UserNotificationsUI.h 5 | 6 | headerFilter = UserNotificationsUI/** 7 | 8 | compilerOpts = -framework UserNotificationsUI 9 | linkerOpts = -framework UserNotificationsUI 10 | -------------------------------------------------------------------------------- /samples/objc/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'kotlin-multiplatform' 3 | } 4 | 5 | // Determine host preset. 6 | def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64]) 7 | 8 | kotlin { 9 | targets { 10 | fromPreset(hostPreset, 'objc') { 11 | compilations.main.outputKinds 'EXECUTABLE' 12 | compilations.main.entryPoint 'sample.objc.main' 13 | } 14 | } 15 | } 16 | 17 | MPPTools.createRunTask(project, 'runProgram', kotlin.targets.objc) 18 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/function/defaults1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.function.defaults1 7 | 8 | import kotlin.test.* 9 | 10 | fun foo(x:Int = 0, y:Int = x + 1, z:Int = x + y + 1) = x + y + z 11 | 12 | @Test fun runTest() { 13 | val v = foo() 14 | if (v != 3) { 15 | println("test failed $v expected 3") 16 | throw Error() 17 | } 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/inline26.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.inline.inline26 7 | 8 | import kotlin.test.* 9 | 10 | inline fun call(block1: () -> Unit, noinline block2: () -> Int): Int { 11 | block1() 12 | return block2() 13 | } 14 | 15 | @Test fun runTest() { 16 | var x = 5 17 | println(call({ x = 7 }, x::toInt)) 18 | } 19 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/localFunctionInInitializerBlock.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.inline.localFunctionInInitializerBlock 7 | 8 | import kotlin.test.* 9 | 10 | class Foo { 11 | init { 12 | bar() 13 | } 14 | } 15 | 16 | inline fun bar() { 17 | println({ "Ok" }()) 18 | } 19 | 20 | @Test fun runTest() { 21 | Foo() 22 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/kclass/kClassEnumArgument.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.kclass.kClassEnumArgument 7 | 8 | import kotlin.test.* 9 | import kotlin.reflect.KClass 10 | 11 | enum class E(val arg: KClass<*>?) { 12 | A(null as KClass<*>?), 13 | B(String::class); 14 | } 15 | 16 | @Test fun runTest() { 17 | println(E.B.arg?.simpleName) 18 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/lambda/lambda11.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.lambda.lambda11 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val first = "first" 12 | val second = "second" 13 | 14 | run { 15 | println(first) 16 | println(second) 17 | } 18 | } 19 | 20 | fun run(f: () -> Unit) { 21 | f() 22 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/collections/array2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.collections.array2 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | val byteArray = Array(5, { i -> (i * 2).toByte() }) 12 | byteArray.map { println(it) } 13 | 14 | val intArray = Array(5, { i -> i * 4 }) 15 | println(intArray.sum()) 16 | } -------------------------------------------------------------------------------- /licenses/NOTICE.txt: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Kotlin Compiler distribution. == 5 | ========================================================================= 6 | 7 | Kotlin Compiler 8 | Copyright 2010-2017 JetBrains s.r.o and respective authors and developers 9 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/innerClass/getOuterVal.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.innerClass.getOuterVal 7 | 8 | import kotlin.test.* 9 | 10 | class Outer(val s: String) { 11 | inner class Inner { 12 | fun box() = s 13 | } 14 | } 15 | 16 | fun box() = Outer("OK").Inner().box() 17 | 18 | @Test fun runTest() 19 | { 20 | println(box()) 21 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/try/finally10.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.`try`.finally10 7 | 8 | import kotlin.test.* 9 | 10 | @Test fun runTest() { 11 | while (true) { 12 | try { 13 | continue 14 | } finally { 15 | println("Finally") 16 | break 17 | } 18 | } 19 | 20 | println("After") 21 | } -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/entry1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | fun fail() { 7 | println("Test failed, this is a wrong main() function.") 8 | } 9 | 10 | fun foo(args: Array) { 11 | println("Hello.") 12 | } 13 | 14 | fun bar() { 15 | println("Hello, without args.") 16 | } 17 | 18 | 19 | fun main(args: Array) { 20 | fail() 21 | } 22 | 23 | -------------------------------------------------------------------------------- /backend.native/tests/runtime/basic/enum_equals.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package runtime.basic.enum_equals 7 | 8 | import kotlin.test.* 9 | 10 | enum class EnumA { 11 | A, B 12 | } 13 | 14 | enum class EnumB { 15 | B 16 | } 17 | 18 | @Test fun run() { 19 | println(EnumA.A == EnumA.A) 20 | println(EnumA.A == EnumA.B) 21 | println(EnumA.A == EnumB.B) 22 | } -------------------------------------------------------------------------------- /platformLibs/src/platform/ios/PhotosUI.def: -------------------------------------------------------------------------------- 1 | depends = AVFoundation AudioToolbox CFNetwork CoreAudio CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia CoreText CoreVideo EAGL FileProvider Foundation IOSurface ImageIO MediaToolbox Metal OpenGLESCommon Photos QuartzCore Security UIKit darwin posix 2 | language = Objective-C 3 | package = platform.PhotosUI 4 | headers = PhotosUI/PhotosUI.h 5 | 6 | headerFilter = PhotosUI/** 7 | 8 | compilerOpts = -framework PhotosUI 9 | linkerOpts = -framework PhotosUI 10 | -------------------------------------------------------------------------------- /platformLibs/src/platform/osx/QuartzCore.def: -------------------------------------------------------------------------------- 1 | depends = ApplicationServices CFNetwork CoreFoundation CoreGraphics CoreImage CoreServices CoreText CoreVideo DiskArbitration Foundation IOKit IOSurface ImageIO Metal OpenGLCommon Security darwin libkern osx posix 2 | language = Objective-C 3 | package = platform.QuartzCore 4 | headers = QuartzCore/QuartzCore.h QuartzCore/CIImage.h QuartzCore/CIColor.h 5 | 6 | headerFilter = QuartzCore/** 7 | 8 | compilerOpts = -framework QuartzCore 9 | linkerOpts = -framework QuartzCore 10 | -------------------------------------------------------------------------------- /runtime/src/main/kotlin/kotlin/native/internal/ValueTypes.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package kotlin.native.internal 7 | 8 | internal class BooleanValue 9 | internal class ByteValue 10 | internal class ShortValue 11 | internal class IntValue 12 | internal class LongValue 13 | internal class FloatValue 14 | internal class DoubleValue 15 | internal class NotNullPointerValue 16 | -------------------------------------------------------------------------------- /samples/opengl/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'kotlin-multiplatform' 3 | } 4 | 5 | // Determine host preset. 6 | def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64]) 7 | 8 | kotlin { 9 | targets { 10 | fromPreset(hostPreset, 'opengl') { 11 | compilations.main.outputKinds 'EXECUTABLE' 12 | compilations.main.entryPoint 'sample.opengl.main' 13 | } 14 | } 15 | } 16 | 17 | MPPTools.createRunTask(project, 'runProgram', kotlin.targets.opengl) 18 | -------------------------------------------------------------------------------- /backend.native/tests/codegen/cycles/cycle_for.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.cycles.cycle_for 7 | 8 | import kotlin.test.* 9 | 10 | fun cycle_for(arr: Array) : Int { 11 | var sum = 0 12 | for (i in arr) { 13 | sum += i 14 | } 15 | return sum 16 | } 17 | 18 | @Test fun runTest() { 19 | if (cycle_for(Array(4, init = { it })) != 6) throw Error() 20 | } -------------------------------------------------------------------------------- /backend.native/tests/codegen/inline/inline2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license 3 | * that can be found in the LICENSE file. 4 | */ 5 | 6 | package codegen.inline.inline2 7 | 8 | import kotlin.test.* 9 | 10 | @Suppress("NOTHING_TO_INLINE") 11 | inline fun foo(i4: Int, i5: Int) { 12 | println("hello $i4 $i5") 13 | } 14 | 15 | fun bar(i1: Int, i2: Int) { 16 | foo(i1, i2) 17 | } 18 | 19 | @Test fun runTest() { 20 | bar(1, 8) 21 | } 22 | --------------------------------------------------------------------------------