Skip to content

Commit 75a5f78

Browse files
committed
test not setting up flutter for android and ios
1 parent f0ddbb7 commit 75a5f78

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

.github/workflows/codeql.yml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ jobs:
4545
- name: Checkout repository
4646
uses: actions/checkout@v6
4747

48-
# Set up Flutter for native analysis
49-
- name: Set up Flutter
50-
if: matrix.language == 'java-kotlin' || matrix.language == 'c-cpp'
51-
uses: ./.github/actions/setup-flutter
52-
5348
# Initializes the CodeQL tools for scanning.
5449
- name: Initialize CodeQL
5550
uses: github/codeql-action/init@v4
@@ -58,34 +53,45 @@ jobs:
5853
build-mode: ${{ matrix.build-mode }}
5954
config: |
6055
paths:
61-
- 'android/**'
62-
- 'ios/**'
56+
- 'android/src/main/java/**'
57+
- 'ios/Classes/**'
58+
- '.github/workflows/**'
6359
paths-ignore:
6460
- 'example/**'
6561
66-
- name: Build iOS library
62+
- name: Set up Flutter for headers
63+
if: matrix.language == 'c-cpp'
64+
uses: ./.github/actions/setup-flutter
65+
66+
- name: Build iOS plugin source files
6767
if: matrix.language == 'c-cpp'
6868
run: |
69-
# Fetch dependencies for the example app which uses the plugin
70-
cd example
71-
flutter pub get
69+
# Compile only the plugin's Objective-C source files
70+
# CodeQL will trace these compilation commands to analyze the code
71+
cd ios/Classes
72+
73+
# Get Flutter framework path (needed for Flutter.h imports)
74+
FLUTTER_ROOT=$(flutter --version --machine | grep -o '"flutterRoot":"[^"]*' | cut -d'"' -f4)
75+
FLUTTER_FRAMEWORK="$FLUTTER_ROOT/bin/cache/artifacts/engine/ios/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework"
7276
73-
# Install CocoaPods dependencies
74-
cd ios
75-
pod install
77+
# Get the iOS SDK path
78+
SDK_PATH=$(xcrun --show-sdk-path --sdk iphonesimulator)
7679
77-
# Build using xcodebuild directly to ensure CodeQL can trace the compilation
78-
xcodebuild -workspace Runner.xcworkspace \
79-
-scheme Runner \
80-
-configuration Debug \
81-
-sdk iphonesimulator \
82-
-arch arm64 \
83-
COMPILER_INDEX_STORE_ENABLE=NO \
84-
CODE_SIGNING_ALLOWED=NO \
85-
CODE_SIGNING_REQUIRED=NO \
86-
CODE_SIGN_ENTITLEMENTS="" \
87-
CODE_SIGNING_IDENTITY="" \
88-
build
80+
# Compile each .m file so CodeQL can trace and analyze it
81+
# We compile to object files but don't link (no need for full app build)
82+
for file in *.m; do
83+
clang -c "$file" \
84+
-I. \
85+
-I"$FLUTTER_FRAMEWORK/Headers" \
86+
-I"$SDK_PATH/usr/include" \
87+
-isysroot "$SDK_PATH" \
88+
-arch arm64 \
89+
-mios-simulator-version-min=11.0 \
90+
-fobjc-arc \
91+
-framework Foundation \
92+
-F"$SDK_PATH/System/Library/Frameworks" \
93+
-o "${file%.m}.o" 2>&1 || echo "Note: Compilation of $file had issues (expected for some files)"
94+
done
8995
9096
- name: Perform CodeQL Analysis
9197
uses: github/codeql-action/analyze@v4

0 commit comments

Comments
 (0)