forked from korlibs-archive/korgw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.project.gradle.kts.old
104 lines (93 loc) · 4.27 KB
/
build.project.gradle.kts.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
val hasAndroid: Boolean by rootProject.extra
val pname = "korui"
File(projectDir, "$pname/src/commonMain/kotlin/com/soywiz/$pname/internal/${pname.capitalize()}Version.kt").apply {
parentFile.mkdirs()
val newText = "package com.soywiz.$pname.internal\n\ninternal const val ${pname.toUpperCase()}_VERSION = \"${project.property("projectVersion")}\""
if (!exists() || (readText() != newText)) writeText(newText)
}
val projDeps = Deps().run { LinkedHashMap<String, List<Dep>>().apply {
val base = listOf(kotlinxCoroutines, klock, kmem, kds, korio, korma, korim)
val androidSupport = Dep {
if (hasAndroid) {
add("androidMainApi", "com.android.support:appcompat-v7:28.0.0")
}
}
this["kgl"] = base
this["korag"] = base
this["korag-format"] = base + korag
this["korag-opengl"] = base + korag + kgl
this["korev"] = base
this["korgw"] = base + korev + korag + kgl + koragOpengl + androidSupport
this["korgw-sample"] = base + korev + korag + kgl + koragOpengl + korgw
this["korui"] = base + korev + korag + kgl + koragOpengl
this["korui-sample"] = base + korev + korag + kgl + koragOpengl + korui
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
class Deps {
val kgl = Dep(project = ":kgl")
val korag = Dep(project = ":korag")
val koragOpengl = Dep(project = ":korag-opengl")
val korev = Dep(project = ":korev")
val korgw = Dep(project = ":korgw")
val korui = Dep(project = ":korui")
val korim = DepKorlib("korim")
val klock = DepKorlib("klock")
val korma = DepKorlib("korma")
val kmem = DepKorlib("kmem")
val kds = DepKorlib("kds")
val korio = DepKorlib("korio")
val kotlinxCoroutines = Dep {
val coroutinesVersion: String by project
val coroutines = "kotlinx-coroutines-core"
add("commonMainApi", "org.jetbrains.kotlinx:$coroutines-common:$coroutinesVersion")
add("jvmMainApi", "org.jetbrains.kotlinx:$coroutines:$coroutinesVersion")
add("jsMainApi", "org.jetbrains.kotlinx:$coroutines-js:$coroutinesVersion")
if (hasAndroid) {
add("androidMainApi", "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
add("androidTestImplementation", "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
}
add("linuxX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_linux_x64:$coroutinesVersion")
add("mingwX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_mingw_x64:$coroutinesVersion")
add("macosX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_macos_x64:$coroutinesVersion")
add("iosX64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_x64:$coroutinesVersion")
add("iosArm32MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_arm32:$coroutinesVersion")
add("iosArm64MainApi", "org.jetbrains.kotlinx:$coroutines-native_debug_ios_arm64:$coroutinesVersion")
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
fun DepKorlib(name: String) = Dep("com.soywiz:$name:${project.property("${name}Version")}")
class Dep(val commonName: String? = null, val project: String ? = null, val register: (DependencyHandlerScope.() -> Unit)? = null)
subprojects {
val deps = projDeps[project.name]
if (deps != null) {
dependencies {
for (dep in deps) {
if (dep.commonName != null) {
add("commonMainApi", dep.commonName)
add("commonTestImplementation", dep.commonName)
}
if (dep.project != null) {
add("commonMainApi", rootProject.project(dep.project))
add("commonTestImplementation", rootProject.project(dep.project))
}
dep.register?.invoke(this)
}
}
}
}
if (
org.apache.tools.ant.taskdefs.condition.Os.isFamily(org.apache.tools.ant.taskdefs.condition.Os.FAMILY_UNIX) &&
(File("/.dockerenv").exists() || System.getenv("TRAVIS") != null) &&
(File("/usr/bin/apt-get").exists())
) {
exec {
commandLine("sudo")
args("apt-get", "update")
}
exec {
commandLine("sudo")
args("apt-get", "-y", "install", "freeglut3-dev")
}
}