Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Builtin plugins can be applied via a type-safe, tooling-friendly mechanism #168

@bamboo

Description

@bamboo

Improve the usability of builtin plugins by providing extension members that can be used in the scope of the plugins block:

plugins {
    java
    application
}

This should give users the following benefits:

  • content-assist for applying plugins (typing <CTRL+SPACE> within the plugins block would cause the IDE to present a list of available plugins)
  • a starting point for navigating their docs directly in the IDE

A standalone Kotlin example

fun buildscript() {
    plugins {
        java
        application
    }
}

// Plugins block
fun plugins(setup: PluginsBlock.() -> Unit) {
}

class PluginsBlock {
    fun id(id: String): PluginId = PluginId(id)
}

data class PluginId(val id: String)

// Builtin plugin ids as extension members
val PluginsBlock.java: PluginId
    get() = id("java")

val PluginsBlock.application: PluginId
    get() = id("application")

Alternatively an infix + operator could be used as syntactic hook if the UX is considerably improved:

class PluginBlock { // same as above plus
    // Provides a syntactic hook for content-assist
    operator fun PluginId.unaryPlus(): PluginId = this
}

plugins {
  +application
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions