platform/build-scripts/product-dsl/docs/dsl-api-reference.md
Complete reference for the product-dsl Kotlin DSL functions used to define product module composition.
The product-dsl provides two main DSL entry points:
| DSL | Purpose | Source File |
|---|---|---|
productModules {} | Define product content specification | ProductModulesContentSpec.kt |
moduleSet() {} | Define reusable module collections | ModuleSetBuilder.kt |
productModules {} - Create Product SpecificationEntry point for defining a product's module composition.
fun productModules(block: ProductModulesContentSpecBuilder.() -> Unit): ProductModulesContentSpec
Example:
override fun getProductContentDescriptor(): ProductModulesContentSpec = productModules {
alias("com.intellij.modules.idea")
vendor("JetBrains")
moduleSet(essential())
moduleSet(vcs())
embeddedModule("intellij.platform.additional")
bundledPlugins(listOf("intellij.java.plugin"))
}
These functions are available inside the productModules {} block:
alias() - Add Module Aliasfun alias(value: String)
Adds a product module alias for <module value="..."/> declaration. Plugins can depend on this alias.
Example:
alias("com.intellij.modules.idea")
alias("com.jetbrains.gateway")
vendor() - Set Product Vendorfun vendor(value: String)
Sets the product vendor for the <vendor> tag in plugin.xml.
Example:
vendor("JetBrains")
include() - Include Another Specfun include(spec: ProductModulesContentSpec)
Merges another ProductModulesContentSpec into this builder. Enables composition of reusable spec fragments.
Example:
productModules {
include(commonCapabilityAliases()) // Reusable aliases
include(platformCommonIncludes()) // Reusable deprecatedIncludes
moduleSet(commercialIdeBase())
}
deprecatedInclude() - Add XML Includefun deprecatedInclude(
moduleName: String,
resourcePath: String,
ultimateOnly: Boolean = false,
optional: Boolean = false
)
Adds an xi:include directive to include XML content from a module's resources.
| Parameter | Description |
|---|---|
moduleName | Module containing the resource |
resourcePath | Path within the module (e.g., META-INF/Plugin.xml) |
ultimateOnly | If true, skipped in Community builds |
optional | If true, always uses xi:fallback (never inlined) |
Example:
deprecatedInclude("intellij.platform.resources", "META-INF/PlatformLangPlugin.xml")
deprecatedInclude("intellij.ultimate.resources", "META-INF/UltimatePlugin.xml", ultimateOnly = true)
deprecatedInclude("intellij.rider.languages", "intellij.rider.languages.xml", optional = true)
moduleSet() - Include Module Set// Without overrides
fun moduleSet(set: ModuleSet)
// With loading overrides
fun moduleSet(set: ModuleSet, block: ModuleLoadingOverrideBuilder.() -> Unit)
Includes a module set. When overrides are provided, the set is inlined instead of using xi:include.
Example:
// Simple inclusion
moduleSet(essential())
moduleSet(vcs())
// With loading overrides (causes inlining)
moduleSet(commercialIdeBase()) {
overrideAsEmbedded("intellij.rd.platform")
overrideAsEmbedded("intellij.rd.ui")
}
module() - Add Individual Modulefun module(
name: String,
loading: ModuleLoadingRuleValue = ModuleLoadingRuleValue.OPTIONAL,
allowedMissingPluginIds: List<String> = emptyList()
)
Adds an individual module to additionalModules. Use for modules not in any module set.
allowedMissingPluginIds is only used for DSL test plugins to suppress unresolved plugin-owned auto-add deps
discovered from this module.
Example:
module("intellij.platform.specific.feature")
module("intellij.some.module", ModuleLoadingRuleValue.REQUIRED)
embeddedModule() - Add Embedded Modulefun embeddedModule(name: String, allowedMissingPluginIds: List<String> = emptyList())
Adds a module with loading="embedded". Use for modules that must load in the core classloader.
allowedMissingPluginIds is only used for DSL test plugins to suppress unresolved plugin-owned auto-add deps
discovered from this module.
Example:
embeddedModule("intellij.platform.core.extension")
requiredModule() - Add Required Modulefun requiredModule(name: String, allowedMissingPluginIds: List<String> = emptyList())
Adds a module with loading="required". Use for test framework modules.
allowedMissingPluginIds is only used for DSL test plugins to suppress unresolved plugin-owned auto-add deps
discovered from this module.
Example:
requiredModule("intellij.libraries.junit5")
bundledPlugins() - Specify Bundled Pluginsfun bundledPlugins(pluginModules: List<String>)
Specifies bundled plugin modules for automatic dependency generation. These are JPS modules containing META-INF/plugin.xml.
Example:
bundledPlugins(listOf(
"intellij.java.plugin",
"intellij.kotlin.plugin",
"intellij.git4idea"
))
allowMissingDependencies() - Allow Missing Modulesfun allowMissingDependencies(vararg modules: String)
fun allowMissingDependencies(modules: List<String>)
Allows specific modules to be missing during validation. Use for modules provided by plugin layouts.
Example:
allowMissingDependencies("com.jetbrains.cidr.lang", "com.jetbrains.cidr.execution")
testPlugin {} - Define Test Pluginfun testPlugin(
pluginId: String,
name: String,
pluginXmlPath: String,
additionalBundledPluginTargetNames: List<String> = emptyList(),
allowedMissingPluginIds: List<String> = emptyList(),
block: ProductModulesContentSpecBuilder.() -> Unit
)
Defines a test plugin with programmatically generated plugin.xml.
Auto-add fills in unresolvable transitive test deps under the additional region, so keep the spec minimal.
additionalBundledPluginTargetNames lists extra bundled plugin target (JPS module) names used for resolution.
Use allowedMissingPluginIds (plugin IDs) to suppress errors for unresolvable plugin dependencies (it does not add the dependency).
For more precise suppression tied to a specific module, pass allowedMissingPluginIds to module(), embeddedModule(),
or requiredModule() inside the test plugin block.
Example:
testPlugin(
pluginId = "intellij.python.junit5Tests.plugin",
name = "Python Tests Plugin",
pluginXmlPath = "python/junit5Tests/plugin/testResources/META-INF/plugin.xml"
) {
moduleSet(CommunityModuleSets.platformTestFrameworksCore())
module("intellij.tools.testsBootstrap")
module("intellij.python.testFramework")
}
See test-plugins.md for details.
moduleSet() {} - Create Module SetEntry point for defining a reusable module collection.
fun moduleSet(
name: String,
alias: String? = null,
outputModule: String? = null,
selfContained: Boolean = false,
includeDependencies: Boolean = false,
block: ModuleSetBuilder.() -> Unit
): ModuleSet
| Parameter | Description |
|---|---|
name | Identifier for the set (e.g., "vcs", "essential.minimal") |
alias | Optional module alias for <module value="..."/> |
outputModule | Module whose resources dir receives generated XML |
selfContained | If true, validates in isolation (all deps must be within set) |
includeDependencies | Default for embedded modules to include transitive deps |
Examples:
// Simple module set
fun vcs() = moduleSet("vcs") {
module("intellij.platform.vcs.impl")
module("intellij.platform.vcs.log")
embeddedModule("intellij.platform.vcs")
}
// With alias
fun xml() = moduleSet("xml", alias = "com.intellij.modules.xml") {
embeddedModule("intellij.xml.dom")
embeddedModule("intellij.xml.psi")
}
// With custom output location
fun corePlatform() = moduleSet("core.platform", outputModule = "intellij.platform.ide.core") {
// ...
}
// With dependency auto-inclusion
fun essential() = moduleSet("essential", includeDependencies = true) {
embeddedModule("intellij.platform.core") // Inherits includeDependencies=true
}
These functions are available inside the moduleSet() {} block:
module() - Add Regular Modulefun module(
name: String,
loading: ModuleLoadingRuleValue = ModuleLoadingRuleValue.OPTIONAL,
allowedMissingPluginIds: List<String> = emptyList()
)
Adds a module with default or specified loading mode.
allowedMissingPluginIds is only used for DSL test plugins to suppress unresolved plugin-owned auto-add deps
discovered from this module.
embeddedModule() - Add Embedded Modulefun embeddedModule(name: String, allowedMissingPluginIds: List<String> = emptyList())
Adds a module with loading="embedded".
allowedMissingPluginIds is only used for DSL test plugins to suppress unresolved plugin-owned auto-add deps
discovered from this module.
requiredModule() - Add Required Modulefun requiredModule(name: String, allowedMissingPluginIds: List<String> = emptyList())
Adds a module with loading="required".
allowedMissingPluginIds is only used for DSL test plugins to suppress unresolved plugin-owned auto-add deps
discovered from this module.
moduleSet() - Include Nested Module Setfun moduleSet(set: ModuleSet)
Includes another module set, creating hierarchical composition.
Example:
fun ideCommon() = moduleSet("ide.common") {
moduleSet(essential())
moduleSet(vcs())
moduleSet(xml())
}
plugin(name) - Create Pluginized Module Setfun plugin(
name: String,
pluginId: String? = null,
outputModule: String? = null,
addToMainModule: Boolean = true,
block: ModuleSetBuilder.() -> Unit
): ModuleSet
Creates a module set and marks it to be materialized as a standalone bundled plugin wrapper.
The Product DSL pipeline generates the wrapper module files, plugin-content.yaml, and modules.xml entries during generation.
Do not pass the result to product-level or nested moduleSet(...) composition APIs; bundle the generated wrapper plugin module instead.
Example:
fun recentFiles() = plugin("recentFiles") {
module("intellij.platform.recentFiles")
module("intellij.platform.recentFiles.frontend")
module("intellij.platform.recentFiles.backend")
}
Available when using moduleSet(set) { ... } with overrides:
overrideAsEmbedded() - Override to Embeddedfun overrideAsEmbedded(moduleName: String)
Overrides a module's loading to embedded.
overrideAsRequired() - Override to Requiredfun overrideAsRequired(moduleName: String)
Overrides a module's loading to required.
loading() - Custom Loading Rulefun loading(rule: ModuleLoadingRuleValue, vararg moduleNames: String)
Sets custom loading rule for multiple modules.
Example:
moduleSet(commercialIdeBase()) {
overrideAsEmbedded("intellij.rd.platform")
overrideAsRequired("intellij.some.module")
loading(ModuleLoadingRuleValue.EMBEDDED, "module.a", "module.b", "module.c")
}
ContentModuleRepresents a module with optional loading attribute.
data class ContentModule(
val name: String,
val loading: ModuleLoadingRuleValue? = null,
val includeDependencies: Boolean = false
)
ModuleSetRepresents a named collection of content modules.
data class ModuleSet(
val name: String,
val modules: List<ContentModule>,
val nestedSets: List<ModuleSet> = emptyList(),
val alias: String? = null,
val outputModule: String? = null,
val selfContained: Boolean = false
)
DeprecatedXmlIncludeRepresents an XML include directive.
data class DeprecatedXmlInclude(
val moduleName: String,
val resourcePath: String,
val ultimateOnly: Boolean = false,
val optional: Boolean = false
)
TestPluginSpecSpecification for a test plugin.
data class TestPluginSpec(
val pluginId: String,
val name: String,
val pluginXmlPath: String,
val spec: ProductModulesContentSpec,
val additionalBundledPluginTargetNames: List<String> = emptyList(),
val allowedMissingPluginIds: List<String> = emptyList()
)
| Mode | XML Attribute | Use Case |
|---|---|---|
null (default) | none | Regular modules |
EMBEDDED | loading="embedded" | Core classloader modules |
REQUIRED | loading="required" | Test framework modules |
OPTIONAL | loading="optional" | Optional features |
ON_DEMAND | loading="on-demand" | Lazy-loaded modules |
ModuleSetGenerationConfigConfiguration class for module set generation with validation options.
allowedMissingPluginIds in testPlugin DSL (module(), requiredModule(), embeddedModule()).suppressions.json (contentModules.<module>.suppressPlugins).--update-suppressions updates suppressions.json for non-DSL suppressions only; DSL allowlists remain in code.