Skip to content
Arciphant
Esc
↑↓navigate↵open⌘Jpreview
On this page

DSL reference

All functions of the Arciphant DSL — signatures, parameters and defaults.

This page is the reference of everything that can be declared inside the arciphant { } block in settings.gradle.kts. For a guided introduction see Declare Structure.

Global settings

Function Description
basePath(path: String) Base path under which all modules are created; can be nested (e.g. "backend:my-service"). Can be overridden per module. See Custom base path.
projectSetComponentLayout() Selects the project layout — one Gradle project per component. This is the default.
sourceSetComponentLayout() Selects the source set layout — one Gradle project per functional module, components as source sets.
disableProjectFolderCreation() Disables the automatic creation of missing project folders.
disableQualifiedArchiveBaseName() Project layout
Disables the qualified archive base name moduleName-componentName.
withTestSourceSet(Boolean) Source set layout
Enables/disables test source sets for all components (default true). See Test source set configuration.
withTestFixturesSourceSet(Boolean) Source set layout
Enables/disables test fixtures source sets for all components (default true).
testSourceSetName((String) -> String) Source set layout
Naming scheme for test source sets (default <component>Test).
testFixturesSourceSetName((String) -> String) Source set layout
Naming scheme for test fixtures source sets (default <component>TestFixtures).
packageStructureValidation { } Configures the package structure validation — see Validate project structure for all options.

Declaring structure

template

template(): ModuleTemplateBuilder

Creates a new module template. The returned builder provides createComponent, extendComponent and extends.

module

module(name: String, basePath: String? = null, template: ModuleTemplateBuilder)
module(name: String, basePath: String? = null, templates: Set<ModuleTemplateBuilder> = emptySet())

Creates a domain module, instantiated from the given template(s).

PropType
nameString

The module name; becomes the name of the Gradle project (and folder).

TypeString
basePath?String?

Overrides the global base path for this module.

TypeString?
Defaultglobal base path
template / templates?ModuleTemplateBuilder

The template(s) the module is instantiated from. When several templates are combined, each component name may only be declared by one of them. A module may also be declared without any template.

TypeModuleTemplateBuilder
DefaultemptySet()

The returned builder provides createComponent and extendComponent to add or extend components of this specific module.

library

library(name: String, basePath: String? = null, template: ModuleTemplateBuilder)
library(name: String, basePath: String? = null, templates: Set<ModuleTemplateBuilder> = emptySet())

Creates a library module. Same parameters and builder as module. Each component of each domain module automatically gets an api dependency on the same-named component of the library module — see Shared code.

bundle

bundle(name: String, basePath: String? = null, plugin: String? = null, includes: Set<ModuleBuilder> = emptySet())

Creates a bundle module that depends on the modules it includes.

PropType
nameString

The bundle name; becomes the name of the Gradle project (and folder).

TypeString
basePath?String?

Overrides the global base path for this bundle.

TypeString?
Defaultglobal base path
plugin?String?

Project layout only. Id of a convention plugin applied to the bundle project — see Bundle plugins.

TypeString?
includes?Set<ModuleBuilder>

The modules (or other bundles) this bundle packages. If empty, the bundle depends on all functional modules.

TypeSet<ModuleBuilder>
Defaultall functional modules

Declaring components

createComponent

Available on templates and on modules/libraries.

createComponent(
    name: String,
    plugin: String? = null,
    dependencies: Set<String> = emptySet(),
    apiDependencies: Set<String> = emptySet(),
    withTestSourceSet: Boolean? = null,
    withTestFixturesSourceSet: Boolean? = null,
)
PropType
nameString

The component name. In the source set layout, prefer lowerCamelCase names — the name becomes a source set name.

TypeString
plugin?String?

Project layout only. Id of a convention plugin applied to the component project — see Using Plugins.

TypeString?
dependencies?Set<String>

Names of components of the same module this component gets an implementation dependency on.

TypeSet<String>
DefaultemptySet()
apiDependencies?Set<String>

Names of components of the same module this component gets an api (transitive) dependency on. A component listed here does not need to be repeated in dependencies.

TypeSet<String>
DefaultemptySet()
withTestSourceSet?Boolean?

Source set layout only. Overrides the global withTestSourceSet flag for this component.

TypeBoolean?
Defaultglobal setting
withTestFixturesSourceSet?Boolean?

Source set layout only. Overrides the global withTestFixturesSourceSet flag for this component.

TypeBoolean?
Defaultglobal setting

Creating a component that already exists (e.g. inherited from a template) is a configuration error — use extendComponent instead.

extendComponent

Available on templates and on modules/libraries.

extendComponent(
    name: String,
    dependencies: Set<String> = emptySet(),
    apiDependencies: Set<String> = emptySet(),
)

Adds the given dependencies to an already declared (typically inherited) component — see Extending components. Everything else about the component remains untouched. Each component can be extended at most once per module or template; extending a component that does not exist is a configuration error.

extends

Available on templates only.

extends(template: ModuleTemplateBuilder)

Inherits all components of another template — see Different shapes.

Dependencies in build scripts

component

// build.gradle.kts of the component project
dependencies {
    "implementation"(component(module = "contracts", component = "api"))
}
// build.gradle.kts of the module project
dependencies {
    "applicationImplementation"(component(module = "contracts", component = "api"))
}

The component(module, component) extension creates a dependency notation for a component of another module, resolved from the Arciphant configuration. It is registered on every project managed by Arciphant except bundle projects and is available in both component layouts — see Component dependencies in build scripts.

Was this page helpful?