Commit 9a010d13 authored by qq_38816927's avatar qq_38816927

清空

parent 9b517c53
......@@ -184,28 +184,39 @@ configurations.all {
}
/** 仅清理 harmonyApp 下 entry 的中间目录,与 publish 无关时可单独执行:`:composeApp:cleanHarmonyAppEntryBuildsAndNativeLibs` */
tasks.register("cleanHarmonyAppEntryBuildsAndNativeLibs") {
tasks.register<Delete>("cleanHarmonyAppEntryBuildsAndNativeLibs") {
group = "harmony"
val repoRoot = layout.rootDirectory
doLast {
val root = repoRoot.get().asFile
listOf(
File(root, "harmonyApp/entry/build"),
File(root, "harmonyApp/entry/libs/arm64-v8a"),
File(root, "harmonyApp/entry/libs/x86_64"),
File(root, "harmonyApp/entry/src/main/cpp/include"),
).forEach { f ->
if (f.exists()) {
f.deleteRecursively()
}
}
val root = layout.rootDirectory
// delete(
// root.dir("harmonyApp/entry/build"),
// root.dir("harmonyApp/entry/libs/arm64-v8a"),
// root.dir("harmonyApp/entry/libs/x86_64"),
// root.dir("harmonyApp/entry/src/main/cpp/include"),
// )
doFirst {
getDelete().setFrom(project.files())
val dBuild = root.dir("harmonyApp/entry/build")
val fBuild: File = dBuild.get().asFile
if (fBuild.exists()) getDelete().from(dBuild)
val dArm64 = root.dir("harmonyApp/entry/libs/arm64-v8a")
val fArm64: File = dArm64.get().asFile
if (fArm64.exists()) getDelete().from(dArm64)
val dX86 = root.dir("harmonyApp/entry/libs/x86_64")
val fX86: File = dX86.get().asFile
if (fX86.exists()) getDelete().from(dX86)
val dInclude = root.dir("harmonyApp/entry/src/main/cpp/include")
val fInclude: File = dInclude.get().asFile
if (fInclude.exists()) getDelete().from(dInclude)
}
}
// 为不同类型(debug、release)OHOS构建注册Copy任务并发布到Harmony App目录
arrayOf("debug", "release").forEach { type ->
tasks.register<Copy>("publish${type.capitalizeUS()}BinariesToHarmonyApp") {
//dependsOn("cleanHarmonyAppEntryBuildsAndNativeLibs")
dependsOn("cleanHarmonyAppEntryBuildsAndNativeLibs")
group = "harmony" // 归类到harmony任务组
dependsOn("link${type.capitalizeUS()}SharedOhosArm64", "link${type.capitalizeUS()}SharedOhosX64")
duplicatesStrategy = DuplicatesStrategy.INCLUDE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment