Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 8 | project.ext.ideaActive = System.getProperty('idea.active') == 'true' |
| 9 | |
| 10 | kotlin { |
| 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 Elizarov | 7dd86b6 | 2019-02-24 21:21:18 +0300 | [diff] [blame] | 24 | if (winEnabled) ideaPreset = presets.mingwX64 |
Vsevolod Tolstopyatov | e50a0fa | 2019-01-28 11:34:24 +0300 | [diff] [blame] | 25 | project.ext.ideaPreset = ideaPreset |
| 26 | } |
| 27 | } |
| 28 | } |