Commit 4b151778 authored by qq_38816927's avatar qq_38816927

修改清除方法

parent 9a010d13
...@@ -184,35 +184,22 @@ configurations.all { ...@@ -184,35 +184,22 @@ configurations.all {
} }
/** 仅清理 harmonyApp 下 entry 的中间目录,与 publish 无关时可单独执行:`:composeApp:cleanHarmonyAppEntryBuildsAndNativeLibs` */ /** 仅清理 harmonyApp 下 entry 的中间目录,与 publish 无关时可单独执行:`:composeApp:cleanHarmonyAppEntryBuildsAndNativeLibs` */
tasks.register<Delete>("cleanHarmonyAppEntryBuildsAndNativeLibs") { tasks.register("cleanHarmonyAppEntryBuildsAndNativeLibs") {
group = "harmony" group = "harmony"
val root = layout.rootDirectory notCompatibleWithConfigurationCache("脚本里按存在性删除,动作无法纳入配置缓存序列化")
// delete( val basePath = rootProject.rootDir.absolutePath
// root.dir("harmonyApp/entry/build"), doLast {
// root.dir("harmonyApp/entry/libs/arm64-v8a"), val base = File(basePath)
// root.dir("harmonyApp/entry/libs/x86_64"), val entryBuild = File(base, "harmonyApp/entry/build")
// root.dir("harmonyApp/entry/src/main/cpp/include"), if (entryBuild.exists()) entryBuild.deleteRecursively()
// ) val libsArm64 = File(base, "harmonyApp/entry/libs/arm64-v8a")
doFirst { if (libsArm64.exists()) libsArm64.deleteRecursively()
getDelete().setFrom(project.files()) val libsX86 = File(base, "harmonyApp/entry/libs/x86_64")
val dBuild = root.dir("harmonyApp/entry/build") if (libsX86.exists()) libsX86.deleteRecursively()
val fBuild: File = dBuild.get().asFile val cppInclude = File(base, "harmonyApp/entry/src/main/cpp/include")
if (fBuild.exists()) getDelete().from(dBuild) if (cppInclude.exists()) cppInclude.deleteRecursively()
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目录 // 为不同类型(debug、release)OHOS构建注册Copy任务并发布到Harmony App目录
arrayOf("debug", "release").forEach { type -> arrayOf("debug", "release").forEach { type ->
tasks.register<Copy>("publish${type.capitalizeUS()}BinariesToHarmonyApp") { tasks.register<Copy>("publish${type.capitalizeUS()}BinariesToHarmonyApp") {
......
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