Remove common 3rd party headers and update code rules (#90) #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile Test | |
on: | |
push: | |
jobs: | |
compile-headers: | |
strategy: | |
fail-fast: false | |
matrix: | |
runner: ["ubuntu-latest", "macos-latest"] | |
language: ["objective-c", "objective-c++"] | |
cflags: ["", "-fobjc-arc"] | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout theos/sdks | |
uses: actions/checkout@v3 | |
with: | |
repository: theos/sdks | |
ref: bb425abf3acae8eac328b828628b82df544d2774 # pinned, should be updated as appropriate | |
sparse-checkout: iPhoneOS14.5.sdk | |
path: sdks | |
- name: Checkout theos/headers | |
uses: actions/checkout@v3 | |
with: | |
path: headers | |
- name: Compile All | |
run: | | |
UNCHECKED_DIRECTORIES=( | |
"IOKit" | |
) | |
UNCHECKED_FILES=( | |
"QuartzCore/QuartzCore-Structs.h" # known to not work | |
"rocketbootstrap/rocketbootstrap_dynamic.h" # noted to not include directly | |
"libundirect/libundirect_hookoverwrite.h" # user's responsibility to include either the base or dynamic header | |
) | |
ADDITIONAL_FLAGS="" | |
if [[ "${{ matrix.language }}" == *"++"* ]]; then | |
ADDITIONAL_FLAGS="-stdlib=libc++" | |
fi | |
HEADER_DIR="headers" | |
# cut to drop the leading directory | |
for HEADER in $(find "${HEADER_DIR}" -name "*.h" | cut -c"$(( ${#HEADER_DIR} + 2))"-); do | |
for UNCHECKED_DIRECTORY in "${UNCHECKED_DIRECTORIES[@]}"; do | |
if [[ "${HEADER}" == "${UNCHECKED_DIRECTORY}"/* ]]; then | |
continue 2 | |
fi | |
done | |
for UNCHECKED_FILE in "${UNCHECKED_FILES[@]}"; do | |
if [[ "${HEADER}" == "${UNCHECKED_FILE}" ]]; then | |
continue 2 | |
fi | |
done | |
{ | |
echo "#import <${HEADER}>" | |
echo "int main() {}" | |
} | clang -I "${HEADER_DIR}" -isysroot sdks/iPhoneOS14.5.sdk \ | |
-target arm64-apple-ios14.5 -arch arm64 \ | |
-x "${{ matrix.language }}" ${{ matrix.cflags }} \ | |
${ADDITIONAL_FLAGS} -fsyntax-only - | |
done |