[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
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user