api / org.gradle.platform.base

Package org.gradle.platform.base

Types

Application

interface Application : Component

A software application.

ApplicationBinarySpec

interface ApplicationBinarySpec : BinarySpec

A binary produced from a `org.gradle.platform.base.ApplicationSpec`.

ApplicationSpec

interface ApplicationSpec : GeneralComponentSpec

A specification of a org.gradle.platform.base.Application.

Binary

interface Binary

A physical binary artifact, which can run on a particular platform or runtime.

BinaryContainer

interface BinaryContainer : ModelMap<BinarySpec>

A container for project binaries, which represent physical artifacts that can run on a particular platform or runtime.

BinarySpec

interface BinarySpec : BuildableComponentSpec, CheckableComponentSpec, Binary

Represents a binary that is the result of building a component.

BinaryTasksCollection

interface BinaryTasksCollection : DomainObjectSet<Task>

A collection of tasks associated to a binary

ComponentSpec

interface ComponentSpec : ModelElement

A software component that is built by Gradle.

ComponentSpecContainer

interface ComponentSpecContainer : ModelMap<ComponentSpec>

A container of software components.

DependencySpec

interface DependencySpec

A dependency onto a Gradle component.

DependencySpecBuilder

interface DependencySpecBuilder

A builder of a DependencySpec. Implementations are required to return immutable dependency specs.

DependencySpecContainer

interface DependencySpecContainer

A container for dependency specifications.

GeneralComponentSpec

interface GeneralComponentSpec : ComponentSpec, SourceComponentSpec, VariantComponentSpec

A general purpose component specification, that can be used to represent some software component built from source and producing multiple output variants.

Library

interface Library : Component

A library that can be linked into or depended on by another software element.

LibraryBinaryDependencySpec

interface LibraryBinaryDependencySpec : DependencySpec

A dependency onto a specific binary of a library published by a project.

LibraryBinarySpec

interface LibraryBinarySpec : BinarySpec

A binary produced from a `org.gradle.platform.base.LibrarySpec`.

LibrarySpec

interface LibrarySpec : GeneralComponentSpec

A specification of a org.gradle.platform.base.Library.

ModuleDependencySpec

interface ModuleDependencySpec : DependencySpec

A dependency onto a module.

ModuleDependencySpecBuilder

interface ModuleDependencySpecBuilder : DependencySpecBuilder

A builder of a ModuleDependencySpec.

Platform

interface Platform : Named

The platform or runtime that a binary is designed to run on. Examples: the JvmPlatform defines a java runtime, while the NativePlatform defines the Operating System and Architecture for a native app.

PlatformAwareComponentSpec

interface PlatformAwareComponentSpec : VariantComponentSpec

Defines Platform specific operations for ComponentSpecs

PlatformContainer

interface PlatformContainer : ExtensiblePolymorphicDomainObjectContainer<Platform>

A container of Platforms.

ProjectDependencySpec

interface ProjectDependencySpec : DependencySpec

A dependency onto a library published by a project.

ProjectDependencySpecBuilder

interface ProjectDependencySpecBuilder : DependencySpecBuilder

A builder of a ProjectDependencySpec.

SourceComponentSpec

interface SourceComponentSpec : ComponentSpec

Represents some component whose implementation can be represented as a collection of source files, and whose other outputs are built from this source.

ToolChain

interface ToolChain : Named

A set of compilers that are used together to construct binaries.

ToolChainRegistry

interface ToolChainRegistry<P : Platform, T : ToolChain>

A Provider of ToolChains.

TransformationFileType

interface TransformationFileType

The type of a file of a transformation

TypeBuilder

interface TypeBuilder<T : Any>

A TypeBuilder to configure the registration of a type.

VariantComponent

interface VariantComponent : ModelElement

A component that has one or more mutually exclusive variants.

VariantComponentSpec

interface VariantComponentSpec : ComponentSpec, VariantComponent

Represents a component spec that is made up of one or more mutually exclusive variants.

Annotations

BinaryTasks

class BinaryTasks

Declares the tasks to build a custom org.gradle.platform.base.BinarySpec binary. The following example demonstrates how to register multiple tasks for custom binary using a plugin with a org.gradle.platform.base.BinaryTasks annotation.

 @Managed interface SampleComponent extends ComponentSpec {} @Managed interface SampleBinary extends BinarySpec {} apply plugin: MyCustomBinariesPlugin class MyCustomBinaryCreationTask extends DefaultTask { @TaskAction void build() { //building the binary } } class MyCustomBinariesPlugin extends RuleSource { @ComponentType void register(TypeBuilder<SampleBinary> builder) {} @BinaryTasks void createBinaryTasks(ModelMap<Task> tasks, SampleBinary binary) { tasks.create("${binary.name}Task1", MyCustomBinaryCreationTask) tasks.create("${binary.name}Task2") { dependsOn "${binary.name}Task1" } } } 

ComponentBinaries

class ComponentBinaries

Declares the binaries that should be built for a custom org.gradle.platform.base.ComponentSpec type. The following example demonstrates how to register a binary for a custom component type using a plugin with a org.gradle.platform.base.ComponentBinaries annotation. Furthermore the plugin registers 'DefaultSampleBinary' as implementation for org.gradle.platform.base.BinarySpec.

 interface SampleComponent extends VariantComponentSpec {} interface SampleBinary extends BinarySpec {} class DefaultSampleBinary extends BaseBinarySpec implements SampleBinary {} apply plugin: MyCustomBinariesPlugin class MyCustomBinariesPlugin extends RuleSource { @ComponentType void register(TypeBuilder<SampleBinary> builder) { builder.defaultImplementation(DefaultSampleBinary) } @ComponentBinaries void createBinariesForSampleLibrary(ModelMap<SampleBinary> binaries, SampleComponent component) { binaries.create("${component.name}Binary", SampleBinary) } } 

ComponentType

class ComponentType

Declares a custom org.gradle.platform.base.ComponentSpec type. The following example demonstrates how to register a custom component type using a plugin with a ComponentType annotation. Furthermore the plugin creates an instance of SampleComponent named 'sampleComponent'.

 interface SampleComponent extends ComponentSpec {} class DefaultSampleComponent extends BaseComponentSpec implements SampleComponent {} apply plugin: MySamplePlugin class MySamplePlugin extends RuleSource { @ComponentType void register(TypeBuilder<SampleComponent> builder) { builder.defaultImplementation(DefaultSampleComponent) } @Mutate void createSampleLibraryComponents(ModelMap<SampleComponent> componentSpecs) { componentSpecs.create("sampleComponent") } } 

Variant

class Variant

Declares that a property represents a variant dimension. Variants are used in dependency resolution to discriminate between various binaries that may match the requirements (such as a platform, a build type, ...). This annotation must be set on a getter. The return type of the getter must either be a String or a class implementing org.gradle.api.Named.

Exceptions

InvalidModelException

open class InvalidModelException : GradleException

Thrown when a component model is declared in an invalid way.

ModelInstantiationException

open class ModelInstantiationException : GradleException

Thrown when a model element cannot be instantiated for some reason.