forked from JetBrains/kotlin-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Samples: Drop MPPTools + migrate to KTS
- Loading branch information
Showing
43 changed files
with
981 additions
and
980 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven("https://dl.bintray.com/kotlin/kotlin-dev") | ||
maven("https://dl.bintray.com/kotlin/kotlin-eap") | ||
} | ||
|
||
val kotlin_version: String by rootProject | ||
dependencies { | ||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
maven("https://dl.bintray.com/kotlin/kotlin-dev") | ||
maven("https://dl.bintray.com/kotlin/kotlin-eap") | ||
} | ||
} | ||
|
||
val hostOs = System.getProperty("os.name") | ||
val isMacos = hostOs == "Mac OS X" | ||
val isLinux = hostOs == "Linux" | ||
val isWindows = hostOs.startsWith("Windows") | ||
|
||
val localRepo = rootProject.file("build/.m2-local") | ||
|
||
val clean by tasks.creating(Delete::class) { | ||
delete(localRepo) | ||
} | ||
|
||
val buildSh by tasks.creating(Exec::class) { | ||
errorOutput = System.out | ||
isIgnoreExitValue = true | ||
workingDir = projectDir | ||
enabled = !isWindows | ||
if (isLinux || isMacos) { | ||
commandLine = listOf(projectDir.resolve("build.sh").toString()) | ||
} | ||
} | ||
|
||
val buildSamplesWithPlatformLibs by tasks.creating { | ||
dependsOn(":csvparser:assemble") | ||
dependsOn(":curl:assemble") | ||
dependsOn(":echoServer:assemble") | ||
dependsOn(":globalState:assemble") | ||
dependsOn(":html5Canvas:assemble") | ||
dependsOn(":workers:assemble") | ||
|
||
if (isMacos || isLinux) { | ||
dependsOn(":nonBlockingEchoServer:assemble") | ||
dependsOn(":tensorflow:assemble") | ||
} | ||
|
||
if (isMacos) { | ||
dependsOn(":objc:assemble") | ||
dependsOn(":opengl:assemble") | ||
dependsOn(":uikit:assemble") | ||
dependsOn(":coverage:assemble") | ||
} | ||
|
||
if (isWindows) { | ||
dependsOn(":win32:assemble") | ||
} | ||
} | ||
|
||
val buildAllSamples by tasks.creating { | ||
subprojects.forEach { | ||
dependsOn("${it.path}:assemble") | ||
} | ||
finalizedBy(buildSh) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetPreset | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
} | ||
|
||
// Determine host preset. | ||
val hostOs = System.getProperty("os.name") | ||
|
||
val hostPreset: KotlinNativeTargetPreset = when { | ||
hostOs == "Mac OS X" -> "macosX64" | ||
hostOs == "Linux" -> "linuxX64" | ||
hostOs.startsWith("Windows") -> "mingwX64" | ||
else -> throw GradleException("Host OS '$hostOs' is not supported in Kotlin/Native $project.") | ||
}.let { | ||
kotlin.presets[it] as KotlinNativeTargetPreset | ||
} | ||
|
||
kotlin { | ||
targetFromPreset(hostPreset, "csvParser") { | ||
binaries { | ||
executable { | ||
entryPoint = "sample.csvparser.main" | ||
runTask?.args("./European_Mammals_Red_List_Nov_2009.csv", 4, 100) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.