Skip to content

Commit

Permalink
Import as-needed without implicitly importing UIKit (#89)
Browse files Browse the repository at this point in the history
* Import as-needed without implicitly importing UIKit

* Remove duplicate imports

* Try adding sandbox.h include_next back

* Seems the sys header was too specific

* Pass stdlib for ++ langs only

* Conditionally include_next sandbox.h in sandbox.h

* matrix.cxxflags -> additional_flags

* Don't 'compile' directly

* Remove quotes since these can be blank
  • Loading branch information
L1ghtmann authored Nov 26, 2023
1 parent a2a4086 commit 1c33d11
Show file tree
Hide file tree
Showing 311 changed files with 638 additions and 77 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/compile-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
with:
repository: theos/sdks
ref: bb425abf3acae8eac328b828628b82df544d2774 # pinned, should be updated as appropriate
sparse-checkout: iPhoneOS14.5.sdk
path: sdks

- name: Checkout theos/headers
Expand All @@ -36,30 +37,33 @@ jobs:
"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
{
# Eventually we want to not require UIKit, but we're not there yet
echo "#import <UIKit/UIKit.h>"
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 }} \
-fsyntax-only -
${ADDITIONAL_FLAGS} -fsyntax-only -
done
1 change: 1 addition & 0 deletions AVFoundation/AVCaptureStillImageOutput+Private.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import <AVFoundation/AVFoundation.h>
#import <CoreGraphics/CoreGraphics.h>

@interface AVCaptureStillImageOutput (Private)

Expand Down
1 change: 1 addition & 0 deletions AVFoundation/AVCaptureStillImageRequest.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>

@interface AVCaptureStillImageRequest : NSObject

Expand Down
2 changes: 1 addition & 1 deletion AddressBookUI/ABMonogrammer.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIImage.h>

typedef NS_ENUM(NSUInteger, ABMonogrammerStyle) {
ABMonogrammerStyleLightGray,
Expand Down
3 changes: 3 additions & 0 deletions AlienBlue/AlienBlueAppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <UIKit/UIApplication.h>
#import <UIKit/UIWindow.h>

@interface AlienBlueAppDelegate : NSObject <UIApplicationDelegate>

@property (nonatomic, retain) UIWindow *window;
Expand Down
3 changes: 3 additions & 0 deletions AlienBlue/AppSchemeCoordinator.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

@interface AppSchemeCoordinator : NSObject

+ (void)openRedditThreadUrl:(NSString *)url;
Expand Down
2 changes: 2 additions & 0 deletions AlienBlue/JMOutlineViewController.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <UIKit/UIViewController.h>

@interface JMOutlineViewController : UIViewController

@end
3 changes: 3 additions & 0 deletions AlienBlue/NavigationManager.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

@class Post;

@interface NavigationManager : NSObject
Expand Down
1 change: 1 addition & 0 deletions AlienBlue/Post.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "VotableElement.h"
#import <Foundation/NSString.h>

@interface Post : VotableElement

Expand Down
2 changes: 2 additions & 0 deletions AlienBlue/PostsViewController.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <UIKit/UIViewController.h>

@interface PostsViewController : UIViewController

- (instancetype)initWithSubreddit:(NSString *)subreddit title:(NSString *)title;
Expand Down
2 changes: 2 additions & 0 deletions AlienBlue/VotableElement.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface VotableElement : NSObject

@end
3 changes: 3 additions & 0 deletions Anemone/ANEMSettingsManager.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSArray.h>

@interface ANEMSettingsManager : NSObject

+ (instancetype)sharedManager;
Expand Down
2 changes: 0 additions & 2 deletions AppList/ALApplicationList.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <libkern/OSAtomic.h>

enum {
Expand Down
1 change: 0 additions & 1 deletion AppList/ALApplicationTableDataSource.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <libkern/OSAtomic.h>

@class ALApplicationList;
Expand Down
1 change: 0 additions & 1 deletion AppList/ALValueCell.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@protocol ALValueCellDelegate;

Expand Down
2 changes: 2 additions & 0 deletions AppSupport/CPBitmapStore.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface CPBitmapStore : NSObject

- (void)purge;
Expand Down
5 changes: 5 additions & 0 deletions AppSupport/CPDistributedMessagingCenter.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>

@interface CPDistributedMessagingCenter : NSObject

+ (instancetype)centerNamed:(NSString *)name;
Expand Down
5 changes: 5 additions & 0 deletions ApplePushService/APSMessage.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import <Foundation/NSObjCRuntime.h>

@interface APSMessage : NSObject <NSCoding>

- (id)initWithDictionary:(NSDictionary *)dictionary;
Expand Down
2 changes: 2 additions & 0 deletions AssertionServices/BKSProcess.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface BKSProcess : NSObject

@property (nonatomic, assign) BOOL nowPlayingWithAudio;
Expand Down
4 changes: 4 additions & 0 deletions AssertionServices/BKSProcessAssertion.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>

#define kBKSBackgroundModeUnboundedTaskCompletion @"unboundedTaskCompletion"
#define kBKSBackgroundModeContinuous @"continuous"
#define kBKSBackgroundModeFetch @"fetch"
Expand Down
1 change: 1 addition & 0 deletions BaseBoard/BSAction.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import "BSDescriptionProviding.h"
#import "BSSettingDescriptionProvider.h"
#import "BSXPCCoding.h"
#import <Foundation/Foundation.h>

@interface BSAction : NSObject <BSDescriptionProviding, BSSettingDescriptionProvider, BSXPCCoding>

Expand Down
3 changes: 3 additions & 0 deletions BaseBoard/BSAuditToken.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

@interface BSAuditToken : NSObject <NSCopying>

@property (nonatomic, copy, readonly) NSString *bundleID;
Expand Down
2 changes: 2 additions & 0 deletions BaseBoard/BSBaseXPCClient.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface BSBaseXPCClient : NSObject

@end
4 changes: 3 additions & 1 deletion BaseBoard/BSPlatform.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#import <Foundation/Foundation.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSObjCRuntime.h>

typedef NS_ENUM(NSUInteger, BSDeviceClass) {
BSDeviceClassIPhone,
Expand Down
4 changes: 4 additions & 0 deletions BaseBoard/BSProcessHandle.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSObjCRuntime.h>

@class BSMachPortTaskNameRight;

@interface BSProcessHandle : NSObject
Expand Down
4 changes: 4 additions & 0 deletions BaseBoard/BSSettings.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSIndexSet.h>

typedef NS_ENUM(NSUInteger, BSSettingType) {
BSSettingTypeThisIsAReminderToFillOutTheseEnumNames = 8
};
Expand Down
2 changes: 2 additions & 0 deletions BaseBoardUI/UIViewController+BaseBoardUI.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <UIKit/UIViewController.h>

@interface UIViewController (BaseBoardUI)

- (BOOL)bs_addChildViewController:(UIViewController *)childController;
Expand Down
2 changes: 2 additions & 0 deletions BiteSMS/BSQCQRLauncher.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface BSQCQRLauncher : NSObject

+ (void)showQuickCompose:(BOOL)isLocked;
Expand Down
4 changes: 4 additions & 0 deletions BulletinBoard/BBAction.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSURL.h>

typedef void (^BBActionCallblock)();

@class BBAppearance;
Expand Down
3 changes: 3 additions & 0 deletions BulletinBoard/BBAppearance.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

@interface BBAppearance : NSObject

+ (instancetype)appearanceWithTitle:(NSString *)title;
Expand Down
1 change: 1 addition & 0 deletions BulletinBoard/BBBulletin.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import <AddressBook/AddressBook.h>
#import <Foundation/Foundation.h>

@class BBAction, BBContent, BBSectionIcon, BBSectionParameters, BBSectionSubtypeParameters;

Expand Down
3 changes: 3 additions & 0 deletions BulletinBoard/BBDataProvider.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>

@class BBActionResponse, BBBulletinRequestParameters, BBDataProviderIdentity, BBSectionIcon, BBSectionInfo, BBSectionParameters, BBThumbnailSizeConstraints;

@protocol BBSectionIdentity <NSObject>
Expand Down
4 changes: 4 additions & 0 deletions BulletinBoard/BBDataProviderIdentity.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSArray.h>

@class BBDataProvider, BBSectionInfo, BBSectionParameters;

@interface BBDataProviderIdentity : NSObject
Expand Down
2 changes: 2 additions & 0 deletions BulletinBoard/BBLocalDataProviderStore.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@protocol BBDataProvider;

@interface BBLocalDataProviderStore : NSObject
Expand Down
2 changes: 2 additions & 0 deletions BulletinBoard/BBSectionIcon.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@class BBSectionIconVariant;

@interface BBSectionIcon : NSObject
Expand Down
4 changes: 4 additions & 0 deletions BulletinBoard/BBSectionIconVariant.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSData.h>

@interface BBSectionIconVariant : NSObject

+ (instancetype)variantWithFormat:(NSUInteger)format imageData:(NSData *)data;
Expand Down
3 changes: 3 additions & 0 deletions BulletinBoard/BBSectionInfoSettings.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSObjCRuntime.h>

typedef NS_OPTIONS(NSUInteger, BBSectionInfoPushSettings) {
BBSectionInfoPushSettingsBadges = 1 << 0,
BBSectionInfoPushSettingsSounds = 1 << 1,
Expand Down
3 changes: 3 additions & 0 deletions BulletinBoard/BBSectionParameters.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSDictionary.h>

@class BBSectionSubtypeParameters;

@interface BBSectionParameters : NSObject
Expand Down
2 changes: 2 additions & 0 deletions BulletinBoard/BBSectionSubtypeParameters.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface BBSectionSubtypeParameters : NSObject

@property (nonatomic) BOOL allowsAddingToLockScreenWhenUnlocked;
Expand Down
3 changes: 3 additions & 0 deletions BulletinBoard/BBSettingsGateway.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

@class BBSectionInfo;

typedef void (^BBSettingsGatewayGetSectionInfoCompletion)(BBSectionInfo *sectionInfo);
Expand Down
3 changes: 3 additions & 0 deletions BulletinBoard/BBThumbnailSizeConstraints.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <CoreGraphics/CoreGraphics.h>

@interface BBThumbnailSizeConstraints : NSObject

@property (nonatomic) CGFloat fixedWidth;
Expand Down
3 changes: 3 additions & 0 deletions BulletinBoard/BBWeeAppController.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <UIKit/UIView.h>
#import <UIKit/UIApplication.h>

@protocol BBWeeAppController

- (UIView *)view;
Expand Down
1 change: 0 additions & 1 deletion CameraKit/UIView+CameraKitAdditions.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface UIView (CameraKit)
Expand Down
2 changes: 2 additions & 0 deletions Celestial/AVController.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface AVController : NSObject

@end
2 changes: 2 additions & 0 deletions Celestial/AVItem.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface AVItem : NSObject

@end
2 changes: 2 additions & 0 deletions Celestial/AVQueue.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/NSObject.h>

@interface AVQueue : NSObject

@end
3 changes: 3 additions & 0 deletions ChatKit/CKConversation.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

@class IMChat;

@interface CKConversation : NSObject
Expand Down
3 changes: 3 additions & 0 deletions ChatKit/CKConversationList.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSArray.h>

@interface CKConversationList : NSObject {
NSMutableArray *_trackedConversations;
}
Expand Down
3 changes: 3 additions & 0 deletions ChatKit/CKConversationListCell.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <UIKit/UITableViewCell.h>
#import <UIKit/UILabel.h>

@class CKConversation;

@interface CKConversationListCell : UITableViewCell {
Expand Down
2 changes: 2 additions & 0 deletions ChatKit/CKConversationListController.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <UIKit/UITableViewController.h>

@class CKConversationList;

@interface CKConversationListController : UITableViewController
Expand Down
4 changes: 4 additions & 0 deletions ChatKit/CKDNDList.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSDate.h>
#import <Foundation/NSString.h>

@interface CKDNDList : NSObject

+ (instancetype)sharedList;
Expand Down
3 changes: 3 additions & 0 deletions ChatKit/CKDetailsCell.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#import <UIKit/UITableViewCell.h>
#import <UIKit/UIView.h>

@interface CKDetailsCell : UITableViewCell

@property (nonatomic, retain) UIView *topSeperator;
Expand Down
Loading

0 comments on commit 1c33d11

Please sign in to comment.