
【主 题】:不从配置文件远端获取 ArduinoJson库 添加到根目录调用 【描 述】: [原因]:防止版本不同 造成bug [过程]: [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
30 lines
647 B
Bash
30 lines
647 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
ARDUINOJSON_H="$1"
|
|
|
|
read_string() {
|
|
jq --slurp --raw-input '.' "$1"
|
|
}
|
|
|
|
compile() {
|
|
FILE_PATH="$(dirname $0)/$1.cpp"
|
|
cat >parameters.json <<END
|
|
{
|
|
"code":$(read_string "$FILE_PATH"),
|
|
"codes": [{"file":"ArduinoJson.h","code":$(read_string "$ARDUINOJSON_H")}],
|
|
"options": "warning",
|
|
"compiler": "gcc-4.9.4",
|
|
"save": true
|
|
}
|
|
END
|
|
URL=$(curl -sS -H "Content-type: application/json" -d @parameters.json https://wandbox.org/api/compile.json | jq --raw-output .url)
|
|
rm parameters.json
|
|
[ -n "$URL" ] && echo "$1: $URL"
|
|
}
|
|
|
|
compile "JsonGeneratorExample"
|
|
compile "JsonParserExample"
|
|
compile "MsgPackParserExample"
|