From 6d948a42bbc2f952e2cd8bb5273b629f3343df8b Mon Sep 17 00:00:00 2001
From: Caoruihong <crh.cao@huawei.com>
Date: Sat, 10 Jul 2021 19:36:44 +0800
Subject: [PATCH] chore: place .config files under config dir of products

place .config files under config dir of products

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I80c6641ae462d4888a6f3124f92b4c9d7fa1567b
---
 BUILD.gn            |  6 +-----
 build.sh            | 33 +++++++++++----------------------
 kernel_test.sources |  1 -
 3 files changed, 12 insertions(+), 28 deletions(-)
 delete mode 100644 kernel_test.sources

diff --git a/BUILD.gn b/BUILD.gn
index af86842e..df7704a6 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -73,14 +73,10 @@ lite_subsystem("kernel") {
 
 build_ext_component("make") {
   exec_path = rebase_path(".", root_build_dir)
-  tee_enable = "false"
-  if (board_name == "hi3516dv300" && enable_tee_ree) {
-    tee_enable = "tee"
-  }
   outdir = rebase_path(get_path_info(".", "out_dir"))
   sysroot_path = rebase_path(ohos_current_sysroot)
   arch_cflags = string_join(" ", target_arch_cflags)
-  command = "./build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable}"
+  command = "./build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} \"${tee_enable}\""
   command += " \"${device_company}\" \"${product_path}\" $outdir \"${ohos_version}\" ${sysroot_path} \"${arch_cflags}\""
   command += " \"${device_path}\""
 }
diff --git a/build.sh b/build.sh
index 70ffc687..16794d13 100755
--- a/build.sh
+++ b/build.sh
@@ -48,44 +48,33 @@ echo "sh param:" "$@"
 
 function main() {
     destination=".config"
-    config_file=""
     tee=""
-    if [ "${tee_enable}" = "tee" ]; then
+    if [ "${tee_enable}" = "true" ]; then
         tee="_tee"
     fi
+
+    config_file="${product_path}/config/${ohos_build_type}${tee}.config"
+    if [ -f "${config_file}" ]; then
+        cp "${config_file}" "${destination}"
+        return
+    fi
+
     product_name=$(basename "${product_path}")
-    source="tools/build/config/${product_name}_release.config"
+    config_file="${product_name}_release.config"
     if [ "${ohos_build_compiler}" = "clang" ]; then
         if [ "${ohos_build_type}" = "debug" ]; then
-            config_file="${product_name}_${ohos_build_compiler}${tee}.config"
-            source="tools/build/config/debug/${config_file}"
+            config_file="debug/${product_name}_${ohos_build_compiler}${tee}.config"
         else
             config_file="${product_name}_${ohos_build_compiler}_release${tee}.config"
-            source="tools/build/config/${config_file}"
         fi
     elif [ "${ohos_build_compiler}" = "gcc" ]; then
         if [ "${ohos_build_type}" = "debug" ]; then
             config_file="${product_name}_debug_shell${tee}.config"
-            source="tools/build/config/${config_file}"
         else
             config_file="${product_name}_release${tee}.config"
-            source="tools/build/config/${config_file}"
         fi
     fi
-    if [ -d "./out" ]; then
-        rm -rf ./out
-    fi
-    if [ -f "${destination}" ]; then
-        rm -rf ${destination}
-    fi
-    if [ ! -f "${source}" ]; then
-        source="${product_path}/config/sys/${config_file}"
-    fi
-    cp "${source}" ${destination}
-
-    test_info_outdir="../..${root_build_dir}/test_info/gen/kernel/test"
-    mkdir -p "${test_info_outdir}"
-    cp kernel_test.sources "${test_info_outdir}"
+    cp "tools/build/config/${config_file}" "${destination}"
 }
 
 if [ "x" != "x${sysroot_path}" ]; then
diff --git a/kernel_test.sources b/kernel_test.sources
deleted file mode 100644
index cab52bfd..00000000
--- a/kernel_test.sources
+++ /dev/null
@@ -1 +0,0 @@
-../../kernel/liteos_a/test/apps/src/osTest.c