Compare commits

...

6 Commits

Author SHA1 Message Date
4u7
12bf5e654f Normalize endings for files previously commited with crlf 2020-03-16 13:35:23 +03:00
Vyacheslav Gerasimov
3a55bf865a Build: Improve cacheability of tasks building embedded artifacts
Use configuration property annotated with classpath for ShadowJar
Remove bunch of unnecessary ShadowJar tasks
2020-03-15 20:29:03 +03:00
Vyacheslav Gerasimov
4bbdeca2c5 Build: Keep writePluginVersion task until TeamCity usages removed 2020-03-15 20:29:03 +03:00
Vyacheslav Gerasimov
67f7e5e3f5 Build: Move writing ide plugin version to the idea module 2020-03-15 20:29:03 +03:00
Vyacheslav Gerasimov
46044bb779 Always checkout/checkin text files with lf endings
Different line endings on linux/windows prevents gradle from reusing
build cache since endings make task inputs completely different between
systems
2020-03-15 20:29:03 +03:00
Vyacheslav Gerasimov
dc922442e4 Build: Make ProGuard task cacheable
Exclude jdk files form libraries input. Instead add jdk major version
to inputs. JavaCompile task acts same to ignore fluctuations in JDK
implementations since api should remain same
2020-03-15 20:29:02 +03:00
42 changed files with 775 additions and 463 deletions

2
.gitattributes vendored
View File

@@ -1,4 +1,6 @@
**/testData/** linguist-vendored
*Generated.java linguist-generated=true
* text=auto
* eol=lf
compiler/cli/bin/* eol=lf
compiler/cli/bin/*.bat eol=crlf

View File

@@ -30,7 +30,6 @@ buildscript {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.15")
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath("net.sf.proguard:proguard-gradle:6.1.0")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
}
}

View File

@@ -101,6 +101,7 @@ dependencies {
implementation("com.jakewharton.dex:dex-method-list:3.0.0")
implementation("com.github.jengelman.gradle.plugins:shadow:${rootProject.extra["versions.shadow"]}")
implementation("net.sf.proguard:proguard-gradle:6.2.2")
implementation("org.jetbrains.intellij.deps:asm-all:7.0.1")
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")

View File

@@ -0,0 +1,385 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import groovy.lang.Closure
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.*
import org.gradle.internal.jvm.Jvm
import org.gradle.internal.jvm.inspection.JvmVersionDetector
import proguard.ClassSpecification
import java.io.File
import javax.inject.Inject
@CacheableTask
open class CacheableProguardTask @Inject constructor(
private val jvmVersionDetector: JvmVersionDetector
) : proguard.gradle.ProGuardTask() {
@Internal
var jdkHome: File? = null
@get:Optional
@get:Input
internal val jdkMajorVersion: String?
get() = jdkHome?.let { jvmVersionDetector.getJavaVersion(Jvm.forHome(jdkHome)) }?.majorVersion
@CompileClasspath
override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection().filter { libraryFile ->
jdkHome?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true
}
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
override fun getConfigurationFileCollection(): FileCollection = super.getConfigurationFileCollection()
@InputFiles
@Classpath
override fun getInJarFileCollection(): FileCollection = super.getInJarFileCollection()
@Optional
@OutputFiles
override fun getOutJarFileCollection(): FileCollection = super.getOutJarFileCollection()
@get:Optional
@get:OutputFile
internal val printConfigurationFile: File?
get() = configuration.printConfiguration?.takeIf { it.path.isNotEmpty() }
@Input
override fun getOutJarFilters(): MutableList<Any?> = super.getOutJarFilters()
@Input
override fun getInJarFilters(): MutableList<Any?> = super.getInJarFilters()
@Input
override fun getLibraryJarFilters(): MutableList<Any?> = super.getLibraryJarFilters()
@Internal
override fun getOutJarFiles(): MutableList<Any?> = super.getOutJarFiles()
@Internal
override fun getInJarFiles(): MutableList<Any?> = super.getInJarFiles()
@Internal
override fun getInJarCounts(): MutableList<Any?> = super.getInJarCounts()
@Internal
override fun getLibraryJarFiles(): MutableList<Any?> = super.getLibraryJarFiles()
/*
* Inputs properly declared these methods so we don't override them
*
* configuration(configurationFiles: Any?)
* libraryjars(libraryJarFiles: Any?)
* libraryjars(filterArgs: MutableMap<Any?, Any?>?, libraryJarFiles: Any?)
* injars(inJarFiles: Any?)
* injars(filterArgs: MutableMap<Any?, Any?>?, inJarFiles: Any?)
* outjars(outJarFiles: Any?)
* outjars(filterArgs: MutableMap<Any?, Any?>?, outJarFiles: Any?)
* printconfiguration()
* printconfiguration(printConfiguration: Any?)
*/
override fun renamesourcefileattribute() = throw NotImplementedError()
override fun renamesourcefileattribute(newSourceFileAttribute: String?) = throw NotImplementedError()
override fun dontshrink() = throw NotImplementedError()
override fun assumenosideeffects(classSpecificationString: String?) = throw NotImplementedError()
override fun assumenosideeffects(classSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun keepnames(classSpecificationString: String?) = throw NotImplementedError()
override fun keepnames(keepArgs: MutableMap<Any?, Any?>?, classSpecificationString: String?) = throw NotImplementedError()
override fun keepnames(keepClassSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun keepnames(keepClassSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun printmapping() = throw NotImplementedError()
override fun printmapping(printMapping: Any?) = throw NotImplementedError()
override fun keep(classSpecificationString: String?) = throw NotImplementedError()
override fun keep(keepArgs: MutableMap<Any?, Any?>?, classSpecificationString: String?) = throw NotImplementedError()
override fun keep(keepClassSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun keep(keepClassSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun keepdirectories() = throw NotImplementedError()
override fun keepdirectories(filter: String?) = throw NotImplementedError()
override fun dontpreverify() = throw NotImplementedError()
override fun dontnote() = throw NotImplementedError()
override fun dontnote(filter: String?) = throw NotImplementedError()
@Internal
override fun getrenamesourcefileattribute(): Any? = throw NotImplementedError()
override fun useuniqueclassmembernames() = throw NotImplementedError()
override fun overloadaggressively() = throw NotImplementedError()
@Internal
override fun getprintusage(): Any? = throw NotImplementedError()
@Internal
override fun getforceprocessing(): Any? = throw NotImplementedError()
override fun whyareyoukeeping(classSpecificationString: String?) = throw NotImplementedError()
override fun whyareyoukeeping(classSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun whyareyoukeeping(classSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun obfuscationdictionary(obfuscationDictionary: Any?) = throw NotImplementedError()
override fun adaptclassstrings() = throw NotImplementedError()
override fun adaptclassstrings(filter: String?) = throw NotImplementedError()
override fun applymapping(applyMapping: Any?) = throw NotImplementedError()
override fun mergeinterfacesaggressively() = throw NotImplementedError()
@Internal
override fun getdontwarn(): Any? = throw NotImplementedError()
override fun ignorewarnings() = throw NotImplementedError()
@Internal
override fun getaddconfigurationdebugging(): Any? = throw NotImplementedError()
override fun field(memberSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
@Internal
override fun getallowaccessmodification(): Any? = throw NotImplementedError()
override fun constructor(memberSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun dontusemixedcaseclassnames() = throw NotImplementedError()
@Internal
override fun getignorewarnings(): Any? = throw NotImplementedError()
@Internal
override fun getkeepdirectories(): Any? = throw NotImplementedError()
override fun classobfuscationdictionary(classObfuscationDictionary: Any?) = throw NotImplementedError()
override fun verbose() = throw NotImplementedError()
override fun optimizations(filter: String?) = throw NotImplementedError()
@Internal
override fun getuseuniqueclassmembernames(): Any? = throw NotImplementedError()
@Internal
override fun getmicroedition(): Any? = throw NotImplementedError()
override fun assumenoescapingparameters(classSpecificationString: String?) = throw NotImplementedError()
override fun assumenoescapingparameters(classSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
@Internal
override fun getandroid(): Any? = throw NotImplementedError()
override fun keeppackagenames() = throw NotImplementedError()
override fun keeppackagenames(filter: String?) = throw NotImplementedError()
@Internal
override fun getoverloadaggressively(): Any? = throw NotImplementedError()
override fun skipnonpubliclibraryclasses() = throw NotImplementedError()
@Internal
override fun getdontusemixedcaseclassnames(): Any? = throw NotImplementedError()
@Internal
override fun getdontnote(): Any? = throw NotImplementedError()
override fun assumenoexternalreturnvalues(classSpecificationString: String?) = throw NotImplementedError()
override fun assumenoexternalreturnvalues(classSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun target(targetClassVersion: String?) = throw NotImplementedError()
override fun keepattributes() = throw NotImplementedError()
override fun keepattributes(filter: String?) = throw NotImplementedError()
override fun keepclassmembernames(classSpecificationString: String?) = throw NotImplementedError()
override fun keepclassmembernames(keepArgs: MutableMap<Any?, Any?>?, classSpecificationString: String?) = throw NotImplementedError()
override fun keepclassmembernames(keepClassSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun keepclassmembernames(keepClassSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
@Internal
override fun getdontpreverify(): Any? = throw NotImplementedError()
@Internal
override fun getverbose(): Any? = throw NotImplementedError()
@Internal
override fun getskipnonpubliclibraryclasses(): Any? = throw NotImplementedError()
@Internal
override fun getdontoptimize(): Any? = throw NotImplementedError()
override fun keepclasseswithmembernames(classSpecificationString: String?) = throw NotImplementedError()
override fun keepclasseswithmembernames(keepArgs: MutableMap<Any?, Any?>?, classSpecificationString: String?) = throw NotImplementedError()
override fun keepclasseswithmembernames(keepClassSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun keepclasseswithmembernames(keepClassSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun keepclasseswithmembers(classSpecificationString: String?) = throw NotImplementedError()
override fun keepclasseswithmembers(keepArgs: MutableMap<Any?, Any?>?, classSpecificationString: String?) = throw NotImplementedError()
override fun keepclasseswithmembers(keepClassSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun keepclasseswithmembers(keepClassSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
@Internal
override fun getdump(): Any? = throw NotImplementedError()
override fun printseeds() = throw NotImplementedError()
override fun printseeds(printSeeds: Any?) = throw NotImplementedError()
override fun dontoptimize() = throw NotImplementedError()
override fun dontobfuscate() = throw NotImplementedError()
override fun extendClassSpecifications(
classSpecifications: MutableList<Any?>?,
classSpecification: ClassSpecification?
): MutableList<Any?> = throw NotImplementedError()
override fun allowaccessmodification() = throw NotImplementedError()
@Internal
override fun getdontobfuscate(): Any? = throw NotImplementedError()
@Internal
override fun getprintmapping(): Any? = throw NotImplementedError()
override fun flattenpackagehierarchy() = throw NotImplementedError()
override fun flattenpackagehierarchy(flattenPackageHierarchy: String?) = throw NotImplementedError()
override fun android() = throw NotImplementedError()
override fun dump() = throw NotImplementedError()
override fun dump(dump: Any?) = throw NotImplementedError()
@Internal
override fun getdontshrink(): Any? = throw NotImplementedError()
@Internal
override fun getkeepattributes(): Any? = throw NotImplementedError()
override fun microedition() = throw NotImplementedError()
override fun keepparameternames() = throw NotImplementedError()
override fun addconfigurationdebugging() = throw NotImplementedError()
override fun packageobfuscationdictionary(packageObfuscationDictionary: Any?) = throw NotImplementedError()
@Internal
override fun getdontskipnonpubliclibraryclassmembers(): Any? = throw NotImplementedError()
override fun dontskipnonpubliclibraryclassmembers() = throw NotImplementedError()
@Internal
override fun getprintconfiguration(): Any? = throw NotImplementedError()
override fun forceprocessing() = throw NotImplementedError()
override fun keepclassmembers(classSpecificationString: String?) = throw NotImplementedError()
override fun keepclassmembers(keepArgs: MutableMap<Any?, Any?>?, classSpecificationString: String?) = throw NotImplementedError()
override fun keepclassmembers(keepClassSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
override fun keepclassmembers(keepClassSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
@Internal
override fun getmergeinterfacesaggressively(): Any? = throw NotImplementedError()
@Internal
override fun getConfigurationFiles(): MutableList<Any?> = throw NotImplementedError()
@Internal
override fun getkeeppackagenames(): Any? = throw NotImplementedError()
override fun assumevalues(classSpecificationString: String?) = throw NotImplementedError()
override fun assumevalues(classSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun printusage() = throw NotImplementedError()
override fun printusage(printUsage: Any?) = throw NotImplementedError()
@Internal
override fun getprintseeds(): Any? = throw NotImplementedError()
@Internal
override fun getadaptresourcefilenames(): Any? = throw NotImplementedError()
override fun assumenoexternalsideeffects(classSpecificationString: String?) = throw NotImplementedError()
override fun assumenoexternalsideeffects(classSpecificationArgs: MutableMap<Any?, Any?>?, classMembersClosure: Closure<*>?) = throw NotImplementedError()
override fun dontwarn() = throw NotImplementedError()
override fun dontwarn(filter: String?) = throw NotImplementedError()
@Internal
override fun getrepackageclasses(): Any? = throw NotImplementedError()
@Internal
override fun getadaptresourcefilecontents(): Any? = throw NotImplementedError()
@Internal
override fun getflattenpackagehierarchy(): Any? = throw NotImplementedError()
override fun optimizationpasses(optimizationPasses: Int) = throw NotImplementedError()
override fun adaptresourcefilenames() = throw NotImplementedError()
override fun adaptresourcefilenames(filter: String?) = throw NotImplementedError()
override fun method(memberSpecificationArgs: MutableMap<Any?, Any?>?) = throw NotImplementedError()
@Internal
override fun getadaptclassstrings(): Any? = throw NotImplementedError()
override fun repackageclasses() = throw NotImplementedError()
override fun repackageclasses(repackageClasses: String?) = throw NotImplementedError()
@Internal
override fun getkeepparameternames(): Any? = throw NotImplementedError()
override fun adaptresourcefilecontents() = throw NotImplementedError()
override fun adaptresourcefilecontents(filter: String?) = throw NotImplementedError()
}

View File

@@ -10,7 +10,9 @@ import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetOutput
import org.gradle.api.tasks.bundling.AbstractArchiveTask
import org.gradle.kotlin.dsl.*
import proguard.gradle.ProGuardTask
import java.io.File
import java.util.concurrent.Callable
@@ -71,3 +73,9 @@ fun Project.javaPluginConvention(): JavaPluginConvention = the()
fun Project.findJavaPluginConvention(): JavaPluginConvention? = convention.findByType() ?: convention.findPlugin()
fun JavaExec.pathRelativeToWorkingDir(file: File): String = file.relativeTo(workingDir).invariantSeparatorsPath
fun Task.singleOutputFile(): File = when (this) {
is AbstractArchiveTask -> archiveFile.get().asFile
is ProGuardTask -> project.file(outJarFiles.single()!!)
else -> outputs.files.singleFile
}

View File

@@ -64,6 +64,8 @@ fun Project.runtimeJarArtifactBy(task: Task, artifactRef: Any, body: Configurabl
}
}
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body), { })
fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {}): TaskProvider<T> {
tasks.named<Jar>("jar").configure {
removeArtifacts(configurations.getOrCreate("archives"), this)
@@ -83,8 +85,6 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
return task
}
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body), { })
fun Project.sourcesJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> {
val task = tasks.register<Jar>("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

View File

@@ -8,20 +8,22 @@ import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.*
import java.io.File
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
const val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
val packagesToRelocate =
listOf( "com.intellij",
"com.google",
"com.sampullara",
"org.apache",
"org.jdom",
"org.picocontainer",
"org.jline",
"org.fusesource",
"kotlinx.coroutines",
"net.jpountz",
"one.util.streamex")
listOf(
"com.intellij",
"com.google",
"com.sampullara",
"org.apache",
"org.jdom",
"org.picocontainer",
"org.jline",
"org.fusesource",
"kotlinx.coroutines",
"net.jpountz",
"one.util.streamex"
)
// The shaded compiler "dummy" is used to rewrite dependencies in projects that are used with the embeddable compiler
// on the runtime and use some shaded dependencies from the compiler
@@ -29,21 +31,23 @@ val packagesToRelocate =
// But due to the shadow plugin bug (https://github.com/johnrengelman/shadow/issues/262) it is not possible to use
// packagesToRelocate list to for the include list. Therefore the exclude list has to be created.
val packagesToExcludeFromDummy =
listOf("org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt")
listOf(
"org/jetbrains/kotlin/**",
"org/intellij/lang/annotations/**",
"org/jetbrains/jps/**",
"META-INF/**",
"com/sun/jna/**",
"com/thoughtworks/xstream/**",
"javaslang/**",
"*.proto",
"messages/**",
"net/sf/cglib/**",
"one/util/streamex/**",
"org/iq80/snappy/**",
"org/jline/**",
"org/xmlpull/**",
"*.txt"
)
private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boolean = true) {
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
@@ -54,7 +58,6 @@ private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boo
relocate("javax.inject", "$kotlinEmbeddableRootPackage.javax.inject")
}
relocate("org.fusesource", "$kotlinEmbeddableRootPackage.org.fusesource") {
// TODO: remove "it." after #KT-12848 get addressed
exclude("org.fusesource.jansi.internal.CLibrary")
}
}
@@ -65,9 +68,9 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar"))
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from(compilerJar)
configurations = listOf(compilerJar)
destinationDirectory.set(File(buildDir, "libs"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
body()
}
}
@@ -105,8 +108,8 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(
)
return tasks.register<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDirectory.set(File(buildDir, "libs"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(compilerDummyJar)
configureEmbeddableCompilerRelocation(withJavaxInject = false)
body()
@@ -117,27 +120,27 @@ fun Project.rewriteDepsToShadedJar(
originalJarTask: TaskProvider<out Jar>, shadowJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}
): TaskProvider<out Jar> {
originalJarTask.configure {
classifier = "original"
archiveClassifier.set("original")
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
shadowJarTask.configure {
dependsOn(originalJarTask)
from(originalJarTask)// { include("**") }
from(originalJarTask)
// When Gradle traverses the inputs, reject the shaded compiler JAR,
// which leads to the content of that JAR being excluded as well:
// ShadowJar can only relocate classes within one jar
// so we add compiler embeddable contents for relocation ad exclude it from final jar
exclude { it.file == compilerDummyJarFile }
classifier = ""
archiveClassifier.set("")
body()
}
return shadowJarTask
}
fun Project.rewriteDepsToShadedCompiler(originalJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}): TaskProvider<out Jar> =
fun Project.relocateToEmbeddableCompiler(originalJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}): TaskProvider<out Jar> =
rewriteDepsToShadedJar(originalJarTask, embeddableCompilerDummyForDependenciesRewriting(), body)
fun Project.rewriteDefaultJarDepsToShadedCompiler(body: Jar.() -> Unit = {}): TaskProvider<out Jar> =
fun Project.relocateDefaultJarToEmbeddableCompiler(body: Jar.() -> Unit = {}): TaskProvider<out Jar> =
rewriteDepsToShadedJar(tasks.named<Jar>("jar"), embeddableCompilerDummyForDependenciesRewriting(), body)

View File

@@ -1,6 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "Compiler runner + daemon client"
plugins {
@@ -29,6 +26,6 @@ sourceSets {
publish()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()

View File

@@ -1,17 +1,17 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// FILE: A.java
public enum A {
ENTRY {
public String s() {
return "s";
}
};
public abstract String s();
}
// FILE: test.kt
fun main() {
checkSubtype<String?>(A.ENTRY.s())
}
// !CHECK_TYPE
// FILE: A.java
public enum A {
ENTRY {
public String s() {
return "s";
}
};
public abstract String s();
}
// FILE: test.kt
fun main() {
checkSubtype<String?>(A.ENTRY.s())
}

View File

@@ -1,13 +1,13 @@
public class A() {
public val <!REDECLARATION!>FOO<!>: String = "test"
public class <!REDECLARATION!>FOO<!>() { }
}
public class B() {
companion object {
public val <!REDECLARATION!>FOO<!>: String = "test"
public class <!REDECLARATION!>FOO<!>() { }
}
}
public class A() {
public val <!REDECLARATION!>FOO<!>: String = "test"
public class <!REDECLARATION!>FOO<!>() { }
}
public class B() {
companion object {
public val <!REDECLARATION!>FOO<!>: String = "test"
public class <!REDECLARATION!>FOO<!>() { }
}
}

View File

@@ -1,27 +1,27 @@
//KT-2418 Front-end allows enum constants with same name
package kt2418
enum class A {
<!REDECLARATION!>FOO<!>,
<!REDECLARATION!>FOO<!>
}
enum class B {
FOO;
fun FOO() {}
}
enum class C {
<!REDECLARATION!>FOO<!>;
val <!REDECLARATION!>FOO<!> = 1
}
enum class D {
<!REDECLARATION!>FOO<!>;
class <!REDECLARATION!>FOO<!> {}
}
//KT-2418 Front-end allows enum constants with same name
package kt2418
enum class A {
<!REDECLARATION!>FOO<!>,
<!REDECLARATION!>FOO<!>
}
enum class B {
FOO;
fun FOO() {}
}
enum class C {
<!REDECLARATION!>FOO<!>;
val <!REDECLARATION!>FOO<!> = 1
}
enum class D {
<!REDECLARATION!>FOO<!>;
class <!REDECLARATION!>FOO<!> {}
}

View File

@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.1
Created-By: 1.7.0_72-b14 (Oracle Corporation)
Built-By: JetBrains
Implementation-Vendor: JetBrains
Implementation-Version: snapshot
Specification-Title: Kotlin JavaScript Lib
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.1
Created-By: 1.7.0_72-b14 (Oracle Corporation)
Built-By: JetBrains
Implementation-Vendor: JetBrains
Implementation-Version: snapshot
Specification-Title: Kotlin JavaScript Lib

View File

@@ -1,8 +1,12 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
kotlin("jvm")
id("jps-compatible")
}
val kotlinVersion: String by rootProject.extra
repositories {
maven("https://jetbrains.bintray.com/markdown")
}
@@ -183,6 +187,17 @@ dependencies {
}
tasks.named<Copy>("processResources") {
val currentIde = IdeVersionConfigurator.currentIde
val pluginPatchNumber = findProperty("pluginPatchNumber") as String? ?: "1"
val defaultPluginVersion = "$kotlinVersion-${currentIde.kind.shortName}${currentIde.platform.version}-$pluginPatchNumber"
val pluginVersion = findProperty("pluginVersion") as String? ?: defaultPluginVersion
inputs.property("pluginVersion", pluginVersion)
filesMatching("META-INF/plugin.xml") {
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to pluginVersion))
}
from(provider { project(":compiler:cli-common").mainSourceSet.resources }) {
include("META-INF/extensions/compiler.xml")
}

View File

@@ -1,8 +1,8 @@
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.1
Created-By: 1.7.0_72-b14 (Oracle Corporation)
Built-By: JetBrains
Implementation-Vendor: JetBrains
Implementation-Version: snapshot
Specification-Title: Kotlin JavaScript Lib
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.1
Created-By: 1.7.0_72-b14 (Oracle Corporation)
Built-By: JetBrains
Implementation-Vendor: JetBrains
Implementation-Version: snapshot
Specification-Title: Kotlin JavaScript Lib

View File

@@ -37,5 +37,5 @@ dependencies {
// Relocate `com.intellij.*` and some other classes to match those in the `kotlin-compiler-embeddable`
// (for example, the actual package at runtime is `org.jetbrains.kotlin.com.intellij.*`):
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
ArtifactsKt.runtimeJar(project, EmbeddableKt.relocateDefaultJarToEmbeddableCompiler(project, {}), {})
// In a standalone build, you can setup the relocation with the Shadow plugin.

View File

@@ -5,7 +5,6 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContex
import kotlinx.metadata.jvm.KmModuleVisitor
import kotlinx.metadata.jvm.KotlinModuleMetadata
import org.gradle.api.tasks.PathSensitivity.RELATIVE
import proguard.gradle.ProGuardTask
import shadow.org.apache.tools.zip.ZipEntry
import shadow.org.apache.tools.zip.ZipOutputStream
@@ -21,6 +20,8 @@ plugins {
java
}
val JDK_16: String by rootProject.extra
callGroovy("configureJavaOnlyJvm6Project", project)
publish()
@@ -43,7 +44,6 @@ dependencies {
proguardDeps(kotlinStdlib())
proguardAdditionalInJars(project(":kotlin-annotations-jvm"))
proguardDeps(files(firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar", jdkHome = File(property("JDK_16") as String))))
embedded(project(":core:type-system"))
embedded(project(":kotlin-reflect-api"))
@@ -56,7 +56,7 @@ dependencies {
embedded(project(":core:util.runtime"))
embedded("javax.inject:javax.inject:1")
embedded(protobufLite())
compileOnly("org.jetbrains:annotations:13.0")
}
@@ -139,16 +139,16 @@ val stripMetadata by tasks.registering {
val proguardOutput = "$libsDir/${property("archivesBaseName")}-proguard.jar"
val proguard by task<ProGuardTask> {
val proguard by task<CacheableProguardTask> {
dependsOn(stripMetadata)
inputs.files(stripMetadata.get().outputs.files)
outputs.file(proguardOutput)
injars(mapOf("filter" to "!META-INF/versions/**"), stripMetadata.get().outputs.files)
injars(mapOf("filter" to "!META-INF/**,!**/*.kotlin_builtins"), proguardAdditionalInJars)
outjars(proguardOutput)
jdkHome = File(JDK_16)
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardDeps)
libraryjars(firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar", jdkHome = jdkHome!!))
configuration("$core/reflection.jvm/reflection.pro")
}
@@ -202,7 +202,7 @@ val intermediate = when {
val result by task<Jar> {
dependsOn(intermediate)
from {
zipTree(intermediate.get().outputs.files.singleFile)
zipTree(intermediate.get().singleOutputFile())
}
callGroovy("manifestAttributes", manifest, project, "Main")
}
@@ -210,8 +210,10 @@ val result by task<Jar> {
val modularJar by task<Jar> {
dependsOn(intermediate)
archiveClassifier.set("modular")
from(zipTree(intermediate.get().outputs.files.single()))
from(zipTree(reflectShadowJar.get().archivePath)) {
from {
zipTree(intermediate.get().singleOutputFile())
}
from(zipTree(provider { reflectShadowJar.get().archiveFile.get().asFile })) {
include("META-INF/versions/**")
}
callGroovy("manifestAttributes", manifest, project, "Main", true)

View File

@@ -1,15 +1,12 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.jvm.tasks.Jar
description = "Kotlin Scripting JSR-223 support"
plugins { java }
val packedJars by configurations.creating
plugins {
java
}
dependencies {
packedJars(project(":kotlin-scripting-jsr223")) { isTransitive = false }
embedded(project(":kotlin-scripting-jsr223")) { isTransitive = false }
runtime(project(":kotlin-script-runtime"))
runtime(kotlinStdlib())
runtime(project(":kotlin-scripting-common"))
@@ -26,12 +23,6 @@ sourceSets {
publish()
noDefaultJar()
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()

View File

@@ -1,5 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "Kotlin Scripting JVM host (for using with embeddable compiler)"
plugins { java }
@@ -23,6 +21,6 @@ publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()

View File

@@ -34,7 +34,7 @@ jar {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
ArtifactsKt.runtimeJar(project, EmbeddableKt.relocateDefaultJarToEmbeddableCompiler(project, {}), {})
artifacts {
archives sourcesJar

View File

@@ -1,17 +1,12 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.jvm.tasks.Jar
description = "Kapt - Annotation processing for Kotlin"
plugins {
kotlin("jvm")
}
val packedJars by configurations.creating
dependencies {
compile(kotlinStdlib())
packedJars(project(":kotlin-annotation-processing")) { isTransitive = false }
embedded(project(":kotlin-annotation-processing")) { isTransitive = false }
runtime(projectRuntimeJar(":kotlin-compiler-embeddable"))
}
@@ -21,15 +16,7 @@ projectTest(parallel = true) {
publish()
tasks.named<Jar>("jar").configure {
classifier = "base"
}
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()

View File

@@ -1,3 +1,3 @@
fun main() {
println("<root>.main")
}
fun main() {
println("<root>.main")
}

View File

@@ -1,3 +1,3 @@
fun main() {
println("<root>.main")
}
fun main() {
println("<root>.main")
}

View File

@@ -3,15 +3,11 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.jvm.tasks.Jar
description = "Shaded test jars from compiler for Gradle integration tests"
plugins { `java` }
val packedJars by configurations.creating
plugins {
java
}
val projectsToInclude = listOf(":compiler:tests-common",
":compiler:incremental-compilation-impl",
@@ -20,15 +16,11 @@ val projectsToInclude = listOf(":compiler:tests-common",
dependencies {
for (projectName in projectsToInclude) {
compile(projectTests(projectName)) { isTransitive = false }
packedJars(projectTests(projectName)) { isTransitive = false }
embedded(projectTests(projectName)) { isTransitive = false }
}
packedJars(intellijDep()) { includeJars("idea_rt") }
embedded(intellijDep()) { includeJars("idea_rt") }
}
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
runtimeJar(relocateDefaultJarToEmbeddableCompiler())

View File

@@ -67,7 +67,7 @@ dependencies {
runtime(projectRuntimeJar(":kotlin-scripting-compiler-impl-embeddable"))
runtime(project(":kotlin-reflect"))
jarContents(compileOnly(intellijDep()) {
embedded(compileOnly(intellijDep()) {
includeJars("asm-all", "gson", "serviceMessages", rootProject = rootProject)
})
@@ -94,16 +94,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
configurations.compile.get().exclude("com.android.tools.external.com-intellij", "intellij-core")
}
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()).configure {
dependsOn(jarContents)
from {
jarContents.asFileTree.map {
if (it.endsWith(".jar")) zipTree(it)
else it
}
}
}
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
tasks {
withType<KotlinCompile> {

View File

@@ -8,6 +8,7 @@ plugins {
id("jps-compatible")
}
val JDK_18: String by rootProject.extra
val jarBaseName = property("archivesBaseName") as String
val proguardLibraryJars by configurations.creating
@@ -31,9 +32,7 @@ dependencies {
embedded(project(":kotlin-script-util")) { isTransitive = false }
embedded("org.apache.ivy:ivy:2.5.0")
embedded(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
proguardLibraryJars(files(firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar"),
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar"),
toolsJarFile()))
proguardLibraryJars(kotlinStdlib())
proguardLibraryJars(project(":kotlin-reflect"))
proguardLibraryJars(project(":kotlin-compiler"))
@@ -67,20 +66,23 @@ val relocatedJar by task<ShadowJar> {
}
}
val proguard by task<ProGuardTask> {
val proguard by task<CacheableProguardTask> {
dependsOn(relocatedJar)
configuration("main-kts.pro")
injars(mapOf("filter" to "!META-INF/versions/**"), relocatedJar.get().outputs.files)
val outputJar = fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar")
outjars(outputJar)
inputs.files(relocatedJar.get().outputs.files.singleFile)
outputs.file(outputJar)
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
jdkHome = File(JDK_18)
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraryJars)
libraryjars(
files(
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar", jdkHome = jdkHome!!),
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar", jdkHome = jdkHome!!),
toolsJarFile(jdkHome = jdkHome!!)
)
)
}
val resultJar by task<Jar> {
@@ -88,7 +90,7 @@ val resultJar by task<Jar> {
dependsOn(pack)
setupPublicJar(jarBaseName)
from {
zipTree(pack.get().outputs.files.singleFile)
zipTree(pack.get().singleOutputFile())
}
}

View File

@@ -1 +1 @@
local-repo
local-repo

View File

@@ -40,7 +40,7 @@ jar {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
ArtifactsKt.runtimeJar(project, EmbeddableKt.relocateDefaultJarToEmbeddableCompiler(project, {}), {})
artifacts {
archives sourcesJar

View File

@@ -40,7 +40,7 @@ jar {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
ArtifactsKt.runtimeJar(project, EmbeddableKt.relocateDefaultJarToEmbeddableCompiler(project, {}), {})
artifacts {
archives sourcesJar

View File

@@ -28,7 +28,7 @@ jar {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
ArtifactsKt.runtimeJar(project, EmbeddableKt.relocateDefaultJarToEmbeddableCompiler(project, {}), {})
artifacts {
archives sourcesJar

View File

@@ -1,74 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>
<name>${groupId} ${artifactId}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>${kotlinVersion}</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
<configuration>
<sourceMap>true</sourceMap> <!-- source map is useful for debugging in tools that support source maps -->
<outputFile>${project.build.outputDirectory}/${project.artifactId}.js</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<!-- unpack kotlin.js to target/classes/lib for example index.html -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>extract-kotlinjs</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>kotlin-stdlib-js</includeArtifactIds>
<outputDirectory>${build.outputDirectory}/lib</outputDirectory>
<includes>**\/*.js</includes>
<excludes>**\/*.meta.js</excludes> <!-- we don't need meta.js files in runtime -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>
<name>${groupId} ${artifactId}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>${kotlinVersion}</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
<configuration>
<sourceMap>true</sourceMap> <!-- source map is useful for debugging in tools that support source maps -->
<outputFile>${project.build.outputDirectory}/${project.artifactId}.js</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<!-- unpack kotlin.js to target/classes/lib for example index.html -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>extract-kotlinjs</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>kotlin-stdlib-js</includeArtifactIds>
<outputDirectory>${build.outputDirectory}/lib</outputDirectory>
<includes>**\/*.js</includes>
<excludes>**\/*.meta.js</excludes> <!-- we don't need meta.js files in runtime -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,69 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>
<name>${groupId} ${artifactId}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>${kotlinVersion}</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>
<name>${groupId} ${artifactId}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>${kotlinVersion}</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -20,6 +20,6 @@ publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()

View File

@@ -1,5 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "ABI generation for Kotlin/JVM (for using with embeddable compiler)"
plugins {
@@ -12,7 +10,7 @@ dependencies {
publish()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()

View File

@@ -1,25 +1,19 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins { java }
plugins {
java
}
description = "Kotlin Scripting Compiler Plugin for embeddable compiler"
val packedJars by configurations.creating
dependencies {
packedJars(project(":kotlin-scripting-compiler")) { isTransitive = false }
embedded(project(":kotlin-scripting-compiler")) { isTransitive = false }
runtime(project(":kotlin-scripting-compiler-impl-embeddable"))
runtime(kotlinStdlib())
}
publish()
noDefaultJar()
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()

View File

@@ -1,12 +1,12 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins { java }
plugins {
java
}
description = "Kotlin Compiler Infrastructure for Scripting for embeddable compiler"
val packedJars by configurations.creating
dependencies {
packedJars(project(":kotlin-scripting-compiler-impl")) { isTransitive = false }
embedded(project(":kotlin-scripting-compiler-impl")) { isTransitive = false }
runtime(project(":kotlin-scripting-common"))
runtime(project(":kotlin-scripting-jvm"))
runtime(kotlinStdlib())
@@ -15,11 +15,6 @@ dependencies {
publish()
noDefaultJar()
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()

View File

@@ -1,6 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "Kotlin Android Extensions Compiler"
plugins {
@@ -29,7 +26,7 @@ sourceSets {
publish()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()

View File

@@ -44,19 +44,7 @@ val writeStdlibVersion by tasks.registering {
}
}
val writePluginVersion by tasks.registering {
val versionFile = project(":idea").projectDir.resolve("resources/META-INF/plugin.xml")
val pluginVersion = rootProject.findProperty("pluginVersion") as String?
inputs.property("version", pluginVersion)
outputs.file(versionFile)
doLast {
requireNotNull(pluginVersion) { "Specify 'pluginVersion' property" }
replaceVersion(versionFile, """<version>([^<]+)</version>""") {
logger.lifecycle("Writing new plugin version: $pluginVersion")
pluginVersion!!
}
}
}
val writePluginVersion by tasks.registering // Remove this task after removing usages in the TeamCity build
val writeVersions by tasks.registering {
dependsOn(writeBuildNumber, writeStdlibVersion)

View File

@@ -1,7 +1,6 @@
@file:Suppress("HasPlatformType")
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import proguard.gradle.ProGuardTask
import java.util.regex.Pattern.quote
description = "Kotlin Compiler"
@@ -12,6 +11,8 @@ plugins {
java
}
val JDK_18: String by rootProject.extra
val fatJarContents by configurations.creating
val fatJarContentsStripMetadata by configurations.creating
val fatJarContentsStripServices by configurations.creating
@@ -133,13 +134,6 @@ dependencies {
compile(commonDep("org.jetbrains.intellij.deps", "trove4j"))
proguardLibraries(project(":kotlin-annotations-jvm"))
proguardLibraries(
files(
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar"),
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar"),
toolsJarFile()
)
)
compilerVersion(project(":compiler:compiler.version"))
proguardLibraries(project(":compiler:compiler.version"))
@@ -253,24 +247,42 @@ val packCompiler by task<Jar> {
}
}
val proguard by task<ProGuardTask> {
val proguard by task<CacheableProguardTask> {
dependsOn(packCompiler)
configuration("$rootDir/compiler/compiler.pro")
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
jdkHome = File(JDK_18)
inputs.files(packCompiler.get().outputs.files.singleFile)
outputs.file(outputJar)
configuration("$projectDir/compiler.pro")
injars(
mapOf("filter" to """
!org/apache/log4j/jmx/Agent*,
!org/apache/log4j/net/JMS*,
!org/apache/log4j/net/SMTP*,
!org/apache/log4j/or/jms/MessageRenderer*,
!org/jdom/xpath/Jaxen*,
!org/jline/builtins/ssh/**,
!org/mozilla/javascript/xml/impl/xmlbeans/**,
!net/sf/cglib/**,
!META-INF/maven**,
**.class,**.properties,**.kt,**.kotlin_*,**.jnilib,**.so,**.dll,**.txt,**.caps,
META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF,
messages/**""".trimIndent()),
provider { packCompiler.get().outputs.files.singleFile }
)
outjars(fileFrom(buildDir, "libs", "$compilerBaseName-after-proguard.jar"))
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraries)
libraryjars(
files(
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar", jdkHome = jdkHome!!),
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar", jdkHome = jdkHome!!),
toolsJarFile(jdkHome = jdkHome!!)
)
)
printconfiguration("$buildDir/compiler.pro.dump")
// This properties are used by proguard config compiler.pro
doFirst {
System.setProperty("kotlin-compiler-jar-before-shrink", packCompiler.get().outputs.files.singleFile.canonicalPath)
System.setProperty("kotlin-compiler-jar", outputJar.canonicalPath)
}
}
val pack = if (kotlinBuildProperties.proguard) proguard else packCompiler
@@ -281,7 +293,7 @@ val jar = runtimeJar {
dependsOn(compilerVersion)
from {
zipTree(pack.get().outputs.files.singleFile)
zipTree(pack.get().singleOutputFile())
}
from {

View File

@@ -1,19 +1,3 @@
-injars '<kotlin-compiler-jar-before-shrink>'(
!org/apache/log4j/jmx/Agent*,
!org/apache/log4j/net/JMS*,
!org/apache/log4j/net/SMTP*,
!org/apache/log4j/or/jms/MessageRenderer*,
!org/jdom/xpath/Jaxen*,
!org/jline/builtins/ssh/**,
!org/mozilla/javascript/xml/impl/xmlbeans/**,
!net/sf/cglib/**,
!META-INF/maven**,
**.class,**.properties,**.kt,**.kotlin_*,**.jnilib,**.so,**.dll,**.txt,**.caps,
META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF,
messages/**)
-outjars '<kotlin-compiler-jar>'
-dontnote **
-dontwarn apple.awt.*
-dontwarn dk.brics.automaton.*

View File

@@ -1,19 +1,3 @@
-injars '<kotlin-compiler-jar-before-shrink>'(
!org/apache/log4j/jmx/Agent*,
!org/apache/log4j/net/JMS*,
!org/apache/log4j/net/SMTP*,
!org/apache/log4j/or/jms/MessageRenderer*,
!org/jdom/xpath/Jaxen*,
!org/jline/builtins/ssh/**,
!org/mozilla/javascript/xml/impl/xmlbeans/**,
!net/sf/cglib/**,
!META-INF/maven**,
**.class,**.properties,**.kt,**.kotlin_*,**.jnilib,**.so,**.dll,**.txt,**.caps,
META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF,
messages/**)
-outjars '<kotlin-compiler-jar>'
-dontnote **
-dontwarn com.intellij.util.ui.IsRetina*
-dontwarn com.intellij.util.ui.UIUtilities

View File

@@ -1,5 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "Annotation Processor for Kotlin (for using with embeddable compiler)"
plugins {
@@ -12,7 +10,7 @@ dependencies {
publish()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()

View File

@@ -1,28 +1,17 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.jvm.tasks.Jar
description = "Kotlin Daemon (for using with embeddable compiler)"
plugins {
`java`
java
}
val packedJars by configurations.creating
dependencies {
packedJars(project(":kotlin-daemon")) { isTransitive = false }
embedded(project(":kotlin-daemon")) { isTransitive = false }
}
publish()
noDefaultJar()
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
runtimeJar(relocateDefaultJarToEmbeddableCompiler())
sourcesJar()
javadocJar()