Skip to content

Commit

Permalink
Start ignoring all system libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikoloutsos committed Oct 31, 2024
1 parent 5bb922b commit bf32d59
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct ExplicitDependencyImportCheckPlugin: BuildToolPlugin {
let dependeniesNames = findSpmTargetDependencies(fromTarget: target)
let sitrepResponse = try findImportsUsedInCode(context: context, path: target.directory.string)
let transitiveDependencies = sitrepResponse.subtracting(dependeniesNames)
let transitiveDependenciesWithoutCommon = transitiveDependencies.subtracting(commonDependencies)
let transitiveDependenciesWithoutCommon = transitiveDependencies.subtracting(systemLibraries)
guard transitiveDependenciesWithoutCommon.isEmpty == false else { return [] }
return [
try exportTransitiveDependenciesAsErrors(
Expand Down Expand Up @@ -42,23 +42,6 @@ extension ExplicitDependencyImportCheckPlugin {
}
}

extension ExplicitDependencyImportCheckPlugin {
/// These should not be considered as transitive dependencies.
var commonDependencies: Set<String> {
Set<String>(
[
"Foundation",
"UIKit",
"SwiftUI",
"Combine",
"CoreData",
"Webkit",
"OSLog"
]
)
}
}

extension ExplicitDependencyImportCheckPlugin {
/// This function is finding the import statements in sourcecode.
func findImportsUsedInCode(context: PluginContext, path: String) throws -> Set<String> {
Expand Down
248 changes: 248 additions & 0 deletions Plugins/explicitDependencyImportCheckPlugin/SystemLibraries.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
/// A list of all system libraries extracted from [applewiki](https://theapplewiki.com/wiki/Filesystem:/System/Library/Frameworks)
let systemLibraries = Set<String>(
[
"_AdAttributionKit_StoreKit",
"_AppIntents_SwiftUI",
"_AppIntents_UIKit",
"_AuthenticationServices_SwiftUI",
"_AVKit_SwiftUI",
"_CoreData_CloudKit",
"_CoreLocationUI_SwiftUI",
"_CoreNFC_UIKit",
"_DeviceActivity_SwiftUI",
"_GameController_SwiftUI",
"_GroupActivities_UIKit",
"_HomeKit_SwiftUI",
"_Intents_TipKit",
"_ManagedAppDistribution_SwiftUI",
"_MapKit_SwiftUI",
"_MarketplaceKit_UIKit",
"_MusicKit_SwiftUI",
"_PassKit_SwiftUI",
"_PhotosUI_SwiftUI",
"_QuickLook_SwiftUI",
"_RealityKit_SwiftUI",
"_SceneKit_SwiftUI",
"_SpriteKit_SwiftUI",
"_StoreKit_SwiftUI",
"_SwiftData_CoreData",
"_SwiftData_SwiftUI",
"_Translation_SwiftUI",
"_WorkoutKit_SwiftUI",
"Accelerate",
"Accessibility",
"AccessorySetupKit",
"Accounts",
"ActivityKit",
"AdAttributionKit",
"AddressBook",
"AddressBookUI",
"AdServices",
"AdSupport",
"AppClip",
"AppIntents",
"AppleBasebandManager",
"AppTrackingTransparency",
"ARDisplayDevice",
"ARKit",
"AssetsLibrary",
"Assignables",
"AudioToolbox",
"AudioUnit",
"AuthenticationServices",
"AutomatedDeviceEnrollment",
"AutomaticAssessmentConfiguration",
"AVFAudio",
"AVFoundation",
"AVKit",
"AVRouting",
"BackgroundAssets",
"BackgroundTasks",
"BrowserEngineCore",
"BrowserEngineKit",
"BusinessChat",
"CallKit",
"CarKey",
"CarPlay",
"CFNetwork",
"Charts",
"CHIP",
"Cinematic",
"ClassKit",
"ClockKit",
"CloudKit",
"ColorSync",
"Combine",
"ContactProvider",
"Contacts",
"ContactsUI",
"CoreAudio",
"CoreAudioKit",
"CoreAudioTypes",
"CoreBluetooth",
"CoreData",
"CoreFoundation",
"CoreGraphics",
"CoreHaptics",
"CoreImage",
"CoreLocation",
"CoreLocationUI",
"CoreMedia",
"CoreMediaIO",
"CoreMIDI",
"CoreML",
"CoreMotion",
"CoreNFC",
"CoreServices",
"CoreSpotlight",
"CoreTelephony",
"CoreText",
"CoreTransferable",
"CoreVideo",
"CreateML",
"CreateMLComponents",
"CryptoKit",
"CryptoTokenKit",
"DataDetection",
"DeveloperToolsSupport",
"DeviceActivity",
"DeviceCheck",
"DeviceDiscoveryExtension",
"DockKit",
"DriverKit",
"EventKit",
"EventKitUI",
"ExposureNotification",
"ExtensionFoundation",
"ExtensionKit",
"ExternalAccessory",
"FamilyControls",
"FileProvider",
"FileProviderUI",
"FinanceKit",
"FinanceKitUI",
"Foundation",
"GameController",
"GameKit",
"GameplayKit",
"GLKit",
"GroupActivities",
"GSS",
"HealthKit",
"HealthKitUI",
"HomeKit",
"iAD",
"iAd",
"IdentityLookup",
"IdentityLookupUI",
"ImageCaptureCore",
"ImageIO",
"Intents",
"IntentsUI",
"IOKit",
"IOSurface",
"JavaScriptCore",
"JournalingSuggestions",
"LightweightCodeRequirements",
"LinkPresentation",
"LiveCommunicationKit",
"LocalAuthentication",
"LocalAuthenticationEmbeddedUI",
"LockedCameraCapture",
"ManagedAppDistribution",
"ManagedSettings",
"ManagedSettingsUI",
"MapKit",
"MarketplaceKit",
"Matter",
"MatterSupport",
"MediaAccessibility",
"MediaPlayer",
"MediaSetup",
"MediaToolbox",
"Messages",
"MessageUI",
"Metal",
"MetalFX",
"MetalKit",
"MetalPerformanceShaders",
"MetalPerformanceShadersGraph",
"MetricKit",
"MLCompute",
"MobileCoreServices",
"ModelIO",
"MultipeerConnectivity",
"MultitouchSupport",
"MusicKit",
"NaturalLanguage",
"NearbyInteraction",
"Network",
"NetworkExtension",
"NewsstandKit",
"NotificationCenter",
"OpenAL",
"OpenGLES",
"OSLog",
"PassKit",
"PDFKit",
"PencilKit",
"PHASE",
"Photos",
"PhotosUI",
"ProximityReader",
"PushKit",
"PushToTalk",
"QuartzCore",
"QuickLook",
"QuickLookThumbnailing",
"RealityFoundation",
"RealityKit",
"ReplayKit",
"RoomPlan",
"SafariServices",
"SafetyKit",
"SceneKit",
"ScreenTime",
"Security",
"SensitiveContentAnalysis",
"SensorKit",
"ServiceExtensions",
"ServiceExtensionsCore",
"SharedWithYou",
"SharedWithYouCore",
"ShazamKit",
"Social",
"SoundAnalysis",
"Speech",
"SpriteKit",
"StickerFoundation",
"StickerKit",
"StoreKit",
"SwiftData",
"SwiftUI",
"SwiftUICore",
"Symbols",
"System",
"SystemConfiguration",
"TabularData",
"ThreadNetwork",
"TipKit",
"TipsNext",
"Translation",
"Twitter",
"UIKit",
"UniformTypeIdentifiers",
"UserNotifications",
"UserNotificationsUI",
"VideoSubscriberAccount",
"VideoToolbox",
"Vision",
"VisionKit",
"WatchConnectivity",
"WatchKit",
"WeatherKit",
"WebKit",
"WidgetKit",
"WorkoutKit"
]
)

0 comments on commit bf32d59

Please sign in to comment.