[Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3 There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242 ^KTI-1473 In Progress
This commit is contained in:
committed by
Space Team
parent
b784544f8d
commit
a19bd2ed2e
@@ -73,7 +73,7 @@ tasks.withType<Zip>().matching { it.name == "mainBenchmarkJar" }.configureEach {
|
||||
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
|
||||
tasks.withType<JavaExec>().matching { it.name in benchmarkTasks }.configureEach {
|
||||
dependsOn(":createIdeaHomeForTests")
|
||||
systemProperty("idea.home.path", ideaHomePathForTests().canonicalPath)
|
||||
systemProperty("idea.home.path", ideaHomePathForTests().get().asFile.canonicalPath)
|
||||
systemProperty("idea.use.native.fs.for.win", false)
|
||||
}
|
||||
|
||||
@@ -81,17 +81,26 @@ tasks.register<JavaExec>("runBenchmark") {
|
||||
dependsOn(":createIdeaHomeForTests")
|
||||
|
||||
// jmhArgs example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
|
||||
val jmhArgs = if (project.hasProperty("jmhArgs")) project.property("jmhArgs").toString() else ""
|
||||
val resultFilePath = "$buildDir/benchmarks/jmh-result.json"
|
||||
val ideaHome = ideaHomePathForTests().canonicalPath
|
||||
val jmhArgs = project.providers.gradleProperty("jvmArgs")
|
||||
val resultFilePath = project.layout.buildDirectory.file("benchmarks/jmh-result.json")
|
||||
val ideaHome = ideaHomePathForTests()
|
||||
|
||||
val benchmarkJarPath = "$buildDir/benchmarks/main/jars/benchmarks.jar"
|
||||
args = mutableListOf("-Didea.home.path=$ideaHome", benchmarkJarPath, "-rf", "json", "-rff", resultFilePath) + jmhArgs.split("\\s".toRegex())
|
||||
val benchmarkJarPath = project.layout.buildDirectory.file("benchmarks/main/jars/benchmarks.jar")
|
||||
argumentProviders.add {
|
||||
listOf(
|
||||
"-Didea.home.path=${ideaHome.get().asFile.canonicalPath}",
|
||||
benchmarkJarPath.get().asFile.toString(),
|
||||
"-rf",
|
||||
"json",
|
||||
"-rff",
|
||||
resultFilePath.get().asFile.toString(),
|
||||
) + jmhArgs.map { it.split("\\s".toRegex()) }.orElse(emptyList()).get()
|
||||
}
|
||||
mainClass.set("-jar")
|
||||
|
||||
doLast {
|
||||
if (project.kotlinBuildProperties.isTeamcityBuild) {
|
||||
val jsonArray = com.google.gson.JsonParser.parseString(File(resultFilePath).readText()).asJsonArray
|
||||
val jsonArray = com.google.gson.JsonParser.parseString(resultFilePath.get().asFile.readText()).asJsonArray
|
||||
jsonArray.forEach {
|
||||
val benchmark = it.asJsonObject
|
||||
// remove unnecessary name parts from string like this "org.jetbrains.kotlin.benchmarks.CommonCallsBenchmark.benchmark"
|
||||
|
||||
+7
-4
@@ -692,14 +692,17 @@ tasks.register("createIdeaHomeForTests") {
|
||||
val intellijSdkVersion = rootProject.extra["versions.intellijSdk"]
|
||||
outputs.file(ideaBuildNumberFileForTests)
|
||||
doFirst {
|
||||
ideaBuildNumberFileForTests.parentFile.mkdirs()
|
||||
ideaBuildNumberFileForTests.writeText("IC-$intellijSdkVersion")
|
||||
with(ideaBuildNumberFileForTests.get().asFile) {
|
||||
parentFile.mkdirs()
|
||||
writeText("IC-$intellijSdkVersion")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
named<Delete>("clean") {
|
||||
delete += setOf("$buildDir/repo", distDir)
|
||||
delete(distDir)
|
||||
delete(layout.buildDirectory.dir("repo"))
|
||||
}
|
||||
|
||||
register<Delete>("cleanupArtifacts") {
|
||||
@@ -1046,7 +1049,7 @@ val zipCompilerWithSignature by secureZipTask(zipCompiler)
|
||||
configure<IdeaModel> {
|
||||
module {
|
||||
excludeDirs = files(
|
||||
project.buildDir,
|
||||
project.layout.buildDirectory,
|
||||
commonLocalDataDir,
|
||||
".gradle",
|
||||
"dependencies",
|
||||
|
||||
@@ -55,7 +55,7 @@ projectTest(
|
||||
defineJDKEnvVariables = listOf(JdkMajorVersion.JDK_1_8, JdkMajorVersion.JDK_11_0, JdkMajorVersion.JDK_17_0)
|
||||
) {
|
||||
dependsOn(":dist")
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
|
||||
workingDir = rootDir
|
||||
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
||||
|
||||
@@ -68,7 +68,7 @@ fun Test.configureTest(configureJUnit: JUnitPlatformOptions.() -> Unit = {}) {
|
||||
useJUnitPlatform {
|
||||
configureJUnit()
|
||||
}
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,12 +43,12 @@ sourceSets {
|
||||
|
||||
projectTest(parallel = true) {
|
||||
workingDir = rootDir
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
}
|
||||
|
||||
projectTest("testJvmICWithJdk11", parallel = true) {
|
||||
workingDir = rootDir
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
filter {
|
||||
includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalK1JvmCompilerRunnerTestGenerated*")
|
||||
includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalK2JvmCompilerRunnerTestGenerated*")
|
||||
|
||||
@@ -31,7 +31,7 @@ sourceSets {
|
||||
|
||||
ant.importBuild("buildLexer.xml")
|
||||
|
||||
ant.properties["builddir"] = buildDir.absolutePath
|
||||
ant.properties["builddir"] = layout.buildDirectory.get().asFile.absolutePath
|
||||
|
||||
tasks.findByName("lexer")!!.apply {
|
||||
doFirst {
|
||||
|
||||
@@ -32,7 +32,7 @@ val testDataDir = project(":compiler").projectDir.resolve("testData/klib/dump-ab
|
||||
|
||||
projectTest(jUnitMode = JUnitMode.JUnit5) {
|
||||
inputs.dir(testDataDir)
|
||||
outputs.dir("$buildDir/t")
|
||||
outputs.dir(layout.buildDirectory.dir("t"))
|
||||
|
||||
dependsOn(":dist")
|
||||
workingDir = rootDir
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import org.gradle.api.tasks.PathSensitivity.RELATIVE
|
||||
import java.io.File
|
||||
|
||||
plugins {
|
||||
base
|
||||
@@ -13,9 +12,6 @@ val kotlinReflectJvm = fileFrom(rootDir, "libraries/stdlib/jvm/src/kotlin/reflec
|
||||
val kotlinRangesCommon = fileFrom(rootDir, "libraries/stdlib/src/kotlin/ranges")
|
||||
val kotlinCollectionsCommon = fileFrom(rootDir, "libraries/stdlib/src/kotlin/collections")
|
||||
val kotlinAnnotationsCommon = fileFrom(rootDir, "libraries/stdlib/src/kotlin/annotations")
|
||||
val builtinsCherryPicked = fileFrom(buildDir, "src/reflect")
|
||||
val rangesCherryPicked = fileFrom(buildDir, "src/ranges")
|
||||
val builtinsCherryPickedJvm = fileFrom(buildDir, "src-jvm/reflect")
|
||||
|
||||
val runtimeElements by configurations.creating {
|
||||
isCanBeResolved = false
|
||||
@@ -47,7 +43,7 @@ val prepareRangeSources by tasks.registering(Sync::class) {
|
||||
include("WasExperimental.kt")
|
||||
}
|
||||
|
||||
into(rangesCherryPicked)
|
||||
into(layout.buildDirectory.dir("src/ranges"))
|
||||
}
|
||||
|
||||
val prepareSources by tasks.registering(Sync::class) {
|
||||
@@ -55,7 +51,7 @@ val prepareSources by tasks.registering(Sync::class) {
|
||||
exclude("typeOf.kt")
|
||||
exclude("KClasses.kt")
|
||||
}
|
||||
into(builtinsCherryPicked)
|
||||
into(layout.buildDirectory.dir("src/reflect"))
|
||||
}
|
||||
|
||||
val prepareSourcesJvm by tasks.registering(Sync::class) {
|
||||
@@ -69,13 +65,16 @@ val prepareSourcesJvm by tasks.registering(Sync::class) {
|
||||
include("KTypeParameter.kt")
|
||||
include("KVariance.kt")
|
||||
}
|
||||
into(builtinsCherryPickedJvm)
|
||||
into(layout.buildDirectory.dir("src-jvm/reflect"))
|
||||
}
|
||||
|
||||
fun serializeTask(name: String, sourcesTask: TaskProvider<*>, inDirs: List<File>) =
|
||||
/**
|
||||
* @param inDirs a list of input directories. Each value is evaluated as per [Project.file].
|
||||
*/
|
||||
fun serializeTask(name: String, sourcesTask: TaskProvider<*>, inDirs: List<Any>) =
|
||||
tasks.register(name, NoDebugJavaExec::class) {
|
||||
dependsOn(sourcesTask, prepareRangeSources)
|
||||
val outDir = buildDir.resolve(this.name)
|
||||
val outDir = layout.buildDirectory.dir(this.name)
|
||||
inDirs.forEach { inputs.dir(it).withPathSensitivity(RELATIVE) }
|
||||
outputs.dir(outDir)
|
||||
outputs.cacheIf { true }
|
||||
@@ -83,30 +82,35 @@ fun serializeTask(name: String, sourcesTask: TaskProvider<*>, inDirs: List<File>
|
||||
classpath(rootProject.buildscript.configurations["bootstrapCompilerClasspath"])
|
||||
mainClass.set("org.jetbrains.kotlin.serialization.builtins.RunKt")
|
||||
jvmArguments.add("-Didea.io.use.nio2=true")
|
||||
args(
|
||||
pathRelativeToWorkingDir(outDir),
|
||||
*inDirs.map(::pathRelativeToWorkingDir).toTypedArray()
|
||||
)
|
||||
|
||||
val inputDirectories = project.files(inDirs)
|
||||
argumentProviders.add {
|
||||
listOf(
|
||||
pathRelativeToWorkingDir(outDir.get().asFile),
|
||||
*inputDirectories.map(::pathRelativeToWorkingDir).toTypedArray()
|
||||
)
|
||||
}
|
||||
|
||||
doFirst {
|
||||
if (logger.isInfoEnabled) jvmArguments.add("-Dkotlin.builtins.serializer.log=true")
|
||||
}
|
||||
}
|
||||
|
||||
val serialize = serializeTask("serialize", prepareSources, listOf(builtinsSrc, builtinsNative, builtinsCherryPicked, rangesCherryPicked))
|
||||
val serialize = serializeTask("serialize", prepareSources, listOf(builtinsSrc, builtinsNative, prepareSources.map { it.destinationDir }, prepareRangeSources.map { it.destinationDir }))
|
||||
|
||||
val serializeJvm = serializeTask("serializeJvm", prepareSourcesJvm, listOf(builtinsSrc, builtinsNative, builtinsCherryPickedJvm, rangesCherryPicked))
|
||||
val serializeJvm = serializeTask("serializeJvm", prepareSourcesJvm, listOf(builtinsSrc, builtinsNative, prepareSourcesJvm.map { it.destinationDir }, prepareRangeSources.map { it.destinationDir }))
|
||||
|
||||
val builtinsJar by task<Jar> {
|
||||
dependsOn(serialize)
|
||||
from(serialize) { include("kotlin/**") }
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||
}
|
||||
|
||||
val builtinsJvmJar by task<Jar> {
|
||||
dependsOn(serializeJvm)
|
||||
from(serializeJvm) { include("kotlin/**") }
|
||||
archiveClassifier.set("jvm")
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||
}
|
||||
|
||||
val assemble by tasks.getting {
|
||||
@@ -125,6 +129,6 @@ publishing {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("${rootProject.buildDir}/internal/repo")
|
||||
maven(rootProject.layout.buildDirectory.dir("internal/repo"))
|
||||
}
|
||||
}
|
||||
|
||||
+6
-9
@@ -1,6 +1,5 @@
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import java.net.URI
|
||||
import javax.inject.Inject
|
||||
|
||||
repositories {
|
||||
ivy {
|
||||
@@ -54,8 +53,7 @@ val androidPlatform by configurations.creating
|
||||
val buildTools by configurations.creating
|
||||
val androidEmulator by configurations.creating
|
||||
|
||||
val libsDestDir = File(buildDir, "androidSdk/platforms/android-26")
|
||||
val sdkDestDir = File(buildDir, "androidSdk")
|
||||
val sdkDestDirName = "androidSdk"
|
||||
|
||||
val toolsOs = when {
|
||||
OperatingSystem.current().isWindows -> "windows"
|
||||
@@ -107,12 +105,11 @@ fun unzipSdkTask(
|
||||
val dependency = "google:$sdkName:$sdkVer${coordinatesSuffix.takeIf { it.isNotEmpty() }?.let { ":$it" } ?: ""}@$ext"
|
||||
dependencies.add(createdCfg.name, dependency)
|
||||
|
||||
val sdkDestDir = sdkDestDir
|
||||
val unzipTask = tasks.register("unzip_$id") {
|
||||
val cfg = project.configurations.getByName(id)
|
||||
dependsOn(cfg)
|
||||
inputs.files(cfg)
|
||||
val targetDir = project.file("$sdkDestDir/$destinationSubdir")
|
||||
val targetDir = project.layout.buildDirectory.dir("$sdkDestDirName/$destinationSubdir")
|
||||
outputs.dirs(targetDir)
|
||||
val injected = project.objects.newInstance<Injected>()
|
||||
val fs = injected.fs
|
||||
@@ -159,17 +156,17 @@ unzipSdkTask("armeabi-v7a", "19", "system-images/android-19/default","r05", prep
|
||||
unzipSdkTask("x86", "19", "system-images/android-19/default", "r06", prepareTask = prepareEmulator)
|
||||
|
||||
val clean by task<Delete> {
|
||||
delete(buildDir)
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
|
||||
artifacts.add(androidSdk.name, file("$sdkDestDir")) {
|
||||
artifacts.add(androidSdk.name, layout.buildDirectory.dir(sdkDestDirName)) {
|
||||
builtBy(prepareSdk)
|
||||
}
|
||||
|
||||
artifacts.add(androidJar.name, file("$libsDestDir/android.jar")) {
|
||||
artifacts.add(androidJar.name, layout.buildDirectory.file("$sdkDestDirName/platforms/android-26/android.jar")) {
|
||||
builtBy(preparePlatform)
|
||||
}
|
||||
|
||||
artifacts.add(androidEmulator.name, file("$sdkDestDir")) {
|
||||
artifacts.add(androidEmulator.name, layout.buildDirectory.dir(sdkDestDirName)) {
|
||||
builtBy(prepareEmulator)
|
||||
}
|
||||
+10
-5
@@ -1,6 +1,10 @@
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader.SKIP_CODE
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||
import org.jetbrains.org.objectweb.asm.ClassWriter
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_PUBLIC
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.API_VERSION
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
plugins {
|
||||
@@ -20,7 +24,7 @@ val toolsJarStubs by tasks.registering {
|
||||
val toolsJarFile = toolsJar().singleFile
|
||||
inputs.file(toolsJarFile)
|
||||
|
||||
val outDir = buildDir.resolve(name)
|
||||
val outDir = layout.buildDirectory.dir(name)
|
||||
outputs.dir(outDir)
|
||||
|
||||
val usedInternalApiPackages = listOf(
|
||||
@@ -28,7 +32,8 @@ val toolsJarStubs by tasks.registering {
|
||||
)
|
||||
|
||||
doLast {
|
||||
outDir.deleteRecursively()
|
||||
val outputDirectoryFile = outDir.get().asFile
|
||||
outputDirectoryFile.deleteRecursively()
|
||||
val zipFile = ZipFile(toolsJarFile)
|
||||
zipFile.stream()
|
||||
.filter { it.name.endsWith(".class") }
|
||||
@@ -63,7 +68,7 @@ val toolsJarStubs by tasks.registering {
|
||||
}, SKIP_CODE)
|
||||
|
||||
if (isExported) {
|
||||
val result = File(outDir, zipEntry.name)
|
||||
val result = File(outputDirectoryFile, zipEntry.name)
|
||||
result.parentFile.mkdirs()
|
||||
result.writeBytes(classWriter.toByteArray())
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ import java.util.zip.ZipFile
|
||||
val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
|
||||
|
||||
val distDir: String by rootProject.extra
|
||||
val repoDir: String = "${rootProject.buildDir}/repo"
|
||||
val kotlinVersion: String by rootProject.extra
|
||||
|
||||
val checkMavenArtifacts = tasks.register("checkMavenArtifacts") {
|
||||
val repoDir = rootProject.layout.buildDirectory.dir("repo")
|
||||
doLast {
|
||||
fileTree(repoDir).checkArtifacts { zip ->
|
||||
if (!zip.name.endsWith("-sources.jar"))
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import com.github.gradle.node.npm.task.NpmTask
|
||||
import com.github.gradle.node.variant.computeNodeExec
|
||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
||||
import org.jetbrains.kotlin.ideaExt.idea
|
||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute
|
||||
import java.util.Properties
|
||||
import org.jetbrains.kotlin.ideaExt.idea
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
@@ -14,13 +14,12 @@ plugins {
|
||||
id("com.github.node-gradle.node") version "5.0.0"
|
||||
}
|
||||
|
||||
val nodeDir = buildDir.resolve("node")
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
|
||||
node {
|
||||
download.set(true)
|
||||
version.set(nodejsVersion)
|
||||
nodeProjectDir.set(nodeDir)
|
||||
nodeProjectDir.set(layout.buildDirectory.dir("node"))
|
||||
if (cacheRedirectorEnabled) {
|
||||
distBaseUrl.set("https://cache-redirector.jetbrains.com/nodejs.org/dist")
|
||||
}
|
||||
@@ -361,7 +360,7 @@ fun Test.setUpBoxTests() {
|
||||
systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
|
||||
}
|
||||
|
||||
systemProperty("kotlin.js.test.root.out.dir", "$nodeDir/")
|
||||
systemProperty("kotlin.js.test.root.out.dir", "${node.nodeProjectDir.get().asFile}/")
|
||||
systemProperty(
|
||||
"overwrite.output", project.providers.gradleProperty("overwrite.output").orNull ?: "false"
|
||||
)
|
||||
@@ -378,8 +377,8 @@ val test = projectTest(jUnitMode = JUnitMode.JUnit5) {
|
||||
inputs.dir(rootDir.resolve("dist"))
|
||||
inputs.dir(rootDir.resolve("compiler/testData"))
|
||||
|
||||
outputs.dir("$buildDir/out")
|
||||
outputs.dir("$buildDir/out-min")
|
||||
outputs.dir(layout.buildDirectory.dir("out"))
|
||||
outputs.dir(layout.buildDirectory.dir("out-min"))
|
||||
|
||||
configureTestDistribution()
|
||||
}
|
||||
@@ -448,26 +447,25 @@ val packageJsonFile = testDataDir.resolve("package.json")
|
||||
|
||||
val prepareNpmTestData by task<Copy> {
|
||||
inputs.files(testJsFile, packageJsonFile)
|
||||
outputs.dir(nodeDir)
|
||||
|
||||
from(testJsFile)
|
||||
from(packageJsonFile)
|
||||
into(nodeDir)
|
||||
into(node.nodeProjectDir)
|
||||
}
|
||||
|
||||
val npmInstall by tasks.getting(NpmTask::class) {
|
||||
val packageLockFile = testDataDir.resolve("package-lock.json")
|
||||
|
||||
inputs.file(nodeDir.resolve("package.json"))
|
||||
inputs.file(node.nodeProjectDir.file("package.json"))
|
||||
outputs.file(packageLockFile)
|
||||
outputs.upToDateWhen { packageLockFile.exists() }
|
||||
|
||||
workingDir.set(nodeDir)
|
||||
workingDir.fileProvider(node.nodeProjectDir.asFile)
|
||||
dependsOn(prepareNpmTestData)
|
||||
}
|
||||
|
||||
val mochaTest by task<MochaTestTask> {
|
||||
workingDir.set(nodeDir)
|
||||
workingDir.fileProvider(node.nodeProjectDir.asFile)
|
||||
|
||||
val target = if (project.hasProperty("teamcity")) "runOnTeamcity" else "test"
|
||||
args.set(listOf("run", target))
|
||||
@@ -493,7 +491,7 @@ val runMocha by tasks.registering {
|
||||
projectTest("invalidationTest", jUnitMode = JUnitMode.JUnit5) {
|
||||
workingDir = rootDir
|
||||
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
include("org/jetbrains/kotlin/incremental/*")
|
||||
dependsOn(":dist")
|
||||
forwardProperties()
|
||||
|
||||
@@ -22,7 +22,7 @@ plugins {
|
||||
|
||||
val libclangextProject = project(":kotlin-native:libclangext")
|
||||
val libclangextTask = libclangextProject.path + ":build"
|
||||
val libclangextDir = libclangextProject.buildDir
|
||||
val libclangextDir = libclangextProject.layout.buildDirectory.get().asFile
|
||||
val libclangextIsEnabled = libclangextProject.findProperty("isEnabled")!! as Boolean
|
||||
|
||||
|
||||
@@ -148,8 +148,8 @@ val nativelibs = project.tasks.register<Copy>("nativelibs") {
|
||||
val clangstubsSolib = solib("clangstubs")
|
||||
dependsOn(clangstubsSolib)
|
||||
|
||||
from("$buildDir/$clangstubsSolib")
|
||||
into("$buildDir/nativelibs/")
|
||||
from(layout.buildDirectory.dir(clangstubsSolib))
|
||||
into(layout.buildDirectory.dir("nativelibs"))
|
||||
}
|
||||
|
||||
kotlinNativeInterop {
|
||||
@@ -183,7 +183,7 @@ tasks.withType<Test>().configureEach {
|
||||
dependsOn(projectsWithNativeLibs.map { "${it.path}:nativelibs" })
|
||||
dependsOn(nativeDependencies.llvmDependency)
|
||||
systemProperty("java.library.path", projectsWithNativeLibs.joinToString(File.pathSeparator) {
|
||||
File(it.buildDir, "nativelibs").absolutePath
|
||||
it.layout.buildDirectory.dir("nativelibs").get().asFile.absolutePath
|
||||
})
|
||||
|
||||
systemProperty("kotlin.native.llvm.libclang", "${nativeDependencies.llvmPath}/" + if (HostManager.hostIsMingw) {
|
||||
@@ -192,7 +192,7 @@ tasks.withType<Test>().configureEach {
|
||||
"lib/${System.mapLibraryName("clang")}"
|
||||
})
|
||||
|
||||
systemProperty("kotlin.native.interop.indexer.temp", File(buildDir, "testTemp"))
|
||||
systemProperty("kotlin.native.interop.indexer.temp", layout.buildDirectory.dir("testTemp").get().asFile)
|
||||
}
|
||||
|
||||
// Please note that list of headers should be fixed manually.
|
||||
@@ -202,14 +202,14 @@ tasks.register("updatePrebuilt") {
|
||||
|
||||
doLast {
|
||||
copy {
|
||||
from("$buildDir/nativeInteropStubs/clang/kotlin") {
|
||||
from(layout.buildDirectory.dir("nativeInteropStubs/clang/kotlin")) {
|
||||
include("clang/clang.kt")
|
||||
}
|
||||
into("prebuilt/nativeInteropStubs/kotlin")
|
||||
}
|
||||
|
||||
copy {
|
||||
from("$buildDir/interopTemp") {
|
||||
from(layout.buildDirectory.dir("interopTemp")) {
|
||||
include("clangstubs.c")
|
||||
}
|
||||
into("prebuilt/nativeInteropStubs/c")
|
||||
|
||||
@@ -36,7 +36,7 @@ native {
|
||||
tool(*hostPlatform.clangForJni.clangCXX("").toTypedArray())
|
||||
flags("-shared",
|
||||
"-o",ruleOut(), *ruleInAll(),
|
||||
"-L${project(":kotlin-native:libclangext").buildDir}",
|
||||
"-L${project(":kotlin-native:libclangext").layout.buildDirectory.get().asFile}",
|
||||
"${nativeDependencies.libffiPath}/lib/libffi.$lib",
|
||||
"-lclangext")
|
||||
}
|
||||
@@ -54,7 +54,7 @@ dependencies {
|
||||
|
||||
val prepareSharedSourcesForJvm by tasks.registering(Sync::class) {
|
||||
from("src/main/kotlin")
|
||||
into("$buildDir/src/main/kotlin")
|
||||
into(project.layout.buildDirectory.dir("src/main/kotlin"))
|
||||
}
|
||||
val prepareKotlinIdeaImport by tasks.registering {
|
||||
dependsOn(prepareSharedSourcesForJvm)
|
||||
@@ -83,6 +83,6 @@ val nativelibs = project.tasks.create<Copy>("nativelibs") {
|
||||
val callbacksSolib = solib("callbacks")
|
||||
dependsOn(callbacksSolib)
|
||||
|
||||
from("$buildDir/$callbacksSolib")
|
||||
into("$buildDir/nativelibs/")
|
||||
from(layout.buildDirectory.dir(callbacksSolib))
|
||||
into(layout.buildDirectory.dir("nativelibs"))
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ tasks {
|
||||
dependsOn(projectsWithNativeLibs.map { "${it.path}:nativelibs" })
|
||||
dependsOn(nativeDependencies.llvmDependency)
|
||||
systemProperty("java.library.path", projectsWithNativeLibs.joinToString(File.pathSeparator) {
|
||||
File(it.buildDir, "nativelibs").absolutePath
|
||||
it.layout.buildDirectory.dir("nativelibs").get().asFile.absolutePath
|
||||
})
|
||||
val libclangPath = "${nativeDependencies.llvmPath}/" + if (org.jetbrains.kotlin.konan.target.HostManager.hostIsMingw) {
|
||||
"bin/libclang.dll"
|
||||
@@ -70,7 +70,7 @@ tasks {
|
||||
"lib/${System.mapLibraryName("clang")}"
|
||||
}
|
||||
systemProperty("kotlin.native.llvm.libclang", libclangPath)
|
||||
systemProperty("kotlin.native.interop.stubgenerator.temp", File(buildDir, "stubGeneratorTestTemp"))
|
||||
systemProperty("kotlin.native.interop.stubgenerator.temp", layout.buildDirectory.dir("stubGeneratorTestTemp").get().asFile)
|
||||
|
||||
// Set the konan.home property because we run the cinterop tool not from a distribution jar
|
||||
// so it will not be able to determine this path by itself.
|
||||
|
||||
@@ -89,7 +89,7 @@ kotlinNativeInterop {
|
||||
// To enforce linking with proper libc++, pass the default path explicitly:
|
||||
linkerOpts "-L${hostPlatform.absoluteTargetSysRoot}/usr/lib"
|
||||
}
|
||||
linkerOpts "-L$llvmDir/lib", "-L${rootProject.project(':kotlin-native:llvmDebugInfoC').buildDir}", "-L${rootProject.project(':kotlin-native:libllvmext').buildDir}"
|
||||
linkerOpts "-L$llvmDir/lib", "-L${rootProject.project(':kotlin-native:llvmDebugInfoC').layout.buildDirectory.get().asFile}", "-L${rootProject.project(':kotlin-native:libllvmext').layout.buildDirectory.get().asFile}"
|
||||
}
|
||||
|
||||
files {
|
||||
|
||||
@@ -3016,16 +3016,17 @@ KotlinNativeTestKt.createTest(project, "kt39548", KonanStandaloneTest) { task ->
|
||||
task.enabled = isWindowsTarget(project)
|
||||
|
||||
if (task.enabled) {
|
||||
def ktFile = project.layout.buildDirectory.file("kt39548/kt39548.kt").get().asFile
|
||||
konanArtifacts {
|
||||
program(name, targets: [target.name]) {
|
||||
baseDir "$testOutputLocal/$name"
|
||||
srcFiles "$buildDir/kt39548/kt39548.kt" // Generated by doBeforeBuild task.
|
||||
srcFiles ktFile.toString() // Generated by doBeforeBuild task.
|
||||
extraOpts task.flags
|
||||
extraOpts project.globalTestArgs
|
||||
}
|
||||
}
|
||||
doBeforeBuild {
|
||||
GenTestKT39548Kt.genTestKT39548(file("$buildDir/kt39548/kt39548.kt"))
|
||||
GenTestKT39548Kt.genTestKT39548(ktFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3311,15 +3312,16 @@ linkTest("inline_innerInlineFunCapturesOuter_linkTest") {
|
||||
}
|
||||
|
||||
def generateWithSpaceDefFile() {
|
||||
def mapOption = "--Map \"${buildDir}/cutom map.map\""
|
||||
def buildDirectory = project.layout.buildDirectory.get().asFile
|
||||
def mapOption = "--Map \"$buildDirectory/cutom map.map\""
|
||||
if (isAppleTarget(project)) {
|
||||
mapOption = "-map \"${buildDir}/cutom map.map\""
|
||||
mapOption = "-map \"$buildDirectory/cutom map.map\""
|
||||
} else if (isWindowsTarget(project)) {
|
||||
mapOption = "\"-Wl,--Map,${buildDir}/cutom map.map\""
|
||||
mapOption = "\"-Wl,--Map,$buildDirectory/cutom map.map\""
|
||||
}
|
||||
|
||||
buildDir.mkdirs()
|
||||
def file = new File("${buildDir}/withSpaces.def")
|
||||
buildDirectory.mkdirs()
|
||||
def file = new File("${buildDirectory}/withSpaces.def")
|
||||
file.write """
|
||||
headers = stdio.h "${projectDir}/interop/basics/custom headers/custom.h"
|
||||
linkerOpts = $mapOption
|
||||
@@ -3429,7 +3431,7 @@ createInterop("embedStaticLibraries") {
|
||||
it.headers "$projectDir/interop/embedStaticLibraries/embedStaticLibraries.h"
|
||||
|
||||
// Note: also hardcoded in def file.
|
||||
final String libDir = "$buildDir/embedStaticLibraries/"
|
||||
final File libDir = project.layout.buildDirectory.dir("embedStaticLibraries").get().asFile
|
||||
|
||||
it.getByTarget(target.name).configure {
|
||||
doFirst {
|
||||
@@ -3456,7 +3458,7 @@ createInterop("kt43502") {
|
||||
it.defFile 'interop/kt43502/kt43502.def'
|
||||
it.headers "$projectDir/interop/kt43502/kt43502.h"
|
||||
// Note: also hardcoded in def file.
|
||||
final String libDir = "$buildDir/kt43502/"
|
||||
final File libDir = project.layout.buildDirectory.dir("kt43502").get().asFile
|
||||
// Construct library that contains actual symbol definition.
|
||||
it.getByTarget(target.name).configure {
|
||||
doFirst {
|
||||
@@ -3700,7 +3702,7 @@ Task interopTestBase(String name, boolean multiFile, boolean interop2ForMainOnly
|
||||
}
|
||||
srcFiles multiFile ? fileTree(task.source) { include '**/*.kt' } : task.getSources()
|
||||
baseDir "$testOutputLocal/$name"
|
||||
linkerOpts "-L$buildDir"
|
||||
linkerOpts "-L${project.layout.buildDirectory.get().asFile}"
|
||||
extraOpts task.flags
|
||||
extraOpts project.globalTestArgs
|
||||
}
|
||||
@@ -3869,7 +3871,7 @@ interopTest("interop_withSpaces") {
|
||||
source = "interop/basics/withSpaces.kt"
|
||||
|
||||
doLast {
|
||||
assert file("${buildDir}/cutom map.map").exists()
|
||||
assert project.layout.buildDirectory.file("cutom map.map").get().asFile.exists()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3992,16 +3994,17 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
source = "interop/objc/smoke.kt"
|
||||
interop = 'objcSmoke'
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcsmoke.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/smoke.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcsmoke.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
// Enable ARC optimizations to prevent some objects from leaking in Obj-C code due to exceptions:
|
||||
args '-O2'
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcsmoke.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
|
||||
copy {
|
||||
@@ -4018,16 +4021,17 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
interop = 'objcSmoke'
|
||||
verifyIr = false // KT-57716
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcsmoke.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/smoke.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcsmoke.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
// Enable ARC optimizations to prevent some objects from leaking in Obj-C code due to exceptions:
|
||||
args '-O2'
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcsmoke.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
|
||||
copy {
|
||||
@@ -4056,16 +4060,17 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
}
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjctests.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args fileTree("$projectDir/interop/objc/tests/") { include '**/*.m' }
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjctests.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
// Enable ARC optimizations to prevent some objects from leaking in Obj-C code due to exceptions:
|
||||
args '-O2'
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjctests.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4100,14 +4105,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
interop = 'objcMisc'
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcmisc.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc_with_initializer/objc_misc.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcmisc.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcmisc.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4117,14 +4123,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
interop = 'objcMessaging'
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcmessaging.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/msg_send/messaging.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcmessaging.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcmessaging.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4146,14 +4153,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
UtilsKt.dependsOnPlatformLibs(it)
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcexception.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcexception.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4165,14 +4173,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
UtilsKt.dependsOnPlatformLibs(it)
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcexception.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcexception.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4184,14 +4193,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
UtilsKt.dependsOnPlatformLibs(it)
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcexception.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcexception.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4217,14 +4227,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
useGoldenData = true
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjc_kt42172.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/kt42172/objclib.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjc_kt42172.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjc_kt42172.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4282,29 +4293,31 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
}
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjc_kt55938.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/kt55938/objclib.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjc_kt55938.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjc_kt55938.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
standaloneTest("objc_arc_contract") {
|
||||
def bcFile = project.layout.buildDirectory.file("objc_arc_contract.bc").get().asFile
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
mkdir(bcFile.parentFile)
|
||||
ExecLlvmKt.execLlvmUtility(project, "llvm-as") {
|
||||
args "$projectDir/interop/objc_arc_contract/main.ll"
|
||||
args "-o", "$buildDir/objc_arc_contract.bc"
|
||||
args "-o", bcFile.toString()
|
||||
}
|
||||
}
|
||||
source = "interop/objc_arc_contract/main.kt"
|
||||
useGoldenData = true
|
||||
flags = ["-native-library", "$buildDir/objc_arc_contract.bc"]
|
||||
flags = ["-native-library", bcFile.toString()]
|
||||
}
|
||||
|
||||
interopTest("interop_objc_include_categories") {
|
||||
@@ -4312,14 +4325,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
source = "interop/objc/include_categories/main.kt"
|
||||
interop = "objc_include_categories"
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjcincludecategories.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/include_categories/objc_include_categories.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcincludecategories.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjcincludecategories.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4349,16 +4363,17 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
flags = ["-tr", "-e", "runAllTests"] // Generate test suites, but use custom entrypoint.
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjc_kt56402.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/kt56402/objclib.m"
|
||||
args "-g"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjc_kt56402.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
args '-framework', 'AppKit'
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjc_kt56402.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4370,14 +4385,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
flags = ["-tr"]
|
||||
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjc_friendly_dealloc.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/objc_friendly_dealloc/objclib.m"
|
||||
args "-lobjc", '-fno-objc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjc_friendly_dealloc.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjc_friendly_dealloc.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
UtilsKt.dependsOnPlatformLibs(it)
|
||||
@@ -4388,14 +4404,15 @@ if (PlatformInfo.isAppleTarget(project)) {
|
||||
interop = "objCAction"
|
||||
flags = ["-tr"]
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
def dylibFile = project.layout.buildDirectory.file("libobjCAction.dylib").get().asFile
|
||||
mkdir(dylibFile.parentFile)
|
||||
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||
args "$projectDir/interop/objc/objCAction/objclib.m"
|
||||
args "-lobjc", '-fobjc-arc'
|
||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjCAction.dylib"
|
||||
args '-fPIC', '-shared', '-o', dylibFile.toString()
|
||||
}
|
||||
if (UtilsKt.isSimulatorTarget(project, project.target)) {
|
||||
UtilsKt.codesign(project, "$buildDir/libobjCAction.dylib")
|
||||
UtilsKt.codesign(project, dylibFile.toString())
|
||||
}
|
||||
}
|
||||
UtilsKt.dependsOnPlatformLibs(it)
|
||||
@@ -4413,15 +4430,16 @@ tasks.register("KT-50983", KonanDriverTest) {
|
||||
// The test is not working on Windows Server 2019-based TeamCity agents for the unknown reason.
|
||||
// TODO: Re-enable it after LLVM update where llvm-windres will be added.
|
||||
enabled = false
|
||||
def resFile = project.layout.buildDirectory.file("File.res").get().asFile
|
||||
doBeforeBuild {
|
||||
mkdir(buildDir)
|
||||
mkdir(resFile.parentFile)
|
||||
exec {
|
||||
commandLine UtilsKt.binaryFromToolchain(project, "windres")
|
||||
args "$projectDir/windows/KT-50983/File.rc", "-O", "coff", "-o", "$buildDir/File.res"
|
||||
args "$projectDir/windows/KT-50983/File.rc", "-O", "coff", "-o", resFile.toString()
|
||||
}
|
||||
}
|
||||
source = "windows/KT-50983/main.kt"
|
||||
flags = ['-linker-option', "$buildDir/File.res"]
|
||||
flags = ['-linker-option', resFile.toString()]
|
||||
}
|
||||
|
||||
standaloneTest("interop_libiconv") {
|
||||
@@ -4601,7 +4619,7 @@ standaloneTest("library_ir_provider_mismatch") {
|
||||
String invalidManifest = "$projectDir/link/ir_providers/library/manifest.properties"
|
||||
String mainSource = "$projectDir/link/ir_providers/hello.kt"
|
||||
|
||||
String outputDir = "$buildDir/$name"
|
||||
File outputDir = project.layout.buildDirectory.dir(name).get().asFile
|
||||
String currentTarget = project.target.name
|
||||
|
||||
inputs.files(librarySource, invalidManifest)
|
||||
@@ -4666,7 +4684,7 @@ standaloneTest("split_compilation_pipeline") {
|
||||
// Also, it is failing for some reason on Windows CI, but since MinGW targets are not inteneded
|
||||
// to use this mode, we can disable it for these targets.
|
||||
enabled = !twoStageEnabled && project.target.name != "mingw_x64" && project.target.name != "mingw_x86"
|
||||
def dir = buildDir.absolutePath
|
||||
def dir = project.layout.buildDirectory.get().asFile.absolutePath
|
||||
source = "link/private_fake_overrides/override_main.kt"
|
||||
doBeforeBuild {
|
||||
konanc("$projectDir/link/private_fake_overrides/override_lib.kt -p library -target ${target.name} -o $dir/lib.klib")
|
||||
@@ -4709,7 +4727,7 @@ Task frameworkTest(String name, Closure<FrameworkTest> configurator) {
|
||||
libraries {
|
||||
klibFile konanArtifacts[library].getArtifactByTarget(target.name)
|
||||
}
|
||||
linkerOpts "-L$buildDir"
|
||||
linkerOpts "-L${project.layout.buildDirectory.get().asFile}"
|
||||
UtilsKt.dependsOnKonanBuildingTask(task, library, target)
|
||||
}
|
||||
|
||||
@@ -5183,7 +5201,7 @@ Task pluginTest(String name, String pluginName, Closure configureClosure) {
|
||||
sourceSets[pluginName].output
|
||||
}
|
||||
archiveBaseName = pluginName
|
||||
destinationDirectory = buildDir
|
||||
destinationDirectory = project.layout.buildDirectory.get().asFile
|
||||
}
|
||||
def taskName = "$name-with-$pluginName"
|
||||
return KotlinNativeTestKt.createTest(project, taskName, KonanStandaloneTest) { task ->
|
||||
@@ -5194,7 +5212,7 @@ Task pluginTest(String name, String pluginName, Closure configureClosure) {
|
||||
program(taskName, targets: [target.name]) {
|
||||
baseDir "$testOutputLocal/$taskName"
|
||||
srcFiles task.getSources()
|
||||
extraOpts task.flags + "-Xplugin=$buildDir/nop-plugin.jar"
|
||||
extraOpts task.flags + "-Xplugin=${project.layout.buildDirectory.file("nop-plugin.jar").get().asFile}"
|
||||
extraOpts project.globalTestArgs
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -146,15 +146,15 @@ class NamedNativeInteropConfig implements Named {
|
||||
}
|
||||
|
||||
File getNativeLibsDir() {
|
||||
return new File(project.buildDir, "nativelibs/$target")
|
||||
return project.layout.buildDirectory.dir("nativelibs/$target").get().asFile
|
||||
}
|
||||
|
||||
File getGeneratedSrcDir() {
|
||||
return new File(project.buildDir, "nativeInteropStubs/$name/kotlin")
|
||||
return project.layout.buildDirectory.dir("nativeInteropStubs/$name/kotlin").get().asFile
|
||||
}
|
||||
|
||||
File getTemporaryFilesDir() {
|
||||
return new File(project.buildDir, "interopTemp")
|
||||
return project.layout.buildDirectory.dir("interopTemp").get().asFile
|
||||
}
|
||||
|
||||
String getLlvmDir() {
|
||||
@@ -213,8 +213,8 @@ class NamedNativeInteropConfig implements Named {
|
||||
jvmArgs '-ea'
|
||||
|
||||
systemProperties "java.library.path" : project.files(
|
||||
new File(project.findProject(":kotlin-native:Interop:Indexer").buildDir, "nativelibs"),
|
||||
new File(project.findProject(":kotlin-native:Interop:Runtime").buildDir, "nativelibs")
|
||||
project.findProject(":kotlin-native:Interop:Indexer").layout.buildDirectory.dir("nativelibs"),
|
||||
project.findProject(":kotlin-native:Interop:Runtime").layout.buildDirectory.dir("nativelibs"),
|
||||
).asPath
|
||||
// Set the konan.home property because we run the cinterop tool not from a distribution jar
|
||||
// so it will not be able to determine this path by itself.
|
||||
|
||||
@@ -16,7 +16,7 @@ open class CopyCommonSources : DefaultTask() {
|
||||
val sourcePaths: ConfigurableFileCollection = project.files()
|
||||
|
||||
@OutputDirectory
|
||||
var outputDir: File = project.buildDir.resolve("sources")
|
||||
var outputDir: File = project.layout.buildDirectory.get().asFile.resolve("sources")
|
||||
|
||||
fun zipSources(needToZip: Boolean) {
|
||||
zipSources = needToZip
|
||||
@@ -46,7 +46,7 @@ open class CopyCommonSources : DefaultTask() {
|
||||
val filePrefix = sourcePath.name.replace(Regex("-\\d+.*"), "")
|
||||
val targetFileName = "$filePrefix-sources.zip"
|
||||
|
||||
val tempDir = project.buildDir.resolve(name).resolve(filePrefix).also {
|
||||
val tempDir = project.layout.buildDirectory.dir("$name/$filePrefix").get().asFile.also {
|
||||
it.deleteRecursively()
|
||||
it.mkdirs()
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ internal val Project.konanVersion: String
|
||||
?.toString()
|
||||
?: project.version.toString()
|
||||
|
||||
internal val Project.konanBuildRoot get() = buildDir.resolve("konan")
|
||||
internal val Project.konanBuildRoot get() = layout.buildDirectory.get().asFile.resolve("konan")
|
||||
internal val Project.konanBinBaseDir get() = konanBuildRoot.resolve("bin")
|
||||
internal val Project.konanLibsBaseDir get() = konanBuildRoot.resolve("libs")
|
||||
internal val Project.konanBitcodeBaseDir get() = konanBuildRoot.resolve("bitcode")
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ abstract class KonanCompileTask: KonanBuildingTask(), KonanCompileSpec {
|
||||
|
||||
protected fun directoryToKt(dir: Any) = project.fileTree(dir).apply {
|
||||
include("**/*.kt")
|
||||
exclude { it.file.startsWith(project.buildDir) }
|
||||
exclude { it.file.startsWith(project.layout.buildDirectory.get().asFile) }
|
||||
}
|
||||
|
||||
// Command line ------------------------------------------------------------
|
||||
|
||||
+2
-2
@@ -121,7 +121,7 @@ open class SourceSet(
|
||||
return SourceSet(
|
||||
sourceSets,
|
||||
name,
|
||||
sourceSets.project.file("${sourceSets.project.buildDir}/$name/${suffixes.first}_${suffixes.second}/"),
|
||||
sourceSets.project.file(sourceSets.project.layout.buildDirectory.dir("$name/${suffixes.first}_${suffixes.second}/")),
|
||||
this,
|
||||
suffixes
|
||||
)
|
||||
@@ -218,7 +218,7 @@ open class NativeToolsExtension(val project: Project) {
|
||||
dependsOn(it.implicitTasks())
|
||||
}
|
||||
val deps = objSet.flatMap { it.collection.files }.map { it.path }
|
||||
val toolConfiguration = ToolPatternImpl(sourceSets.extension, "${project.buildDir.path}/$name", *deps.toTypedArray())
|
||||
val toolConfiguration = ToolPatternImpl(sourceSets.extension, "${project.layout.buildDirectory.get().asFile.path}/$name", *deps.toTypedArray())
|
||||
toolConfiguration.configuration()
|
||||
toolConfiguration.configure(this, false )
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ targetList.each { target ->
|
||||
|
||||
destinationDir project.file("$distDir/klib/cache/")
|
||||
|
||||
from("${project(":kotlin-native:runtime").buildDir}/cache/$target") {
|
||||
from(project(":kotlin-native:runtime").layout.buildDirectory.dir("cache/$target")) {
|
||||
include('**')
|
||||
}
|
||||
}
|
||||
@@ -747,7 +747,7 @@ tasks.named("clean", Delete) {
|
||||
dependsOn subprojects.collect { it.tasks.matching { it.name == "clean" } }
|
||||
doFirst {
|
||||
delete distDir
|
||||
delete buildDir
|
||||
delete layout.buildDirectory
|
||||
delete bundle.outputs.files
|
||||
delete "${projectDir}/compile_commands.json"
|
||||
}
|
||||
|
||||
@@ -33,5 +33,5 @@ tasks.register("build") {
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(buildDir)
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
|
||||
@@ -20,9 +20,7 @@ task clean {
|
||||
subprojects.each {
|
||||
dependsOn it.getTasksByName('clean', true)[0]
|
||||
}
|
||||
doLast {
|
||||
delete "${buildDir.absolutePath}"
|
||||
}
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
|
||||
defaultTasks 'konanRun'
|
||||
|
||||
@@ -121,9 +121,7 @@ task clean {
|
||||
dependsOn "${it.path}:clean"
|
||||
}
|
||||
}
|
||||
doLast {
|
||||
delete "${buildDir.absolutePath}"
|
||||
}
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
|
||||
defaultTasks 'konanRun'
|
||||
@@ -166,7 +164,7 @@ private def uploadBenchmarkResultToArtifactory(String fileName) {
|
||||
buildProperties.load(new FileInputStream(teamcityConfig))
|
||||
def password = buildProperties.getProperty("artifactory.apikey")
|
||||
MPPTools.uploadFileToArtifactory("${artifactoryUrl}", "${artifactoryRepo}",
|
||||
uploadedFile, "${buildDir.absolutePath}/${fileName}", password)
|
||||
uploadedFile, layout.buildDirectory.file(fileName).get().asFile.toString(), password)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +174,7 @@ task registerExternalBenchmarks {
|
||||
def reports = externalReports.split(';')
|
||||
def jsonReports = []
|
||||
reports.each {
|
||||
def reportFile = new File(buildDir, it)
|
||||
def reportFile = layout.buildDirectory.file(it).get().asFile
|
||||
if (!reportFile.exists())
|
||||
return
|
||||
|
||||
@@ -222,14 +220,14 @@ task registerExternalBenchmarks {
|
||||
properties += ["codeSize": MPPTools.toCodeSizeBenchmark(codeSize, status, name)]
|
||||
}
|
||||
def output = MPPTools.createJsonReport(properties)
|
||||
def jsonFile = new File(buildDir, it.replace(".txt", ".json"))
|
||||
def jsonFile = layout.buildDirectory.file(it.replace(".txt", ".json")).get().asFile
|
||||
jsonFile.write(output)
|
||||
jsonReports.add(jsonFile)
|
||||
}
|
||||
def merged = MPPTools.mergeReports(jsonReports)
|
||||
if (!merged.isEmpty()) {
|
||||
mkdir buildDir.absolutePath
|
||||
new File(buildDir, externalBenchmarksReport).write(merged)
|
||||
mkdir layout.buildDirectory.get().asFile.absolutePath
|
||||
layout.buildDirectory.file(externalBenchmarksReport).get().asFile.write(merged)
|
||||
uploadBenchmarkResultToArtifactory(externalBenchmarksReport)
|
||||
}
|
||||
}
|
||||
@@ -269,14 +267,14 @@ registerExternalBenchmarks.finalizedBy registerExternalBuild
|
||||
def mergeReports(String fileName) {
|
||||
def reports = []
|
||||
subprojects.each {
|
||||
def reportFile = new File("${it.buildDir.absolutePath}/${fileName}")
|
||||
def reportFile = it.layout.buildDirectory.file(fileName).get().asFile
|
||||
if (reportFile.exists()) {
|
||||
reports.add(reportFile)
|
||||
}
|
||||
}
|
||||
def output = MPPTools.mergeReports(reports)
|
||||
mkdir buildDir.absolutePath
|
||||
new File("${buildDir.absolutePath}/${fileName}").write(output)
|
||||
mkdir layout.buildDirectory.get().asFile.absolutePath
|
||||
new File("${layout.buildDirectory.get().asFile.absolutePath}/${fileName}").write(output)
|
||||
}
|
||||
|
||||
task mergeNativeReports {
|
||||
@@ -313,7 +311,7 @@ task teamCityStat(type:Exec) {
|
||||
"--artifactory-url", "https://repo.labs.intellij.net/kotlin-native-benchmarks",
|
||||
"--teamcity-url", "http://buildserver.labs.intellij.net",
|
||||
"--server-url", findProperty("kotlin.native.performance.server.url")?.toString() ?: "http://localhost:3000",
|
||||
"${buildDir.absolutePath}/${nativeJson}"
|
||||
"${layout.buildDirectory.file(nativeJson).get().asFile}"
|
||||
}
|
||||
|
||||
task cinterop {
|
||||
|
||||
@@ -180,7 +180,7 @@ abstract class BenchmarkingPlugin: Plugin<Project> {
|
||||
|
||||
protected open fun Project.configureNativeTask(nativeTarget: KotlinNativeTarget): Task {
|
||||
val konanRun = createRunTask(this, "konanRun", nativeLinkTask,
|
||||
nativeExecutable, buildDir.resolve(nativeBenchResults).absolutePath).apply {
|
||||
nativeExecutable, layout.buildDirectory.file(nativeBenchResults).get().asFile.absolutePath).apply {
|
||||
group = BENCHMARKING_GROUP
|
||||
description = "Runs the benchmark for Kotlin/Native."
|
||||
}
|
||||
@@ -222,7 +222,7 @@ abstract class BenchmarkingPlugin: Plugin<Project> {
|
||||
|
||||
doLast {
|
||||
val applicationName = benchmark.applicationName
|
||||
val benchContents = buildDir.resolve(nativeBenchResults).readText()
|
||||
val benchContents = layout.buildDirectory.file(nativeBenchResults).get().asFile.readText()
|
||||
val nativeCompileTasks = if (benchmark.compileTasks.isEmpty()) {
|
||||
listOf("linkBenchmark${benchmark.buildType.name.lowercase().replaceFirstChar { it.uppercase() }}ExecutableNative")
|
||||
} else benchmark.compileTasks
|
||||
@@ -239,7 +239,7 @@ abstract class BenchmarkingPlugin: Plugin<Project> {
|
||||
)
|
||||
|
||||
val output = createJsonReport(properties)
|
||||
buildDir.resolve(nativeJson).writeText(output)
|
||||
layout.buildDirectory.file(nativeJson).get().asFile.writeText(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -40,11 +40,11 @@ open class CompileBenchmarkingPlugin : Plugin<Project> {
|
||||
|
||||
private fun Project.configureUtilityTasks() {
|
||||
tasks.create("configureBuild") {
|
||||
doLast { mkdir(buildDir) }
|
||||
doLast { mkdir(layout.buildDirectory.get().asFile) }
|
||||
}
|
||||
|
||||
tasks.create("clean", Delete::class.java) {
|
||||
delete(buildDir)
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ open class CompileBenchmarkingPlugin : Plugin<Project> {
|
||||
repeatNumber,
|
||||
exitCodes
|
||||
)
|
||||
val nativeExecutable = buildDir.resolve("program${getNativeProgramExtension()}")
|
||||
val nativeExecutable = layout.buildDirectory.file("program${getNativeProgramExtension()}").get().asFile
|
||||
val properties = commonBenchmarkProperties + mapOf(
|
||||
"type" to "native",
|
||||
"compilerVersion" to konanVersion,
|
||||
@@ -100,7 +100,7 @@ open class CompileBenchmarkingPlugin : Plugin<Project> {
|
||||
"codeSize" to getCodeSizeBenchmark(applicationName, nativeExecutable.absolutePath)
|
||||
)
|
||||
val output = createJsonReport(properties)
|
||||
buildDir.resolve(nativeJson).writeText(output)
|
||||
layout.buildDirectory.file(nativeJson).get().asFile.writeText(output)
|
||||
}
|
||||
konanRun.finalizedBy(this)
|
||||
}
|
||||
|
||||
+3
-3
@@ -44,7 +44,7 @@ open class KotlinNativeBenchmarkingPlugin: BenchmarkingPlugin() {
|
||||
val applicationName = benchmark.applicationName
|
||||
val jarPath = (tasks.getByName("jvmJar") as Jar).archiveFile.get().asFile
|
||||
val jvmCompileTime = getJvmCompileTime(project, applicationName)
|
||||
val benchContents = buildDir.resolve(jvmBenchResults).readText()
|
||||
val benchContents = layout.buildDirectory.file(jvmBenchResults).get().asFile.readText()
|
||||
|
||||
val properties: Map<String, Any> = commonBenchmarkProperties + mapOf(
|
||||
"type" to "jvm",
|
||||
@@ -55,7 +55,7 @@ open class KotlinNativeBenchmarkingPlugin: BenchmarkingPlugin() {
|
||||
)
|
||||
|
||||
val output = createJsonReport(properties)
|
||||
buildDir.resolve(jvmJson).writeText(output)
|
||||
layout.buildDirectory.file(jvmJson).get().asFile.writeText(output)
|
||||
}
|
||||
|
||||
jvmRun.finalizedBy(this)
|
||||
@@ -78,7 +78,7 @@ open class KotlinNativeBenchmarkingPlugin: BenchmarkingPlugin() {
|
||||
args("-p", "${benchmark.applicationName}::")
|
||||
warmupCount = jvmWarmup
|
||||
repeatCount = attempts
|
||||
outputFileName = buildDir.resolve(jvmBenchResults).absolutePath
|
||||
outputFileName = layout.buildDirectory.file(jvmBenchResults).get().asFile.absolutePath
|
||||
repeatingType = benchmark.repeatingType
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ open class SwiftBenchmarkingPlugin : BenchmarkingPlugin() {
|
||||
override val benchmarkExtensionName: String = "swiftBenchmark"
|
||||
|
||||
override val Project.nativeExecutable: String
|
||||
get() = Paths.get(buildDir.absolutePath, benchmark.applicationName).toString()
|
||||
get() = Paths.get(layout.buildDirectory.get().asFile.absolutePath, benchmark.applicationName).toString()
|
||||
|
||||
override val Project.nativeLinkTask: Task
|
||||
get() = tasks.getByName("buildSwift")
|
||||
@@ -92,7 +92,7 @@ open class SwiftBenchmarkingPlugin : BenchmarkingPlugin() {
|
||||
val frameworkParentDirPath = framework.outputDirectory.absolutePath
|
||||
val options = listOf("-O", "-wmo", "-Xlinker", "-rpath", "-Xlinker", frameworkParentDirPath, "-F", frameworkParentDirPath)
|
||||
compileSwift(project, nativeTarget.konanTarget, benchmark.swiftSources, options,
|
||||
Paths.get(buildDir.absolutePath, benchmark.applicationName), false)
|
||||
Paths.get(layout.buildDirectory.get().asFile.absolutePath, benchmark.applicationName), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import org.jetbrains.kotlin.MPPTools
|
||||
import org.jetbrains.kotlin.PlatformInfo
|
||||
import org.jetbrains.kotlin.RunJvmTask
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
||||
|
||||
buildscript {
|
||||
@@ -106,7 +105,7 @@ task konanJsonReport {
|
||||
'compileTime' : [nativeCompileTime],
|
||||
'codeSize' : MPPTools.getCodeSizeBenchmark(applicationName, nativeExecutable)]
|
||||
def output = MPPTools.createJsonReport(properties)
|
||||
new File("${buildDir.absolutePath}/${nativeJson}").write(output)
|
||||
layout.buildDirectory.file(nativeJson).get().asFile.write(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ task konanRun {
|
||||
|
||||
task configureBuild {
|
||||
doLast {
|
||||
mkdir "${buildDir.absolutePath}"
|
||||
mkdir "${layout.buildDirectory.get().asFile.absolutePath}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,23 +33,21 @@ task configureBuild {
|
||||
}
|
||||
|
||||
task clean {
|
||||
doLast {
|
||||
delete "${buildDir.absolutePath}"
|
||||
}
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
|
||||
task konanJsonReport {
|
||||
doLast {
|
||||
def nativeCompileTime = MPPTools.getCompileBenchmarkTime(project.ext.applicationName, project.ext.buildSteps.keySet(),
|
||||
project.ext.repeatNumber, exitCodes)
|
||||
def nativeExecutable = "${buildDir.absolutePath}/program${MPPTools.getNativeProgramExtension()}"
|
||||
def nativeExecutable = layout.buildDirectory.file("program${MPPTools.getNativeProgramExtension()}").get().asFile.toString()
|
||||
def properties = getCommonProperties() + ['type': 'native',
|
||||
'compilerVersion': "${konanVersion}".toString(),
|
||||
'benchmarks': "[]",
|
||||
'compileTime': nativeCompileTime,
|
||||
'codeSize': MPPTools.getCodeSizeBenchmark(project.ext.applicationName, nativeExecutable) ]
|
||||
def output = MPPTools.createJsonReport(properties)
|
||||
new File("${buildDir.absolutePath}/${nativeJson}").write(output)
|
||||
layout.buildDirectory.file(nativeJson).get().asFile.write(output)
|
||||
}
|
||||
}
|
||||
task jvmRun {
|
||||
|
||||
@@ -77,7 +77,7 @@ compileBenchmark {
|
||||
command = listOf(
|
||||
"$dist/bin/konanc$toolSuffix",
|
||||
"-ea", "-p", "program",
|
||||
"-o", "${buildDir.absolutePath}/program$binarySuffix",
|
||||
"-o", layout.buildDirectory.file("program$binarySuffix").get().asFile.toString(),
|
||||
"-l", "$videoplayerDir/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-ffmpeg.klib",
|
||||
"-l", "$videoplayerDir/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-sdl.klib",
|
||||
"-Xmulti-platform", "$videoplayerDir/src/videoPlayerMain/kotlin",
|
||||
|
||||
@@ -70,7 +70,7 @@ konanTargetList.forEach { target ->
|
||||
klibFiles(df.config.depends.map { "$konanHome/klib/platform/$targetName/${fileNamePrefix}${it}" })
|
||||
}
|
||||
extraOpts("-Xpurge-user-libs", "-Xshort-module-name", df.name, "-Xdisable-experimental-annotation")
|
||||
compilerOpts("-fmodules-cache-path=${project.buildDir}/clangModulesCache")
|
||||
compilerOpts("-fmodules-cache-path=${project.layout.buildDirectory.dir("clangModulesCache").get().asFile}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -502,9 +502,7 @@ val hostAssemble by tasks.registering {
|
||||
}
|
||||
|
||||
tasks.named("clean") {
|
||||
doFirst {
|
||||
delete(buildDir)
|
||||
}
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
|
||||
// region: Stdlib
|
||||
@@ -535,7 +533,7 @@ lateinit var stdlibBuildTask: TaskProvider<Task>
|
||||
|
||||
konanArtifacts {
|
||||
library("stdlib") {
|
||||
baseDir(project.buildDir.resolve("stdlib"))
|
||||
baseDir(project.layout.buildDirectory.dir("stdlib").get().asFile)
|
||||
|
||||
enableMultiplatform(true)
|
||||
noStdLib(true)
|
||||
@@ -578,9 +576,9 @@ targetList.forEach { targetName ->
|
||||
dependsOn(stdlibBuildTask)
|
||||
dependsOn("${targetName}Runtime")
|
||||
|
||||
destinationDir = project.buildDir.resolve("${targetName}Stdlib")
|
||||
into(project.layout.buildDirectory.dir("${targetName}Stdlib"))
|
||||
|
||||
from(project.buildDir.resolve("stdlib/${hostName}/stdlib"))
|
||||
from(project.layout.buildDirectory.dir("stdlib/${hostName}/stdlib"))
|
||||
val runtimeFiles = runtimeBitcode.incoming.artifactView {
|
||||
attributes {
|
||||
attribute(TargetWithSanitizer.TARGET_ATTRIBUTE, project.platformManager.targetByName(targetName).withSanitizer())
|
||||
@@ -614,7 +612,7 @@ targetList.forEach { targetName ->
|
||||
target = targetName
|
||||
originalKlib.fileProvider(stdlibTask.map { it.destinationDir })
|
||||
klibUniqName = "stdlib"
|
||||
cacheRoot = project.buildDir.resolve("cache/$targetName").absolutePath
|
||||
cacheRoot = project.layout.buildDirectory.dir("cache/$targetName").get().asFile.absolutePath
|
||||
|
||||
dependsOn(":kotlin-native:${targetName}CrossDistRuntime")
|
||||
}
|
||||
|
||||
@@ -13,17 +13,17 @@ val commonMainSources by task<Sync> {
|
||||
"$rootDir/libraries/kotlin.test/common/src/main/kotlin",
|
||||
"$rootDir/libraries/kotlin.test/annotations-common/src/main/kotlin"
|
||||
)
|
||||
into("$buildDir/commonMainSources")
|
||||
into(layout.buildDirectory.dir("commonMainSources"))
|
||||
}
|
||||
|
||||
val commonTestSources by task<Sync> {
|
||||
from("$rootDir/libraries/kotlin.test/common/src/test/kotlin")
|
||||
into("$buildDir/commonTestSources")
|
||||
into(layout.buildDirectory.dir("commonTestSources"))
|
||||
}
|
||||
|
||||
val jsMainSources by task<Sync> {
|
||||
from("$rootDir/libraries/kotlin.test/js/src/main/kotlin")
|
||||
into("$buildDir/jsMainSources")
|
||||
into(layout.buildDirectory.dir("jsMainSources"))
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
||||
@@ -19,12 +19,12 @@ node {
|
||||
|
||||
val jsMainSources by task<Sync> {
|
||||
from("$rootDir/libraries/kotlin.test/js/it/src")
|
||||
into("$buildDir/jsMainSources")
|
||||
into(layout.buildDirectory.dir("jsMainSources"))
|
||||
}
|
||||
|
||||
val jsSources by task<Sync> {
|
||||
from("$rootDir/libraries/kotlin.test/js/it/js")
|
||||
into("$buildDir/jsSources")
|
||||
into(layout.buildDirectory.dir("jsSources"))
|
||||
}
|
||||
|
||||
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
|
||||
@@ -75,7 +75,7 @@ val populateNodeModules = tasks.register<Copy>("populateNodeModules") {
|
||||
}
|
||||
}
|
||||
|
||||
into("${buildDir}/node_modules")
|
||||
into(layout.buildDirectory.dir("node_modules"))
|
||||
}
|
||||
|
||||
fun createFrameworkTest(name: String): TaskProvider<NpmTask> {
|
||||
@@ -83,12 +83,12 @@ fun createFrameworkTest(name: String): TaskProvider<NpmTask> {
|
||||
dependsOn(compileTestDevelopmentExecutableKotlinJs, populateNodeModules, "npmInstall")
|
||||
val testName = name
|
||||
val lowerName = name.lowercase()
|
||||
val tcOutput = project.file("$buildDir/tc-${lowerName}.log")
|
||||
val stdOutput = "$buildDir/test-${lowerName}.log"
|
||||
val errOutput = "$buildDir/test-${lowerName}.err.log"
|
||||
val exitCodeFile = project.file("$buildDir/test-${lowerName}.exit-code")
|
||||
val tcOutput = layout.buildDirectory.file("tc-${lowerName}.log")
|
||||
val stdOutput = layout.buildDirectory.file("test-${lowerName}.log")
|
||||
val errOutput = layout.buildDirectory.file("test-${lowerName}.err.log")
|
||||
val exitCodeFile = layout.buildDirectory.file("test-${lowerName}.exit-code")
|
||||
// inputs.files(sourceSets.test.output)
|
||||
inputs.dir("${buildDir}/node_modules")
|
||||
inputs.dir(layout.buildDirectory.dir("node_modules"))
|
||||
outputs.files(tcOutput, stdOutput, errOutput, exitCodeFile)
|
||||
|
||||
args.set(listOf("run", "test-$lowerName"))
|
||||
@@ -98,12 +98,12 @@ fun createFrameworkTest(name: String): TaskProvider<NpmTask> {
|
||||
|
||||
execOverrides {
|
||||
isIgnoreExitValue = true
|
||||
standardOutput = FileOutputStream(stdOutput)
|
||||
errorOutput = FileOutputStream(errOutput)
|
||||
standardOutput = FileOutputStream(stdOutput.get().asFile)
|
||||
errorOutput = FileOutputStream(errOutput.get().asFile)
|
||||
}
|
||||
doLast {
|
||||
println(tcOutput.readText())
|
||||
if (exitCodeFile.readText() != "0" /* && !rootProject.ignoreTestFailures*/) {
|
||||
println(tcOutput.get().asFile.readText())
|
||||
if (exitCodeFile.get().asFile.readText() != "0" /* && !rootProject.ignoreTestFailures*/) {
|
||||
throw GradleException("$testName integration test failed")
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ apiValidation {
|
||||
}
|
||||
|
||||
tasks.dokkaHtml.configure {
|
||||
outputDirectory.set(buildDir.resolve("dokka"))
|
||||
outputDirectory.set(layout.buildDirectory.dir("dokka"))
|
||||
pluginsMapConfiguration.set(
|
||||
mapOf(
|
||||
"org.jetbrains.dokka.base.DokkaBase"
|
||||
|
||||
@@ -25,7 +25,7 @@ configureJavaOnlyToolchain(JdkMajorVersion.JDK_1_8)
|
||||
publish()
|
||||
|
||||
val core = "$rootDir/core"
|
||||
val relocatedCoreSrc = "$buildDir/core-relocated"
|
||||
val relocatedCoreSrc = "${layout.buildDirectory.get().asFile}/core-relocated"
|
||||
|
||||
val proguardDeps by configurations.creating
|
||||
val proguardAdditionalInJars by configurations.creating
|
||||
|
||||
@@ -68,7 +68,7 @@ val mavenPackagesToRelocate = listOf(
|
||||
val relocatedJar by task<ShadowJar> {
|
||||
configurations = listOf(embedded)
|
||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||
archiveClassifier.set("relocated")
|
||||
|
||||
transform(ComponentsXmlResourceTransformer())
|
||||
@@ -82,8 +82,7 @@ val relocatedJar by task<ShadowJar> {
|
||||
|
||||
val normalizeComponentsXmlEndings by tasks.registering {
|
||||
dependsOn(relocatedJar)
|
||||
val outputDirectory = buildDir.resolve(name)
|
||||
val outputFile = outputDirectory.resolve(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH)
|
||||
val outputFile = layout.buildDirectory.file("$name/${ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH}")
|
||||
val relocatedJarFile = project.provider { relocatedJar.get().singleOutputFile() }
|
||||
val archiveOperations = serviceOf<ArchiveOperations>()
|
||||
outputs.file(outputFile)
|
||||
@@ -93,8 +92,9 @@ val normalizeComponentsXmlEndings by tasks.registering {
|
||||
include { it.path == ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH }
|
||||
}.single().readText()
|
||||
val processedComponentsXml = componentsXml.replace("\r\n", "\n")
|
||||
outputDirectory.mkdirs()
|
||||
outputFile.writeText(processedComponentsXml)
|
||||
val outputAsFile = outputFile.get().asFile
|
||||
outputAsFile.parentFile.mkdirs()
|
||||
outputAsFile.writeText(processedComponentsXml)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ val proguard by task<CacheableProguardTask> {
|
||||
|
||||
injars(mapOf("filter" to "!META-INF/versions/**,!kotlinx/coroutines/debug/**"), normalizedJar.get().outputs.files)
|
||||
|
||||
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
|
||||
outjars(layout.buildDirectory.file("libs/$jarBaseName-$version-after-proguard.jar"))
|
||||
|
||||
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_8))
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ dependencies {
|
||||
}
|
||||
|
||||
val builtinsDir = "${rootDir}/core/builtins"
|
||||
val builtinsSrcDir = "${buildDir}/src/builtin-sources"
|
||||
val builtinsSrcDir = "${layout.buildDirectory.get().asFile}/src/builtin-sources"
|
||||
|
||||
val jsDir = "${projectDir}/js"
|
||||
val jsBuiltinsSrcDir = "${buildDir}/src/js-builtin-sources"
|
||||
val jsBuiltinsSrcDir = "${layout.buildDirectory.get().asFile}/src/js-builtin-sources"
|
||||
|
||||
val commonOptIns = listOf(
|
||||
"kotlin.ExperimentalMultiplatform",
|
||||
@@ -473,7 +473,7 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
into("$buildDir/src/wasm-builtin-sources")
|
||||
into(layout.buildDirectory.dir("src/wasm-builtin-sources"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -527,7 +527,7 @@ kotlin {
|
||||
val prepareKotlinTestCommonNativeSources by tasks.registering(Sync::class) {
|
||||
from("../kotlin.test/common/src/main/kotlin")
|
||||
from("../kotlin.test/annotations-common/src/main/kotlin")
|
||||
into("$buildDir/src/native-kotlin-test-common-sources")
|
||||
into(layout.buildDirectory.dir("src/native-kotlin-test-common-sources"))
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -642,13 +642,13 @@ tasks {
|
||||
from(jsJar)
|
||||
rename { _ -> "full-runtime.klib" }
|
||||
// some tests expect stdlib-js klib in this location
|
||||
into(rootProject.buildDir.resolve("js-ir-runtime"))
|
||||
into(rootProject.layout.buildDirectory.dir("js-ir-runtime"))
|
||||
}
|
||||
|
||||
val jsRearrangedSourcesJar by registering(Jar::class) {
|
||||
archiveClassifier.set("js-sources")
|
||||
archiveVersion.set("")
|
||||
destinationDirectory.set(file("$buildDir/lib"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("lib"))
|
||||
|
||||
includeEmptyDirs = false
|
||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
||||
|
||||
@@ -25,7 +25,7 @@ val commonMainFullSources by task<Sync> {
|
||||
}
|
||||
}
|
||||
|
||||
into("$buildDir/commonMainFullSources")
|
||||
into(layout.buildDirectory.dir("commonMainFullSources"))
|
||||
}
|
||||
|
||||
val commonMainSources by task<Sync> {
|
||||
@@ -72,7 +72,7 @@ val commonMainSources by task<Sync> {
|
||||
commonMainFullSources.get().outputs.files.singleFile
|
||||
}
|
||||
|
||||
into("$buildDir/commonMainSources")
|
||||
into(layout.buildDirectory.dir("commonMainSources"))
|
||||
}
|
||||
|
||||
val commonMainCollectionSources by task<Sync> {
|
||||
@@ -82,7 +82,7 @@ val commonMainCollectionSources by task<Sync> {
|
||||
commonMainFullSources.get().outputs.files.singleFile
|
||||
}
|
||||
|
||||
into("$buildDir/commonMainCollectionSources")
|
||||
into(layout.buildDirectory.dir("commonMainCollectionSources"))
|
||||
}
|
||||
|
||||
val jsMainSources by task<Sync> {
|
||||
@@ -131,7 +131,7 @@ val jsMainSources by task<Sync> {
|
||||
into("builtins")
|
||||
}
|
||||
|
||||
into("$buildDir/jsMainSources")
|
||||
into(layout.buildDirectory.dir("jsMainSources"))
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
||||
@@ -25,7 +25,7 @@ dependencies {
|
||||
sourceSets {
|
||||
"main" {
|
||||
java.apply {
|
||||
srcDir(File(buildDir, "src"))
|
||||
srcDir(layout.buildDirectory.dir("src"))
|
||||
}
|
||||
}
|
||||
"test" {}
|
||||
@@ -50,7 +50,7 @@ val copySources by task<Sync> {
|
||||
"kotlin/enums/EnumEntries.kt",
|
||||
"kotlin/collections/AbstractList.kt",
|
||||
"kotlin/io/Serializable.kt")
|
||||
into(File(buildDir, "src"))
|
||||
into(layout.buildDirectory.dir("src"))
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,6 @@ publishing {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("${rootProject.buildDir}/internal/repo")
|
||||
maven(rootProject.layout.buildDirectory.dir("internal/repo"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ dependencies {
|
||||
signature("org.codehaus.mojo.signature:java16:1.1@signature")
|
||||
}
|
||||
|
||||
val signaturesDirectory = buildDir.resolve("signatures")
|
||||
val signaturesDirectory = layout.buildDirectory.get().asFile.resolve("signatures")
|
||||
|
||||
val collectSignatures by tasks.registering(Sync::class) {
|
||||
from(signature)
|
||||
|
||||
@@ -64,7 +64,7 @@ val outgoingClasspath by configurations.creating {
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(project.buildDir)
|
||||
delete(layout.buildDirectory)
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
@@ -94,11 +94,12 @@ run {
|
||||
implicitDependencies("com.google.protobuf:protoc:3.21.9:windows-x86_64@exe")
|
||||
}
|
||||
|
||||
val protocExecutable = buildDir.resolve("protoc/bin")
|
||||
val protocExecutable = layout.buildDirectory.file("protoc/bin")
|
||||
val setupProtoc = tasks.register("setupProtoc") {
|
||||
doFirst {
|
||||
protoc.files.single().copyTo(protocExecutable, overwrite = true)
|
||||
protocExecutable.setExecutable(true)
|
||||
val protocFile = protocExecutable.get().asFile
|
||||
protoc.files.single().copyTo(protocFile, overwrite = true)
|
||||
protocFile.setExecutable(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,16 +123,16 @@ run {
|
||||
|
||||
workingDir(project.projectDir)
|
||||
|
||||
commandLine(
|
||||
*arrayOf(
|
||||
protocExecutable.absolutePath,
|
||||
argumentProviders.add {
|
||||
listOf(
|
||||
protocExecutable.get().asFile.absolutePath,
|
||||
"-I=$protoSources",
|
||||
"--java_out=${javaOutput.absolutePath}",
|
||||
"--kotlin_out=${kotlinOutput.absolutePath}"
|
||||
) + protoSources.listFiles().orEmpty()
|
||||
.filter { it.extension == "proto" }
|
||||
.map { it.path },
|
||||
)
|
||||
.map { it.path }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ val cleanTestKitCacheTask = tasks.register<Delete>("cleanTestKitCache") {
|
||||
group = "Build"
|
||||
description = "Deletes temporary Gradle TestKit cache"
|
||||
|
||||
delete(project.buildDir.resolve("testKitCache"))
|
||||
delete(layout.buildDirectory.dir("testKitCache"))
|
||||
}
|
||||
|
||||
tasks.register<Delete>("cleanUserHomeKonanDir") {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ plugins {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(project(":producer").buildDir.resolve("repo"))
|
||||
maven(project(":producer").layout.buildDirectory.dir("repo"))
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ noDefaultJar()
|
||||
val relocatedJar by task<ShadowJar> {
|
||||
configurations = listOf(relocatedJarContents)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||
archiveClassifier.set("before-proguard")
|
||||
|
||||
// don't add this files to resources classpath to avoid IDE exceptions on kotlin project
|
||||
@@ -87,7 +87,7 @@ val proguard by task<CacheableProguardTask> {
|
||||
|
||||
injars(mapOf("filter" to "!META-INF/versions/**,!kotlinx/coroutines/debug/**"), relocatedJar.get().outputs.files)
|
||||
|
||||
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
|
||||
outjars(layout.buildDirectory.file("libs/$jarBaseName-$version-after-proguard.jar"))
|
||||
|
||||
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_8))
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ javadocJar()
|
||||
|
||||
testsJar()
|
||||
|
||||
val robolectricDependencyDir = "$buildDir/robolectricDependencies"
|
||||
val robolectricDependencyDir = layout.buildDirectory.dir("robolectricDependencies")
|
||||
val prepareRobolectricDependencies by tasks.registering(Copy::class) {
|
||||
from(robolectricDependency)
|
||||
into(robolectricDependencyDir)
|
||||
@@ -100,7 +100,7 @@ projectTest {
|
||||
systemProperty("robolectric.classpath", robolectricClasspathProvider.get())
|
||||
|
||||
systemProperty("robolectric.offline", "true")
|
||||
systemProperty("robolectric.dependency.dir", robolectricDependencyDir)
|
||||
systemProperty("robolectric.dependency.dir", robolectricDependencyDir.get().asFile)
|
||||
|
||||
systemProperty("layoutLib.path", layoutLibConf.singleFile.canonicalPath)
|
||||
systemProperty("layoutLibApi.path", layoutLibApiConf.singleFile.canonicalPath)
|
||||
|
||||
@@ -168,7 +168,7 @@ projectTest(jUnitMode = JUnitMode.JUnit5) {
|
||||
// Exclude all tests with the "atomicfu-native" tag. They should be launched by another test task.
|
||||
excludeTags("atomicfu-native")
|
||||
}
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
|
||||
workingDir = rootDir
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ projectTest(parallel = true, jUnitMode = JUnitMode.JUnit5) {
|
||||
val generateTests by generator("org.jetbrains.kotlinx.serialization.TestGeneratorKt")
|
||||
|
||||
fun Test.setUpJsIrBoxTests() {
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
|
||||
val localJsCoreRuntimeForTests: FileCollection = coreJsIrRuntimeForTests
|
||||
val localJsJsonRuntimeForTests: FileCollection = jsonJsIrRuntimeForTests
|
||||
|
||||
@@ -87,7 +87,7 @@ sourcesJar()
|
||||
javadocJar()
|
||||
testsJar()
|
||||
|
||||
val robolectricDependencyDir = "$buildDir/robolectricDependencies"
|
||||
val robolectricDependencyDir = layout.buildDirectory.dir("robolectricDependencies")
|
||||
val prepareRobolectricDependencies by tasks.registering(Copy::class) {
|
||||
from(robolectricDependency)
|
||||
into(robolectricDependencyDir)
|
||||
@@ -113,7 +113,7 @@ projectTest(jUnitMode = JUnitMode.JUnit5) {
|
||||
systemProperty("robolectric.classpath", robolectricClasspathConf.asPath)
|
||||
|
||||
systemProperty("robolectric.offline", "true")
|
||||
systemProperty("robolectric.dependency.dir", robolectricDependencyDir)
|
||||
systemProperty("robolectric.dependency.dir", robolectricDependencyDir.get().asFile)
|
||||
|
||||
systemProperty("layoutLib.path", layoutLibConf.singleFile.canonicalPath)
|
||||
systemProperty("layoutLibApi.path", layoutLibApiConf.singleFile.canonicalPath)
|
||||
|
||||
@@ -2,23 +2,25 @@
|
||||
|
||||
import java.io.File
|
||||
|
||||
val buildVersionFilePath = "$buildDir/build.txt"
|
||||
val buildVersionFilePath = layout.buildDirectory.file("build.txt")
|
||||
val buildVersion by configurations.creating
|
||||
val buildNumber: String by rootProject.extra
|
||||
val kotlinVersion: String by rootProject.extra
|
||||
|
||||
val writeBuildNumber by tasks.registering {
|
||||
val versionFile = File(buildVersionFilePath)
|
||||
val versionFile = buildVersionFilePath
|
||||
val buildNumber = buildNumber
|
||||
inputs.property("version", buildNumber)
|
||||
outputs.file(versionFile)
|
||||
doLast {
|
||||
versionFile.parentFile.mkdirs()
|
||||
versionFile.writeText(buildNumber)
|
||||
with(versionFile.get().asFile) {
|
||||
parentFile.mkdirs()
|
||||
writeText(buildNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifacts.add(buildVersion.name, file(buildVersionFilePath)) {
|
||||
artifacts.add(buildVersion.name, buildVersionFilePath) {
|
||||
builtBy(writeBuildNumber)
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,6 @@ val buildNumber by configurations.creating
|
||||
|
||||
val compilerBaseName = name
|
||||
|
||||
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
|
||||
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
|
||||
val distLibraryProjects = listOfNotNull(
|
||||
@@ -261,7 +259,7 @@ val distSbomTask = configureSbom(
|
||||
|
||||
val packCompiler by task<Jar> {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||
archiveClassifier.set("before-proguard")
|
||||
|
||||
dependsOn(fatJarContents)
|
||||
@@ -315,7 +313,7 @@ val proguard by task<CacheableProguardTask> {
|
||||
provider { packCompiler.get().outputs.files.singleFile }
|
||||
)
|
||||
|
||||
outjars(fileFrom(buildDir, "libs", "$compilerBaseName-after-proguard.jar"))
|
||||
outjars(layout.buildDirectory.file("libs/$compilerBaseName-after-proguard.jar"))
|
||||
|
||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraries)
|
||||
libraryjars(
|
||||
@@ -340,7 +338,7 @@ val proguard by task<CacheableProguardTask> {
|
||||
)
|
||||
)
|
||||
|
||||
printconfiguration("$buildDir/compiler.pro.dump")
|
||||
printconfiguration(layout.buildDirectory.file("compiler.pro.dump"))
|
||||
}
|
||||
|
||||
val pack = if (kotlinBuildProperties.proguard) proguard else packCompiler
|
||||
|
||||
@@ -44,7 +44,7 @@ idePluginDependency {
|
||||
val shadowJar by task<ShadowJar> {
|
||||
configurations = listOf(embedded)
|
||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||
archiveClassifier.set("shadow")
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ idePluginDependency {
|
||||
|
||||
configuration(fileFrom(projectDir, "backend-native-for-ide.pro"))
|
||||
injars(mapOf("filter" to "!META-INF/versions/**"), shadowJar.get().outputs.files)
|
||||
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
|
||||
outjars(layout.buildDirectory.file("libs/$jarBaseName-$version-after-proguard.jar"))
|
||||
|
||||
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_8))
|
||||
|
||||
|
||||
@@ -80,15 +80,16 @@ fun Project.configureCommonPublicationSettingsForGradle(
|
||||
.configureEach {
|
||||
configureKotlinPomAttributes(project)
|
||||
if (sbom && project.name !in internalPlugins) {
|
||||
val buildDirectory = project.layout.buildDirectory
|
||||
if (name == "pluginMaven") {
|
||||
val sbomTask = configureSbom(target = "PluginMaven")
|
||||
artifact("$buildDir/spdx/PluginMaven/PluginMaven.spdx.json") {
|
||||
artifact(buildDirectory.file("spdx/PluginMaven/PluginMaven.spdx.json")) {
|
||||
extension = "spdx.json"
|
||||
builtBy(sbomTask)
|
||||
}
|
||||
} else if (name == "Main") {
|
||||
val sbomTask = configureSbom()
|
||||
artifact("$buildDir/spdx/MainPublication/MainPublication.spdx.json") {
|
||||
artifact(buildDirectory.file("spdx/MainPublication/MainPublication.spdx.json")) {
|
||||
extension = "spdx.json"
|
||||
builtBy(sbomTask)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class InstrumentJava(@Transient val javaInstrumentator: Configuration) : Action<
|
||||
// Javac.execute() - https://github.com/apache/ant/blob/9943641/src/main/org/apache/tools/ant/taskdefs/Javac.java#L1086
|
||||
// InstrumentIdeaExtensions - https://github.com/JetBrains/intellij-community/blob/9c40bdd/java/compiler/javac2/src/com/intellij/ant/InstrumentIdeaExtensions.java
|
||||
// Javac2.compile() - https://github.com/JetBrains/intellij-community/blob/9c40bdd/java/compiler/javac2/src/com/intellij/ant/Javac2.java#L237
|
||||
val dummyInstrumentSrcDir = File(task.project.buildDir, "instrument_dummy_src")
|
||||
val dummyInstrumentSrcDir = task.project.layout.buildDirectory.dir("instrument_dummy_src").get().asFile
|
||||
val dummyInstrumentSrcRelativePath = dummyInstrumentSrcDir.relativeTo(task.project.projectDir).path.replace("\\", "/")
|
||||
|
||||
task.doLast {
|
||||
|
||||
+5
-6
@@ -163,15 +163,14 @@ fun Project.configureKotlinCompilationOptions() {
|
||||
}
|
||||
}
|
||||
|
||||
val relativePathBaseArg: String? =
|
||||
"-Xklib-relative-path-base=$buildDir,$projectDir,$rootDir".takeIf {
|
||||
!kotlinBuildProperties.getBoolean("kotlin.build.use.absolute.paths.in.klib")
|
||||
}
|
||||
val layout = project.layout
|
||||
val rootDir = rootDir
|
||||
val useAbsolutePathsInKlib = kotlinBuildProperties.getBoolean("kotlin.build.use.absolute.paths.in.klib")
|
||||
|
||||
// Workaround to avoid remote build cache misses due to absolute paths in relativePathBaseArg
|
||||
doFirst {
|
||||
if (relativePathBaseArg != null) {
|
||||
kotlinOptions.freeCompilerArgs += relativePathBaseArg
|
||||
if (!useAbsolutePathsInKlib) {
|
||||
kotlinOptions.freeCompilerArgs += "-Xklib-relative-path-base=${layout.buildDirectory.get().asFile},${layout.projectDirectory.asFile},$rootDir"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
|
||||
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler")) { isTransitive = false }
|
||||
|
||||
return tasks.register<ShadowJar>(taskName) {
|
||||
destinationDirectory.set(project.file(File(buildDir, "libs")))
|
||||
destinationDirectory.set(project.layout.buildDirectory.dir("libs"))
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(compilerJar)
|
||||
body()
|
||||
@@ -136,7 +136,7 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(
|
||||
)
|
||||
|
||||
return tasks.register<ShadowJar>(taskName) {
|
||||
destinationDirectory.set(project.file(File(buildDir, "libs")))
|
||||
destinationDirectory.set(project.layout.buildDirectory.dir("libs"))
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(compilerDummyJar)
|
||||
configureEmbeddableCompilerRelocation(withJavaxInject = false)
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.ideaExt.*
|
||||
|
||||
|
||||
val ideaSdkPath: String
|
||||
get() = rootProject.ideaHomePathForTests().absolutePath
|
||||
get() = rootProject.ideaHomePathForTests().get().asFile.absolutePath
|
||||
val distDir by extra("$rootDir/dist")
|
||||
val distKotlinHomeDir by extra("$distDir/kotlinc")
|
||||
|
||||
|
||||
@@ -126,11 +126,11 @@ object IntellijRootUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.ideaHomePathForTests() = rootProject.buildDir.resolve("ideaHomeForTests")
|
||||
fun Project.ideaHomePathForTests() = rootProject.layout.buildDirectory.dir("ideaHomeForTests")
|
||||
|
||||
fun Project.ideaBuildNumberFileForTests() = File(ideaHomePathForTests(), "build.txt")
|
||||
fun Project.ideaBuildNumberFileForTests() = objects.directoryProperty().value(ideaHomePathForTests()).file("build.txt")
|
||||
|
||||
fun Project.writeIdeaBuildNumberForTests() {
|
||||
ideaHomePathForTests().mkdirs()
|
||||
ideaBuildNumberFileForTests().writeText("IC-${rootProject.extra["versions.intellijSdk"]}")
|
||||
ideaHomePathForTests().get().asFile.mkdirs()
|
||||
ideaBuildNumberFileForTests().get().asFile.writeText("IC-${rootProject.extra["versions.intellijSdk"]}")
|
||||
}
|
||||
+1
-8
@@ -1,17 +1,10 @@
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.jetbrains.gradle.ext.ActionDelegationConfig
|
||||
import org.jetbrains.gradle.ext.JUnit
|
||||
import org.jetbrains.gradle.ext.RecursiveArtifact
|
||||
import org.jetbrains.gradle.ext.TopLevelArtifact
|
||||
import org.jetbrains.kotlin.ideaExt.*
|
||||
|
||||
|
||||
val distDir: String by extra
|
||||
val ideaSandboxDir: File by extra
|
||||
val ideaSdkPath: String
|
||||
get() = rootProject.ideaHomePathForTests().absolutePath
|
||||
get() = rootProject.ideaHomePathForTests().get().asFile.absolutePath
|
||||
|
||||
fun MutableList<String>.addModularizedTestArgs(prefix: String, path: String, additionalParameters: Map<String, String>, benchFilter: String?) {
|
||||
add("-${prefix}fir.bench.prefix=$path")
|
||||
|
||||
@@ -23,7 +23,11 @@ fun Project.preparePublication() {
|
||||
|
||||
val sonatypeSnapshotsUrl = "https://oss.sonatype.org/content/repositories/snapshots/".takeIf { repo == "sonatype-nexus-snapshots" }
|
||||
|
||||
val repoUrl: String by extra((deployRepoUrl ?: sonatypeSnapshotsUrl ?: "file://${rootProject.buildDir}/repo").toString())
|
||||
val repoUrl: String by extra(
|
||||
(deployRepoUrl ?: sonatypeSnapshotsUrl ?: "file://${
|
||||
rootProject.layout.buildDirectory.dir("repo").get().asFile
|
||||
}").toString()
|
||||
)
|
||||
|
||||
val username: String? by extra(
|
||||
properties["kotlin.build.deploy-username"]?.toString() ?: properties["kotlin.${repoProvider}.user"]?.toString()
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
* Copyright 2010-2023 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 org.gradle.api.file.Directory
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
|
||||
fun Test.useJsIrBoxTests(
|
||||
version: Any,
|
||||
buildDir: String = "",
|
||||
buildDir: Provider<Directory>,
|
||||
fullStdLib: String = "libraries/stdlib/build/classes/kotlin/js/main",
|
||||
reducedStdlibPath: String = "libraries/stdlib/js-ir-minimal-for-test/build/classes/kotlin/js/main",
|
||||
kotlinJsTestPath: String = "libraries/kotlin.test/js-ir/build/classes/kotlin/js/main",
|
||||
@@ -20,7 +22,7 @@ fun Test.useJsIrBoxTests(
|
||||
dependsOn(":kotlin-stdlib-js-ir-minimal-for-test:compileKotlinJs")
|
||||
dependsOn(":kotlin-dom-api-compat:compileKotlinJs")
|
||||
|
||||
systemProperty("kotlin.js.test.root.out.dir", buildDir)
|
||||
systemProperty("kotlin.js.test.root.out.dir", "${buildDir.get().asFile}/")
|
||||
systemProperty("kotlin.js.full.stdlib.path", fullStdLib)
|
||||
systemProperty("kotlin.js.reduced.stdlib.path", reducedStdlibPath)
|
||||
systemProperty("kotlin.js.kotlin.test.path", kotlinJsTestPath)
|
||||
|
||||
@@ -206,12 +206,12 @@ fun Project.projectTest(
|
||||
}
|
||||
|
||||
systemProperty("idea.is.unit.test", "true")
|
||||
systemProperty("idea.home.path", project.ideaHomePathForTests().canonicalPath)
|
||||
systemProperty("idea.home.path", project.ideaHomePathForTests().get().asFile.canonicalPath)
|
||||
systemProperty("idea.use.native.fs.for.win", false)
|
||||
systemProperty("java.awt.headless", "true")
|
||||
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
|
||||
environment("PROJECT_CLASSES_DIRS", project.testSourceSet.output.classesDirs.asPath)
|
||||
environment("PROJECT_BUILD_DIR", project.buildDir)
|
||||
environment("PROJECT_BUILD_DIR", project.layout.buildDirectory.get().asFile)
|
||||
systemProperty("jps.kotlin.home", project.rootProject.extra["distKotlinHomeDir"]!!)
|
||||
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (project.rootProject.hasProperty("skipMutedTests")) "true" else "false")
|
||||
systemProperty("cacheRedirectorEnabled", project.rootProject.findProperty("cacheRedirectorEnabled")?.toString() ?: "false")
|
||||
|
||||
+2
-2
@@ -19,13 +19,13 @@ private fun Project.createCommonMainSources() = tasks.register("commonMainSource
|
||||
"$rootDir/libraries/kotlin.test/common/src/main/kotlin",
|
||||
"$rootDir/libraries/kotlin.test/annotations-common/src/main/kotlin",
|
||||
)
|
||||
into("$buildDir/commonMainSources")
|
||||
into(layout.buildDirectory.dir("commonMainSources"))
|
||||
}
|
||||
private fun Project.createCommonWasmSources() = tasks.register<Sync>("commonWasmSources") {
|
||||
from(
|
||||
"$rootDir/libraries/kotlin.test/wasm/src/main/kotlin"
|
||||
)
|
||||
into("$buildDir/commonWasmSources")
|
||||
into(layout.buildDirectory.dir("commonWasmSources"))
|
||||
}
|
||||
|
||||
fun Project.configureWasmKotlinTest(
|
||||
|
||||
@@ -26,10 +26,10 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
val wabtDir = File(buildDir, "wabt")
|
||||
val wabtDir = File(layout.buildDirectory.get().asFile, "wabt")
|
||||
val wabtVersion = "1.0.19"
|
||||
val testSuiteRevision = "18f8340"
|
||||
val testSuiteDir = File(buildDir, "testsuite")
|
||||
val testSuiteDir = File(layout.buildDirectory.get().asFile, "testsuite")
|
||||
|
||||
val gradleOs = org.gradle.internal.os.OperatingSystem.current()
|
||||
val wabtOS = when {
|
||||
|
||||
@@ -113,15 +113,12 @@ fun Test.setupGradlePropertiesForwarding() {
|
||||
}
|
||||
}
|
||||
|
||||
val downloadedTools = File(buildDir, "tools")
|
||||
|
||||
val unzipJsShell by task<Copy> {
|
||||
dependsOn(jsShell)
|
||||
from {
|
||||
zipTree(jsShell.singleFile)
|
||||
}
|
||||
val unpackedDir = File(downloadedTools, "jsshell-$jsShellSuffix-$jsShellVersion")
|
||||
into(unpackedDir)
|
||||
into(layout.buildDirectory.dir("tools/jsshell-$jsShellSuffix-$jsShellVersion"))
|
||||
}
|
||||
|
||||
fun Test.setupSpiderMonkey() {
|
||||
@@ -153,7 +150,7 @@ fun Project.wasmProjectTest(
|
||||
setupWasmStdlib("js")
|
||||
setupWasmStdlib("wasi")
|
||||
setupGradlePropertiesForwarding()
|
||||
systemProperty("kotlin.wasm.test.root.out.dir", "$buildDir/")
|
||||
systemProperty("kotlin.wasm.test.root.out.dir", "${layout.buildDirectory.get().asFile}/")
|
||||
body()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user