You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
7.7 KiB
206 lines
7.7 KiB
3 years ago
|
import org.gradle.api.tasks.testing.AbstractTestTask
|
||
3 years ago
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||
3 years ago
|
import org.jetbrains.compose.gradle.kotlinKarmaConfig
|
||
3 years ago
|
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
|
||
2 years ago
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
|
||
3 years ago
|
|
||
3 years ago
|
plugins {
|
||
|
kotlin("multiplatform") apply false
|
||
|
}
|
||
|
|
||
2 years ago
|
val COMPOSE_WEB_VERSION: String = extra["compose.version"] as String
|
||
4 years ago
|
val COMPOSE_REPO_USERNAME: String? by project
|
||
|
val COMPOSE_REPO_KEY: String? by project
|
||
3 years ago
|
val COMPOSE_WEB_BUILD_WITH_SAMPLES = project.property("compose.web.buildSamples")!!.toString().toBoolean()
|
||
4 years ago
|
|
||
3 years ago
|
kotlinKarmaConfig.rootDir = rootProject.rootDir.toString()
|
||
|
|
||
4 years ago
|
apply<jetbrains.compose.web.gradle.SeleniumDriverPlugin>()
|
||
|
|
||
3 years ago
|
fun Project.isSampleProject() = projectDir.parentFile.name == "examples"
|
||
|
|
||
|
tasks.register("printBundleSize") {
|
||
|
dependsOn(
|
||
3 years ago
|
subprojects.filter { it.isSampleProject() }.map { ":examples:${it.name}:printBundleSize" }
|
||
3 years ago
|
)
|
||
|
}
|
||
|
|
||
3 years ago
|
// see https://youtrack.jetbrains.com/issue/KT-49109#focus=Comments-27-5381158.0-0
|
||
|
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
|
||
|
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = "16.13.1"
|
||
|
}
|
||
|
|
||
3 years ago
|
subprojects {
|
||
4 years ago
|
apply(plugin = "maven-publish")
|
||
4 years ago
|
|
||
2 years ago
|
val projectName = name
|
||
|
group = "org.jetbrains.compose.html"
|
||
4 years ago
|
version = COMPOSE_WEB_VERSION
|
||
|
|
||
2 years ago
|
if ((project.name != "html-widgets") && (project.name != "html-integration-widgets")) {
|
||
3 years ago
|
afterEvaluate {
|
||
|
if (plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
|
||
|
project.kotlinExtension.targets.forEach { target ->
|
||
|
target.compilations.forEach { compilation ->
|
||
|
compilation.kotlinOptions {
|
||
3 years ago
|
allWarningsAsErrors = false
|
||
3 years ago
|
// see https://kotlinlang.org/docs/opt-in-requirements.html
|
||
|
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
|
||
3 years ago
|
kotlinOptions.jvmTarget = "11"
|
||
|
}
|
||
|
|
||
4 years ago
|
pluginManager.withPlugin("maven-publish") {
|
||
3 years ago
|
configure<PublishingExtension> {
|
||
4 years ago
|
repositories {
|
||
|
maven {
|
||
4 years ago
|
name = "internal"
|
||
|
url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||
4 years ago
|
credentials {
|
||
4 years ago
|
username = COMPOSE_REPO_USERNAME ?: ""
|
||
|
password = COMPOSE_REPO_KEY ?: ""
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|
||
2 years ago
|
publications.all {
|
||
|
this as MavenPublication
|
||
|
pom {
|
||
2 years ago
|
name.set("JetBrains Compose Multiplatform HTML library")
|
||
|
description.set("JetBrains Compose Multiplatform HTML library")
|
||
2 years ago
|
url.set("https://www.jetbrains.com/lp/compose-mpp/")
|
||
|
licenses {
|
||
|
license {
|
||
|
name.set("Apache-2.0")
|
||
|
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
|
||
|
}
|
||
|
}
|
||
|
developers {
|
||
|
developer {
|
||
|
id.set("JetBrains")
|
||
|
name.set("JetBrains Compose Team")
|
||
|
organization.set("JetBrains")
|
||
|
organizationUrl.set("https://www.jetbrains.com")
|
||
|
}
|
||
|
}
|
||
|
scm {
|
||
2 years ago
|
connection.set("scm:git://github.com/JetBrains/compose-multiplatform.git")
|
||
|
developerConnection.set("scm:git://github.com/JetBrains/compose-multiplatform.git")
|
||
|
url.set("https://github.com/jetbrains/compose-multiplatform")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
publications {
|
||
|
val oldArtifactId = when (projectName) {
|
||
|
"html-core" -> "web-core"
|
||
|
"html-svg" -> "web-svg"
|
||
|
"html-test-utils" -> "test-utils"
|
||
|
"html-benchmark-core" -> "web-benchmark-core"
|
||
|
"internal-html-core-runtime" -> "internal-web-core-runtime"
|
||
|
"html-integration-core" -> "web-integration-core"
|
||
|
"compose-compiler-integration" -> "compose-compiler-integration"
|
||
|
"compose-compiler-integration-lib" -> "compose-compiler-integration-lib"
|
||
|
else -> null
|
||
|
}
|
||
|
|
||
|
// TODO Remove this publishing in Compose 1.7. The package was migrated in 1.4.
|
||
|
if (oldArtifactId != null) {
|
||
|
create<MavenPublication>("relocation") {
|
||
|
pom {
|
||
|
// Old artifact coordinates
|
||
|
groupId = "org.jetbrains.compose.web"
|
||
|
artifactId = oldArtifactId
|
||
|
distributionManagement {
|
||
|
relocation {
|
||
|
// New artifact coordinates
|
||
|
groupId.set("org.jetbrains.compose.html")
|
||
|
artifactId.set(projectName)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
2 years ago
|
}
|
||
|
}
|
||
|
}
|
||
4 years ago
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
pluginManager.withPlugin("kotlin-multiplatform") {
|
||
|
val printTestBundleSize by tasks.registering {
|
||
3 years ago
|
dependsOn(tasks.named("jsTest"))
|
||
3 years ago
|
doLast {
|
||
|
val bundlePath = buildDir.resolve(
|
||
|
"compileSync/test/testDevelopmentExecutable/kotlin/${rootProject.name}-${project.name}-test.js"
|
||
|
)
|
||
|
if (bundlePath.exists()) {
|
||
|
val size = bundlePath.length()
|
||
|
println("##teamcity[buildStatisticValue key='testBundleSize::${project.name}' value='$size']")
|
||
|
}
|
||
3 years ago
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
afterEvaluate {
|
||
|
tasks.named("jsTest") { finalizedBy(printTestBundleSize) }
|
||
|
}
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
|
||
3 years ago
|
if (isSampleProject()) {
|
||
|
val printBundleSize by tasks.registering {
|
||
|
dependsOn(tasks.named("jsBrowserDistribution"))
|
||
|
doLast {
|
||
|
val jsFile = buildDir.resolve("distributions/${project.name}.js")
|
||
|
val size = jsFile.length()
|
||
|
println("##teamcity[buildStatisticValue key='bundleSize::${project.name}' value='$size']")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
afterEvaluate {
|
||
|
tasks.named("build") { finalizedBy(printBundleSize) }
|
||
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
if (COMPOSE_WEB_BUILD_WITH_SAMPLES) {
|
||
4 years ago
|
println("substituting published artifacts with projects ones in project $name")
|
||
|
configurations.all {
|
||
|
resolutionStrategy.dependencySubstitution {
|
||
2 years ago
|
substitute(module("org.jetbrains.compose.html:html-core")).apply {
|
||
|
with(project(":html-core"))
|
||
4 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
4 years ago
|
repositories {
|
||
|
gradlePluginPortal()
|
||
3 years ago
|
mavenLocal()
|
||
4 years ago
|
mavenCentral()
|
||
3 years ago
|
maven {
|
||
|
url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||
4 years ago
|
}
|
||
3 years ago
|
maven {
|
||
|
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
|
||
|
}
|
||
4 years ago
|
maven {
|
||
4 years ago
|
url = uri("https://packages.jetbrains.team/maven/p/ui/dev")
|
||
4 years ago
|
}
|
||
3 years ago
|
google()
|
||
4 years ago
|
}
|
||
3 years ago
|
|
||
|
tasks.withType<AbstractTestTask> {
|
||
|
testLogging {
|
||
|
events("FAILED")
|
||
|
exceptionFormat = TestExceptionFormat.FULL
|
||
|
showStandardStreams = true
|
||
|
showStackTraces = true
|
||
|
}
|
||
|
}
|
||
4 years ago
|
}
|