-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
95 lines (79 loc) · 2.25 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
if [ -z "$1" ]; then
echo "No plugin name provided!"
exit 1
fi
if [ -z "$2" ]; then
echo "No plugin ID provided!"
exit 1
fi
plugin_name=$1
plugin_id=$2
echo "Creating plugin ${plugin_name}, with ID ${plugin_id} ..."
echo "Copying source files..."
mv src/PitchShift.h src/${plugin_name}.h
mv src/PitchShift.cpp src/${plugin_name}.cpp
echo "Copying installer files..."
mv installers/mac/PitchShift.pkgproj installers/mac/${plugin_name}.pkgproj
mv installers/windows/PitchShift_Install_Script.iss installers/windows/${plugin_name}_Install_Script.iss
echo "Setting plugin ID..."
sed -i.bak -e "s/XXXX/${plugin_id}/g" CMakeLists.txt
echo "Setting up source files..."
declare -a source_files=("scripts/validate.sh"
"scripts/win_builds.sh"
"scripts/mac_builds.sh"
"CMakeLists.txt"
"src/CMakeLists.txt"
"src/${plugin_name}.h"
"src/${plugin_name}.cpp"
)
for file in "${source_files[@]}"; do
sed -i.bak -e "s/PitchShift/${plugin_name}/g" $file
done
sed -i.bak -e "s/JUCEPluginTemplate/${plugin_name}/g" README.md
sed -i.bak -e "s/JUCE Plugin Template/${plugin_name}/g" README.md
# Remove `run setup.sh` lines from CI and README
sed -i.bak -e '42,48d' .github/workflows/cmake.yml
sed -i.bak -e '/setup.sh/{N;d;}' README.md
sed -i.bak -e '/set up plugin/d' README.md
# Clean up files we no longer need
rm *.bak
rm */*.bak
rm .github/*.bak
rm .github/*/*.bak
rm installers/*/*.bak
rm setup.sh
echo "Fetching submodules..."
git submodule update --init --recursive
# update chowdsp_utils
(
echo "Updating submodule: chowdsp_utils..."
cd modules/chowdsp_utils
git fetch origin
git checkout master
git pull
git log -n 1
)
# update clap-juce-extensions
(
echo "Updating submodule: clap-juce-extensions..."
cd modules/clap-juce-extensions
git fetch origin
git checkout main
git submodule update --init --recursive
git pull
git log -n 1
)
# Stop tracking from template repo
git remote remove origin
# Remove old git commit history
clean_git_history(){
git add .
git commit -m "Set up ${plugin_name}"
git checkout --orphan new-branch
git add -A
git commit -m "Initial commit"
git branch -D main
git branch -m main
}
clean_git_history > /dev/null