or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

desktop-application.mddesktop-components.mdgradle-plugin.mdindex.mdresource-management.mdui-tooling.md

gradle-plugin.mddocs/

0

# Gradle Plugin Configuration

1

2

The Compose Multiplatform Gradle plugin provides the core functionality for configuring Compose projects and managing dependencies.

3

4

## Plugin Application

5

6

```kotlin { .api }

7

abstract class ComposePlugin : Plugin<Project> {

8

override fun apply(project: Project)

9

}

10

```

11

12

Apply the plugin in your `build.gradle.kts`:

13

14

```kotlin

15

plugins {

16

id("org.jetbrains.compose") version "1.8.2"

17

}

18

```

19

20

## Compose Extension

21

22

```kotlin { .api }

23

abstract class ComposeExtension @Inject constructor(

24

objects: ObjectFactory,

25

project: Project

26

) : ExtensionAware {

27

@Deprecated("Since Kotlin 2.2.0 Compose Compiler configuration is moved to the \"org.jetbrains.kotlin.plugin.compose\" plugin")

28

val kotlinCompilerPlugin: Property<String?>

29

30

@Deprecated("Since Kotlin 2.2.0 Compose Compiler configuration is moved to the \"org.jetbrains.kotlin.plugin.compose\" plugin")

31

val kotlinCompilerPluginArgs: ListProperty<String>

32

33

@Deprecated("Since Kotlin 2.2.0 Compose Compiler configuration is moved to the \"org.jetbrains.kotlin.plugin.compose\" plugin")

34

val platformTypes: SetProperty<KotlinPlatformType>

35

36

val dependencies: ComposePlugin.Dependencies

37

}

38

```

39

40

The extension is available as `compose` in your build script:

41

42

```kotlin

43

compose {

44

// Configuration options

45

}

46

```

47

48

## Dependencies API

49

50

```kotlin { .api }

51

class Dependencies(project: Project) {

52

val desktop: DesktopDependencies

53

val animation: String

54

val animationGraphics: String

55

val foundation: String

56

val material: String

57

val material3: String

58

val material3AdaptiveNavigationSuite: String

59

val runtime: String

60

val runtimeSaveable: String

61

val ui: String

62

val uiTooling: String

63

val uiUtil: String

64

val preview: String

65

val materialIconsExtended: String

66

val components: CommonComponentsDependencies

67

val html: HtmlDependencies

68

69

@Deprecated("Use desktop.uiTestJUnit4")

70

@ExperimentalComposeLibrary

71

val uiTestJUnit4: String

72

73

@ExperimentalComposeLibrary

74

val uiTest: String

75

76

@Deprecated("Use compose.html")

77

val web: WebDependencies

78

79

fun BOM(version: String = ""): String

80

}

81

```

82

83

### Desktop Dependencies

84

85

```kotlin { .api }

86

object DesktopDependencies {

87

val components: DesktopComponentsDependencies

88

val common: String

89

val linux_x64: String

90

val linux_arm64: String

91

val windows_x64: String

92

val windows_arm64: String

93

val macos_x64: String

94

val macos_arm64: String

95

val uiTestJUnit4: String

96

val currentOs: String

97

}

98

```

99

100

### Common Components Dependencies

101

102

```kotlin { .api }

103

object CommonComponentsDependencies {

104

val resources: String

105

val uiToolingPreview: String

106

}

107

```

108

109

### Desktop Components Dependencies

110

111

```kotlin { .api }

112

object DesktopComponentsDependencies {

113

@ExperimentalComposeLibrary

114

val splitPane: String

115

116

@ExperimentalComposeLibrary

117

val animatedImage: String

118

}

119

```

120

121

### HTML Dependencies

122

123

```kotlin { .api }

124

object HtmlDependencies {

125

val core: String

126

val svg: String

127

val testUtils: String

128

}

129

```

130

131

### Web Dependencies (Deprecated)

132

133

```kotlin { .api }

134

@Deprecated("Use compose.html")

135

object WebDependencies {

136

val core: String

137

val svg: String

138

val testUtils: String

139

}

140

```

141

142

## Usage Examples

143

144

### Basic Dependency Configuration

145

146

```kotlin

147

dependencies {

148

implementation(compose.desktop.currentOs)

149

implementation(compose.material3)

150

implementation(compose.ui)

151

implementation(compose.uiTooling)

152

153

// Desktop-specific components

154

implementation(compose.desktop.components.splitPane)

155

implementation(compose.desktop.components.animatedImage)

156

157

// Testing

158

testImplementation(compose.desktop.uiTestJUnit4)

159

}

160

```

161

162

### Platform-Specific Dependencies

163

164

```kotlin

165

dependencies {

166

// Target specific platforms

167

implementation(compose.desktop.linux_x64)

168

implementation(compose.desktop.windows_x64)

169

implementation(compose.desktop.macos_arm64)

170

171

// Or use current OS

172

implementation(compose.desktop.currentOs)

173

}

174

```

175

176

### Repository Configuration

177

178

```kotlin { .api }

179

fun RepositoryHandler.jetbrainsCompose(): MavenArtifactRepository

180

```

181

182

Add the JetBrains Compose repository:

183

184

```kotlin

185

repositories {

186

jetbrainsCompose()

187

mavenCentral()

188

}

189

```

190

191

## Helper Functions

192

193

```kotlin { .api }

194

fun KotlinDependencyHandler.compose(groupWithArtifact: String): String

195

fun DependencyHandler.compose(groupWithArtifact: String): String

196

```

197

198

These functions create dependency strings with the current Compose version:

199

200

```kotlin

201

dependencies {

202

implementation(compose("org.jetbrains.compose.material3:material3"))

203

}

204

```