/amper

Amper - a project configuration and build tool with a focus on the user experience and the IDE support

Primary LanguageKotlinApache License 2.0Apache-2.0

JetBrains incubator project GitHub license Latest release

Amper

Amper is a project configuration and build tool. Its goal is to provide a great and smooth user experience and IDE support We believe that this can be achieved by:

  • providing a developer- and IDE-friendly declarative configuration DSL - to simplify not only the initial setup but also improve maintainability and let an IDE assist with automatic configuration reliably;
  • bundling a curated set of compatible toolchains and extensions - to support the majority of the scenarios without the need to find compatible plugins;
  • carefully choosing the extensibility points - to keep the overall mental model and UX of the configuration consistent and to avoid unexpected third-party code execution.

In essence, we aim to achieve a similar well-thought-out and well-tested experience as with JetBrains IDEs.

We’re currently looking at various aspects, including the configuration of projects for building, packaging, publishing, and more. At the current stage, however, the focus is primarily on configuring projects for building. While the current use case is Kotlin and Kotlin Multiplatform, Amper also supports Java and Swift (as a requirement for multiplatform). However, the same approach to configuration could work for other languages and technology stacks in the future.

Amper exists as a standalone build tool as well as a Gradle plugin for existing Gradle-based projects. Both versions offer a unified, easy-to-use, declarative configuration format.

Supported features:

* only in Gradle-based projects

Future directions:

For a quick start:

Issues and feedback

Amper uses YouTrack for issue tracking, create a new issue there to report problems or submit ideas.

Before reporting an issue, please check the FAQ.

You can also join the Slack channel for discussions, or share your feedback using the feedback form.

How to Try

There are multiple ways to try Amper:

Examples

Basics

Here is a very basic JVM "Hello, World!" project:

The main.kt and MyTest.kt files are just regular Kotlin files with nothing special in them. The interesting part is module.yaml, which is the Amper module configuration file. For the above project structure, it would simply be:

# Produce a JVM application 
product: jvm/app

That's it. The Kotlin and Java toolchains, test framework, and other necessary functionality are configured and available straight out of the box. You can build it, run it, write and run tests, and more. For more detailed information, check out the full example.

Multiplatform

Now, let's look at a Compose Multiplatform project with Android, iOS, and desktop JVM apps, with the following project structure in Fleet:

Notice how the src/ folder contains Kotlin and Swift code together. It could, of course, also be Kotlin and Java. Another aspect to highlight is the shared module with the common code in the src folder and the platform-specific code folders src@ios and src@android (learn more about project layout).

Here is how ios-app/module.yaml file looks:

# Produce an iOS application
product: ios/app

# Depend on the shared library module: 
dependencies:
  - ../shared

settings:
  # Enable the Compose Multiplatform framework
  compose: enabled

This is pretty straightforward: It defines an iOS application with a dependency on a shared module and enables the Compose Multiplatform framework. A more interesting example would be shared/module.yaml:

# Produce a shared library for the JVM, Android, and iOS platforms:
product:
  type: lib
  platforms: [jvm, android, iosArm64, iosSimulatorArm64, iosX64]

# Shared Compose dependencies:
dependencies:
  - $compose.foundation: exported
  - $compose.material3: exported

# Android-only dependencies  
dependencies@android:
  # Android-specific integration with Compose
  - androidx.activity:activity-compose:1.7.2: exported
  - androidx.appcompat:appcompat:1.6.1: exported

# iOS-only dependencies with a dependency on a CocoaPod (not yet implemented)
dependencies@ios:
  - pod: 'Alamofire'
    version: '~> 2.0.1'

settings:
  # Enable Kotlin serialization
  kotlin:
    serialization: json
  
  # Enable the Compose Multiplatform framework
  compose: enabled

A couple of things are worth mentioning. First, note the platform-specific dependencies: sections with the @<platform> qualifier. The platform qualifier can be used both in the manifest and also in the file layout. The qualifier organizes the code, dependencies, and settings for a certain platform. Second, the dependencies: section allows not only Kotlin and Maven dependencies, but also platform-specific package managers, such as CocoaPods, Swift Package Manager, and others.

Naturally, these examples show only a limited set of Amper features. To get more insight into design and functionality, look at the documentation, the tutorial, and example projects.

More examples

Check our these example projects: