Skip to content

Commit 8b9b9c4

Browse files
committed
Fix indentation
1 parent 6ca98c3 commit 8b9b9c4

File tree

3 files changed

+133
-133
lines changed

3 files changed

+133
-133
lines changed

tools/archive-build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ archive_path="dist/arduino-esp32-libs-$1-$idf_version_string.tar.gz"
88

99
mkdir -p dist && rm -rf "$archive_path"
1010
if [ -d "out" ]; then
11-
cd out && tar zcf "../$archive_path" * && cd ..
11+
cd out && tar zcf "../$archive_path" * && cd ..
1212
fi

tools/copy-to-arduino.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
source ./tools/config.sh
33

44
if [ -z $ESP32_ARDUINO ]; then
5-
if [[ "$AR_OS" == "macos" ]]; then
6-
ESP32_ARDUINO="$HOME/Documents/Arduino/hardware/espressif/esp32"
7-
else
8-
ESP32_ARDUINO="$HOME/Arduino/hardware/espressif/esp32"
9-
fi
5+
if [[ "$AR_OS" == "macos" ]]; then
6+
ESP32_ARDUINO="$HOME/Documents/Arduino/hardware/espressif/esp32"
7+
else
8+
ESP32_ARDUINO="$HOME/Arduino/hardware/espressif/esp32"
9+
fi
1010
fi
1111

1212
if ! [ -d "$ESP32_ARDUINO" ]; then
13-
echo "ERROR: Target arduino folder does not exist!"
14-
exit 1
13+
echo "ERROR: Target arduino folder does not exist!"
14+
exit 1
1515
fi
1616

1717
echo "Installing new libraries to $ESP32_ARDUINO"

tools/push-to-arduino.sh

+125-125
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
source ./tools/config.sh
33

44
if [ -x $GITHUB_TOKEN ]; then
5-
echo "ERROR: GITHUB_TOKEN was not defined"
6-
exit 1
5+
echo "ERROR: GITHUB_TOKEN was not defined"
6+
exit 1
77
fi
88

99
if ! [ -d "$AR_COMPS/arduino" ]; then
10-
echo "ERROR: Target arduino folder does not exist!"
11-
exit 1
10+
echo "ERROR: Target arduino folder does not exist!"
11+
exit 1
1212
fi
1313

1414
# setup git for pushing
@@ -25,134 +25,134 @@ git config --global user.email "[email protected]"
2525
#
2626

2727
if [ $LIBS_HAS_COMMIT == "0" ] || [ $AR_HAS_COMMIT == "0" ]; then
28-
cd "$AR_ROOT"
29-
# create branch if necessary
30-
if [ "$LIBS_HAS_BRANCH" == "1" ]; then
31-
echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists"
32-
echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
33-
git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME
34-
else
35-
echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
36-
git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME
37-
fi
38-
if [ $? -ne 0 ]; then
39-
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
40-
exit 1
41-
fi
42-
43-
# make changes to the files
44-
echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
45-
rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/esp32-arduino-libs/* $IDF_LIBS_DIR/
46-
47-
cd $IDF_LIBS_DIR
48-
if [ -f "README.md" ]; then
49-
rm -rf "README.md"
50-
fi
51-
52-
# did any of the files change?
53-
if [ -n "$(git status --porcelain)" ]; then
54-
echo "Pushing changes to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
55-
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
56-
if [ $? -ne 0 ]; then
57-
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
58-
exit 1
59-
fi
60-
IDF_LIBS_COMMIT=`git rev-parse --verify HEAD`
61-
IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT"
62-
# ToDo: this URL needs to get into Arduino's package.json
63-
64-
# Download the file
65-
filename="esp32-arduino-libs-$IDF_LIBS_COMMIT.zip"
66-
curl -s -o "$filename" "$IDF_LIBS_DL_URL"
67-
68-
# Check if the download was successful
69-
if [ $? -ne 0 ]; then
70-
echo "Error downloading file from $IDF_LIBS_DL_URL"
71-
exit 1
72-
fi
73-
74-
# Calculate the size in bytes and SHA-256 sum
75-
size=$(stat -c%s "$filename")
76-
sha256sum=$(sha256sum "$filename" | awk '{print $1}')
77-
78-
# Clean up the downloaded file
79-
rm "$filename"
80-
81-
# Print the results
82-
echo "Tool: esp32-arduino-libs"
83-
echo "Version: $LIBS_VERSION"
84-
echo "URL: $IDF_LIBS_DL_URL"
85-
echo "File: $filename"
86-
echo "Size: $size bytes"
87-
echo "SHA-256: $sha256sum"
88-
echo "JSON: $AR_OUT/package_esp32_index.template.json"
89-
cd "$AR_ROOT"
90-
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_DL_URL" -f "$filename" -s "$size" -c "$sha256sum"
91-
if [ $? -ne 0 ]; then exit 1; fi
92-
93-
else
94-
echo "No changes in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'"
95-
if [ $LIBS_HAS_BRANCH == "0" ]; then
96-
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
97-
git branch -d $AR_NEW_BRANCH_NAME
98-
fi
99-
exit 0
100-
fi
28+
cd "$AR_ROOT"
29+
# create branch if necessary
30+
if [ "$LIBS_HAS_BRANCH" == "1" ]; then
31+
echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists"
32+
echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
33+
git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME
34+
else
35+
echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
36+
git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME
37+
fi
38+
if [ $? -ne 0 ]; then
39+
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
40+
exit 1
41+
fi
42+
43+
# make changes to the files
44+
echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
45+
rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/esp32-arduino-libs/* $IDF_LIBS_DIR/
46+
47+
cd $IDF_LIBS_DIR
48+
if [ -f "README.md" ]; then
49+
rm -rf "README.md"
50+
fi
51+
52+
# did any of the files change?
53+
if [ -n "$(git status --porcelain)" ]; then
54+
echo "Pushing changes to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
55+
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
56+
if [ $? -ne 0 ]; then
57+
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
58+
exit 1
59+
fi
60+
IDF_LIBS_COMMIT=`git rev-parse --verify HEAD`
61+
IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT"
62+
# ToDo: this URL needs to get into Arduino's package.json
63+
64+
# Download the file
65+
filename="esp32-arduino-libs-$IDF_LIBS_COMMIT.zip"
66+
curl -s -o "$filename" "$IDF_LIBS_DL_URL"
67+
68+
# Check if the download was successful
69+
if [ $? -ne 0 ]; then
70+
echo "Error downloading file from $IDF_LIBS_DL_URL"
71+
exit 1
72+
fi
73+
74+
# Calculate the size in bytes and SHA-256 sum
75+
size=$(stat -c%s "$filename")
76+
sha256sum=$(sha256sum "$filename" | awk '{print $1}')
77+
78+
# Clean up the downloaded file
79+
rm "$filename"
80+
81+
# Print the results
82+
echo "Tool: esp32-arduino-libs"
83+
echo "Version: $LIBS_VERSION"
84+
echo "URL: $IDF_LIBS_DL_URL"
85+
echo "File: $filename"
86+
echo "Size: $size bytes"
87+
echo "SHA-256: $sha256sum"
88+
echo "JSON: $AR_OUT/package_esp32_index.template.json"
89+
cd "$AR_ROOT"
90+
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_DL_URL" -f "$filename" -s "$size" -c "$sha256sum"
91+
if [ $? -ne 0 ]; then exit 1; fi
92+
93+
else
94+
echo "No changes in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'"
95+
if [ $LIBS_HAS_BRANCH == "0" ]; then
96+
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
97+
git branch -d $AR_NEW_BRANCH_NAME
98+
fi
99+
exit 0
100+
fi
101101
fi
102102

103103
#
104104
# esp32-arduino
105105
#
106106

107107
if [ $AR_HAS_COMMIT == "0" ]; then
108-
cd "$AR_ROOT"
109-
# create or checkout the branch
110-
if [ ! $AR_HAS_BRANCH == "0" ]; then
111-
echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..."
112-
git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME
113-
else
114-
echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..."
115-
git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME
116-
fi
117-
if [ $? -ne 0 ]; then
118-
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
119-
exit 1
120-
fi
121-
122-
# make changes to the files
123-
echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..."
124-
rm -rf "$AR_COMPS/arduino/package/package_esp32_index.template.json" && cp -f "$AR_OUT/package_esp32_index.template.json" "$AR_COMPS/arduino/package/package_esp32_index.template.json"
125-
126-
cd $AR_COMPS/arduino
127-
128-
# did any of the files change?
129-
if [ -n "$(git status --porcelain)" ]; then
130-
echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..."
131-
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
132-
if [ $? -ne 0 ]; then
133-
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
134-
exit 1
135-
fi
136-
else
137-
echo "No changes in branch '$AR_NEW_BRANCH_NAME'"
138-
if [ $AR_HAS_BRANCH == "0" ]; then
139-
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
140-
git branch -d $AR_NEW_BRANCH_NAME
141-
fi
142-
exit 0
143-
fi
144-
145-
# CREATE PULL REQUEST
146-
if [ "$AR_HAS_PR" == "0" ]; then
147-
echo "Creating PR '$AR_NEW_PR_TITLE'..."
148-
pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"`
149-
if [ $pr_created == "0" ]; then
150-
echo "ERROR: Failed to create PR '$AR_NEW_PR_TITLE': "`echo "$git_create_pr_res" | jq -r '.message'`": "`echo "$git_create_pr_res" | jq -r '.errors[].message'`
151-
exit 1
152-
fi
153-
else
154-
echo "PR '$AR_NEW_PR_TITLE' Already Exists"
155-
fi
108+
cd "$AR_ROOT"
109+
# create or checkout the branch
110+
if [ ! $AR_HAS_BRANCH == "0" ]; then
111+
echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..."
112+
git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME
113+
else
114+
echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..."
115+
git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME
116+
fi
117+
if [ $? -ne 0 ]; then
118+
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
119+
exit 1
120+
fi
121+
122+
# make changes to the files
123+
echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..."
124+
rm -rf "$AR_COMPS/arduino/package/package_esp32_index.template.json" && cp -f "$AR_OUT/package_esp32_index.template.json" "$AR_COMPS/arduino/package/package_esp32_index.template.json"
125+
126+
cd $AR_COMPS/arduino
127+
128+
# did any of the files change?
129+
if [ -n "$(git status --porcelain)" ]; then
130+
echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..."
131+
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
132+
if [ $? -ne 0 ]; then
133+
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
134+
exit 1
135+
fi
136+
else
137+
echo "No changes in branch '$AR_NEW_BRANCH_NAME'"
138+
if [ $AR_HAS_BRANCH == "0" ]; then
139+
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
140+
git branch -d $AR_NEW_BRANCH_NAME
141+
fi
142+
exit 0
143+
fi
144+
145+
# CREATE PULL REQUEST
146+
if [ "$AR_HAS_PR" == "0" ]; then
147+
echo "Creating PR '$AR_NEW_PR_TITLE'..."
148+
pr_created=`git_create_pr "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE" "$AR_PR_TARGET_BRANCH"`
149+
if [ $pr_created == "0" ]; then
150+
echo "ERROR: Failed to create PR '$AR_NEW_PR_TITLE': "`echo "$git_create_pr_res" | jq -r '.message'`": "`echo "$git_create_pr_res" | jq -r '.errors[].message'`
151+
exit 1
152+
fi
153+
else
154+
echo "PR '$AR_NEW_PR_TITLE' Already Exists"
155+
fi
156156
fi
157157

158158
exit 0

0 commit comments

Comments
 (0)