Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(fix) Build scripts

Egor Khindikaynen8cfc080009b9
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 86556912..4f70aaa5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -102,6 +102,9 @@ jobs:
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
+ - uses: actions/setup-node@v5 # builds the Nota Remote phone page (Vite: Node 20.19+ / 22.12+)
+ with:
+ node-version: '22'
- name: Install build tools
run: brew install cmake ninja
- name: Package ${{ matrix.arch }} .dmg
@@ -132,6 +135,9 @@ jobs:
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
+ - uses: actions/setup-node@v5 # builds the Nota Remote phone page (Vite: Node 20.19+ / 22.12+)
+ with:
+ node-version: '22'
- name: Install Inno Setup
run: choco install innosetup --no-progress -y
- name: Package x64 installer
@@ -168,6 +174,9 @@ jobs:
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
+ - uses: actions/setup-node@v5 # builds the Nota Remote phone page (Vite: Node 20.19+ / 22.12+)
+ with:
+ node-version: '22'
- name: Install build + packaging deps
run: |
sudo apt-get update -qq
diff --git a/.gitignore b/.gitignore
index 51c34a7a..7df82d13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,3 @@ cmake_install.cmake
# Nota project bundles created during testing
*.nota/
dist/
- src/managed/Nota.Remote/wwwroot/
diff --git a/BUILD.md b/BUILD.md
index 00113bb6..dd22753c 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -8,6 +8,9 @@ covers the details — per-platform prerequisites and manual step-by-step builds
- macOS 26+, Xcode 26+ (clang, CoreAudio SDK).
- CMake 3.24+ and Ninja — `brew install cmake ninja`.
- .NET SDK 10.
+- Node.js 22 (or 20.19+) — `brew install node`. Optional: the build uses it to rebuild the
+ Nota Remote phone page (`src/web/remote`) when its sources change; without it the
+ committed `src/managed/Nota.Remote/wwwroot` ships as is, with a warning.
- Avalonia templates, only if you are scaffolding new projects —
`dotnet new install Avalonia.Templates`.
@@ -98,6 +101,7 @@ cmake --build build-pentad --target NotaPentad_VST3
- CMake 3.24+ and Ninja (both ship with the VS 2022 "C++ CMake tools", or
`winget install Ninja-build.Ninja`).
- .NET SDK 10.
+- Node.js 22 (optional, for the Nota Remote phone page — see the macOS requirements).
- For the installer, Inno Setup **6.3+** (`winget install JRSoftware.InnoSetup`).
### Quick start
@@ -129,6 +133,7 @@ a single x64 host. An ARM64 build cannot be run on x64 — the smoke test is x64
### Requirements
- `build-essential`, CMake 3.24+, Ninja, .NET SDK 10.
+- Node.js 22 (optional, for the Nota Remote phone page — see the macOS requirements).
- Native dev packages:
```bash
diff --git a/src/managed/Nota.Remote/Nota.Remote.csproj b/src/managed/Nota.Remote/Nota.Remote.csproj
index 879c932c..03a686b7 100644
--- a/src/managed/Nota.Remote/Nota.Remote.csproj
+++ b/src/managed/Nota.Remote/Nota.Remote.csproj
@@ -20,24 +20,28 @@
<ProjectReference Include="..\Nota.Application\Nota.Application.csproj" />
</ItemGroup>
- <!-- The phone app. `npm run build` in src/web/remote writes into wwwroot/; the files are
- embedded so the app ships as one assembly and needs no web root on disk. The build
- runs when its sources are newer than the output (and node is available); a checkout
- without node still builds and serves a page saying the controller wasn't built. -->
+ <!-- The phone app. `npm run build` in src/web/remote writes into wwwroot/, which is committed;
+ the files are embedded so the app ships as one assembly and needs no web root on disk.
+ The build runs when its sources are newer than the output and a Node that Vite supports
+ is on the PATH (^20.19 or >= 22.12); without one (the Linux Docker image, an old Node)
+ the committed wwwroot ships as it is, with a warning. NotaSkipWebBuild=true skips it. -->
<PropertyGroup>
<RemoteWebDir>$(MSBuildProjectDirectory)/../../web/remote</RemoteWebDir>
<RemoteWwwRoot>$(MSBuildProjectDirectory)/wwwroot</RemoteWwwRoot>
</PropertyGroup>
<ItemGroup>
- <RemoteWebSources Include="$(RemoteWebDir)/src/**/*;$(RemoteWebDir)/public/**/*;$(RemoteWebDir)/index.html;$(RemoteWebDir)/package.json;$(RemoteWebDir)/vite.config.ts" />
+ <RemoteWebSources Include="$(RemoteWebDir)/src/**/*;$(RemoteWebDir)/public/**/*;$(RemoteWebDir)/index.html;$(RemoteWebDir)/package.json;$(RemoteWebDir)/package-lock.json;$(RemoteWebDir)/vite.config.ts;$(RemoteWebDir)/svelte.config.js;$(RemoteWebDir)/tsconfig.json" />
</ItemGroup>
<Target Name="BuildRemoteWeb" Inputs="@(RemoteWebSources)" Outputs="$(RemoteWwwRoot)/index.html"
Condition="Exists('$(RemoteWebDir)/package.json') and '$(NotaSkipWebBuild)' != 'true' and '$(DesignTimeBuild)' != 'true'">
- <Exec Command="node --version" ContinueOnError="true" StandardOutputImportance="low">
+ <Exec Command="node -e &quot;const v=process.versions.node.split('.').map(Number),n=v[0]*100+v[1];process.exit(n&gt;=2212||(n&gt;=2019&amp;&amp;n&lt;2100)?0:1)&quot;"
+ IgnoreExitCode="true" StandardOutputImportance="low" StandardErrorImportance="low" EchoOff="true">
<Output TaskParameter="ExitCode" PropertyName="NodeExit" />
</Exec>
- <Warning Condition="'$(NodeExit)' != '0'" Text="Node.js not found: the Nota Remote phone page is not built (install Node 20+ and rebuild)." />
- <Exec Condition="'$(NodeExit)' == '0' and !Exists('$(RemoteWebDir)/node_modules')" WorkingDirectory="$(RemoteWebDir)" Command="npm ci --no-audit --no-fund" />
+ <Warning Condition="'$(NodeExit)' != '0'" Text="Node.js 20.19+ / 22.12+ not found: the Nota Remote phone page is not rebuilt; the committed wwwroot ships as it is." />
+ <!-- Install when there is no node_modules yet, or the lockfile changed since the last install. -->
+ <Exec Condition="'$(NodeExit)' == '0' and (!Exists('$(RemoteWebDir)/node_modules/.package-lock.json') or $([System.IO.File]::GetLastWriteTime('$(RemoteWebDir)/package-lock.json').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(RemoteWebDir)/node_modules/.package-lock.json').Ticks))"
+ WorkingDirectory="$(RemoteWebDir)" Command="npm ci --no-audit --no-fund" />
<Exec Condition="'$(NodeExit)' == '0'" WorkingDirectory="$(RemoteWebDir)" Command="npm run build" />
</Target>
<Target Name="EmbedRemoteWeb" BeforeTargets="BeforeBuild" DependsOnTargets="BuildRemoteWeb">
diff --git a/src/managed/Nota.Remote/RemoteClient.cs b/src/managed/Nota.Remote/RemoteClient.cs
index fc36f89c..d5c824b2 100644
--- a/src/managed/Nota.Remote/RemoteClient.cs
+++ b/src/managed/Nota.Remote/RemoteClient.cs
@@ -72,7 +72,14 @@ public sealed class RemoteClient
/// <summary>Messages waiting to go out — the hub skips a phone's state tick while it lags.</summary>
public int Backlog => _out.Reader.CanCount ? _out.Reader.Count : 0;
- internal async Task SendLoopAsync(CancellationToken ct)
+ /// <summary>Start the single send loop (once, when the socket opens).</summary>
+ internal Task StartSendLoop(CancellationToken ct) => _sendLoop = SendLoopAsync(ct);
+
+ private Task _sendLoop = Task.CompletedTask;
+ /// <summary>How long a close waits for queued messages to go out first.</summary>
+ private static readonly TimeSpan SendDrain = TimeSpan.FromSeconds(1);
+
+ private async Task SendLoopAsync(CancellationToken ct)
{
try
{
@@ -124,6 +131,10 @@ public sealed class RemoteClient
public async Task CloseAsync(WebSocketCloseStatus status, string reason)
{
CompleteSend();
+ // Let what was queued go out first: a "kicked" or "denied" sent just before the close
+ // is what tells the phone not to reconnect on its own. A phone that stopped reading
+ // gets the close after a second anyway.
+ await Task.WhenAny(_sendLoop, Task.Delay(SendDrain));
try
{
if (_ws.State is WebSocketState.Open or WebSocketState.CloseReceived)
diff --git a/src/managed/Nota.Remote/RemoteHub.cs b/src/managed/Nota.Remote/RemoteHub.cs
index 642d01e3..74fbf95a 100644
--- a/src/managed/Nota.Remote/RemoteHub.cs
+++ b/src/managed/Nota.Remote/RemoteHub.cs
@@ -80,7 +80,7 @@ public sealed partial class RemoteHub
var c = new RemoteClient(ws, address);
c.LastActivityTicks = DateTime.UtcNow.Ticks;
_clients[c.ConnectionId] = c;
- var send = c.SendLoopAsync(ct);
+ var send = c.StartSendLoop(ct);
try
{
await c.ReceiveLoopAsync(OnMessageAsync, ct);