Build: Fix usages of deprecated convention in kotlin-native
Required for Gradle 7+ #KTI-559
This commit is contained in:
@@ -61,7 +61,7 @@ ext.target = platformManager.targetManager(project.testTarget).target
|
|||||||
ext.testLibraryDir = "${ext.testOutputRoot}/klib/platform/${project.target.name}"
|
ext.testLibraryDir = "${ext.testOutputRoot}/klib/platform/${project.target.name}"
|
||||||
|
|
||||||
// Add executor to run tests depending on a target
|
// Add executor to run tests depending on a target
|
||||||
project.convention.plugins.executor = ExecutorServiceKt.create(project)
|
project.extensions.executor = ExecutorServiceKt.create(project)
|
||||||
|
|
||||||
|
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
@@ -4710,7 +4710,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
interop = 'objcSmoke'
|
interop = 'objcSmoke'
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc/smoke.m"
|
args "$projectDir/interop/objc/smoke.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcsmoke.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcsmoke.dylib"
|
||||||
@@ -4735,7 +4735,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
interop = 'objcSmoke'
|
interop = 'objcSmoke'
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc/smoke.m"
|
args "$projectDir/interop/objc/smoke.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcsmoke.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcsmoke.dylib"
|
||||||
@@ -4773,7 +4773,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args fileTree("$projectDir/interop/objc/tests/") { include '**/*.m' }
|
args fileTree("$projectDir/interop/objc/tests/") { include '**/*.m' }
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjctests.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjctests.dylib"
|
||||||
@@ -4793,7 +4793,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc_with_initializer/objc_misc.m"
|
args "$projectDir/interop/objc_with_initializer/objc_misc.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcmisc.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcmisc.dylib"
|
||||||
@@ -4810,7 +4810,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc/msg_send/messaging.m"
|
args "$projectDir/interop/objc/msg_send/messaging.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcmessaging.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcmessaging.dylib"
|
||||||
@@ -4828,7 +4828,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
||||||
@@ -4847,7 +4847,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
||||||
@@ -4866,7 +4866,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
args "$projectDir/interop/objc/foreignException/objc_wrap.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcexception.dylib"
|
||||||
@@ -4909,7 +4909,7 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
|
|
||||||
doBeforeBuild {
|
doBeforeBuild {
|
||||||
mkdir(buildDir)
|
mkdir(buildDir)
|
||||||
execClangForCompilerTests(project.target) {
|
project.extensions.execClang.execClangForCompilerTests(project.target) {
|
||||||
args "$projectDir/interop/objc/kt42172/objclib.m"
|
args "$projectDir/interop/objc/kt42172/objclib.m"
|
||||||
args "-lobjc", '-fobjc-arc'
|
args "-lobjc", '-fobjc-arc'
|
||||||
args '-fPIC', '-shared', '-o', "$buildDir/libobjc_kt42172.dylib"
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjc_kt42172.dylib"
|
||||||
|
|||||||
+1
-1
@@ -251,7 +251,7 @@ class NamedNativeInteropConfig implements Named {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: the interop plugin should probably be reworked to execute clang from build scripts directly
|
// TODO: the interop plugin should probably be reworked to execute clang from build scripts directly
|
||||||
environment['PATH'] = project.files(project.hostPlatform.clang.clangPaths).asPath +
|
environment['PATH'] = project.files(project.extensions.platformManager.hostPlatform.clang.clangPaths).asPath +
|
||||||
File.pathSeparator + environment['PATH']
|
File.pathSeparator + environment['PATH']
|
||||||
|
|
||||||
args compilerOpts.collectMany { ['-compiler-option', it] }
|
args compilerOpts.collectMany { ['-compiler-option', it] }
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@ import org.gradle.api.tasks.Input
|
|||||||
import org.gradle.api.tasks.InputFiles
|
import org.gradle.api.tasks.InputFiles
|
||||||
import org.gradle.api.tasks.OutputFile
|
import org.gradle.api.tasks.OutputFile
|
||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
import org.jetbrains.kotlin.bitcode.CompileToBitcode
|
import org.jetbrains.kotlin.bitcode.CompileToBitcode
|
||||||
import java.io.FileReader
|
import java.io.FileReader
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
@@ -63,7 +64,7 @@ open class GenerateCompilationDatabase @Inject constructor(@Input val target: St
|
|||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
fun run() {
|
fun run() {
|
||||||
val plugin = project.convention.getPlugin(ExecClang::class.java)
|
val plugin = project.extensions.getByType<ExecClang>()
|
||||||
val executable = plugin.resolveExecutable(executable)
|
val executable = plugin.resolveExecutable(executable)
|
||||||
val args = listOf(executable) + compilerFlags + plugin.clangArgsForCppRuntime(target)
|
val args = listOf(executable) + compilerFlags + plugin.clangArgsForCppRuntime(target)
|
||||||
val entries: List<Entry> = files.map { Entry.create(srcRoot, it, args, outputDir) }
|
val entries: List<Entry> = files.map { Entry.create(srcRoot, it, args, outputDir) }
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.gradle.api.Project
|
|||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.gradle.api.provider.Provider
|
import org.gradle.api.provider.Provider
|
||||||
import org.gradle.api.tasks.*
|
import org.gradle.api.tasks.*
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
||||||
import org.gradle.process.ExecSpec
|
import org.gradle.process.ExecSpec
|
||||||
import org.jetbrains.kotlin.konan.exec.Command
|
import org.jetbrains.kotlin.konan.exec.Command
|
||||||
@@ -528,7 +529,7 @@ open class KonanDynamicTest : KonanStandaloneTest() {
|
|||||||
|
|
||||||
private fun clang() {
|
private fun clang() {
|
||||||
val log = ByteArrayOutputStream()
|
val log = ByteArrayOutputStream()
|
||||||
val plugin = project.convention.getPlugin(ExecClang::class.java)
|
val plugin = project.extensions.getByType<ExecClang>()
|
||||||
val artifactsDir = "$outputDirectory/${project.testTarget}"
|
val artifactsDir = "$outputDirectory/${project.testTarget}"
|
||||||
|
|
||||||
fun flagsContain(opt: String) = project.globalTestArgs.contains(opt) || flags.contains(opt)
|
fun flagsContain(opt: String) = project.globalTestArgs.contains(opt) || flags.contains(opt)
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.bitcode
|
|||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
import org.gradle.api.tasks.*
|
import org.gradle.api.tasks.*
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
import org.jetbrains.kotlin.ExecClang
|
import org.jetbrains.kotlin.ExecClang
|
||||||
import org.jetbrains.kotlin.konan.target.Family
|
import org.jetbrains.kotlin.konan.target.Family
|
||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
@@ -161,7 +162,7 @@ open class CompileToBitcode @Inject constructor(
|
|||||||
@TaskAction
|
@TaskAction
|
||||||
fun compile() {
|
fun compile() {
|
||||||
objDir.mkdirs()
|
objDir.mkdirs()
|
||||||
val plugin = project.convention.getPlugin(ExecClang::class.java)
|
val plugin = project.extensions.getByType<ExecClang>()
|
||||||
|
|
||||||
plugin.execKonanClang(target) {
|
plugin.execKonanClang(target) {
|
||||||
workingDir = objDir
|
workingDir = objDir
|
||||||
|
|||||||
+2
-1
@@ -11,6 +11,7 @@ import javax.inject.Inject
|
|||||||
import org.gradle.api.*
|
import org.gradle.api.*
|
||||||
import org.gradle.api.file.ConfigurableFileCollection
|
import org.gradle.api.file.ConfigurableFileCollection
|
||||||
import org.gradle.api.tasks.*
|
import org.gradle.api.tasks.*
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
import org.jetbrains.kotlin.ExecClang
|
import org.jetbrains.kotlin.ExecClang
|
||||||
import org.jetbrains.kotlin.bitcode.CompileToBitcode
|
import org.jetbrains.kotlin.bitcode.CompileToBitcode
|
||||||
import org.jetbrains.kotlin.bitcode.CompileToBitcodeExtension
|
import org.jetbrains.kotlin.bitcode.CompileToBitcodeExtension
|
||||||
@@ -37,7 +38,7 @@ open class CompileNativeTest @Inject constructor(
|
|||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
fun compile() {
|
fun compile() {
|
||||||
val plugin = project.convention.getPlugin(ExecClang::class.java)
|
val plugin = project.extensions.getByType<ExecClang>()
|
||||||
val args = clangArgs + sanitizerFlags + listOf(inputFile.absolutePath, "-o", outputFile.absolutePath)
|
val args = clangArgs + sanitizerFlags + listOf(inputFile.absolutePath, "-o", outputFile.absolutePath)
|
||||||
if (target.family.isAppleFamily) {
|
if (target.family.isAppleFamily) {
|
||||||
plugin.execToolchainClang(target) {
|
plugin.execToolchainClang(target) {
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ void setupHostAndTarget() {
|
|||||||
|
|
||||||
void setupClang(Project project) {
|
void setupClang(Project project) {
|
||||||
|
|
||||||
project.convention.plugins.platformManager = project.project(":kotlin-native").ext.platformManager
|
project.extensions.platformManager = project.project(":kotlin-native").ext.platformManager
|
||||||
project.convention.plugins.execClang = new org.jetbrains.kotlin.ExecClang(project)
|
project.extensions.execClang = new org.jetbrains.kotlin.ExecClang(project)
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadLocalProperties() {
|
void loadLocalProperties() {
|
||||||
|
|||||||
Reference in New Issue
Block a user