Amper Update May 2024 – Standalone Build Tool, New IDE Features, and More
A lot has happened since our last update about Amper, an experimental build tool by JetBrains. In this post, we’ll look at a brand-new way of using Amper, see how the tooling has improved recently, and learn what’s new in Amper 0.3.0.
Standalone Amper build tool
We initially built Amper as a Gradle plugin, providing only a configuration layer on top of the existing Gradle build tool. This helped us prototype quickly and focus on validating the Amper user experience. Using Gradle-based Amper also allows incremental adoption within an existing project, as well as adding arbitrary Gradle configuration to your Amper modules.
At the same time, we’ve been experimenting with making Amper a standalone build tool that doesn’t just delegate to an existing system, but handles most build tasks itself. This allows us to have full control over the developer experience, ensure that the entire build configuration is declarative, and provide great tooling integrations for the build tool in the IDE. It also opens up opportunities for performance improvements, such as faster resolution and dependency downloads.
The standalone version of Amper is now available for you to try as a preview, in addition to the Gradle-based version. It currently works with JVM and Android applications, including the use of Compose Multiplatform for these targets. Support for iOS applications is in progress and will be available in later releases.
Amper handles the project import, configures the environment and SDKs used by the project, resolves and downloads dependencies, invokes compilers, and runs applications and tests. It delegates some tasks to external tools in certain scenarios – for example, the Android Gradle plugin for parts of Android builds, or Xcode build tools for iOS builds.
Projects set up with the standalone version of Amper use the same configuration file format but contain Amper’s own executables (amper
and amper.bat
). Check out the usage page of the documentation to learn more about the available tasks.
You can run tasks from the command line or use the tooling offered in Fleet or IntelliJ IDEA:
To get started, try some of the new sample projects using Amper as the build tool. We look forward to hearing your feedback!
Tooling improvements
One of the primary goals of Amper is to provide excellent tooling support, which is enabled by using declarative module files, making it possible to reason about the configuration. Below are some of the recent tooling improvements available in Fleet 1.35 and IntelliJ IDEA 2024.2 (currently available as an EAP build).
Quick-fixes in Kotlin source code
Some problems that you encounter while editing your Kotlin sources can be solved by modifying your build configuration, such as by adding compiler flags. As Amper module files are declarative, there is a single straightforward way to make these modifications in them, allowing us to provide reliable quick-fixes in these scenarios.
For example, you can add a module-wide opt-in for an opt-in annotation:
Or, if you’re using an older language version in your project, you can update it with a quick-fix when trying to use a new language feature:
Setting up projects from scratch
Amper’s tooling support can help you set up new projects or quickly create new modules in an existing project.
To start a new Amper project from scratch, create an empty module file. There are various templates to choose from, and you can also write your own configuration with completion support:
You can then set up the build system using a quick-fix, with a choice of using the standalone version of Amper or the Gradle-based version:
To get started, you can also easily create your initial source folders, either empty or containing a basic sample application:
Merging configuration blocks
A frequent use case for editing build configurations is copying code from another file, documentation, or other sources, and pasting it into your existing configuration. To make this easier, we now offer a quick-fix to merge duplicated blocks in your configuration files:
Try Amper today
In addition to the highlights mentioned above, Amper 0.3.0 adds support for the Wasm platform for Kotlin Multiplatform libraries in Gradle-based Amper projects. It also contains several version upgrades, including Kotlin 2.0.0-RC3, Compose Multiplatform 1.6.2, and Android Gradle plugin 8.2.2. For the full list of changes, see the changelog.
To get started, check out the updated samples for Gradle-based projects. To use the latest version in an existing project, update your plugin version:
plugins { id("org.jetbrains.amper.settings.plugin").version("0.3.0") }
To try the standalone Amper build tool, check out the samples in the GitHub repository.
For the best tooling support, use the latest versions of Fleet 1.35 and IntelliJ IDEA 2024.2 (available as an EAP build).
Share your feedback
Amper is still experimental and under active development. Your feedback is vital to us at this stage, and your thoughts and use cases can contribute to our decisions about how to develop Amper.
To provide feedback about your experience, join the discussion in the Kotlinlang Slack’s #amper channel or share your suggestions and ideas in our issue tracker on YouTrack.
If you’re attending KotlinConf 2024, you’ll also find us at the JetBrains booth, where we’ll be happy to chat about Amper in person!