You are currently viewing Preview of Kotlin 1.5.30 With Native Apple Silicon Support, Improved Kotlin DSL for the CocoaPods Gradle Plugin, and More

Preview of Kotlin 1.5.30 With Native Apple Silicon Support, Improved Kotlin DSL for the CocoaPods Gradle Plugin, and More

Be the first to try the new features and improvements coming in Kotlin 1.5.30: native Apple silicon support, an improved Kotlin DSL for Cocoapods configuration, the ability to share custom native libraries across platforms in multiplatform applications, a better debugging experience for applications with the Kotlin/JS IR backend, and more.

These features are available as part of an early access preview of 1.5.30. Install 1.5.30-M1 to get your hands on them.

For the Kotlin Early Access Preview, we ship a few milestone builds before every release. You can install these builds and try features and improvements before they go live.

You can help us make Kotlin better by reporting any issues you encounter and providing feedback to our issue tracker, YouTrack.

It is very likely that we’ll be able to fix reported issues before the final release, which means you won’t need to wait until the next version of Kotlin for your issues to be addressed.

This blog post provides an overview of the following features shipped in 1.5.30-M1:

Try new features

Native support for Apple silicon

Previously, if you wanted to build and run Kotlin applications on Apple silicon hosts, you had to use the Rosetta translation environment. With 1.5.30, this is no longer necessary. You can build applications for all targets on Apple silicon hardware naturally without this environment.

New targets introduced in 1.5.30 –

macosArm64

,

iosSimulatorArm64

,

watchosSimulatorArm64

, and

tvosSimulatorArm64

– make it possible to run Kotlin code on Apple silicon natively. 

Note that due to limited support for these new targets in 1.5.30, they can’t be run using target shortcuts. We are working on improving support for these targets. 

Improved Kotlin DSL for the CocoaPods Gradle plugin

Kotlin 1.5.30 improves CocoaPods configuration by providing a new DSL format and new parameters for: 

  • Defining the dynamic or static version of the framework
  • Enabling export dependencies explicitly
  • Enabling Bitcode embedding
cocoapods {
    frameworkName = "MyFramework" //This property is deprecated and will be removed in future versions
    //new DSL for framework configuration
    framework {
        //All Framework properties are supported
        //Framework name configuration. Use this property instead of deprecated 'frameworkName'
        baseName = "MyFramework"
        //Dynamic framework support
        isStatic = false
        //Dependency export
        export(project(":anotherKMMModule"))
        transitiveExport = true
        //Bitcode embedding
        embedBitcode(BITCODE)
    }
}

Sharing custom

cinterop

libraries across platforms in multiplatform applications

Previously, when creating multiplatform applications you could share only native platform-dependent libraries shipped with Kotlin/Native.

With Kotlin 1.5.30, you can also share custom native libraries that are configured using the

cinterops

block of the build script.

To enable this support, add

kotlin.mpp.enableCInteropCommonization=true

to your

gradle.properties

.

kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableCInteropCommonization=true

Better debugging for applications with Kotlin/JS IR backend 

Kotlin 1.5.30 improves the debugging experience for Kotlin/JS applications with the new IR backend by generating JavaScript source maps. Now you can enjoy a better debugging experience with breakpoints, stepping, variable inspections, and readable stack traces with proper source references in any JavaScript debugger.  

Learn more about debugging Kotlin/JS applications.

Please note that, because of internal changes, Kotlin/JS IR compiler 1.5.30 and its previews work only with the standard library of the same version. And vice versa, the 1.5.30 Kotlin/JS standard library can be used only with the same version of the IR compiler. This restriction does not apply to the default (legacy) compiler or any other libraries.

Try new features and provide feedback

These new features are available in the 1.5.30 preview release – Kotlin 1.5.30-M1. You can easily install it in your IDE – IntelliJ IDEA or Android Studio – in any of these ways: 

  • If you use the Early Access Preview update channel, the IDE will suggest updating to 1.5.30-M1 automatically once it is out.
  • If you use the Stable update channel, you can change the channel to Early Access Preview at any time by selecting Tools | Kotlin | Configure Kotlin Plugin Updates in your IDE, then you’ll be able to install the latest preview release. Check out these instructions for details.

You can always download the latest versions of these IDEs to get extensive support for Kotlin:

  • IntelliJ IDEA for developing Kotlin applications for a variety of platforms.
  • Android Studio for developing Android and cross-platform mobile applications.

Once you’ve installed 1.5.30-M1, change the Kotlin version to

1.5.30-M1

in your build scripts. 

If you run into any problems, please refer to these instructions.

Read more