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
12 changes: 9 additions & 3 deletions .github/workflows/google-utilities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ jobs:
run: |
sudo xcode-select -s '/Applications/Xcode_16.2.app/Contents/Developer'
xcodebuild -list
- name: Install Simulator
if: matrix.target == 'iOS' || matrix.target == 'tvOS'
run: xcodebuild -downloadPlatform ${{ matrix.target }}
- name: Install simulator SDKs
if: matrix.target != 'macOS' && matrix.target != 'catalyst'
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
with:
timeout_minutes: 15
max_attempts: 5
retry_wait_seconds: 120
continue_on_error: true
command: xcodebuild -downloadPlatform ${{ matrix.target }}
- name: iOS Unit Tests
run: scripts/third_party/travis/retry.sh scripts/build.sh GoogleUtilities-Package ${{ matrix.target }} spm

Expand Down
42 changes: 28 additions & 14 deletions GoogleUtilities/SwizzlerTestHelpers/GULRuntimeSnapshot.m
Copy link
Copy Markdown
Member Author

@ncooke3 ncooke3 Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-merge actions:

  • Merge PR, move tags, stage pod, verify with
pod spec lint GoogleUtilities.podspec --platforms=macos --sources=git@github.com:firebase/SpecsStaging.git,https://cdn.cocoapods.org
  • Then publish

Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,43 @@ - (NSString *)description {
}

- (void)capture {
int numberOfClasses = objc_getClassList(NULL, 0);
Class *classList = (Class *)malloc(numberOfClasses * sizeof(Class));
numberOfClasses = objc_getClassList(classList, numberOfClasses);
int bufferLen = objc_getClassList(NULL, 0);
if (bufferLen <= 0) {
return;
}
Class *classList = (Class *)calloc(bufferLen, sizeof(Class));
if (classList == NULL) {
return;
}
int numberOfClasses = objc_getClassList(classList, bufferLen);
int count = MIN(bufferLen, numberOfClasses);

// If we should track specific classes, then there's no need to figure out all ObjC classes.
if (_classes) {
for (Class aClass in _classes) {
NSString *classString = NSStringFromClass(aClass);
GULRuntimeClassSnapshot *classSnapshot =
[[GULRuntimeClassSnapshot alloc] initWithClass:aClass];
_classSnapshots[classString] = classSnapshot;
[classSnapshot capture];
_runningHash ^= [classSnapshot hash];
if (classString) {
GULRuntimeClassSnapshot *classSnapshot =
[[GULRuntimeClassSnapshot alloc] initWithClass:aClass];
_classSnapshots[classString] = classSnapshot;
[classSnapshot capture];
_runningHash ^= [classSnapshot hash];
}
}
} else {
for (int i = 0; i < numberOfClasses; i++) {
for (int i = 0; i < count; i++) {
Class aClass = classList[i];
if (aClass == Nil) {
continue;
}
NSString *classString = NSStringFromClass(aClass);
GULRuntimeClassSnapshot *classSnapshot =
[[GULRuntimeClassSnapshot alloc] initWithClass:aClass];
_classSnapshots[classString] = classSnapshot;
[classSnapshot capture];
_runningHash ^= [classSnapshot hash];
if (classString) {
GULRuntimeClassSnapshot *classSnapshot =
[[GULRuntimeClassSnapshot alloc] initWithClass:aClass];
_classSnapshots[classString] = classSnapshot;
[classSnapshot capture];
_runningHash ^= [classSnapshot hash];
}
}
}
free(classList);
Expand Down
Loading