-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move train configuration to build-logic
- Loading branch information
Showing
4 changed files
with
77 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package ktorbuild.internal | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.api.tasks.testing.Test | ||
import org.gradle.kotlin.dsl.withType | ||
|
||
fun Project.setupTrain() { | ||
if (!buildSnapshotTrain) return | ||
|
||
if (name == "ktor-client") { | ||
println("Manifest of kotlin-compiler-embeddable.jar") | ||
printManifest() | ||
} | ||
|
||
configureVersion() | ||
filterSnapshotTests() | ||
} | ||
|
||
// Hacking test tasks, removing stress and flaky tests" | ||
private fun Project.filterSnapshotTests() { | ||
tasks.withType<Test>().configureEach { | ||
exclude("**/*ServerSocketTest*") | ||
exclude("**/*NettyStressTest*") | ||
exclude("**/*CIOMultithreadedTest*") | ||
exclude("**/*testBlockingConcurrency*") | ||
exclude("**/*testBigFile*") | ||
exclude("**/*numberTest*") | ||
exclude("**/*testWithPause*") | ||
exclude("**/*WebSocketTest*") | ||
exclude("**/*PostTest*") | ||
exclude("**/*testCustomUrls*") | ||
exclude("**/*testStaticServeFromDir*") | ||
exclude("**/*testRedirect*") | ||
exclude("**/*CIOHttpsTest*") | ||
} | ||
} | ||
|
||
private fun Project.printManifest() { | ||
configurations.matching { it.name == "kotlinCompilerClasspath" }.all { | ||
resolvedConfiguration.files.filter { it.name.contains("kotlin-compiler-embeddable") }.forEach { | ||
val manifest = zipTree(it).matching { | ||
include("META-INF/MANIFEST.MF") | ||
}.files.first() | ||
|
||
manifest.readLines().forEach { | ||
println(it) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun Project.configureVersion() { | ||
version = findProperty("DeployVersion") ?: return | ||
|
||
if (buildSnapshotTrain && !rootProject.hasProperty("skip_snapshot_checks")) { | ||
check(version, rootProject.libs.versions.atomicfu, "atomicfu") | ||
check(version, rootProject.libs.versions.coroutines, "coroutines") | ||
check(version, rootProject.libs.versions.serialization, "serialization") | ||
} | ||
} | ||
|
||
private val Project.buildSnapshotTrain: Boolean | ||
get() = rootProject.findProperty("build_snapshot_train")?.toString().toBoolean() | ||
|
||
private fun check(version: Any, libVersionProvider: Provider<String>, libName: String) { | ||
val libVersion = libVersionProvider.get() | ||
check(version == libVersion) { | ||
"Current deploy version is $version, but $libName version is not overridden ($libVersion)" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.