Samples: Don't call MPPTools from 'kotlin {}' block. #2277 (#2280)

This commit is contained in:
Dmitriy Dolovov
2018-10-30 15:03:53 +07:00
committed by GitHub
parent f5280940ae
commit 4f0633412d
17 changed files with 56 additions and 47 deletions
+1 -5
View File
@@ -52,14 +52,10 @@ fun defaultHostPreset(
else -> null
}
val preset = if (presetCandidate != null && presetCandidate in whitelist)
return if (presetCandidate != null && presetCandidate in whitelist)
presetCandidate
else
throw Exception("Host OS '$hostOs' is not supported in Kotlin/Native ${subproject.displayName}.")
subproject.ext.set("hostPreset", preset)
return preset
}
// A short-cut to add a Kotlin/Native run task.
+4 -1
View File
@@ -2,9 +2,12 @@ plugins {
id 'kotlin-multiplatform'
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project)
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project), 'csvParser') {
fromPreset(hostPreset, 'csvParser') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.csvparser.main'
}
+3 -7
View File
@@ -1,5 +1,3 @@
import java.nio.file.Paths
plugins {
id 'kotlin-multiplatform'
}
@@ -10,12 +8,10 @@ repositories {
maven { url = "file://$localRepo" }
}
kotlin {
presets {
// Determine host preset.
MPPTools.defaultHostPreset(project, [macosX64, linuxX64])
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(hostPreset, 'curl') {
compilations.main.outputKinds 'EXECUTABLE'
+4 -1
View File
@@ -2,9 +2,12 @@ plugins {
id 'kotlin-multiplatform'
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project)
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project), 'echoServer') {
fromPreset(hostPreset, 'echoServer') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.echoserver.main'
}
+3 -5
View File
@@ -2,12 +2,10 @@ plugins {
id 'kotlin-multiplatform'
}
kotlin {
presets {
// Determine host preset.
MPPTools.defaultHostPreset(project, [macosX64, linuxX64])
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(hostPreset, 'gitChurn') {
compilations.main.outputKinds 'EXECUTABLE'
+4 -1
View File
@@ -2,9 +2,12 @@ plugins {
id 'kotlin-multiplatform'
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project)
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project), 'globalState') {
fromPreset(hostPreset, 'globalState') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.globalstate.main'
compilations.main.cinterops {
+3 -5
View File
@@ -2,12 +2,10 @@ plugins {
id 'kotlin-multiplatform'
}
kotlin {
presets {
// Determine host preset.
MPPTools.defaultHostPreset(project, [macosX64, linuxX64])
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(hostPreset, 'gtk') {
compilations.main.outputKinds 'EXECUTABLE'
+3 -5
View File
@@ -20,12 +20,10 @@ task cleanLocalRepo(type: Delete) {
delete localRepo
}
kotlin {
presets {
// Determine host preset.
MPPTools.defaultHostPreset(project, [macosX64, linuxX64])
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(hostPreset, 'libcurl') {
compilations.main.cinterops {
+3 -5
View File
@@ -2,12 +2,10 @@ plugins {
id 'kotlin-multiplatform'
}
kotlin {
presets {
// Determine host preset.
MPPTools.defaultHostPreset(project, [macosX64, linuxX64])
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(hostPreset, 'nonBlockingEchoServer') {
compilations.main.outputKinds 'EXECUTABLE'
+4 -1
View File
@@ -2,9 +2,12 @@ plugins {
id 'kotlin-multiplatform'
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64])
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project, [presets.macosX64]), 'objc') {
fromPreset(hostPreset, 'objc') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.objc.main'
}
+4 -1
View File
@@ -2,9 +2,12 @@ plugins {
id 'kotlin-multiplatform'
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64])
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project, [presets.macosX64]), 'opengl') {
fromPreset(hostPreset, 'opengl') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.opengl.main'
}
+4 -1
View File
@@ -4,9 +4,12 @@ plugins {
def tensorflowHome = "${MPPTools.kotlinNativeDataPath()}/third-party/tensorflow"
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project, [presets.macosX64, presets.linuxX64]), 'tensorflow') {
fromPreset(hostPreset, 'tensorflow') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.tensorflow.main'
compilations.main.linkerOpts "-L$tensorflowHome/lib", '-ltensorflow'
+1 -1
View File
@@ -3,7 +3,7 @@ plugins {
}
File winCompiledResourceFile = file("$buildDir/compiledWindowsResources/Tetris.res")
project.ext.hostPreset = determinePreset()
def hostPreset = determinePreset()
kotlin {
targets {
+4 -1
View File
@@ -4,9 +4,12 @@ plugins {
def torchHome = "${MPPTools.kotlinNativeDataPath()}/third-party/torch"
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project, [presets.macosX64, presets.linuxX64]), 'torch') {
fromPreset(hostPreset, 'torch') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.torch.main'
compilations.main.linkerOpts "-L$torchHome/lib", '-lATen'
+3 -5
View File
@@ -2,12 +2,10 @@ plugins {
id 'kotlin-multiplatform'
}
kotlin {
presets {
// Determine host preset.
MPPTools.defaultHostPreset(project, [macosX64, linuxX64, mingwX64])
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
kotlin {
targets {
fromPreset(hostPreset, 'videoPlayer') {
compilations.main.outputKinds 'EXECUTABLE'
+4 -1
View File
@@ -2,9 +2,12 @@ plugins {
id 'kotlin-multiplatform'
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.mingwX64])
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project, [presets.mingwX64]), 'win32') {
fromPreset(hostPreset, 'win32') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.win32.main'
compilations.main.linkerOpts '-Wl,--subsystem,windows'
+4 -1
View File
@@ -2,9 +2,12 @@ plugins {
id 'kotlin-multiplatform'
}
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project)
kotlin {
targets {
fromPreset(MPPTools.defaultHostPreset(project), 'workers') {
fromPreset(hostPreset, 'workers') {
compilations.main.outputKinds 'EXECUTABLE'
compilations.main.entryPoint 'sample.workers.main'
}