summaryrefslogtreecommitdiff
path: root/justfile
diff options
context:
space:
mode:
Diffstat (limited to 'justfile')
-rw-r--r--justfile37
1 files changed, 33 insertions, 4 deletions
diff --git a/justfile b/justfile
index 79e6d1e..e294615 100644
--- a/justfile
+++ b/justfile
@@ -9,6 +9,10 @@ location := "/Users/${USER}/Applications"
alias fmt := format
alias b := build
alias gen := generate
+alias loc := localize
+alias t := test
+alias to := test_only
+alias v := verify
fetch:
curl https://raw.githubusercontent.com/Fuwn/justfiles/refs/heads/main/xcode.just > xcode.just
@@ -27,6 +31,29 @@ build_ios configuration="Release":
build_ios_simulator configuration="Release":
just build "platform=iOS Simulator,name=iPhone 17 Pro" "{{configuration}}"
+localize destination="platform=macOS" configuration="Debug":
+ xcodebuild -project Sora.xcodeproj -configuration {{configuration}} -scheme {{target}} -destination '{{destination}}' CODE_SIGNING_ALLOWED=NO build
+
+_test destination="platform=iOS Simulator,name=iPhone 17 Pro" scheme="SoraTests" configuration="Debug" *xcodebuild_args:
+ simulator_name="$(printf '%s\n' '{{destination}}' | sed -n "s/.*name=\\([^,']*\\).*/\\1/p")"; \
+ if [ -n "${simulator_name}" ]; then \
+ xcrun simctl boot "${simulator_name}" >/dev/null 2>&1 || true; \
+ xcrun simctl bootstatus "${simulator_name}" -b; \
+ fi
+ xcodebuild -project Sora.xcodeproj -configuration {{configuration}} -scheme {{scheme}} -destination '{{destination}}' {{xcodebuild_args}} test
+
+test destination="platform=iOS Simulator,name=iPhone 17 Pro" scheme="SoraTests" configuration="Debug":
+ just _test "{{destination}}" "{{scheme}}" "{{configuration}}"
+
+test_only filter destination="platform=iOS Simulator,name=iPhone 17 Pro" scheme="SoraTests" configuration="Debug":
+ just _test "{{destination}}" "{{scheme}}" "{{configuration}}" "-only-testing:{{filter}}"
+
+verify configuration="Debug":
+ just format
+ just lint
+ just localize "platform=macOS" "{{configuration}}"
+ just test "platform=iOS Simulator,name=iPhone 17 Pro" "SoraTests" "{{configuration}}"
+
test_ios_simulator scheme="SoraTests":
xcodebuild -project Sora.xcodeproj -scheme {{scheme}} -destination 'platform=iOS Simulator,name=iPhone 17 Pro' test
@@ -34,15 +61,17 @@ run:
just _open {{target}}
install derived_data=derived_data location=location:
- cp -r {{derived_data}}/{{target}}-*/Build/Products/Release/{{target}}.app {{location}}
+ app_path="$(find {{derived_data}} -maxdepth 6 -path '*/Build/Products/Release/{{target}}.app' -print | xargs ls -td 2>/dev/null | head -n 1)"; [ -n "${app_path}" ] || { echo "No built app found for {{target}}" >&2; exit 1; }; \
+ cp -r "${app_path}" {{location}}
generate:
command -v xcodegen >/dev/null 2>&1 \
- && xcodegen generate \
- || mint run xcodegen@synced_folder generate
+ && DEVELOPMENT_TEAM='{{development_team}}' xcodegen generate \
+ || DEVELOPMENT_TEAM='{{development_team}}' mint run xcodegen@synced_folder generate
install_ios derived_data=derived_data configuration="Release":
- xcrun devicectl device install app --device {{device_identifier}} {{derived_data}}/{{target}}-*/Build/Products/{{configuration}}-iphoneos/{{target}}.app
+ app_path="$(find {{derived_data}} -maxdepth 6 -path '*/Build/Products/{{configuration}}-iphoneos/{{target}}.app' -print | xargs ls -td 2>/dev/null | head -n 1)"; [ -n "${app_path}" ] || { echo "No iOS app found for {{target}} ({{configuration}})" >&2; exit 1; }; \
+ xcrun devicectl device install app --device {{device_identifier}} "${app_path}"
run_ios flags="":
xcrun devicectl device process launch {{flags}} --device {{device_identifier}} {{identifier}}