-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build Config update & enable Configuration Cache (#4062)
Minor build config updates, aiming to improve build configuration speed and stability. - Re-order repositories by stability, and add snapshotsOnly() filter to Sonatype snapshots. - Update Shadow plugin to 8.1.1 (better config cache support) - remove deprecated `kotlin { targets {} }` config - update gradle.properties - enable configuration cache - should work fine with KGP 1.9 - re-enable KN compiler daemon - again, it should be more stable - remove ignoreIncorrectDependencies (it doesn't seem to be triggered any more - but if it was, it's an important warning so it shouldn't be ignored) - sort & group properties - remove `kotlin.code.style` - I don't think it does anything, and besides, the project has an .editorconfig file - remove nested `gradle.properties` files (it's not clear whether it works, and the only option in the files was `org.gradle.parallel=false` - which only makes sense as a project-wide setting) - Introduce BuildService for limiting parallel publishing, because Maven Central can't handle parallel uploads. - Add a delay in `kotest-tests-spec-parallelism` test to try and make it more stable. - Comment out non-functional `buildConfigDocs` task. - Update GitHub workflows to make the Gradle flags closer to what's in the project's `gradle.properties`.
- Loading branch information
Showing
35 changed files
with
239 additions
and
251 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
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
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
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
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 |
---|---|---|
|
@@ -3,7 +3,6 @@ plugins { | |
} | ||
|
||
kotlin { | ||
|
||
jvm { | ||
withJava() | ||
} | ||
|
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
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,71 @@ | ||
import groovy.util.Node | ||
import groovy.util.NodeList | ||
import org.gradle.api.Project | ||
import org.gradle.api.XmlProvider | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.api.publish.maven.tasks.GenerateMavenPom | ||
import org.gradle.configurationcache.extensions.capitalized | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.gradle.kotlin.dsl.named | ||
import org.gradle.kotlin.dsl.withType | ||
import org.gradle.plugins.signing.SigningExtension | ||
|
||
//region manually define accessors, because IntelliJ _still_ doesn't index them properly :( | ||
internal val Project.signing get() = extensions.getByType<SigningExtension>() | ||
internal fun Project.signing(configure: SigningExtension.() -> Unit = {}): Unit = signing.configure() | ||
internal val Project.publishing get() = extensions.getByType<PublishingExtension>() | ||
internal fun Project.publishing(configure: PublishingExtension.() -> Unit = {}): Unit = publishing.configure() | ||
//endregion | ||
|
||
/** | ||
* Publish the platform JAR and POM so that consumers who depend on this module and can't read Gradle module | ||
* metadata can still get the platform artifact and transitive dependencies from the POM | ||
* (see details in https://youtrack.jetbrains.com/issue/KT-39184#focus=streamItem-27-4115233.0-0) | ||
*/ | ||
internal fun publishPlatformArtifactsInRootModule(project: Project) { | ||
val platformPublication: MavenPublication = | ||
project.publishing.publications.named<MavenPublication>("jvm").get() | ||
val kmpPublication: MavenPublication = | ||
project.publishing.publications.named<MavenPublication>("kotlinMultiplatform").get() | ||
|
||
lateinit var platformXml: XmlProvider | ||
platformPublication.pom?.withXml { platformXml = this } | ||
|
||
// replace pom | ||
kmpPublication.pom.withXml { | ||
val xmlProvider = this | ||
val root = xmlProvider.asNode() | ||
// Remove the original content and add the content from the platform POM: | ||
root.children().toList().forEach { root.remove(it as Node) } | ||
platformXml.asNode().children().forEach { root.append(it as Node) } | ||
|
||
// Adjust the self artifact ID, as it should match the root module's coordinates: | ||
((root.get("artifactId") as NodeList).get(0) as Node).setValue(kmpPublication.artifactId) | ||
|
||
// Set packaging to POM to indicate that there's no artifact: | ||
root.appendNode("packaging", "pom") | ||
|
||
// Remove the original platform dependencies and add a single dependency on the platform | ||
// module: | ||
val dependencies = (root.get("dependencies") as NodeList).get(0) as Node | ||
dependencies.children().toList().forEach { dependencies.remove(it as Node) } | ||
val singleDependency = dependencies.appendNode("dependency") | ||
singleDependency.appendNode("groupId", platformPublication.groupId) | ||
singleDependency.appendNode("artifactId", platformPublication.artifactId) | ||
singleDependency.appendNode("version", platformPublication.version) | ||
singleDependency.appendNode("scope", "compile") | ||
} | ||
|
||
project.tasks | ||
.matching { it.name == "generatePomFileForKotlinMultiplatformPublication" } | ||
.configureEach { | ||
dependsOn("generatePomFileFor${platformPublication.name.capitalized()}Publication") | ||
|
||
// Disable Config Cache to prevent error: | ||
// Task `:[...]:generatePomFileForKotlinMultiplatformPublication` of type `GenerateMavenPom`: | ||
// cannot serialize object of type 'DefaultMavenPublication', a subtype of 'Publication', | ||
// as these are not supported with the configuration cache. | ||
notCompatibleWithConfigurationCache("publishPlatformArtifactsInRootModule") | ||
} | ||
} |
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
Oops, something went wrong.