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 {
|
||||
manifest.attributes.put("Class-Path", "$compilerManifestClassPath kotlin-preloader.jar")
|
||||
manifest.attributes["Class-Path"] = "$compilerManifestClassPath kotlin-preloader.jar"
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ sourceSets {
|
||||
}
|
||||
|
||||
runtimeJar {
|
||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main")
|
||||
manifest.attributes.put("Class-Path", "kotlin-stdlib.jar")
|
||||
manifest.attributes["Main-Class"] = "org.jetbrains.kotlin.runner.Main"
|
||||
manifest.attributes["Class-Path"] = "kotlin-stdlib.jar"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
import org.jetbrains.gradle.ext.*
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.jetbrains.kotlin.ideaExt.*
|
||||
|
||||
|
||||
@@ -341,8 +342,12 @@ fun NamedDomainObjectContainer<TopLevelArtifact>.jarFromProject(project: Project
|
||||
val jarName = name ?: project.name + ".jar"
|
||||
create(jarName) {
|
||||
archive(jarName) {
|
||||
(project.tasks["jar"] as? Jar)?.let { jar ->
|
||||
val manifestPath = jar.temporaryDir.resolve("MANIFEST.MF")
|
||||
jar.manifest.writeTo(manifestPath)
|
||||
directory("META-INF") {
|
||||
file("${project.buildDir}/tmp/jar/MANIFEST.MF")
|
||||
file(manifestPath)
|
||||
}
|
||||
}
|
||||
|
||||
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 proguardLibraries by configurations.creating {
|
||||
extendsFrom(compile)
|
||||
@@ -220,14 +219,11 @@ dependencies {
|
||||
|
||||
publish()
|
||||
|
||||
noDefaultJar()
|
||||
|
||||
val packCompiler by task<ShadowJar> {
|
||||
configurations = emptyList()
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
|
||||
setupPublicJar(compilerBaseName, "before-proguard")
|
||||
archiveClassifier.set("before-proguard")
|
||||
|
||||
from(fatJarContents)
|
||||
|
||||
@@ -244,9 +240,6 @@ val packCompiler by task<ShadowJar> {
|
||||
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> {
|
||||
@@ -270,9 +263,29 @@ val proguard by task<ProGuardTask> {
|
||||
}
|
||||
|
||||
val pack = if (shrink) proguard else packCompiler
|
||||
|
||||
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") {
|
||||
destinationDir = File("$distDir/kotlinc")
|
||||
|
||||
@@ -287,7 +300,7 @@ val distKotlinc = distTask<Sync>("distKotlinc") {
|
||||
}
|
||||
|
||||
into("lib") {
|
||||
from(pack) { rename { "$compilerBaseName.jar" } }
|
||||
from(jar) { rename { "$compilerBaseName.jar" } }
|
||||
from(libraries)
|
||||
from(sources)
|
||||
from(compilerPlugins) {
|
||||
@@ -323,21 +336,6 @@ distTask<Copy>("dist") {
|
||||
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(
|
||||
name: String,
|
||||
crossinline block: T.() -> Unit
|
||||
|
||||
Reference in New Issue
Block a user