Add Linux compilation support#9
Open
davidbean-hash wants to merge 2 commits into
Open
Conversation
- Create UTICompat.swift with cross-platform utiConforms() function that uses CoreServices on macOS and a fallback UTI hierarchy on Linux - Replace all UTTypeConformsTo calls in ScreenshotsCommand.swift, AttachmentsCommand.swift, and CommandRegistry.swift with utiConforms() - Update tests to use utiConforms() via XCParseCore import - Remove macOS platform restriction from Package.swift to allow Linux builds Fixes ChargePoint#77 Co-Authored-By: david.bean <david.bean@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Add 'import XCParseCore' to AttachmentsCommand, CommandRegistry, and ScreenshotsCommand so utiConforms() is in scope - Add FoundationNetworking import for URLSession/URLRequest on Linux - Fix ProcessInfo() -> ProcessInfo.processInfo for Linux compatibility - Remove unused Bundle(for:) call in ReportConverterTests - Expand UTI hierarchy: add com.microsoft.bmp, com.apple.icns, and remove redundant hardcoded image check - Add UTICompatTests with 11 tests covering image, text, data hierarchies, transitive conformance, identity, and negative cases - Register ScreenshotCommandUTITests and UTICompatTests in XCTestManifests for Linux test discovery Co-Authored-By: david.bean <david.bean@cognition.ai>
🧪 Linux E2E Test ResultsEnvironment: Ubuntu 22.04.5 LTS, Swift 5.10.1, x86_64-unknown-linux-gnu Build & Test Results
Code Changes Verified
UTICompatTests — Full Output |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description:
Adds Linux compilation support by replacing macOS-only
UTTypeConformsTo(from CoreServices) with a cross-platformutiConforms()helper function. Fixes ChargePoint/xcparse#77.The main blocker for Linux builds was
UTTypeConformsTofrom CoreServices, which is macOS-only. This PR:Creates
Sources/XCParseCore/UTICompat.swift— a cross-platform UTI conformance check:UTTypeConformsTovia#if canImport(CoreServices)Replaces all
UTTypeConformsTocalls inScreenshotsCommand.swift,AttachmentsCommand.swift, andCommandRegistry.swiftRemoves macOS platform restriction from
Package.swiftto allow Linux buildsFixes Linux compilation errors:
import XCParseCoretoAttachmentsCommand,CommandRegistry,ScreenshotsCommand(utiConforms was not in scope)import FoundationNetworkingforURLSession/URLRequeston LinuxProcessInfo()→ProcessInfo.processInfo(internal init on Linux)Bundle(for:)call inReportConverterTestsExpanded UTI hierarchy to cover all common types:
Added comprehensive UTI tests (
UTICompatTests.swift) with 11 test cases covering identity, image conformance, text hierarchies, transitive conformance (e.g.public.png→public.data), and negative casesFixed Linux test discovery — registered
ScreenshotCommandUTITestsandUTICompatTestsinXCTestManifests.swiftReference: Based on endanke's WIP commit.
Test Plan/Testing Performed:
swift buildsucceeds on Linux (Ubuntu 22.04, Swift 5.10.1)swift test --filter UTICompatTests— 11/11 tests passswift test --filter ScreenshotCommandUTITests— 1/1 test passespublic.pngconforms topublic.dataviapublic.image)public.imageconformanceLink to Devin session: https://app.devin.ai/sessions/668559778fc94cc8a60cb94da5222224
Requested by: @davidbean-hash