Build: Fix manifest for kotlin-compiler in jps build
Trigger manifest generation from jar task during jps import
This commit is contained in:
@@ -17,5 +17,5 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runtimeJar {
|
runtimeJar {
|
||||||
manifest.attributes.put("Class-Path", "$compilerManifestClassPath kotlin-preloader.jar")
|
manifest.attributes["Class-Path"] = "$compilerManifestClassPath kotlin-preloader.jar"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runtimeJar {
|
runtimeJar {
|
||||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main")
|
manifest.attributes["Main-Class"] = "org.jetbrains.kotlin.runner.Main"
|
||||||
manifest.attributes.put("Class-Path", "kotlin-stdlib.jar")
|
manifest.attributes["Class-Path"] = "kotlin-stdlib.jar"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
@file:Suppress("UnstableApiUsage")
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
import org.jetbrains.gradle.ext.*
|
import org.jetbrains.gradle.ext.*
|
||||||
|
import org.gradle.jvm.tasks.Jar
|
||||||
import org.jetbrains.kotlin.ideaExt.*
|
import org.jetbrains.kotlin.ideaExt.*
|
||||||
|
|
||||||
|
|
||||||
@@ -341,8 +342,12 @@ fun NamedDomainObjectContainer<TopLevelArtifact>.jarFromProject(project: Project
|
|||||||
val jarName = name ?: project.name + ".jar"
|
val jarName = name ?: project.name + ".jar"
|
||||||
create(jarName) {
|
create(jarName) {
|
||||||
archive(jarName) {
|
archive(jarName) {
|
||||||
directory("META-INF") {
|
(project.tasks["jar"] as? Jar)?.let { jar ->
|
||||||
file("${project.buildDir}/tmp/jar/MANIFEST.MF")
|
val manifestPath = jar.temporaryDir.resolve("MANIFEST.MF")
|
||||||
|
jar.manifest.writeTo(manifestPath)
|
||||||
|
directory("META-INF") {
|
||||||
|
file(manifestPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.sourceSets.names.contains("main")) {
|
if (project.sourceSets.names.contains("main")) {
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val runtimeJar by configurations.creating
|
|
||||||
val compile by configurations // maven plugin writes pom compile scope from compile configuration by default
|
val compile by configurations // maven plugin writes pom compile scope from compile configuration by default
|
||||||
val proguardLibraries by configurations.creating {
|
val proguardLibraries by configurations.creating {
|
||||||
extendsFrom(compile)
|
extendsFrom(compile)
|
||||||
@@ -220,14 +219,11 @@ dependencies {
|
|||||||
|
|
||||||
publish()
|
publish()
|
||||||
|
|
||||||
noDefaultJar()
|
|
||||||
|
|
||||||
val packCompiler by task<ShadowJar> {
|
val packCompiler by task<ShadowJar> {
|
||||||
configurations = emptyList()
|
configurations = emptyList()
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
destinationDirectory.set(File(buildDir, "libs"))
|
destinationDirectory.set(File(buildDir, "libs"))
|
||||||
|
archiveClassifier.set("before-proguard")
|
||||||
setupPublicJar(compilerBaseName, "before-proguard")
|
|
||||||
|
|
||||||
from(fatJarContents)
|
from(fatJarContents)
|
||||||
|
|
||||||
@@ -244,9 +240,6 @@ val packCompiler by task<ShadowJar> {
|
|||||||
zipTree(it).matching { exclude("META-INF/jb/**", "META-INF/LICENSE") }
|
zipTree(it).matching { exclude("META-INF/jb/**", "META-INF/LICENSE") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
manifest.attributes["Class-Path"] = compilerManifestClassPath
|
|
||||||
manifest.attributes["Main-Class"] = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val proguard by task<ProGuardTask> {
|
val proguard by task<ProGuardTask> {
|
||||||
@@ -270,9 +263,29 @@ val proguard by task<ProGuardTask> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val pack = if (shrink) proguard else packCompiler
|
val pack = if (shrink) proguard else packCompiler
|
||||||
|
|
||||||
val distDir: String by rootProject.extra
|
val distDir: String by rootProject.extra
|
||||||
|
|
||||||
|
val jar = runtimeJar {
|
||||||
|
dependsOn(pack)
|
||||||
|
|
||||||
|
from {
|
||||||
|
zipTree(pack.outputs.files.singleFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
manifest.attributes["Class-Path"] = compilerManifestClassPath
|
||||||
|
manifest.attributes["Main-Class"] = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar {
|
||||||
|
from {
|
||||||
|
compilerModules.map {
|
||||||
|
project(it).mainSourceSet.allSource
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
javadocJar()
|
||||||
|
|
||||||
val distKotlinc = distTask<Sync>("distKotlinc") {
|
val distKotlinc = distTask<Sync>("distKotlinc") {
|
||||||
destinationDir = File("$distDir/kotlinc")
|
destinationDir = File("$distDir/kotlinc")
|
||||||
|
|
||||||
@@ -287,7 +300,7 @@ val distKotlinc = distTask<Sync>("distKotlinc") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
into("lib") {
|
into("lib") {
|
||||||
from(pack) { rename { "$compilerBaseName.jar" } }
|
from(jar) { rename { "$compilerBaseName.jar" } }
|
||||||
from(libraries)
|
from(libraries)
|
||||||
from(sources)
|
from(sources)
|
||||||
from(compilerPlugins) {
|
from(compilerPlugins) {
|
||||||
@@ -323,21 +336,6 @@ distTask<Copy>("dist") {
|
|||||||
from(distStdlibMinimalForTests)
|
from(distStdlibMinimalForTests)
|
||||||
}
|
}
|
||||||
|
|
||||||
runtimeJarArtifactBy(pack, pack.outputs.files.singleFile) {
|
|
||||||
name = compilerBaseName
|
|
||||||
classifier = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcesJar {
|
|
||||||
from {
|
|
||||||
compilerModules.map {
|
|
||||||
project(it).mainSourceSet.allSource
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
javadocJar()
|
|
||||||
|
|
||||||
inline fun <reified T : AbstractCopyTask> Project.distTask(
|
inline fun <reified T : AbstractCopyTask> Project.distTask(
|
||||||
name: String,
|
name: String,
|
||||||
crossinline block: T.() -> Unit
|
crossinline block: T.() -> Unit
|
||||||
|
|||||||
Reference in New Issue
Block a user