Files
kotlin-fork/kotlin-native/samples/calculator/arithmeticParser/build.gradle
T
Stanislav Erokhin f624800b84 Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise
they would be ignored according .gitignore settings. Probably they
should be deleted from repo.

Interop/.idea/compiler.xml
Interop/.idea/gradle.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml
Interop/.idea/modules.xml
Interop/.idea/modules/Indexer/Indexer.iml
Interop/.idea/modules/Runtime/Runtime.iml
Interop/.idea/modules/StubGenerator/StubGenerator.iml
backend.native/backend.native.iml
backend.native/bc.frontend/bc.frontend.iml
backend.native/cli.bc/cli.bc.iml
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt
backend.native/tests/link/lib/foo.kt
backend.native/tests/link/lib/foo2.kt
backend.native/tests/teamcity-test.property
2020-10-27 21:00:28 +03:00

82 lines
2.4 KiB
Groovy

apply plugin: 'org.jetbrains.kotlin.multiplatform'
kotlin {
targets {
fromPreset(determineIosPreset(), 'ios') {
binaries {
framework()
}
}
fromPreset(presets.jvm, 'jvm')
}
sourceSets {
commonMain {
dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
jvmMain {
dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
}
}
}
}
// Workaround for https://youtrack.jetbrains.com/issue/KT-27170
configurations {
compileClasspath
}
// If custom preset specified in 'calculator.preset.name' property, then use it for building.
// Otherwise build for iPhone simulator (by default).
def determineIosPreset() {
String presetName = project.hasProperty('calculator.preset.name') ? project.properties['calculator.preset.name'] : 'iosX64'
def preset = project.kotlin.presets[presetName]
println("$project has been configured for $presetName platform.")
preset
}
// Special Gradle task that is called from Xcode.
// Two Gradle properties must be specified for this task:
// - calculator.configuration.name=[Release|Debug]
// - calculator.framework.location
task buildFrameworkForXcode {
if (isCalledFromXcode()) {
dependsOn kotlin.targets.ios.binaries.getFramework(getBuildTypeForXcode()).linkTask
}
doLast {
if (!isCalledFromXcode()) {
throw new Exception("Please run 'buildFrameworkForXcode' task with all necessary properties!")
}
def frameworkDir = kotlin.targets.ios.binaries.getFramework(getBuildTypeForXcode()).outputFile
println("from: ${frameworkDir.parentFile}")
println("into: ${getXcodeConfigurationBuildDir()}")
copy {
from frameworkDir.parentFile
into getXcodeConfigurationBuildDir()
include "${frameworkDir.name}/**"
include "${frameworkDir.name}.dSYM/**"
}
}
}
private boolean isCalledFromXcode() {
project.hasProperty('calculator.configuration.name') && project.hasProperty('calculator.framework.location')
}
private String getBuildTypeForXcode() {
project.properties['calculator.configuration.name'] as String
}
private String getXcodeConfigurationBuildDir() {
project.properties['calculator.framework.location'] as String
}