加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
make_ark_styles.sh 2.74 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
# release build by default
isRelease=true
# out path
out=./out
# release file path
release=./out/arkStyles.js
# debug file path
debug=./out/arkStyles_debug.js
# engine path
engine=./engine
# engine output path
engine_output=./engine/arkStyles.js
# read arguments
# -d means debug build with console.log usages
while getopts d OPT
do
case "$OPT" in
d) isRelease=false ;;
?) ;;
esac
done
# remove last output
if [ -d "$out" ]; then
rm -rf $out
fi
# compile solution
tsc --build tsconfig.json
# remove stabs
sed -i '/<!-- BOF CLEAN -->/,/<!-- EOF CLEAN -->/d' $release
# remove shapes tokens usage
sed -i '/if (SHAPES_TOKENS_ARE_ENABLED)/,/SHAPES_TOKENS_ARE_ENABLED END/d' $release
# remove typography tokens usage
sed -i '/if (TYPOGRAPHY_TOKENS_ARE_ENABLED)/,/TYPOGRAPHY_TOKENS_ARE_ENABLED END/d' $release
# remove other tokens usage
sed -i '/if (OTHER_TOKENS_ARE_ENABLED)/,/OTHER_TOKENS_ARE_ENABLED END/d' $release
# add header
sed -i '1i /*' $release
sed -i '2i \ * Copyright (c) 2024 Huawei Device Co., Ltd.' $release
sed -i '3i \ * Licensed under the Apache License, Version 2.0 (the "License");' $release
sed -i '4i \ * you may not use this file except in compliance with the License.' $release
sed -i '5i \ * You may obtain a copy of the License at' $release
sed -i '6i \ *' $release
sed -i '7i \ * http://www.apache.org/licenses/LICENSE-2.0' $release
sed -i '8i \ *' $release
sed -i '9i \ * Unless required by applicable law or agreed to in writing, software' $release
sed -i '10i\ * distributed under the License is distributed on an "AS IS" BASIS,' $release
sed -i '11i\ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.' $release
sed -i '12i\ * See the License for the specific language governing permissions and' $release
sed -i '13i\ * limitations under the License.' $release
sed -i '14i\ */' $release
sed -i '15i /* THIS IS AUTOGENERATED FILE, PLEASE DON`T CHANGE IT MANUALLY */' $release
# copy debug version
cp $release $debug
# remove logs for release version
sed -i '/console.log/d' $release
# move library to 'engine' dirrectory
if [ ! -d "$engine" ];
then
mkdir $engine
else
rm $engine_output
fi
if "$isRelease"
then
cp $release $engine_output
else
cp $debug $engine_output
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化