7789054547
^KT-46972 Fixed
92 lines
2.9 KiB
Kotlin
92 lines
2.9 KiB
Kotlin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
import org.jetbrains.kotlin.pill.PillExtension
|
|
|
|
description = "Kotlin JVM metadata manipulation library"
|
|
|
|
plugins {
|
|
kotlin("jvm")
|
|
id("jps-compatible")
|
|
}
|
|
|
|
pill {
|
|
variant = PillExtension.Variant.FULL
|
|
}
|
|
|
|
/*
|
|
* To publish this library use `:kotlinx-metadata-jvm:publish` task and specify the following parameters
|
|
*
|
|
* - `-PdeployVersion=1.2.nn`: the version of the standard library dependency to put into .pom
|
|
* - `-PkotlinxMetadataDeployVersion=0.0.n`: the version of the library itself
|
|
* - `-PdeployRepoUrl=repository_url`: (optional) the url of repository to deploy to;
|
|
* if not specified, the local directory repository `build/repo` will be used
|
|
* - `-PdeployRepoUsername=username`: (optional) the username to authenticate in the deployment repository
|
|
* - `-PdeployRepoPassword=password`: (optional) the password to authenticate in the deployment repository
|
|
*/
|
|
group = "org.jetbrains.kotlinx"
|
|
val deployVersion = findProperty("kotlinxMetadataDeployVersion") as String?
|
|
version = deployVersion ?: "0.1-SNAPSHOT"
|
|
|
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
|
|
|
sourceSets {
|
|
"main" { projectDefault() }
|
|
"test" { projectDefault() }
|
|
}
|
|
|
|
val shadows by configurations.creating {
|
|
isTransitive = false
|
|
}
|
|
configurations.getByName("compileOnly").extendsFrom(shadows)
|
|
configurations.getByName("testCompile").extendsFrom(shadows)
|
|
|
|
dependencies {
|
|
api(kotlinStdlib())
|
|
shadows(project(":kotlinx-metadata"))
|
|
shadows(project(":core:metadata"))
|
|
shadows(project(":core:metadata.jvm"))
|
|
shadows(protobufLite())
|
|
testImplementation(project(":kotlin-test:kotlin-test-junit"))
|
|
testImplementation(commonDep("junit:junit"))
|
|
testImplementation(intellijDep()) { includeJars("asm-all", rootProject = rootProject) }
|
|
testCompileOnly(project(":kotlin-reflect-api"))
|
|
testRuntimeOnly(project(":kotlin-reflect"))
|
|
}
|
|
|
|
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
|
kotlinOptions {
|
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
}
|
|
}
|
|
|
|
if (deployVersion != null) {
|
|
publish()
|
|
}
|
|
|
|
noDefaultJar()
|
|
|
|
runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
|
|
callGroovy("manifestAttributes", manifest, project)
|
|
manifest.attributes["Implementation-Version"] = version
|
|
|
|
from(mainSourceSet.output)
|
|
exclude("**/*.proto")
|
|
configurations = listOf(shadows)
|
|
relocate("org.jetbrains.kotlin", "kotlinx.metadata.internal")
|
|
}
|
|
|
|
val test by tasks
|
|
test.dependsOn("shadowJar")
|
|
|
|
sourcesJar {
|
|
for (dependency in shadows.dependencies) {
|
|
if (dependency is ProjectDependency) {
|
|
val javaPlugin = dependency.dependencyProject.convention.findPlugin(JavaPluginConvention::class.java)
|
|
if (javaPlugin != null) {
|
|
from(javaPlugin.sourceSets["main"].allSource)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
javadocJar()
|