summaryrefslogtreecommitdiff
path: root/justfile
blob: 79e6d1e448d8df0b9ecdf85e5ddbe462b86808b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import? 'xcode.just'
import? 'environment.just'

target := 'Sora'
identifier := "me.fuwn." + target
derived_data := "/Users/${USER}/Library/Developer/Xcode/DerivedData"
location := "/Users/${USER}/Applications"

alias fmt := format
alias b := build
alias gen := generate

fetch:
   curl https://raw.githubusercontent.com/Fuwn/justfiles/refs/heads/main/xcode.just > xcode.just

format:
	just _format {{target}}

build destination="platform=macOS" configuration="Release":
  command -v xcbeautify >/dev/null 2>&1 \
    && xcodebuild -project Sora.xcodeproj -configuration {{configuration}} -scheme {{target}} -destination '{{destination}}' build | xcbeautify \
    || just _build {{target}}

build_ios configuration="Release":
  just build "platform=iOS,arch=arm64,name={{device_name}}" "{{configuration}}"

build_ios_simulator configuration="Release":
  just build "platform=iOS Simulator,name=iPhone 17 Pro" "{{configuration}}"

test_ios_simulator scheme="SoraTests":
  xcodebuild -project Sora.xcodeproj -scheme {{scheme}} -destination 'platform=iOS Simulator,name=iPhone 17 Pro' test

run:
	just _open {{target}}

install derived_data=derived_data location=location:
  cp -r {{derived_data}}/{{target}}-*/Build/Products/Release/{{target}}.app {{location}}

generate:
  command -v xcodegen >/dev/null 2>&1 \
    && xcodegen generate \
    || 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

run_ios flags="":
  xcrun devicectl device process launch {{flags}} --device {{device_identifier}} {{identifier}}

ios_log:
  just ios --console "Debug"

ios flags="" configuration="Release":
  just build_ios "{{configuration}}"
  just install_ios "{{derived_data}}" "{{configuration}}"
  just run_ios {{flags}}

macos:
  just build
  just run

commit:
  git add . && git commit -am "feat: Development commit"