Skip to content
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

Fix duplicatge symbols with gradle instead of manual copy-pasting #226

Merged
merged 1 commit into from
Sep 3, 2024
Merged
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
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ jobs:
- os: ubuntu-latest
EXTRA_GRADLE_ARGS: apiCheck :test:proguard:r8jar
- os: macos-latest
EXTRA_GRADLE_ARGS: :mordant:compileKotlinMetadata
EXTRA_GRADLE_ARGS: >-
:mordant:compileNativeMainKotlinMetadata
:mordant:compilePosixMainKotlinMetadata
:mordant:compileAppleMainKotlinMetadata
:mordant:compileMacosMainKotlinMetadata
:mordant:compileWatchosMainKotlinMetadata
:mordant:compileTvosMainKotlinMetadata
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 11 additions & 0 deletions buildSrc/src/main/kotlin/mordant-native-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ kotlin {
tvosX64()
tvosArm64()
tvosSimulatorArm64()
watchosArm32()
watchosArm64()
watchosX64()
watchosSimulatorArm64()

sourceSets {
for (target in listOf(
"tvosX64", "tvosArm64", "tvosSimulatorArm64",
"watchosArm32", "watchosArm64", "watchosX64", "watchosSimulatorArm64",
)) {
sourceSets.getByName(target + "Main").kotlin.srcDirs("src/posixSharedMain/kotlin")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ kotlin {
// Not all targets are supported by the markdown library
// tvosX64()
// tvosArm64()
tvosSimulatorArm64()
// tvosSimulatorArm64()
// watchosArm32()
// watchosArm64()
// watchosDeviceArm64()
// watchosX64()
watchosSimulatorArm64()
// watchosSimulatorArm64()

applyDefaultHierarchyTemplate()

Expand All @@ -33,5 +33,15 @@ kotlin {
for (target in listOf(iosMain, tvosMain, watchosMain)) {
target.get().dependsOn(appleNonDesktopMain)
}
// Kotlin 2.0 changed the way MPP is compiled, so instead of copying shared sources to each
// target, it compiles intermediate sources separately. That means that code that previously
// compiled is broken due to errors like "declaration is using numbers with different bit
// widths". So we copy the shared sources to each target manually.
for (target in listOf(
"linuxX64", "linuxArm64",
"macosX64", "macosArm64",
)) {
sourceSets.getByName(target + "Main").kotlin.srcDirs("src/posixSharedMain/kotlin")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
package com.github.ajalt.mordant.internal

import com.github.ajalt.mordant.terminal.TerminalInterface
import com.github.ajalt.mordant.terminal.terminalinterface.TerminalInterfaceNativeCopyPasted

internal actual fun testsHaveFileSystem(): Boolean = true
internal actual fun getStandardTerminalInterface(): TerminalInterface {
return TerminalInterfaceNativeCopyPasted()
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.ajalt.mordant.internal

import com.github.ajalt.mordant.terminal.TerminalInterface
import com.github.ajalt.mordant.terminal.terminalinterface.TerminalInterfaceNativeCopyPasted
import com.github.ajalt.mordant.terminal.terminalinterface.TerminalInterfaceNativeShared

internal actual fun getStandardTerminalInterface(): TerminalInterface {
return TerminalInterfaceNativeCopyPasted()
return TerminalInterfaceNativeShared()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import platform.posix.*
// they have different bit widths for some fields, so the compileMetadata task fails if we don't use
// separate files. Hopefully some day there will be solution that doesn't require copy-pasting.

internal class TerminalInterfaceNativeCopyPasted : TerminalInterfaceNativePosix() {
internal class TerminalInterfaceNativeShared : TerminalInterfaceNativePosix() {
override val termiosConstants: TermiosConstants = TermiosConstants(
VTIME = VTIME,
VMIN = VMIN,
Expand Down

This file was deleted.

This file was deleted.

Loading