Compare commits

...

18 Commits

Author SHA1 Message Date
Vyacheslav Gerasimov
2c211f74fe Build: Use sourceMapBaseDirs in :kotlin-stdlib-js:compileKotlin2Js
instead of freeCompiler args to avoid snapshotting absolute paths
and fix caching
2020-02-28 18:02:51 +03:00
Vyacheslav Gerasimov
0480ab4e4f Advance bootstrap to 1.4.0-dev-1818 2020-02-28 18:02:51 +03:00
Vyacheslav Gerasimov
7810634b6a Build: Use configurations property for shadowJar in :kotlin-main-kts
It marked as classpath and improves cache reuse between different builds
2020-02-28 18:02:51 +03:00
Vyacheslav Gerasimov
bc31f6d415 Build: Make toolsJarApi() helper for JPS build 2020-02-28 16:54:15 +03:00
Vyacheslav Gerasimov
1432dcf32f Build: Remove all code from tools-jar-api leaving only declarations
Since method bodies are not required for compilation
strip them out to remove noise between different versions.
2020-02-28 16:54:15 +03:00
Vyacheslav Gerasimov
713da2fd08 Build: Use preprocessed tools.jar for compilation
tools.jar from JDK has different public api on different platforms which
makes impossible to reuse caches for tasks which depend on it. Since we
can't compile against those classes & stay cross-platform anyway, we
may just exclude them from compile classpath. This should make tools.jar
compatible at least within one build of JDK for different platforms
2020-02-28 16:54:15 +03:00
Vyacheslav Gerasimov
5325d9d74a Build: Make all compile dependencies on toolsJar compileOnly
tools.jar differs between different versions of JDK reducing cache reuse
so better to not leak it to other modules
2020-02-28 16:54:15 +03:00
Vyacheslav Gerasimov
7f2fd8907a Build: Make DexMethodCount task cacheable, extract TC stats to task 2020-02-28 16:54:15 +03:00
Vyacheslav Gerasimov
de0617daee Build: Don't disable incremental compilation for CI
Using different incremental setting for KotlinCompile makes impossible
using caches built on CI since it is marked as @Input. Same property for
JavaCompile marked as @Internal.
We do clean checkout now so it shouldn't matter but we want to build
incrementally in some cases for Dev builds on CI.
2020-02-28 16:54:14 +03:00
Vyacheslav Gerasimov
e123961151 Build: normalize inputs of :kotlin-reflect:stripMetadata as classpath 2020-02-28 16:54:14 +03:00
Vyacheslav Gerasimov
1c068f4e1c Build: Make :kotlin-reflect:relocateCoreSources task cacheable 2020-02-28 16:54:14 +03:00
Vyacheslav Gerasimov
78fb1c9d31 Build: Use same com.eclipsesource.j2v8 artifact for compilation
We can't reuse caches from different platform when we compile against
different jar on each platform. Since they have same api we may use
platform specific jars only for runtime.
2020-02-28 16:54:14 +03:00
Vyacheslav Gerasimov
1262938c89 Build: Remove duplicated manifestAttributes call from reflectShadowJar
manifestAttributes call done in the result jar
2020-02-28 16:54:14 +03:00
Vyacheslav Gerasimov
ddcc629ba2 Build: Disable caching for Test tasks until we are sure it is safe
#KT-37089
2020-02-28 16:54:14 +03:00
Vyacheslav Gerasimov
d974e795bf Build: Add buildserver.labs.intellij.net to valid hosts in caching check 2020-02-28 16:54:14 +03:00
Vyacheslav Gerasimov
c0f9ca7d20 Build: Use Jar task for :kotlin-compiler:packCompiler
Right now can't be cached between builds because of compiler version.
We may move module containing compiler version directly to the final jar
2020-02-28 16:54:13 +03:00
Vyacheslav Gerasimov
7fb6605dce Build: Use Jar task instead ShadowJar task in :kotlin-daemon-client-new 2020-02-28 16:54:13 +03:00
Vyacheslav Gerasimov
7eaba6309c Build: Use Jar task instead ShadowJar task in :kotlin-daemon 2020-02-28 16:54:13 +03:00
36 changed files with 218 additions and 96 deletions

View File

@@ -1,6 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import proguard.gradle.ProGuardTask
@@ -8,7 +7,7 @@ buildscript {
extra["defaultSnapshotVersion"] = "1.4-SNAPSHOT"
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap("1.4.0-dev-1075", cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap("1.4.0-dev-1818", cacheRedirectorEnabled))
repositories {
bootstrapKotlinRepo?.let(::maven)
@@ -386,6 +385,11 @@ allprojects {
isReproducibleFileOrder = true
}
tasks.withType<Test> {
outputs.cacheIf { false }
// https://youtrack.jetbrains.com/issue/KT-37089
}
tasks {
register("listArchives") { listConfigurationContents("archives") }
@@ -438,12 +442,6 @@ allprojects {
gradle.taskGraph.whenReady {
if (isTeamcityBuild) {
logger.warn("CI build profile is active (IC is off, proguard is on). Use -Pteamcity=false to reproduce local build")
for (task in allTasks) {
when (task) {
is AbstractKotlinCompile<*> -> task.incremental = false
is JavaCompile -> task.options.isIncremental = false
}
}
} else {
logger.warn("Local build profile is active (IC is on, proguard is off). Use -Pteamcity=true to reproduce TC build")
}

View File

@@ -135,6 +135,12 @@ fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = Fi
logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome")
}
fun Project.toolsJarApi(): Any =
if (kotlinBuildProperties.isInJpsBuildIdeaSync)
files(toolsJarFile() ?: error("tools.jar is not found!"))
else
dependencies.project(":dependencies:tools-jar-api")
fun Project.toolsJar(): FileCollection = files(toolsJarFile() ?: error("tools.jar is not found!"))
fun Project.toolsJarFile(jdkHome: File = File(this.property("JDK_18") as String)): File? =

View File

@@ -5,10 +5,12 @@
import com.jakewharton.dex.*
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.tasks.*
import org.gradle.jvm.tasks.Jar
import java.io.File
@CacheableTask
open class DexMethodCount : DefaultTask() {
data class Counts(
@@ -19,30 +21,19 @@ open class DexMethodCount : DefaultTask() {
val byClass: Map<String, Int>
)
init {
outputs.upToDateWhen { !shouldPrintTeamCityStatistics } // always execute when teamCityStatistics output is required
}
@InputFile
@Classpath
lateinit var jarFile: File
@Input
@Optional
@Input
var ownPackages: List<String>? = null
// ##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='62362']
@Input
@Optional
var teamCityStatistics: Boolean? = null
private val shouldPrintTeamCityStatistics = teamCityStatistics ?: project.hasProperty("teamcity")
@Input
@Optional
@Internal
var artifactName: String? = null
private val artifactOrArchiveName get() = artifactName ?: project.name
@get:Input
val artifactOrArchiveName: String
get() = artifactName ?: project.name
fun from(jar: Jar) {
jarFile = jar.archivePath
@@ -54,7 +45,8 @@ open class DexMethodCount : DefaultTask() {
lateinit var counts: Counts
@get:OutputFile
val detailOutputFile: File get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
val detailOutputFile: File
get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
@TaskAction
fun invoke() {
@@ -63,7 +55,6 @@ open class DexMethodCount : DefaultTask() {
val counts = methods.getCounts().also { this.counts = it }
printTotals(counts)
printTCStats(counts)
outputDetails(counts)
}
@@ -95,18 +86,6 @@ open class DexMethodCount : DefaultTask() {
}
}
private fun printTCStats(counts: Counts) {
if (shouldPrintTeamCityStatistics) {
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='${counts.total}']")
counts.totalOwnPackages?.let { value ->
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}_OwnPackages' value='$value']")
}
counts.totalOtherPackages?.let { value ->
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}_OtherPackages' value='$value']")
}
}
}
private fun outputDetails(counts: Counts) {
detailOutputFile.printWriter().use { writer ->
writer.println("${counts.total.padRight()}\tTotal methods")
@@ -126,9 +105,44 @@ open class DexMethodCount : DefaultTask() {
}
}
}
}
open class TCDexMethodCountStats : DefaultTask() {
@Internal
lateinit var from: TaskProvider<DexMethodCount>
@get:InputFile
internal val inputFile
get() = from.get().detailOutputFile
@TaskAction
private fun printTCStats() {
val artifactOrArchiveName = from.get().artifactOrArchiveName
inputFile.reader().useLines { lines ->
fun String.getStatValue() = substringBefore("\t").trim()
val stats = lines.take(3).toList()
val total = stats[0].getStatValue()
val totalOwnPackages = stats[1].getStatValue()
val totalOtherPackages = stats[2].getStatValue()
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='$total']")
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}_OwnPackages' value='$totalOwnPackages']")
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}_OtherPackages' value='$totalOtherPackages']")
}
}
}
fun Project.printTCStats(dexMethodCount: TaskProvider<DexMethodCount>) {
val dexMethodCountStats = tasks.register("dexMethodCountStats", TCDexMethodCountStats::class.java) {
from = dexMethodCount
}
dexMethodCount.configure {
finalizedBy(dexMethodCountStats)
}
}
private val DexMethod.`package`: String get() = declaringType.substringBeforeLast('.')
private fun Int.padRight() = toString().padStart(5, ' ')

View File

@@ -30,7 +30,7 @@ dependencies {
compile(project(":kotlin-util-io"))
compile(project(":compiler:ir.serialization.common"))
compile(toolsJar())
compileOnly(toolsJarApi())
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }

View File

@@ -49,11 +49,7 @@ sourceSets {
publish()
noDefaultJar()
runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
from(mainSourceSet.output)
}
runtimeJar()
sourcesJar()

View File

@@ -63,11 +63,7 @@ sourceSets {
publish()
noDefaultJar()
runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
from(mainSourceSet.output)
}
runtimeJar()
sourcesJar()

View File

@@ -38,11 +38,12 @@ dependencies {
testCompileOnly(project(":plugins:android-extensions-compiler"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(projectTests(":compiler:tests-common-jvm6"))
testCompileOnly(project(":kotlin-reflect-api"))
testCompile(project(":kotlin-scripting-compiler-impl"))
testCompile(commonDep("junit:junit"))
testCompile(androidDxJar()) { isTransitive = false }
testCompile(commonDep("com.android.tools:r8"))
testCompileOnly(project(":kotlin-reflect-api"))
testCompileOnly(toolsJar())
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
Platform[193].orLower {
testCompile(intellijDep()) { includeJars("openapi", "picocontainer", rootProject = rootProject) }

View File

@@ -11,6 +11,7 @@ dependencies {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompile(projectTests(":generators:test-generator"))
testRuntime(project(":kotlin-reflect"))
testRuntimeOnly(toolsJar())
testRuntime(intellijDep())
Platform[192].orHigher {
testRuntimeOnly(intellijPluginDep("java"))

View File

@@ -0,0 +1,78 @@
import org.jetbrains.kotlin.gradle.internal.ensureParentDirsCreated
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.ClassReader.SKIP_CODE
import org.jetbrains.org.objectweb.asm.ClassVisitor
import org.jetbrains.org.objectweb.asm.ClassWriter
import org.jetbrains.org.objectweb.asm.Opcodes.*
import java.util.zip.ZipFile
plugins {
base
}
val JDK_18: String by rootProject.extra
val toolsJarFile = toolsJarFile(jdkHome = File(JDK_18)) ?: error("Couldn't find tools.jar in $JDK_18")
// tools.jar from JDK has different public api on different platforms which makes impossible to reuse caches
// for tasks which depend on it. Since we can't compile against those classes & stay cross-platform anyway,
// we may just exclude them from compile classpath. Since method bodies are not required for compilation
// strip them out to remove noise between different versions.
val toolsJarStubs by tasks.registering {
inputs.file(toolsJarFile)
val outDir = buildDir.resolve(name)
outputs.dir(outDir)
doLast {
val zipFile = ZipFile(toolsJarFile)
zipFile.stream()
.filter { it.name.endsWith(".class") }
.forEach { zipEntry ->
zipFile.getInputStream(zipEntry).use { entryStream ->
val classReader = ClassReader(entryStream)
val classWriter = ClassWriter( 0)
classReader.accept(object : ClassVisitor(API_VERSION, classWriter) {
}, SKIP_CODE)
val result = File(outDir, zipEntry.name)
result.ensureParentDirsCreated()
result.writeBytes(classWriter.toByteArray())
}
}
}
}
val jar = tasks.register<Jar>("jar") {
dependsOn(toolsJarStubs)
from {
fileTree(toolsJarStubs.get().outputs.files.singleFile).matching {
exclude("META-INF/**")
exclude("sun/tools/attach/LinuxAttachProvider.class")
exclude("sun/tools/attach/LinuxVirtualMachine*")
exclude("sun/tools/attach/BsdAttachProvider.class")
exclude("sun/tools/attach/BsdVirtualMachine*")
exclude("sun/tools/attach/WindowsAttachProvider.class")
exclude("sun/tools/attach/WindowsVirtualMachine*")
// Windows only classes
exclude("com/sun/tools/jdi/SharedMemoryAttachingConnector$1.class")
exclude("com/sun/tools/jdi/SharedMemoryAttachingConnector.class")
exclude("com/sun/tools/jdi/SharedMemoryConnection.class")
exclude("com/sun/tools/jdi/SharedMemoryListeningConnector$1.class")
exclude("com/sun/tools/jdi/SharedMemoryListeningConnector.class")
exclude("com/sun/tools/jdi/SharedMemoryTransportService${'$'}SharedMemoryListenKey.class")
exclude("com/sun/tools/jdi/SharedMemoryTransportService.class")
exclude("com/sun/tools/jdi/SharedMemoryTransportServiceCapabilities.class")
exclude("com/sun/tools/jdi/SunSDK.class")
// Deprecated class which has differences in api between versions
exclude("com/sun/tools/javadoc/JavaScriptScanner.class")
}
}
}
artifacts.add("default", jar)

View File

@@ -108,8 +108,10 @@ fun RepositoryHandler.redirect() {
}
}
// teamcity.jetbrains.com is located in the same local network with build agents
fun URI.isCachedOrLocal() = host == "cache-redirector.jetbrains.com" || scheme == "file" || host == "teamcity.jetbrains.com"
fun URI.isCachedOrLocal() = scheme == "file" ||
host == "cache-redirector.jetbrains.com" ||
host == "teamcity.jetbrains.com" ||
host == "buildserver.labs.intellij.net"
fun RepositoryHandler.findNonCachedRepositories(): List<String> {
val mavenNonCachedRepos = filterIsInstance<MavenArtifactRepository>()

View File

@@ -97,6 +97,7 @@ dependencies {
compileOnly(intellijPluginDep("java-i18n"))
compileOnly(intellijPluginDep("gradle"))
testCompileOnly(toolsJar())
testCompileOnly(project(":kotlin-reflect-api")) // TODO: fix import (workaround for jps build)
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(projectTests(":compiler:tests-common"))
@@ -109,8 +110,8 @@ dependencies {
testCompile(commonDep("junit:junit"))
testCompileOnly(intellijPluginDep("coverage"))
testRuntimeOnly(toolsJar())
testRuntime(project(":native:kotlin-native-utils")) { isTransitive = false }
testRuntime(commonDep("org.jetbrains", "markdown"))
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
testRuntime(project(":kotlin-reflect"))

View File

@@ -40,6 +40,7 @@ dependencies {
compileOnly(intellijPluginDep("java"))
}
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))
testRuntime(project(":idea:idea-jvm"))
testRuntime(project(":idea:idea-android"))

View File

@@ -53,6 +53,7 @@ dependencies {
testRuntime(project(":native:kotlin-native-utils")) { isTransitive = false }
testRuntime(project(":idea:idea-new-project-wizard"))
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))
testRuntime(project(":idea:idea-jvm"))
testRuntime(project(":idea:idea-android"))

View File

@@ -9,6 +9,8 @@ dependencies {
compile(project(":compiler:light-classes"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:backend.jvm"))
compileOnly(toolsJar())
compileOnly(intellijDep())
compileOnly(commonDep("com.google.code.findbugs", "jsr305"))

View File

@@ -45,6 +45,7 @@ dependencies {
testRuntime(project(":native:frontend.native")) { isTransitive = false }
testRuntime(project(":native:kotlin-native-utils")) { isTransitive = false }
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))
testRuntime(project(":idea:idea-jvm"))
testRuntime(project(":idea:idea-android"))

View File

@@ -6,8 +6,11 @@ plugins {
dependencies {
compile(kotlinStdlib())
compile(project(":compiler:backend"))
compile(toolsJar())
compileOnly(toolsJarApi())
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", rootProject = rootProject) }
testCompileOnly(toolsJarApi())
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit"))
testCompile(intellijDep()) { includeJars("asm-all", rootProject = rootProject) }

View File

@@ -10,8 +10,8 @@ dependencies {
compile(project(":idea:idea-core"))
compile(project(":idea:ide-common"))
compile(project(":idea:jvm-debugger:jvm-debugger-util"))
compile(toolsJar())
compileOnly(toolsJarApi())
compileOnly(intellijDep())
Platform[192].orHigher {

View File

@@ -6,6 +6,7 @@ plugins {
dependencies {
compile(project(":idea:jvm-debugger:jvm-debugger-core"))
compileOnly(toolsJar())
compileOnly(intellijDep())
Platform[192].orHigher {

View File

@@ -9,7 +9,8 @@ dependencies {
compile(project(":idea:idea-core"))
compile(project(":idea:idea-j2k"))
compile(project(":idea:jvm-debugger:jvm-debugger-util"))
compile(toolsJar())
compileOnly(toolsJarApi())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}

View File

@@ -6,8 +6,8 @@ plugins {
dependencies {
compile(project(":compiler:backend"))
compile(project(":idea:ide-common"))
compile(toolsJar())
compileOnly(toolsJarApi())
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))

View File

@@ -11,8 +11,8 @@ dependencies {
// TODO: get rid of this
compile(project(":idea:jvm-debugger:eval4j"))
compile(toolsJar())
compileOnly(toolsJarApi())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}

View File

@@ -34,6 +34,7 @@ dependencies {
testRuntime(intellijPluginDep("java"))
}
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))
testCompileOnly(intellijDep())

View File

@@ -32,6 +32,7 @@ dependencies {
testCompile(project(":idea:idea-native")) { isTransitive = false }
testCompile(project(":idea:idea-gradle-native")) { isTransitive = false }
testRuntimeOnly(toolsJar())
testRuntime(project(":native:frontend.native")) { isTransitive = false }
testRuntime(project(":native:kotlin-native-utils")) { isTransitive = false }
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }

View File

@@ -48,6 +48,7 @@ dependencies {
testRuntimeOnly(intellijPluginDep("java"))
}
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))
testRuntime(project(":kotlin-script-runtime"))
}

View File

@@ -1,4 +1,3 @@
import org.gradle.internal.os.OperatingSystem
plugins {
kotlin("jvm")
@@ -10,18 +9,7 @@ dependencies {
compile(project(":js:js.ast"))
compile(project(":js:js.translator"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
val currentOs = OperatingSystem.current()
when {
currentOs.isWindows -> {
val suffix = if (currentOs.toString().endsWith("64")) "_64" else ""
compileOnly("com.eclipsesource.j2v8:j2v8_win32_x86$suffix:4.6.0")
}
currentOs.isMacOsX -> compileOnly("com.eclipsesource.j2v8:j2v8_macosx_x86_64:4.6.0")
currentOs.run { isLinux || isUnix } -> compileOnly("com.eclipsesource.j2v8:j2v8_linux_x86_64:4.8.0")
else -> logger.error("unsupported platform $currentOs - can not compile com.eclipsesource.j2v8 dependency")
}
compileOnly("com.eclipsesource.j2v8:j2v8_linux_x86_64:4.6.0")
}
sourceSets {

View File

@@ -76,7 +76,8 @@ dependencies {
}
}
testCompile(j2v8idString)
testCompileOnly("com.eclipsesource.j2v8:j2v8_linux_x86_64:4.8.0")
testRuntimeOnly(j2v8idString)
testRuntime(kotlinStdlib())
testJsRuntime(kotlinStdlib("js"))

View File

@@ -106,8 +106,6 @@ val reflectShadowJar by task<ShadowJar> {
archiveClassifier.set("shadow")
configurations = listOf(embedded)
callGroovy("manifestAttributes", manifest, project, "Main" /*true*/)
exclude("**/*.proto")
if (kotlinBuildProperties.relocation) {
@@ -122,9 +120,12 @@ val stripMetadata by tasks.registering {
dependsOn(reflectShadowJar)
val inputJar = provider { reflectShadowJar.get().outputs.files.singleFile }
val outputJar = File("$libsDir/kotlin-reflect-stripped.jar")
inputs.file(inputJar).withPathSensitivity(RELATIVE)
inputs.file(inputJar).withNormalizer(ClasspathNormalizer::class.java)
outputs.file(outputJar)
outputs.cacheIf { true }
doLast {
stripMetadata(
logger = logger,
@@ -175,6 +176,8 @@ val relocateCoreSources by task<Copy> {
filter { line ->
line.replace("org.jetbrains.kotlin", "kotlin.reflect.jvm.internal.impl")
}
outputs.cacheIf { true }
}
tasks.getByName("jar").enabled = false
@@ -219,6 +222,11 @@ val dexMethodCount by task<DexMethodCount> {
jarFile = result.get().outputs.files.single()
ownPackages = listOf("kotlin.reflect")
}
if (kotlinBuildProperties.isTeamcityBuild) {
printTCStats(dexMethodCount)
}
tasks.getByName("check").dependsOn(dexMethodCount)
artifacts {

View File

@@ -136,11 +136,11 @@ compileKotlin2Js {
outputFile = "${buildDir}/classes/main/kotlin.js"
sourceMap = true
sourceMapPrefix = "./"
sourceMapBaseDirs = files(
[builtinsSrcDir, jsSrcDir, jsCommonSrcDir, commonSrcDir, commonSrcDir2, unsignedCommonSrcDir]
.collect { file(it).absoluteFile }
)
freeCompilerArgs += [
"-source-map-base-dirs",
[builtinsSrcDir, jsSrcDir, jsCommonSrcDir, commonSrcDir, commonSrcDir2, unsignedCommonSrcDir]
.collect { file(it).absoluteFile }
.join(File.pathSeparator),
"-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",

View File

@@ -106,10 +106,15 @@ artifacts {
javadocJar()
task dexMethodCount(type: DexMethodCount) {
def dexMethodCount = tasks.register("dexMethodCount", DexMethodCount) {
from jar
ownPackages = ['kotlin']
}
if (BuildPropertiesKt.getKotlinBuildProperties(project).isTeamcityBuild) {
DexMethodCountKt.printTCStats(project, dexMethodCount)
}
check.dependsOn(dexMethodCount)
compileKotlin {

View File

@@ -11,6 +11,8 @@ plugins {
val jarBaseName = property("archivesBaseName") as String
val proguardLibraryJars by configurations.creating
val relocatedJarContents by configurations.creating
val embedded by configurations
dependencies {
compileOnly("org.apache.ivy:ivy:2.5.0")
@@ -35,6 +37,9 @@ dependencies {
proguardLibraryJars(kotlinStdlib())
proguardLibraryJars(project(":kotlin-reflect"))
proguardLibraryJars(project(":kotlin-compiler"))
relocatedJarContents(embedded)
relocatedJarContents(mainSourceSet.output)
}
sourceSets {
@@ -46,15 +51,12 @@ publish()
noDefaultJar()
val packJar by task<ShadowJar> {
configurations = emptyList()
val relocatedJar by task<ShadowJar> {
configurations = listOf(relocatedJarContents)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDirectory.set(File(buildDir, "libs"))
archiveClassifier.set("before-proguard")
from(mainSourceSet.output)
from(project.configurations.embedded)
// don't add this files to resources classpath to avoid IDE exceptions on kotlin project
from("jar-resources")
@@ -66,23 +68,23 @@ val packJar by task<ShadowJar> {
}
val proguard by task<ProGuardTask> {
dependsOn(packJar)
dependsOn(relocatedJar)
configuration("main-kts.pro")
injars(mapOf("filter" to "!META-INF/versions/**"), packJar.get().outputs.files)
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(packJar.get().outputs.files.singleFile)
inputs.files(relocatedJar.get().outputs.files.singleFile)
outputs.file(outputJar)
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraryJars)
}
val resultJar by task<Jar> {
val pack = if (kotlinBuildProperties.proguard) proguard else packJar
val pack = if (kotlinBuildProperties.proguard) proguard else relocatedJar
dependsOn(pack)
setupPublicJar(jarBaseName)
from {

View File

@@ -35,6 +35,7 @@ dependencies {
testCompileOnly(intellijDep())
testRuntimeOnly(toolsJar())
testRuntime(project(":idea:idea-jvm"))
testRuntime(project(":sam-with-receiver-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))

View File

@@ -5,8 +5,10 @@ plugins {
dependencies {
compile(kotlinStdlib())
compile(toolsJar())
compileOnly(toolsJarApi())
testCompile(commonDep("junit:junit"))
testCompileOnly(toolsJarApi())
}
sourceSets {

View File

@@ -26,6 +26,8 @@ dependencies {
compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java"))
compile(project(":compiler:plugin-api"))
compileOnly(toolsJarApi())
compileOnly(project(":kotlin-annotation-processing-cli"))
compileOnly(project(":kotlin-annotation-processing-base"))
compileOnly(project(":kotlin-annotation-processing-runtime"))
@@ -38,6 +40,9 @@ dependencies {
testCompile(commonDep("junit:junit"))
testCompile(project(":kotlin-annotation-processing-runtime"))
testCompileOnly(toolsJarApi())
testRuntimeOnly(toolsJar())
embedded(project(":kotlin-annotation-processing-runtime")) { isTransitive = false }
embedded(project(":kotlin-annotation-processing-cli")) { isTransitive = false }
embedded(project(":kotlin-annotation-processing-base")) { isTransitive = false }

View File

@@ -38,6 +38,7 @@ dependencies {
testCompile(project(":idea:idea-native")) { isTransitive = false }
testCompile(project(":idea:idea-gradle-native")) { isTransitive = false }
testRuntimeOnly(toolsJar())
testRuntime(project(":native:frontend.native")) { isTransitive = false }
testRuntime(project(":native:kotlin-native-utils")) { isTransitive = false }
testRuntime(project(":kotlin-reflect"))

View File

@@ -222,13 +222,15 @@ dependencies {
publish()
val packCompiler by task<ShadowJar> {
configurations = emptyList()
val packCompiler by task<Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDirectory.set(File(buildDir, "libs"))
archiveClassifier.set("before-proguard")
from(fatJarContents)
dependsOn(fatJarContents)
from {
fatJarContents.map(::zipTree)
}
dependsOn(fatJarContentsStripServices)
from {

View File

@@ -139,6 +139,7 @@ include ":kotlin-build-common",
":core:metadata.jvm",
":core:util.runtime",
":dependencies:android-sdk",
":dependencies:tools-jar-api",
":idea:idea-jvm",
":idea:idea-maven",
":idea:idea-gradle",