Skip to content

Commit

Permalink
Kotlin version 1.3.70-eap-42, fixed HMPP support in IDE
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Jan 17, 2020
1 parent 10979a3 commit e9ec4cb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# Kotlin
version=1.3.3-native-mt-SNAPSHOT
group=org.jetbrains.kotlinx
kotlin_version=1.3.61
kotlin_version=1.3.70-eap-42

# Dependencies
junit_version=4.12
atomicfu_version=0.14.1
atomicfu_version=0.14.1-1.3.70-eap-42-2
html_version=0.6.8
lincheck_version=2.0
dokka_version=0.9.16-rdev-2-mpp-hacks
Expand Down
28 changes: 11 additions & 17 deletions gradle/compile-native-multiplatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,17 @@ kotlin {
}

targets {
if (project.ext.ideaActive) {
// todo: This is IDEA kludge, without "fromPresent" the code does not resolve properly
//fromPreset(project.ext.ideaPreset, 'native')
addTarget(project.ext.ideaPreset)
} else {
addTarget(presets.linuxX64)
addTarget(presets.iosArm64)
addTarget(presets.iosArm32)
addTarget(presets.iosX64)
addTarget(presets.macosX64)
addTarget(presets.mingwX64)
addTarget(presets.tvosArm64)
addTarget(presets.tvosX64)
addTarget(presets.watchosArm32)
addTarget(presets.watchosArm64)
addTarget(presets.watchosX86)
}
addTarget(presets.linuxX64)
addTarget(presets.iosArm64)
addTarget(presets.iosArm32)
addTarget(presets.iosX64)
addTarget(presets.macosX64)
addTarget(presets.mingwX64)
addTarget(presets.tvosArm64)
addTarget(presets.tvosX64)
addTarget(presets.watchosArm32)
addTarget(presets.watchosArm64)
addTarget(presets.watchosX86)
}

sourceSets {
Expand Down
7 changes: 0 additions & 7 deletions gradle/targets.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,5 @@ kotlin {
project.ext.isLinuxHost = linuxEnabled
project.ext.isMacosHost = macosEnabled
project.ext.isWinHost = winEnabled

if (project.ext.ideaActive) {
def ideaPreset = presets.linuxX64
if (macosEnabled) ideaPreset = presets.macosX64
if (winEnabled) ideaPreset = presets.mingwX64
project.ext.ideaPreset = ideaPreset
}
}
}
26 changes: 19 additions & 7 deletions kotlinx-coroutines-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ defineSourceSet("concurrent", ["common"]) { it in ["jvm", "native"] }
defineSourceSet("nativeDarwin", ["native"]) { isNativeDarwin(it) }
defineSourceSet("nativeOther", ["native"]) { isNativeOther(it) }

// todo: This is IDEA kludge, without "fromPresent" the code does not resolve properly
if (project.ext.ideaActive && isNativeDarwin(project.ext.ideaPreset.name)) {
kotlin.targets {
fromPreset(project.ext.ideaPreset, 'nativeDarwin')
}
}

/*
* All platform plugins and configuration magic happens here instead of build.gradle
* because JMV-only projects depend on core, thus core should always be initialized before configuration.
Expand Down Expand Up @@ -118,6 +111,25 @@ configurations {
configureKotlinJvmPlatform(kotlinCompilerPluginClasspath)
}

if (project.ext.ideaActive) {
def ideaPreset = kotlin.presets.linuxX64
if (project.ext.isLinuxHost) ideaPreset = kotlin.presets.macosX64
if (project.ext.isWinHost) ideaPreset = kotlin.presets.mingwX64

kotlin.sourceSets {
configure(matching { it.name.startsWith("native")}) {
def hostMainCompilation = project.kotlin.targetFromPreset(ideaPreset).compilations.main
def compileConfiguration = configurations[hostMainCompilation.compileDependencyConfigurationName]
def hostNativePlatformLibs = files(provider {
compileConfiguration.findAll {
it.path.endsWith(".klib") || it.absolutePath.contains("klib${File.separator}platform")
}
})
dependencies.add(implementationMetadataConfigurationName, hostNativePlatformLibs)
}
}
}

kotlin.sourceSets {
jvmTest.dependencies {
api "com.devexperts.lincheck:lincheck:$lincheck_version"
Expand Down

0 comments on commit e9ec4cb

Please sign in to comment.