feat: persist local configuration and device identity (#3)

Store receiver and identity together in Keychain, with versioned tracking
preferences, explicit authorization retry and stable Settings focus.
Adopt free Apple Development locally and credential-free ad hoc CI.
Run configuration and focus tests through both CI toolchains.

Final decisions: https://github.com/jayanezj/traccar-client-macos/issues/3#issuecomment-6396087703
This commit is contained in:
jayanezj committed 2026-10-25 10:43:43 +01:00
1 parent 8aaff37d7a
commit 026cd6aa40
23 files changed
+1442 -42

No files matched your search

+2
View File
@@ -12,6 +12,7 @@ case "$configuration" in
*) echo "Configuration must be Debug or Release." >&2; exit 2 ;;
esac
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
source "$repo_root/scripts/signing-options.sh"
mkdir -p "$build_root"
exec xcodebuild \
@@ -22,4 +23,5 @@ exec xcodebuild \
-derivedDataPath "$build_root/DerivedData" \
"CLANG_MODULE_CACHE_PATH=$build_root/ModuleCache" \
"SWIFT_MODULE_CACHE_PATH=$build_root/ModuleCache" \
"${signing_options[@]}" \
build
+6 -1
View File
@@ -28,9 +28,11 @@ esac
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
cd "$repo_root"
source "$repo_root/scripts/signing-options.sh"
trap 'status=$?; echo "Local checks failed (exit $status)." >&2; exit "$status"' ERR
echo "Checking toolchain ($profile)..."
echo "Signing mode: $signing_mode"
scripts/verify-toolchain.sh "${toolchain[@]}"
echo "Checking shell syntax and Git whitespace..."
@@ -48,8 +50,11 @@ for configuration in Debug Release; do
scripts/build.sh "$validation_root/build" "$configuration"
done
echo "Running configuration tests..."
scripts/test.sh "$validation_root/build"
echo "Checking application binaries and signatures..."
scripts/verify-build.sh "$validation_root/build"
echo "Local checks passed ($profile): lint, Debug, Release, arm64, macOS 15.0 minimum and signatures."
echo "Local checks passed ($profile, $signing_mode): lint, Debug, Release, configuration tests, arm64, macOS 15.0 minimum and signatures."
echo "Hosted workflow execution and manual application checks remain separate."
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Shared by build/test/verification scripts; development never falls back to ad hoc.
signing_mode="${TRACCAR_SIGNING_MODE:-development}"
case "$signing_mode" in
development)
signing_options=("CODE_SIGN_STYLE=Manual")
;;
adhoc)
signing_options=("CODE_SIGN_STYLE=Manual" "CODE_SIGN_IDENTITY=-" "DEVELOPMENT_TEAM=")
;;
*)
echo "TRACCAR_SIGNING_MODE must be development or adhoc." >&2
exit 2
;;
esac
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
set -euo pipefail
build_root="${1:?Usage: scripts/test.sh /absolute/path/to/external/build-directory}"
case "$build_root" in
/*) ;;
*) echo "The build directory must be an absolute path." >&2; exit 2 ;;
esac
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
source "$repo_root/scripts/signing-options.sh"
mkdir -p "$build_root/TestResults"
result_root="$(mktemp -d "$build_root/TestResults/run.XXXXXX")"
echo "Test results: $result_root/Configuration.xcresult"
exec xcodebuild \
-project "$repo_root/TraccarClient.xcodeproj" \
-scheme TraccarClient \
-configuration Debug \
-destination 'platform=macOS,arch=arm64' \
-parallel-testing-enabled NO \
-derivedDataPath "$build_root/DerivedData" \
-resultBundlePath "$result_root/Configuration.xcresult" \
"CLANG_MODULE_CACHE_PATH=$build_root/ModuleCache" \
"SWIFT_MODULE_CACHE_PATH=$build_root/ModuleCache" \
"${signing_options[@]}" \
test
+23
View File
@@ -6,6 +6,8 @@ case "$build_root" in
/*) ;;
*) echo "The build directory must be an absolute path." >&2; exit 2 ;;
esac
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
source "$repo_root/scripts/signing-options.sh"
for configuration in Debug Release; do
app="$build_root/DerivedData/Build/Products/$configuration/Traccar Client macOS.app"
@@ -14,4 +16,25 @@ for configuration in Debug Release; do
test "$(lipo -archs "$executable")" = arm64
test "$(xcrun vtool -show-build "$executable" | awk '/minos/ {print $2}')" = 15.0
codesign --verify --strict "$app"
metadata="$(codesign --display --verbose=4 "$app" 2>&1)"
case "$signing_mode" in
development)
if [[ "$metadata" != *"Authority=Apple Development:"* ]]; then
echo "Expected an Apple Development signature for $configuration." >&2
exit 1
fi
team="$(awk -F= '/^TeamIdentifier=/ {print $2}' <<< "$metadata")"
if [[ -z "$team" || "$team" == "not set" || -e "$app/Contents/embedded.provisionprofile" ]]; then
echo "Expected a development Team and no provisioning profile for $configuration." >&2
exit 1
fi
;;
adhoc)
if [[ "$metadata" != *"Signature=adhoc"* ]]; then
echo "Expected an ad hoc signature for $configuration." >&2
exit 1
fi
;;
esac
echo "Verified $configuration: arm64, macOS 15.0 minimum, $signing_mode signature."
done