Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ subprojects {

maven {
name = "LocalDir"
url = rootProject.buildDir.resolve("repo").toURI()
url = uri(layout.buildDirectory.dir("repo"))
}
}
}
Expand Down Expand Up @@ -98,7 +98,7 @@ fun Project.configureMavenPublication(
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
Expand Down
15 changes: 1 addition & 14 deletions gradle-plugins/buildSrc/src/main/kotlin/gradleUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/

import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.dsl.DependencyHandler
Expand All @@ -14,20 +13,14 @@ import org.gradle.api.tasks.TaskContainer
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JavaToolchainService
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import java.io.File

inline fun <reified T> Project.configureIfExists(fn: T.() -> Unit) {
extensions.findByType(T::class.java)?.fn()
}

val isWindows = DefaultNativePlatform.getCurrentOperatingSystem().isWindows

fun Project.configureAllTests(fn: Test.() -> Unit = {}) {
fun DependencyHandler.testImplementation(notation: Any) =
add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, notation)
Expand All @@ -47,12 +40,6 @@ fun Project.configureAllTests(fn: Test.() -> Unit = {}) {
}
}

fun Test.systemProperties(map: Map<String, Any>) {
for ((k, v) in map) {
systemProperty(k, v)
}
}

fun TaskProvider<*>.dependsOn(vararg dependencies: Any) {
configure {
dependsOn(dependencies)
Expand All @@ -71,4 +58,4 @@ inline fun <reified T : Task> TaskContainer.registerVerificationTask(
}

val Provider<out Jar>.archiveFile: Provider<RegularFile>
get() = flatMap { it.archiveFile }
get() = flatMap { it.archiveFile }
17 changes: 8 additions & 9 deletions gradle-plugins/compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ sourceSets.main.configure {
java.srcDir(buildConfig.flatMap { it.generatedOutputDir })
}

val embeddedDependencies by configurations.creating {
val embeddedDependencies: Configuration by configurations.creating {
isTransitive = false
}

Expand Down Expand Up @@ -75,22 +75,22 @@ dependencies {

val packagesToRelocate = listOf("de.undercouch", "com.squareup.kotlinpoet")

val shadow = tasks.named<ShadowJar>("shadowJar") {
val shadowJar = tasks.named<ShadowJar>("shadowJar") {
for (packageToRelocate in packagesToRelocate) {
relocate(packageToRelocate, "org.jetbrains.compose.internal.$packageToRelocate")
}
archiveBaseName.set("shadow")
archiveClassifier.set("")
archiveVersion.set("")
archiveBaseName = "shadow"
archiveClassifier = ""
archiveVersion = ""
configurations = listOf(embeddedDependencies)
exclude("META-INF/gradle-plugins/de.undercouch.download.properties")
exclude("META-INF/versions/**")
}

val jar = tasks.named<Jar>("jar") {
dependsOn(shadow)
from(zipTree(shadow.get().archiveFile))
this.duplicatesStrategy = DuplicatesStrategy.INCLUDE
dependsOn(shadowJar)
from(zipTree(shadowJar.get().archiveFile))
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

val supportedGradleVersions = project.propertyList("compose.tests.gradle.versions")
Expand Down Expand Up @@ -150,7 +150,6 @@ for (jdkVersion in jdkVersionsForTests) {
}
val unpackJdkTask = tasks.register("unpackJdk$jdkVersion", Copy::class) {
dependsOn(downloadJdkTask)
val archive = archive
val archiveTree = when {
archive.name.endsWith(".tar.gz") -> tarTree(archive)
archive.name.endsWith(".zip") -> zipTree(archive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import org.jetbrains.compose.web.WebExtension
import org.jetbrains.compose.web.internal.configureWeb
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler

internal val composeVersion get() = ComposeBuildConfig.composeVersion

abstract class ComposePlugin : Plugin<Project> {
override fun apply(project: Project) {
val composeExtension = project.extensions.create("compose", ComposeExtension::class.java, project)
Expand Down Expand Up @@ -65,28 +63,31 @@ abstract class ComposePlugin : Plugin<Project> {
@Suppress("DEPRECATION")
class Dependencies(project: Project) {
val desktop = DesktopDependencies
val animation get() = composeDependency("org.jetbrains.compose.animation:animation")
val animationGraphics get() = composeDependency("org.jetbrains.compose.animation:animation-graphics")
val foundation get() = composeDependency("org.jetbrains.compose.foundation:foundation")
val material get() = composeDependency("org.jetbrains.compose.material:material")
val material3 get() = composeDependency("org.jetbrains.compose.material3:material3")
val material3AdaptiveNavigationSuite get() = composeDependency("org.jetbrains.compose.material3:material3-adaptive-navigation-suite")
val runtime get() = composeDependency("org.jetbrains.compose.runtime:runtime")
val runtimeSaveable get() = composeDependency("org.jetbrains.compose.runtime:runtime-saveable")
val ui get() = composeDependency("org.jetbrains.compose.ui:ui")
val animation = composeDependency("org.jetbrains.compose.animation:animation")
val animationGraphics = composeDependency("org.jetbrains.compose.animation:animation-graphics")
val foundation = composeDependency("org.jetbrains.compose.foundation:foundation")
val material = composeDependency("org.jetbrains.compose.material:material")
val material3 = composeDependency("org.jetbrains.compose.material3:material3")
val material3AdaptiveNavigationSuite = composeDependency("org.jetbrains.compose.material3:material3-adaptive-navigation-suite")
val runtime = composeDependency("org.jetbrains.compose.runtime:runtime")
val runtimeSaveable = composeDependency("org.jetbrains.compose.runtime:runtime-saveable")
val ui = composeDependency("org.jetbrains.compose.ui:ui")

@Deprecated("Use desktop.uiTestJUnit4", replaceWith = ReplaceWith("desktop.uiTestJUnit4"))
@ExperimentalComposeLibrary
val uiTestJUnit4 get() = composeDependency("org.jetbrains.compose.ui:ui-test-junit4")
val uiTestJUnit4 = composeDependency("org.jetbrains.compose.ui:ui-test-junit4")

@ExperimentalComposeLibrary
val uiTest get() = composeDependency("org.jetbrains.compose.ui:ui-test")
val uiTooling get() = composeDependency("org.jetbrains.compose.ui:ui-tooling")
val uiUtil get() = composeDependency("org.jetbrains.compose.ui:ui-util")
val preview get() = composeDependency("org.jetbrains.compose.ui:ui-tooling-preview")
val materialIconsExtended get() = "org.jetbrains.compose.material:material-icons-extended:1.7.3"
val components get() = CommonComponentsDependencies
val uiTest = composeDependency("org.jetbrains.compose.ui:ui-test")
val uiTooling = composeDependency("org.jetbrains.compose.ui:ui-tooling")
val uiUtil = composeDependency("org.jetbrains.compose.ui:ui-util")
val preview = composeDependency("org.jetbrains.compose.ui:ui-tooling-preview")
val materialIconsExtended = "org.jetbrains.compose.material:material-icons-extended:1.7.3"
val components = CommonComponentsDependencies

@Deprecated("Use compose.html", replaceWith = ReplaceWith("html"))
val web: WebDependencies get() = WebDependencies
val html: HtmlDependencies get() = HtmlDependencies
val web: WebDependencies = WebDependencies
val html: HtmlDependencies = HtmlDependencies
}

object DesktopDependencies {
Expand All @@ -100,7 +101,7 @@ abstract class ComposePlugin : Plugin<Project> {
val macos_x64 = composeDependency("org.jetbrains.compose.desktop:desktop-jvm-macos-x64")
val macos_arm64 = composeDependency("org.jetbrains.compose.desktop:desktop-jvm-macos-arm64")

val uiTestJUnit4 get() = composeDependency("org.jetbrains.compose.ui:ui-test-junit4")
val uiTestJUnit4 = composeDependency("org.jetbrains.compose.ui:ui-test-junit4")

val currentOs by lazy {
composeDependency("org.jetbrains.compose.desktop:desktop-jvm-${currentTarget.id}")
Expand All @@ -122,31 +123,19 @@ abstract class ComposePlugin : Plugin<Project> {

@Deprecated("Use compose.html")
object WebDependencies {
val core by lazy {
composeDependency("org.jetbrains.compose.html:html-core")
}
val core = composeDependency("org.jetbrains.compose.html:html-core")

val svg by lazy {
composeDependency("org.jetbrains.compose.html:html-svg")
}
val svg = composeDependency("org.jetbrains.compose.html:html-svg")

val testUtils by lazy {
composeDependency("org.jetbrains.compose.html:html-test-utils")
}
val testUtils = composeDependency("org.jetbrains.compose.html:html-test-utils")
}

object HtmlDependencies {
val core by lazy {
composeDependency("org.jetbrains.compose.html:html-core")
}
val core = composeDependency("org.jetbrains.compose.html:html-core")

val svg by lazy {
composeDependency("org.jetbrains.compose.html:html-svg")
}
val svg = composeDependency("org.jetbrains.compose.html:html-svg")

val testUtils by lazy {
composeDependency("org.jetbrains.compose.html:html-test-utils")
}
val testUtils = composeDependency("org.jetbrains.compose.html:html-test-utils")
}
}

Expand All @@ -157,7 +146,7 @@ fun KotlinDependencyHandler.compose(groupWithArtifact: String) = composeDependen

fun DependencyHandler.compose(groupWithArtifact: String) = composeDependency(groupWithArtifact)

private fun composeDependency(groupWithArtifact: String) = "$groupWithArtifact:$composeVersion"
private fun composeDependency(groupWithArtifact: String) = "$groupWithArtifact:${ComposeBuildConfig.composeVersion}"

private fun setUpGroovyDslExtensions(project: Project) {
project.plugins.withId("org.jetbrains.kotlin.multiplatform") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ package org.jetbrains.compose.experimental.dsl

import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.jetbrains.compose.internal.DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION
import javax.inject.Inject

abstract class ExperimentalExtension @Inject constructor(
objects: ObjectFactory
) {

@Suppress("DEPRECATION")
@Deprecated(
message = "Starting from 1.6.10, Compose for Web goes to Alpha. Experimental configuration is not needed anymore.",
message = DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION,
)
val web: ExperimentalWebExtension = objects.newInstance(ExperimentalWebExtension::class.java)

@Suppress("DEPRECATION")
@Deprecated(
message = "Starting from 1.6.10, Compose for Web goes to Alpha. Experimental configuration is not needed anymore."
message = DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION,
)
fun web(action: Action<ExperimentalWebExtension>) {
action.execute(web)
}
}
fun web(action: Action<ExperimentalWebExtension>): Unit = action.execute(web)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@

package org.jetbrains.compose.experimental.dsl

import org.jetbrains.compose.internal.DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION
import javax.inject.Inject

@Deprecated(
message = "Starting from 1.6.10, Compose for Web goes to Alpha. Experimental configuration is not needed anymore.",
message = DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION,
)
abstract class ExperimentalWebApplication @Inject constructor(
@Suppress("unused") val name: String,
)
abstract class ExperimentalWebApplication @Inject constructor(
@Suppress("unused")
val name: String,
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@ package org.jetbrains.compose.experimental.dsl
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.gradle.api.plugins.ExtensionAware
import org.jetbrains.compose.internal.DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION
import javax.inject.Inject

@Deprecated(
message = "Starting from 1.6.10, Compose for Web goes to Alpha. Experimental configuration is not needed anymore.",
message = DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION,
)
abstract class ExperimentalWebExtension @Inject constructor(private val objectFactory: ObjectFactory) : ExtensionAware {
internal var _isApplicationInitialized = false
private set

@Suppress("DEPRECATION")
@Deprecated(
message = "Starting from 1.6.10, Compose for Web goes to Alpha. Experimental configuration is not needed anymore.",
message = DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION,
)
val application: ExperimentalWebApplication by lazy {
_isApplicationInitialized = true
objectFactory.newInstance(ExperimentalWebApplication::class.java, "main")
}

@Suppress("DEPRECATION")
@Deprecated(
message = "Starting from 1.6.10, Compose for Web goes to Alpha. Experimental configuration is not needed anymore.",
message = DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION,
)
fun application(fn: Action<ExperimentalWebApplication>) {
fn.execute(application)
}
fun application(fn: Action<ExperimentalWebApplication>): Unit = fn.execute(application)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

package org.jetbrains.compose.experimental.web.tasks

import org.jetbrains.compose.internal.DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB
import org.jetbrains.compose.web.tasks.UnpackSkikoWasmRuntimeTask

@Deprecated(
message = "Starting from 1.6.10 Compose for Web goes to Alpha",
message = DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB,
replaceWith = ReplaceWith("UnpackSkikoWasmRuntimeTask")
)
abstract class ExperimentalUnpackSkikoWasmRuntimeTask : UnpackSkikoWasmRuntimeTask()
abstract class ExperimentalUnpackSkikoWasmRuntimeTask : UnpackSkikoWasmRuntimeTask()
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ internal const val KOTLIN_ANDROID_PLUGIN_ID = "org.jetbrains.kotlin.android"
internal const val KOTLIN_JS_PLUGIN_ID = "org.jetbrains.kotlin.js"
internal const val COMPOSE_PLUGIN_ID = "org.jetbrains.compose"

internal const val IDEA_IMPORT_TASK_NAME = "prepareKotlinIdeaImport"
internal const val IDEA_IMPORT_TASK_NAME = "prepareKotlinIdeaImport"

internal const val DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB: String =
"Starting from 1.6.10, Compose for Web goes to Alpha."
internal const val DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB_IN_CONFIGURATION: String =
DEPRECATED_EXPERIMENTAL_MESSAGE_FOR_WEB + "Experimental configuration is not needed anymore."
4 changes: 2 additions & 2 deletions gradle-plugins/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kotlin = "2.2.0-RC2"
gradle-download-plugin = "5.5.0"
kotlin-poet = "2.1.0"
plugin-android = "8.9.1"
shadow-jar = "8.1.1"
shadow-jar = "8.3.6"
publish-plugin = "1.2.1"

[libraries]
Expand All @@ -15,5 +15,5 @@ plugin-android-api = { module = "com.android.tools.build:gradle-api", version.re
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
download = { id = "de.undercouch.download", version.ref = "gradle-download-plugin" }
shadow-jar = { id = "com.github.johnrengelman.shadow", version.ref = "shadow-jar" }
shadow-jar = { id = "com.gradleup.shadow", version.ref = "shadow-jar" }
publish-plugin = { id = "com.gradle.plugin-publish", version.ref = "publish-plugin" }