Publish Gradle metadata for kotlin-stdlib-common, KT-60911
This makes it depend on kotlin-stdlib in all targets and have no artifacts from Gradle's point of view
This commit is contained in:
committed by
Space Team
parent
e8289181e6
commit
3e4cbd6dd2
@@ -1,11 +1,10 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("kotlin-platform-common")
|
id("kotlin-platform-common")
|
||||||
|
id("maven-publish")
|
||||||
}
|
}
|
||||||
|
|
||||||
description = 'Kotlin Common Standard Library'
|
description = 'Kotlin Common Standard Library'
|
||||||
|
|
||||||
RepoArtifacts.publish(project)
|
|
||||||
|
|
||||||
JvmToolchain.updateJvmTarget(project, "1.8")
|
JvmToolchain.updateJvmTarget(project, "1.8")
|
||||||
|
|
||||||
def commonSrcDir = "../src"
|
def commonSrcDir = "../src"
|
||||||
@@ -76,3 +75,45 @@ RepoArtifacts.javadocJar(project)
|
|||||||
tasks.named("sourcesJar").configure { it.dependsOn(":prepare:build.version:writeStdlibVersion") }
|
tasks.named("sourcesJar").configure { it.dependsOn(":prepare:build.version:writeStdlibVersion") }
|
||||||
|
|
||||||
classes.setDependsOn(classes.dependsOn.findAll { it != "compileJava" })
|
classes.setDependsOn(classes.dependsOn.findAll { it != "compileJava" })
|
||||||
|
|
||||||
|
def stdlibCommonElements = configurations.create("stdlibCommonElements") {
|
||||||
|
canBeResolved = false
|
||||||
|
canBeConsumed = true
|
||||||
|
attributes {
|
||||||
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
add(stdlibCommonElements.name, project(":kotlin-stdlib"))
|
||||||
|
}
|
||||||
|
|
||||||
|
class ComponentsFactoryAccess {
|
||||||
|
SoftwareComponentFactory factory
|
||||||
|
|
||||||
|
@javax.inject.Inject
|
||||||
|
ComponentsFactoryAccess(SoftwareComponentFactory factory) {
|
||||||
|
this.factory = factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SoftwareComponentFactory componentFactory = objects.newInstance(ComponentsFactoryAccess).factory
|
||||||
|
|
||||||
|
def rootComponent = componentFactory.adhoc("root")
|
||||||
|
rootComponent.addVariantsFromConfiguration(stdlibCommonElements) {
|
||||||
|
mapToOptional()
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins.KotlinBuildPublishingPluginKt.configureDefaultPublishing(project)
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
def mainPublication = register("main", MavenPublication) {
|
||||||
|
from(rootComponent)
|
||||||
|
artifact(jar)
|
||||||
|
artifact(sourcesJar)
|
||||||
|
artifact(javadocJar)
|
||||||
|
plugins.KotlinBuildPublishingPluginKt.configureKotlinPomAttributes(it, project, "Kotlin Common Standard Library (legacy, use kotlin-stdlib instead)", "jar")
|
||||||
|
}
|
||||||
|
SbomKt.configureSbom(project, "Main", "kotlin-stdlib-common", ["compileClasspath"], mainPublication)
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
-1
@@ -1,11 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<!-- This module was also published with a richer model, Gradle metadata, -->
|
||||||
|
<!-- which should be used instead. Do not delete the following line which -->
|
||||||
|
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
|
||||||
|
<!-- that they should prefer consuming it instead. -->
|
||||||
|
<!-- do_not_remove: published-with-gradle-metadata -->
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-stdlib-common</artifactId>
|
<artifactId>kotlin-stdlib-common</artifactId>
|
||||||
<version>ArtifactsTest.version</version>
|
<version>ArtifactsTest.version</version>
|
||||||
<name>Kotlin Stdlib Common</name>
|
<name>Kotlin Stdlib Common</name>
|
||||||
<description>Kotlin Common Standard Library</description>
|
<description>Kotlin Common Standard Library (legacy, use kotlin-stdlib instead)</description>
|
||||||
<url>https://kotlinlang.org/</url>
|
<url>https://kotlinlang.org/</url>
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
@@ -25,4 +30,13 @@
|
|||||||
<developerConnection>scm:git:https://github.com/JetBrains/kotlin.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/JetBrains/kotlin.git</developerConnection>
|
||||||
<url>https://github.com/JetBrains/kotlin</url>
|
<url>https://github.com/JetBrains/kotlin</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
|
<version>ArtifactsTest.version</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
+3
@@ -135,6 +135,9 @@ val Project.signLibraryPublication: Boolean
|
|||||||
?: project.providers.gradleProperty("isSonatypeRelease").orNull?.toBoolean()
|
?: project.providers.gradleProperty("isSonatypeRelease").orNull?.toBoolean()
|
||||||
?: false
|
?: false
|
||||||
|
|
||||||
|
// overload for Groovy
|
||||||
|
fun Project.configureDefaultPublishing() = configureDefaultPublishing(signingRequired = signLibraryPublication)
|
||||||
|
|
||||||
fun Project.configureDefaultPublishing(
|
fun Project.configureDefaultPublishing(
|
||||||
signingRequired: Boolean = signLibraryPublication
|
signingRequired: Boolean = signLibraryPublication
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user