Repository navigation
Expand file tree
/
Copy pathsettings.gradle.kts
More file actions
51 lines (46 loc) · 1.79 KB
/
Copy pathsettings.gradle.kts
File metadata and controls
51 lines (46 loc) · 1.79 KB
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
import java.util.Properties
pluginManagement {
includeBuild("build-logic")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
rootProject.name = "tinyui"
include(":compose")
include(":updates")
// as an included build of a host App only the library is wanted; the sample would drag its Node toolchain and app shell into that composite
if (gradle.parent == null) {
include(":sample:shared")
include(":sample:androidApp")
}
// 本地联调 quickjs-kmp:local.properties 写 quickjs-kmp.dir=<仓路径> 即从源码构建,
// 坐标 → 项目路径的映射由该仓 gradle/composite-substitutions 声明;CI 没有 local.properties,解析 Maven 版本。
val localProperties = file("local.properties").takeIf { it.exists() }?.let { f ->
Properties().apply { f.inputStream().use { load(it) } }
}
localProperties?.getProperty("quickjs-kmp.dir")?.let { dir ->
val sdkDir = file(dir)
require(sdkDir.isDirectory) { "quickjs-kmp.dir 不存在: $sdkDir" }
// 构建脚本据此取该仓的宿主产物(qjsc-kmp、host JNI 库)
gradle.extra["quickjs-kmp.dir"] = sdkDir
includeBuild(sdkDir) {
name = "quickjs-kmp" // 构建脚本按这个名字引用它的任务,不依赖目录名
dependencySubstitution {
sdkDir.resolve("gradle/composite-substitutions").readLines()
.map { it.substringBefore('#').trim() }
.filter { it.isNotEmpty() }
.forEach { line ->
val (coordinate, projectPath) = line.split("=", limit = 2).map(String::trim)
substitute(module(coordinate)).using(project(projectPath))
}
}
}
}