Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@ jobs:
steps:
- uses: actions/checkout@v2

- run: mdutil -s /

- run: sudo mdutil -E /

- name: Install shunit2
run: brew install shunit2

- name: Wait for spotlight to index our test Xcodes directory
run: ./bin/wait-for-spotlight

- name: Run mdfind
run: mdfind -onlyin "$PWD/test/applications" "kMDItemCFBundleIdentifier='com.apple.dt.Xcode'"

- name: Run tests
run: make test

Expand Down
19 changes: 19 additions & 0 deletions bin/wait-for-spotlight
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

xcodes_path="$PWD/test/applications"

while true; do
mdimport "$xcodes_path"
mdls "$xcodes_path"

output="$(mdfind -onlyin "$xcodes_path" "kMDItemCFBundleIdentifier='com.apple.dt.Xcode'")"

if [ -z "$output" ]; then
echo "mdfind did not find any Xcodes at $xcodes_path"
ls "$xcodes_path"
sleep 1
else
echo "found '$output'"
break
fi
done
6 changes: 6 additions & 0 deletions share/chxcode/chxcode
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ system_xcode_version() {

xcode_versions() {
system_version=$(system_xcode_version)
versions=()
for xcode in ${XCODES[*]}; do
version=$(xcode_version "$xcode")
versions+=("$version")
done

IFS=$'\n' versions=($(sort -n <<<"${versions[*]}")); unset IFS

for version in ${versions[*]}; do
if [ "$version" = "$system_version" ]; then
echo "* $version"
else
Expand Down
2 changes: 1 addition & 1 deletion test/chxcode_test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
. ./test/helper

test_exec_with_no_arguments() {
export DEVELOPER_DIR="$search_path/Xcode.app/Contents/Developer"
export DEVELOPER_DIR="$search_path/Xcode.app/Contents/Developer"

xcodes=$(chxcode | tr '\n' ' ' | xargs)

Expand Down