Skip to content

Commit bc980f2

Browse files
committed
Introduce Elixir
We now assume that Elixir is installed as a dependency for development. This now gives us access to mix for building, creating releases and developing the Erlang code base. The Erlang OTP app has now been converted to an Elixir OTP app (which currently just starts the Erlang processes after setting some environment values). However, the door is now open for future Elixir extensions and access to dependency management via mix. We also have a nice path for including Rust NIFs through the Rustler lib. We also remove the old prebuild binaries for macOS and Windows as these can now be generated via `mix release`.
1 parent 2fb1310 commit bc980f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+289
-1102
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,32 @@ jobs:
7979
extra: '--b http://mirrors.ocf.berkeley.edu/qt/'
8080
cached: ${{ steps.cache-qt2.outputs.cache-hit }}
8181

82-
# Latest Erlang on Ubuntu
83-
- uses: gleam-lang/setup-erlang@v1.1.2
82+
# Install Elixir on Ubuntu
83+
- uses: erlef/setup-beam@v1
8484
with:
85-
otp-version: 23.2.1
85+
otp-version: 24
8686
if: matrix.os == 'ubuntu-latest'
8787

88-
# Install Erlang on MacOS
89-
- name: Mac Erlang
88+
# Install Elixir on Windows
89+
- uses: erlef/setup-beam@v1
90+
with:
91+
otp-version: '24'
92+
if: matrix.os == 'windows-latest'
93+
94+
# Install Elixir on MacOS
95+
- name: Mac Elixir
9096
continue-on-error: true
9197
run: |
9298
export HOMEBREW_NO_INSTALL_CLEANUP=1
9399
brew update
94-
brew install erlang
100+
brew install elixir
95101
if: matrix.os == 'macos-latest'
96102

97103
# Prebuild on Ubuntu
98104
- name: Prebuild Linux
99105
working-directory: ${{github.workspace}}/app
100106
env:
101-
CC: ${{ matrix.cc }}
107+
CC: ${{ matrix.cc }}
102108
QT_INSTALL_LOCATION: ${{env.Qt5_DIR}}
103109
run: |
104110
sudo apt install -y pulseaudio dbus-x11 libssl-dev ruby-dev supercollider-server sc3-plugins-server alsa-utils jackd2 libjack-jackd2-dev libjack-jackd2-0 libasound2-dev librtmidi-dev pulseaudio-module-jack
@@ -109,34 +115,34 @@ jobs:
109115
- name: Prebuild Mac
110116
working-directory: ${{github.workspace}}/app
111117
env:
112-
CC: ${{ matrix.cc }}
118+
CC: ${{ matrix.cc }}
113119
QT_INSTALL_LOCATION: ${{env.Qt5_DIR}}
114120
run: |
115121
./mac-prebuild.sh
116122
if: matrix.os == 'macos-latest'
117-
123+
118124
# Prebuild on Windows
119-
# Note that we 'hide' the msys folders on windows to stop conflicts when building
125+
# Note that we 'hide' the msys folders on windows to stop conflicts when building
120126
# Flac
121127
- name: Prebuild Windows
122128
working-directory: ${{github.workspace}}/app
123129
shell: cmd
124130
env:
125-
CC: ${{ matrix.cc }}
131+
CC: ${{ matrix.cc }}
126132
QT_INSTALL_LOCATION: ${{env.Qt5_DIR}}
127133
run: |
128134
mv c:/msys64 c:/__msys64
129135
win-prebuild.bat
130136
if: matrix.os == 'windows-latest'
131-
137+
132138
#- name: Setup tmate session
133139
# uses: mxschmitt/action-tmate@v3
134140

135141
# Run Configuration Config on Ubuntu
136142
- name: Config Linux
137143
working-directory: ${{github.workspace}}/app
138144
env:
139-
CC: ${{ matrix.cc }}
145+
CC: ${{ matrix.cc }}
140146
QT_INSTALL_LOCATION: ${{env.Qt5_DIR}}
141147
run: |
142148
./linux-config.sh
@@ -146,7 +152,7 @@ jobs:
146152
- name: Config Mac
147153
working-directory: ${{github.workspace}}/app
148154
env:
149-
CC: ${{ matrix.cc }}
155+
CC: ${{ matrix.cc }}
150156
QT_INSTALL_LOCATION: ${{env.Qt5_DIR}}
151157
run: |
152158
./mac-config.sh
@@ -157,35 +163,35 @@ jobs:
157163
working-directory: ${{github.workspace}}/app
158164
shell: cmd
159165
env:
160-
CC: ${{ matrix.cc }}
166+
CC: ${{ matrix.cc }}
161167
QT_INSTALL_LOCATION: ${{env.Qt5_DIR}}
162168
run: |
163169
win-config.bat
164170
if: matrix.os == 'windows-latest'
165-
171+
166172
# Finally: Build
167173
- name: Do build
168174
working-directory: ${{github.workspace}}/app/build
169175
run: cmake --build . --config ${{ matrix.build_type }}
170-
176+
171177
- name: Ruby Tests (Mac/Linux)
172178
working-directory: ${{github.workspace}}/app/server/ruby
173-
run: rake test
179+
run: rake test
174180
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
175181

176182
- name: API Tests - Mac
177183
working-directory: ${{github.workspace}}/app/build/api-tests
178184
run: ctest --verbose
179185
if: matrix.os == 'macos-latest'
180-
186+
181187
- name: API Tests - Linux
182188
working-directory: ${{github.workspace}}/app/build/api-tests
183189
run: |
184190
jackd -d dummy &
185191
ctest --verbose
186-
if: matrix.os == 'ubuntu-latest'
187-
188-
- name: API Tests Windows - Install Scream Audio Device
192+
if: matrix.os == 'ubuntu-latest'
193+
194+
- name: API Tests Windows - Install Scream Audio Device
189195
shell: powershell
190196
run: |
191197
Start-Service audio*
@@ -212,5 +218,3 @@ jobs:
212218
name: Logs_${{matrix.title}}_${{matrix.build_type}}
213219
path: |
214220
~/.sonic-pi/log/*.log
215-
216-

BUILD-LINUX.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,23 @@ few dependencies:
4343
* Qt + Dev tools (5.15+)
4444
* Jack (and pulse-audio-module-jack if you are running Raspberry Pi OS)
4545
* Ruby + Dev tools (2.5+)
46-
* Erlang + Dev tools (21+)
46+
* Elixir + Dev tools (21+)
4747
* SuperCollider + SC3 plugins
4848
*
4949

5050

5151
### 1.1 Raspberry Pi OS
5252

53-
The following is a list of packages required for Raspberry Pi OS released in Dec 2020:
53+
The following is a list of packages required for Raspberry Pi OS
54+
released in August 2021:
5455

5556
```
5657
sudo apt-get install -y \
57-
build-essential cmake git libssl-dev \
58-
ruby-dev erlang-base erlang-dev erlang-tools \
59-
supercollider-server sc3-plugins-server alsa-utils libaubio5 jackd2 libjack-jackd2-dev libjack-jackd2-0 libasound2-dev librtmidi-dev pulseaudio-module-jack\
60-
qt5-default qttools5-dev-tools libqt5concurrent5 libqt5core5a libqt5gui5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5concurrent5 libqt5svg5 libqt5widgets5 libqt5svg5-dev \
61-
compton pulseaudio-module-jack
58+
build-essential git libssl-dev \
59+
ruby-dev erlang-base erlang-dev erlang-tools elixir \
60+
qttools5-dev-tools qttools5-dev libqt5svg5-dev \
61+
supercollider-server sc3-plugins-server alsa-utils libaubio5 librtmidi-dev libasound2-dev \
62+
jackd2 libjack-jackd2-dev libjack-jackd2-0 pulseaudio-module-jack \
6263
```
6364

6465

BUILD-MAC.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ few dependencies:
3939

4040
1. Xcode (12.1+) and command line tools
4141
2. Homebrew
42-
3. All other dependencies - Qt5 (5.15+), CMake (3.18+)
42+
3. All other dependencies - Qt5 (5.15+), CMake (3.18+), Elixir(2.12+)
4343

4444
### 1.1 Install Xcode
4545

@@ -68,7 +68,7 @@ Once you have Homebrew installed, pulling in the rest of the
6868
dependencies is a couple of lines to execute within a terminal:
6969

7070
```
71-
brew install qt@5 cmake
71+
brew install qt@5 cmake elixir
7272
7373
```
7474

BUILD-WINDOWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies:
4646
2. Qt (5.15+)
4747
3. CMake (3.18+)
4848
4. Ruby (2.7.1+)
49+
5. Elixir (1.12+)
4950

5051
Let's look at each in turn.
5152

@@ -120,6 +121,14 @@ force the locale to UTF-8. For more information see:
120121

121122
https://github.com/samaaron/sonic-pi/issues/2416
122123

124+
### 1.5 Install Elixir
125+
126+
Lastly we just need to head over to the Elixir website and download and
127+
run the installer:
128+
129+
https://elixir-lang.org/install.html#windows
130+
131+
123132
## 2. Preparing the Build
124133

125134
Once we have installed all the dependencies, we're now ready to build

app/linux-build-all.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
set -e # Quit script on error
33

44
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5-
cd ${SCRIPT_DIR}
65

6+
cd ${SCRIPT_DIR}
77
"${SCRIPT_DIR}/linux-prebuild.sh"
8+
9+
cd ${SCRIPT_DIR}
810
"${SCRIPT_DIR}/linux-config.sh"
911

12+
13+
cd ${SCRIPT_DIR}
1014
cd build
1115
cmake --build . --config Release
1216

app/linux-prebuild.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ PATH=`pkg-config --variable bindir Qt5`:$PATH lrelease "${SCRIPT_DIR}"/gui/qt/la
4747

4848
echo "Compiling Erlang files..."
4949
cd "${SCRIPT_DIR}/server/erlang/tau"
50-
erl -make
50+
mix local.hex --force
51+
mix deps.get
52+
mix release
53+
5154
cp src/tau.app.src ebin/tau.app
5255
cd "${SCRIPT_DIR}"

app/mac-build-all.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
55
cd ${SCRIPT_DIR}
66

77
"${SCRIPT_DIR}/mac-prebuild.sh"
8+
cd ${SCRIPT_DIR}
89
"${SCRIPT_DIR}/mac-config.sh"
910

11+
cd ${SCRIPT_DIR}
1012
cd build
1113
cmake --build . --config Release
1214

app/mac-prebuild.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ echo "Updating GUI translation files..."
8282
# Use lrelease on PATH if available otherwise assume Qt was installed via homebrew
8383
PATH=$PATH:/usr/local/opt/qt@5/bin lrelease "${SCRIPT_DIR}"/gui/qt/lang/*.ts
8484

85-
echo "Compiling Erlang files..."
85+
echo "Compiling Erlang/Elixir files..."
8686
cd "${SCRIPT_DIR}/server/erlang/tau"
87-
../../native/erlang/erl -make
87+
mix local.hex --force
88+
mix deps.get
89+
mix release
90+
8891
cp src/tau.app.src ebin/tau.app
8992
cd "${SCRIPT_DIR}"

app/pi-build-all.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
set -e # Quit script on error
33

44
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5-
cd ${SCRIPT_DIR}
65

6+
cd ${SCRIPT_DIR}
77
"${SCRIPT_DIR}/pi-prebuild.sh"
8+
9+
cd ${SCRIPT_DIR}
810
"${SCRIPT_DIR}/pi-config.sh"
911

12+
cd ${SCRIPT_DIR}
1013
cd build
1114
cmake --build . --config Release
1215

app/server/erlang/tau/.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

0 commit comments

Comments
 (0)