blob: d4e560fd5ac4799aa587593a64febf664a97d43a [file] [log] [blame]
Vsevolod Tolstopyatove50a0fa2019-01-28 11:34:24 +03001/*
2 * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4
5/*
6 * This is a hack to avoid creating unsupported native source sets when importing project into IDEA
7 */
8project.ext.ideaActive = System.getProperty('idea.active') == 'true'
9
10kotlin {
11 targets {
12 def manager = project.ext.hostManager
13 def linuxEnabled = manager.isEnabled(presets.linuxX64.konanTarget)
14 def macosEnabled = manager.isEnabled(presets.macosX64.konanTarget)
15 def winEnabled = manager.isEnabled(presets.mingwX64.konanTarget)
16
17 project.ext.isLinuxHost = linuxEnabled
18 project.ext.isMacosHost = macosEnabled
19 project.ext.isWinHost = winEnabled
20
21 if (project.ext.ideaActive) {
22 def ideaPreset = presets.linuxX64
23 if (macosEnabled) ideaPreset = presets.macosX64
Roman Elizarov7dd86b62019-02-24 21:21:18 +030024 if (winEnabled) ideaPreset = presets.mingwX64
Vsevolod Tolstopyatove50a0fa2019-01-28 11:34:24 +030025 project.ext.ideaPreset = ideaPreset
26 }
27 }
28}