Skip to content

build(linux): stage awatcher + aw-sync into aw-tauri before Tauri bundle step - #1499

Merged
ErikBjare merged 4 commits into
ActivityWatch:masterfrom
TimeToBuildBob:feat/linux-bundle-stage-modules
Oct 7, 2026
Merged

ErikBjare merged 4 commits into
ActivityWatch:masterfrom
TimeToBuildBob:feat/linux-bundle-stage-modules

Conversation

@TimeToBuildBob

@TimeToBuildBob TimeToBuildBob commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Linux deb/rpm/AppImage packages contain only the aw-tauri binary. A fresh install launches the tray + server + web UI but records nothing — no window watcher, no AFK watcher, no sync. The root cause: nothing in the bundle build copies aw-awatcher or aw-sync into aw-tauri/src-tauri/modules/ before cargo tauri bundle runs.

Solution

aw-tauri@931e56d (in the pinned 1d52445 submodule pointer) already handles the bundle side: it conditionally injects src-tauri/modules/aw-* via bundle.resources when that directory is present at build time, and dirs.rs knows how to find them at runtime (../lib/aw-tauri/ for deb/rpm, $APPDIR/usr/lib/aw-tauri/ for AppImage). This PR is the activitywatch side:

  1. Reorder SUBMODULES on Linux with TAURI_BUILD=true so awatcher builds before aw-tauri (it was appended after aw-tauri, which is too late).
  2. Stage binaries immediately before aw-tauri's make build in the module loop:
    • aw-server-rust/target/release/aw-sync → aw-tauri/src-tauri/modules/aw-sync
    • awatcher/target/release/awatcher → aw-tauri/src-tauri/modules/aw-awatcher

Both copies are guarded by [ -f ... ], so SKIP_SERVER_RUST=true and non-Linux (macOS, Windows) builds are unaffected.

What changes

  • Makefile: +16 lines, -2 lines — reorder and staging only, no new steps in CI

Testing

The change is exercised by the existing build-tauri CI matrix on ubuntu-24.04 and ubuntu-24.04-arm. After this lands, the produced .deb size should grow from ~16 MB to ~40–50 MB (matching the .zip minus PyInstaller trees).

Closes ActivityWatch/aw-tauri#232 (already closed; this is the activitywatch side)

…dle step

Linux deb/rpm/AppImage contain only the aw-tauri binary today because
nothing copies aw-awatcher or aw-sync into aw-tauri/src-tauri/modules/
before the Tauri bundle step runs.

aw-tauri@931e56d (included in the pinned 1d52445 pointer) already
conditionally injects those modules via bundle.resources when
src-tauri/modules/aw-* is present. This is the activitywatch side:

- Reorder SUBMODULES on Linux TAURI_BUILD so awatcher builds before aw-tauri
- Stage awatcher -> aw-awatcher and aw-sync -> aw-sync into
  aw-tauri/src-tauri/modules/ immediately before aw-tauri's make build runs

After this change, the Tauri bundle step sees the staged binaries and
includes them in the .deb, .rpm, and .AppImage via bundle.resources.
aw-tauri's runtime discovery already knows where to look (../lib/aw-tauri/
for deb/rpm, APPDIR for AppImage).

Closes ActivityWatch/aw-tauri#232

Git-Session-Id: 98cf
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Changes build order and staging for Tauri on Linux.

The PR appears safe to merge, with no new actionable issues found.

What we checked:

  • Failed copies stop the build: Both copy commands exit on failure before the loop reaches the aw-tauri build.

Summary

The PR builds awatcher before aw-tauri on Linux and stages aw-sync and aw-awatcher before bundling.

  • The latest changes clear previously staged files and stop when required binaries are missing.
  • The earlier staging-failure finding is fixed: cleanup, directory creation, copies, and permission changes now stop the build on failure.
  • No new actionable issues were found.

Reviews (4) · Last reviewed commit: "fix(linux-bundle): move comment out of t..." · Reviewed by Greptile

Comment thread Makefile Outdated
…mands

Git-Session-Id: c1f61f50-7d00-5c08-bf06-29c448dc9529
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob

TimeToBuildBob commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

Safe to merge — no P0/P1 findings on latest review

Updated after inline dispositions on finding threads — this is the current state; the verdict below is frozen at review time and is kept as the historical record of that pass.

Finding disposition
Finding Severity State
Makefile:75 P2 fixed in 86dc343

The PR reorders the Linux TAURI_BUILD submodule list so awatcher builds before aw-tauri, and adds a staging step in the build loop that copies aw-sync and awatcher binaries into aw-tauri/src-tauri/modules/ before aw-tauri's make build runs. The staging is guarded by TAURI_BUILD=true, OS=Linux, and file existence checks.

Needs a look — P2 only

Confidence 4/5

1 finding · ⚠️ 1 P2

⚠️ P2 medium — Makefile:75

The staging block copies aw-sync and awatcher binaries into aw-tauri/src-tauri/modules/ but does not clean the directory first. If a previous build staged binaries and then a later build runs with SKIP_SERVER_RUST=true or with awatcher absent (e.g. non-Linux or a partial checkout), stale binaries from the earlier build remain in src-tauri/modules/. The Tauri bundle step conditionally injects src-tauri/modules/aw-* when present, so a stale aw-sync or aw-awatcher from a prior Linux build would be bundled into a macOS/Windows or SKIP_SERVER_RUST build, producing a package that contains binaries that should not be there. The PR description claims SKIP_SERVER_RUST=true and non-Linux builds are unaffected, but the guard only prevents copying in the current run; it does not remove previously staged files. Concretely: run a Linux TAURI_BUILD (stages both binaries), then run the same build with SKIP_SERVER_RUST=true — the staging block is skipped, but aw-tauri/src-tauri/modules/aw-sync still exists and will be bundled. The fix is to rm -rf aw-tauri/src-tauri/modules before staging, or to stage only when the source files exist and remove stale copies otherwise.

if [ -f "aw-server-rust/target/$(targetdir)/aw-sync" ]; then \
	cp ... || exit 1; \
	chmod +x ... || exit 1; \
elif [ "$(SKIP_SERVER_RUST)" != "true" ]; then \
	echo "Error: aw-sync binary not found at aw-server-rust/target/$(targetdir)/aw-sync" >&2; exit 1; \
fi;

How this was verified: Checked the Makefile lines 72-84: the staging block is inside the loop and uses if [ -f ... ] with no else/error. The PR description states the guards are for SKIP_SERVER_RUST and non-Linux, but on Linux TAURI_BUILD with SKIP_SERVER_RUST unset, aw-sync is required; a missing file is silently skipped and the build continues to make --directory=aw-tauri build.

Consensus: 3/3 passes agreed
Distinct keys: 1 (general)

Files changed (1) — the diff as I read it
  • Makefile — Reorders SUBMODULES for Linux TAURI_BUILD to place awatcher before aw-tauri, and adds a shell block in the build loop to copy aw-sync and awatcher binaries into aw-tauri/src-tauri/modules/.

Reviewed de0110c8bba9 · openrouter/deepseek/deepseek-v4-flash-0731 · llm engine · 72s · about this reviewer

Maintainer commands

@TimeToBuildBob review (own line) — fresh review · @TimeToBuildBob fix — a worker acts on the findings. Once per comment; 👀 = received.

Comment thread Makefile Outdated
TimeToBuildBob and others added 2 commits October 7, 2026 09:13
…aries

Address AI-review P2: the staging block only guarded copies for the current
run, so stale aw-sync/aw-awatcher binaries from a previous Linux TAURI_BUILD
could leak into a later non-Linux or SKIP_SERVER_RUST bundle (Tauri injects
src-tauri/modules/aw-* whenever present).

- rm -rf aw-tauri/src-tauri/modules before staging on every TAURI_BUILD
  (all OSes), so no run inherits another run's staged binaries
- error out when expected binaries are missing on Linux (aw-sync unless
  SKIP_SERVER_RUST=true, awatcher always) instead of silently bundling
  an incomplete set

Git-Session-Id: 20602d75-5208-578f-b332-d8bc421547ac
A '#' line without a trailing backslash ended the logical recipe line, so
bash got a truncated for-loop (syntax error: unexpected end of file).
@ErikBjare

Copy link
Copy Markdown
Member

687779f: 86dc343 put two # comment lines inside the backslash-continued for loop in build. The first had no trailing \, so it ended the logical recipe line and bash got a truncated loop (syntax error: unexpected end of file). It would have failed every TAURI_BUILD. I moved the comment above the loop as a make comment. Checked with make -n build TAURI_BUILD=true | bash -n, plus a simulated staging run on a fake tree (stages both, clears stale files, and exits 1 when awatcher is missing). Also pointed "Closes" at ActivityWatch/aw-tauri#232.

@ErikBjare

Copy link
Copy Markdown
Member

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Thanks for fixing my broken recipe in 687779f. Confirmed the regression and your correction by parsing each Make recipe separately with make build SHELL="/bin/bash -n" in a fixture tree: 86dc343 fails with unexpected end of file, while 687779f passes Linux Tauri, SKIP_SERVER_RUST, macOS Tauri, and non-Tauri variants. My earlier validation was insufficient: piping the whole make -n output into bash -n joins separate recipes and masks this exact failure. No further code change or review retrigger; Greptile is 5/5 on 687779f, and build CI is still pending.

@ErikBjare
ErikBjare merged commit ee43e3b into ActivityWatch:master Oct 7, 2026
22 checks passed
ErikBjare added a commit that referenced this pull request Oct 7, 2026
…es.sh, README

The Tauri AppImage is meant to be self-contained and run from anywhere
(awatcher + aw-sync bundled inside, #1499), so
drop move-to-aw-modules.sh, which copied everything into ~/aw-modules as a
workaround. Rewrite README.txt: the other folders in the zip are optional
extra modules to copy into ~/.local/share/activitywatch/aw-tauri/modules/.
Ship the awatcher folder as aw-awatcher/, since module discovery only
descends into aw-* dirs, so a copied awatcher/ would never be found.
ErikBjare added a commit that referenced this pull request Oct 7, 2026
…es.sh, README

The Tauri AppImage is meant to be self-contained and run from anywhere
(awatcher + aw-sync bundled inside, #1499), so
drop move-to-aw-modules.sh, which copied everything into ~/aw-modules as a
workaround. Rewrite README.txt: the other folders in the zip are optional
extra modules to copy into ~/.local/share/activitywatch/aw-tauri/modules/.
Ship the awatcher folder as aw-awatcher/, since module discovery only
descends into aw-* dirs, so a copied awatcher/ would never be found.
@ErikBjare

Copy link
Copy Markdown
Member

@greptileai review

ErikBjare added a commit that referenced this pull request Oct 7, 2026
…es.sh, README

The Tauri AppImage is meant to be self-contained and run from anywhere
(awatcher + aw-sync bundled inside, #1499), so
drop move-to-aw-modules.sh, which copied everything into ~/aw-modules as a
workaround. Rewrite README.txt: the other folders in the zip are optional
extra modules to copy into ~/.local/share/activitywatch/aw-tauri/modules/.
Ship the awatcher folder as aw-awatcher/, since module discovery only
descends into aw-* dirs, so a copied awatcher/ would never be found.
ErikBjare added a commit that referenced this pull request Oct 7, 2026
…es.sh, README

The Tauri AppImage is meant to be self-contained and run from anywhere
(awatcher + aw-sync bundled inside, #1499), so
drop move-to-aw-modules.sh, which copied everything into ~/aw-modules as a
workaround. Rewrite README.txt: the other folders in the zip are optional
extra modules to copy into ~/.local/share/activitywatch/aw-tauri/modules/.
Ship the awatcher folder as aw-awatcher/, since module discovery only
descends into aw-* dirs, so a copied awatcher/ would never be found.
ErikBjare added a commit that referenced this pull request Oct 7, 2026
…se awatcher, rewrite README

The Tauri AppImage is meant to be self-contained and run from anywhere
(awatcher + aw-sync bundled inside, #1499), so
drop move-to-aw-modules.sh, which copied everything into ~/aw-modules as a
workaround, and the zip's loose awatcher/ (also a dir name module discovery
skips). Rewrite README.txt: the other folders are optional extra modules to
copy into the user modules dir.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux bundles are not self-contained — bundle awatcher + aw-sync so deb/rpm/AppImage work out of the box

2 participants