Skip to content

Add support for linuxArm64 and linuxArm32Hfp targets #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion atomicfu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ if (rootProject.ext.native_targets_enabled) {
addNative(fromPreset(project.ext.ideaPreset, 'native'))
} else {
addTarget(presets.linuxX64)
addTarget(presets.linuxArm32Hfp)
addTarget(presets.linuxArm64)
addTarget(presets.iosArm64)
addTarget(presets.iosArm32)
addTarget(presets.iosX64)
Expand Down Expand Up @@ -127,7 +129,15 @@ if (rootProject.ext.native_targets_enabled) {
apply from: "$rootDir/gradle/interop-as-source-set-klib.gradle"

registerInteropAsSourceSetOutput(
kotlin.linuxX64().compilations["main"].cinterops["interop"],
kotlin.linuxX64(),
kotlin.sourceSets["nativeInterop"]
)
registerInteropAsSourceSetOutput(
kotlin.linuxArm64(),
kotlin.sourceSets["nativeInterop"]
)
registerInteropAsSourceSetOutput(
kotlin.linuxArm32Hfp(),
kotlin.sourceSets["nativeInterop"]
)
}
Expand Down
11 changes: 7 additions & 4 deletions gradle/interop-as-source-set-klib.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

project.ext.registerInteropAsSourceSetOutput = { interop, sourceSet ->
project.ext.registerInteropAsSourceSetOutput = { target, sourceSet ->
afterEvaluate {
def interop = target.compilations["main"].cinterops["interop"]
def cinteropTask = tasks.named(interop.interopProcessingTaskName)
def cinteropKlib = cinteropTask.map { it.outputFile }
def fakeCinteropCompilation = kotlin.targets["metadata"].compilations[sourceSet.name]
def destination = fakeCinteropCompilation.compileKotlinTask.destinationDir

def tempDir = "$buildDir/tmp/${sourceSet.name}UnpackedInteropKlib"
def tempDir = "$buildDir/tmp/${target.name}${sourceSet.name}UnpackedInteropKlib"

def prepareKlibTaskProvider = tasks.register("prepare${sourceSet.name.capitalize()}InteropKlib", Sync) {
println("prepare${target.name}${sourceSet.name.capitalize()}InteropKlib")

def prepareKlibTaskProvider = tasks.register("prepare${target.name}${sourceSet.name.capitalize()}InteropKlib", Sync) {
from(files(zipTree(cinteropKlib).matching {
exclude("targets/**", "default/targets/**")
}).builtBy(cinteropTask))
Expand All @@ -33,7 +36,7 @@ project.ext.registerInteropAsSourceSetOutput = { interop, sourceSet ->
}
}

def copyCinteropTaskProvider = tasks.register("copy${sourceSet.name.capitalize()}CinteropKlib", Zip) {
def copyCinteropTaskProvider = tasks.register("copy${target.name}${sourceSet.name.capitalize()}CinteropKlib", Zip) {
from(fileTree(tempDir).builtBy(prepareKlibTaskProvider))
destinationDirectory.set(destination)
archiveFileName.set("${project.name}_${fakeCinteropCompilation.name}.klib")
Expand Down