Skip to content

XCTest include AppKit issue #140

@Kyle-Ye

Description

@Kyle-Ye
swift test --filter UnsafeMutableTupleCompatibilityTests
[1/1] Planning build
Building for debugging...
In file included from /Users/xxx/SwiftProjects/OpenSwiftUIProject/OpenGraph/Tests/OpenGraph_SPITests/table_test_case.mm:8:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/Headers/XCTest.h:35:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCUIAutomation.framework/Headers/XCUIAutomation.h:7:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCUIAutomation.framework/Headers/XCUIApplication.h:6:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCUIAutomation.framework/Headers/XCUIElement.h:10:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:15:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAccessibilityColor.h:9:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:46:
In file included from /Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:10:
/Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:376:4: error: expected a type
  376 | - (IBAction)newWindowForTab:(nullable id)sender API_AVAILABLE(macos(10.12));
      |    ^
/Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:382:4: error: expected a type
  382 | - (IBAction)showWritingTools:(nullable id)sender API_AVAILABLE(macos(15.2));
      |    ^
2 errors generated.
[2/33] Compiling OpenGraph_SPITests table_test_case.mm
error: fatalError

In Package.swift

let swiftToolchainPath = Context.environment["OPENGRAPH_SWIFT_TOOLCHAIN_PATH"] ?? (development ? "/Volumes/BuildMachine/swift-project" : "")
if !swiftToolchainPath.isEmpty {
    sharedCSettings.append(
        .unsafeFlags(
            [
                "-static",
                "-DCOMPILED_WITH_SWIFT",
                "-DPURE_BRIDGING_MODE",
                "-UIBOutlet", "-UIBAction", "-UIBInspectable",
                "-I\(swiftToolchainPath)/swift/include",
                "-I\(swiftToolchainPath)/swift/stdlib/public/SwiftShims",
                "-I\(swiftToolchainPath)/llvm-project/llvm/include",
                "-I\(swiftToolchainPath)/llvm-project/clang/include",
                "-I\(swiftToolchainPath)/build/Default/swift/include",
                "-I\(swiftToolchainPath)/build/Default/llvm/include",
                "-I\(swiftToolchainPath)/build/Default/llvm/tools/clang/include",
                "-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING", // Required to fix LLVM link issue
            ]
        )
    )
}

After remove "-UIBOutlet", "-UIBAction", "-UIBInspectable", it works well.
table_test_case.mm -> XCTest.h → XCUIAutomation.h → AppKit.h → NSResponder.h -> IBAction.
I haven't got around to fixing this part yet.

Originally posted by @Dark-Existed in #135 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions