ci: 完善构建流程和中国网络环境加速

This commit is contained in:
mofeng-git
2026-06-10 09:48:42 +08:00
parent 921c00c472
commit 4b65eebd5d
29 changed files with 7166 additions and 367 deletions

View File

@@ -44,8 +44,6 @@ val oneKvmVersion = Regex("""(?m)^version\s*=\s*"([^"]+)"""")
?.groupValues
?.get(1)
?: throw GradleException("Failed to resolve version from root Cargo.toml")
val androidFfmpegSourceDir = rootProject.layout.projectDirectory
.dir("../.tmp/android-ffmpeg-check/src/ffmpeg-rockchip")
val localProperties = Properties().apply {
val file = rootProject.file("local.properties")
if (file.exists()) {
@@ -207,7 +205,6 @@ tasks.register<Exec>("buildAndroidFfmpegMediaCodec") {
group = "build"
val ffmpegRoot = file(androidFfmpegRoot.get())
val sourceDir = androidFfmpegSourceDir.asFile
val scriptFile = androidFfmpegBuildScript.asFile
val stampFile = ffmpegRoot.resolve(".one-kvm-android-ffmpeg.stamp")
@@ -215,8 +212,6 @@ tasks.register<Exec>("buildAndroidFfmpegMediaCodec") {
commandLine(
"bash",
scriptFile.absolutePath,
"--source",
sourceDir.absolutePath,
"--output",
ffmpegRoot.absolutePath,
"--ndk",
@@ -227,7 +222,6 @@ tasks.register<Exec>("buildAndroidFfmpegMediaCodec") {
selectedAndroidAbis.joinToString(","),
)
inputs.dir(sourceDir)
inputs.file(scriptFile)
outputs.dir(ffmpegRoot)
@@ -235,12 +229,6 @@ tasks.register<Exec>("buildAndroidFfmpegMediaCodec") {
val hasAndroidFfmpeg = androidFfmpegRequiredFiles(ffmpegRoot).all { it.exists() }
val hasCurrentBuildStamp =
stampFile.exists() && stampFile.readText() == androidFfmpegBuildStamp(scriptFile)
if (!hasAndroidFfmpeg && !sourceDir.resolve("configure").exists()) {
throw GradleException(
"Missing Android FFmpeg MediaCodec build at ${ffmpegRoot.absolutePath}, " +
"and source was not found at ${sourceDir.absolutePath}",
)
}
!hasAndroidFfmpeg || !hasCurrentBuildStamp
}

View File

@@ -1,5 +1,16 @@
pluginManagement {
fun isEnabled(value: String?): Boolean = when (value?.lowercase()) {
"1", "true", "yes", "on" -> true
else -> false
}
val mirrorAcceleration = isEnabled(System.getenv("CHINAMIRRO"))
repositories {
if (mirrorAcceleration) {
maven("https://maven.aliyun.com/repository/google")
maven("https://maven.aliyun.com/repository/public")
maven("https://maven.aliyun.com/repository/gradle-plugin")
}
google()
mavenCentral()
gradlePluginPortal()
@@ -7,8 +18,18 @@ pluginManagement {
}
dependencyResolutionManagement {
fun isEnabled(value: String?): Boolean = when (value?.lowercase()) {
"1", "true", "yes", "on" -> true
else -> false
}
val mirrorAcceleration = isEnabled(System.getenv("CHINAMIRRO"))
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
if (mirrorAcceleration) {
maven("https://maven.aliyun.com/repository/google")
maven("https://maven.aliyun.com/repository/public")
}
google()
mavenCentral()
}