1cb93a386Sopenharmony_ciecho -e " 2cb93a386Sopenharmony_ci \033[31m buildConfig \033[0m 3cb93a386Sopenharmony_ci \033[32m recover \033[0m 4cb93a386Sopenharmony_ci" 5cb93a386Sopenharmony_ciback_file="./productdefine/common/inherit/rich_back.json" 6cb93a386Sopenharmony_ciread -p "请输入你的选择buildConfig|recover:" char 7cb93a386Sopenharmony_cicase $char in 8cb93a386Sopenharmony_cibuildConfig) 9cb93a386Sopenharmony_ci if [ -e "$back_file" ]; then 10cb93a386Sopenharmony_ci echo "已备份且配置" 11cb93a386Sopenharmony_ci else 12cb93a386Sopenharmony_ci echo "正在备份" 13cb93a386Sopenharmony_ci cp ./productdefine/common/inherit/rich.json ./productdefine/common/inherit/rich_back.json 14cb93a386Sopenharmony_ci cp ./base/hiviewdfx/hilog/interfaces/js/kits/napi/BUILD.gn ./base/hiviewdfx/hilog/interfaces/js/kits/napi/BUILD_back.gn 15cb93a386Sopenharmony_ci cp ./developtools/profiler/hidebug/interfaces/js/kits/napi/BUILD.gn ./developtools/profiler/hidebug/interfaces/js/kits/napi/BUILD_back.gn 16cb93a386Sopenharmony_ci cp ./base/hiviewdfx/hichecker/interfaces/js/kits/napi/BUILD.gn ./base/hiviewdfx/hichecker/interfaces/js/kits/napi/BUILD_back.gn 17cb93a386Sopenharmony_ci cp ./foundation/resourceschedule/ffrt/BUILD.gn ./foundation/resourceschedule/ffrt/BUILD_back.gn 18cb93a386Sopenharmony_ci cp ./third_party/skia/BUILD.gn ./third_party/skia/BUILD_back.gn 19cb93a386Sopenharmony_ci cp ./third_party/skia/bundle.json ./third_party/skia/bundle_back.json 20cb93a386Sopenharmony_ci cp ./foundation/communication/netstack/interfaces/kits/c/net_ssl/BUILD.gn ./foundation/communication/netstack/interfaces/kits/c/net_ssl/BUILD_back.gn 21cb93a386Sopenharmony_ci echo "备份完成" 22cb93a386Sopenharmony_ci echo "======================================" 23cb93a386Sopenharmony_ci echo "" 24cb93a386Sopenharmony_ci echo "STEP 1: add skia component" 25cb93a386Sopenharmony_ci echo "" 26cb93a386Sopenharmony_ci echo "======================================" 27cb93a386Sopenharmony_ci 28cb93a386Sopenharmony_ci target_file="./productdefine/common/inherit/rich.json" 29cb93a386Sopenharmony_ci sed -i '/"thirdparty"/{n;d}' ${target_file} 30cb93a386Sopenharmony_ci 31cb93a386Sopenharmony_ci target_line=' "components": [\ 32cb93a386Sopenharmony_ci {\ 33cb93a386Sopenharmony_ci "component": "skia",\ 34cb93a386Sopenharmony_ci "features": []\ 35cb93a386Sopenharmony_ci },' 36cb93a386Sopenharmony_ci 37cb93a386Sopenharmony_ci key_line='"thirdparty"' 38cb93a386Sopenharmony_ci 39cb93a386Sopenharmony_ci sed -i "/${key_line}/a\ ${target_line}" ${target_file} 40cb93a386Sopenharmony_ci 41cb93a386Sopenharmony_ci echo "======================================" 42cb93a386Sopenharmony_ci echo "" 43cb93a386Sopenharmony_ci echo " STEP 2: modify napi api" 44cb93a386Sopenharmony_ci echo "" 45cb93a386Sopenharmony_ci echo "======================================" 46cb93a386Sopenharmony_ci 47cb93a386Sopenharmony_ci api_target_gn_file="./base/hiviewdfx/hilog/interfaces/js/kits/napi/BUILD.gn" 48cb93a386Sopenharmony_ci 49cb93a386Sopenharmony_ci sed -i '/output_name/s/libhilog/libhilognapi/g' ${api_target_gn_file} 50cb93a386Sopenharmony_ci 51cb93a386Sopenharmony_ci api_target_file="./developtools/profiler/hidebug/interfaces/js/kits/napi/BUILD.gn" 52cb93a386Sopenharmony_ci api_target_line='output_name = "libhidebugnapi"' 53cb93a386Sopenharmony_ci sed -i "/ohos_shared_library/a\ ${api_target_line}" ${api_target_file} 54cb93a386Sopenharmony_ci 55cb93a386Sopenharmony_ci api_target_file="./base/hiviewdfx/hichecker/interfaces/js/kits/napi/BUILD.gn" 56cb93a386Sopenharmony_ci api_target_line='output_name = "napihichecker"' 57cb93a386Sopenharmony_ci sed -i "/ohos_shared_library/a\ ${api_target_line}" ${api_target_file} 58cb93a386Sopenharmony_ci 59cb93a386Sopenharmony_ci api_target_file="./foundation/resourceschedule/ffrt/BUILD.gn" 60cb93a386Sopenharmony_ci api_target_line='output_name = "libffrt_ndk"' 61cb93a386Sopenharmony_ci sed -i "/ohos_shared_library/a\ ${api_target_line}" ${api_target_file} 62cb93a386Sopenharmony_ci 63cb93a386Sopenharmony_ci api_target_file="./third_party/skia/BUILD.gn" 64cb93a386Sopenharmony_ci sed -i 's/^.*"-flto=thin".*/#&/' ${api_target_file} 65cb93a386Sopenharmony_ci sed -i 's/^.*"-fvisibility=hidden".*/#&/' ${api_target_file} 66cb93a386Sopenharmony_ci sed -i 's/^.*"-fvisibility-inlines-hidden".*/#&/' ${api_target_file} 67cb93a386Sopenharmony_ci 68cb93a386Sopenharmony_ci api_target_file="./foundation/communication/netstack/interfaces/kits/c/net_ssl/BUILD.gn" 69cb93a386Sopenharmony_ci sed -i 's/^.*output_name = "net_ssl".*/#&/' ${api_target_file} 70cb93a386Sopenharmony_ci sed -i 's/^.*output_extension = "so".*/#&/' ${api_target_file} 71cb93a386Sopenharmony_ci 72cb93a386Sopenharmony_ci api_target_line='output_name = "net_ssl"' 73cb93a386Sopenharmony_ci sed -i "/^.*libnet_ssl_ndk/a\ ${api_target_line}" ${api_target_file} 74cb93a386Sopenharmony_ci 75cb93a386Sopenharmony_ci echo "======================================" 76cb93a386Sopenharmony_ci echo "" 77cb93a386Sopenharmony_ci echo " STEP 3: add dm compilation" 78cb93a386Sopenharmony_ci echo "" 79cb93a386Sopenharmony_ci echo "======================================" 80cb93a386Sopenharmony_ci 81cb93a386Sopenharmony_ci skia_bundle_file="./third_party/skia/bundle.json" 82cb93a386Sopenharmony_ci 83cb93a386Sopenharmony_ci skia_pivot_line='inner_kits' 84cb93a386Sopenharmony_ci skia_target_line='"test": [ "//third_party/skia:dm(//build/toolchain/ohos:ohos_clang_arm)" ]' 85cb93a386Sopenharmony_ci 86cb93a386Sopenharmony_ci sed -i '/inner_kits/{n;d}' ${skia_bundle_file} 87cb93a386Sopenharmony_ci sed -i "/${skia_pivot_line}/a\ ${skia_target_line}" ${skia_bundle_file} 88cb93a386Sopenharmony_ci fi 89cb93a386Sopenharmony_ci ;; 90cb93a386Sopenharmony_cirecover) 91cb93a386Sopenharmony_ci if [ -e "$back_file" ]; then 92cb93a386Sopenharmony_ci mv ./productdefine/common/inherit/rich_back.json ./productdefine/common/inherit/rich.json 93cb93a386Sopenharmony_ci mv ./base/hiviewdfx/hilog/interfaces/js/kits/napi/BUILD_back.gn ./base/hiviewdfx/hilog/interfaces/js/kits/napi/BUILD.gn 94cb93a386Sopenharmony_ci mv ./developtools/profiler/hidebug/interfaces/js/kits/napi/BUILD_back.gn ./developtools/profiler/hidebug/interfaces/js/kits/napi/BUILD.gn 95cb93a386Sopenharmony_ci mv ./base/hiviewdfx/hichecker/interfaces/js/kits/napi/BUILD_back.gn ./base/hiviewdfx/hichecker/interfaces/js/kits/napi/BUILD.gn 96cb93a386Sopenharmony_ci 97cb93a386Sopenharmony_ci mv ./foundation/resourceschedule/ffrt/BUILD_back.gn ./foundation/resourceschedule/ffrt/BUILD.gn 98cb93a386Sopenharmony_ci mv ./third_party/skia/BUILD_back.gn ./third_party/skia/BUILD.gn 99cb93a386Sopenharmony_ci mv ./third_party/skia/bundle_back.json ./third_party/skia/bundle.json 100cb93a386Sopenharmony_ci mv ./foundation/communication/netstack/interfaces/kits/c/net_ssl/BUILD_back.gn ./foundation/communication/netstack/interfaces/kits/c/net_ssl/BUILD.gn 101cb93a386Sopenharmony_ci echo "恢复完成" 102cb93a386Sopenharmony_ci else 103cb93a386Sopenharmony_ci echo "没有备份的文件可恢复" 104cb93a386Sopenharmony_ci fi 105cb93a386Sopenharmony_ci ;; 106cb93a386Sopenharmony_ci*) 107cb93a386Sopenharmony_ci echo "输入不正确!请重新输入。" 108cb93a386Sopenharmony_ci ;; 109cb93a386Sopenharmony_ciesac 110