IBDecodable / IBLinter

A linter tool for Interface Builder
MIT License
948 stars 42 forks source link

0.5.0 regression build failure #189

Open chenrui333 opened 2 months ago

chenrui333 commented 2 months ago

👋 trying to build 0.5.0 release for macOS sequoia, but seeing some build failure as below:

  [24/31] Compiling SourceKittenFramework ByteCount.swift
  /private/tmp/iblinter-20240910-4584-eycidf/IBLinter-0.5.0/.build/checkouts/SourceKitten/Source/SourceKittenFramework/SwiftDocs.swift:35:13: error: cannot find 'fputs' in scope
  33 |             )
  34 |         } catch let error as Request.Error {
  35 |             fputs(error.description, stderr)
     |             `- error: cannot find 'fputs' in scope
  36 |             return nil
  37 |         } catch {

  /private/tmp/iblinter-20240910-4584-eycidf/IBLinter-0.5.0/.build/checkouts/SourceKitten/Source/SourceKittenFramework/SwiftDocs.swift:35:38: error: cannot find 'stderr' in scope
  33 |             )
  34 |         } catch let error as Request.Error {
  35 |             fputs(error.description, stderr)
     |                                      `- error: cannot find 'stderr' in scope
  36 |             return nil
  37 |         } catch {
  make: *** [build] Error 1
phimage commented 2 months ago

I change to macOS v12 (maybe just that is needed), and bump some third parties version and it seems to work now

So you could edit Package.swift like this to compile

// swift-tools-version:5.7

import PackageDescription

var package = Package(
    name: "IBLinter",
    platforms: [.macOS(.v12)],
    products: [
        .executable(
            name: "iblinter", targets: ["IBLinter"]
        ),
        .library(
            name: "IBLinterFrontend",
            type: .dynamic, targets: ["IBLinterFrontend"]
        ),
        .library(
            name: "IBLinterKit", targets: ["IBLinterKit"]
        ),
        .executable(
            name: "iblinter-tools", targets: ["IBLinterTools"]
        )
    ],
    dependencies: [
        .package(url: "https://github.com/IBDecodable/IBDecodable.git", from: "0.6.1"),
        .package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.36.0"),
        .package(url: "https://github.com/phimage/XcodeProjKit.git", from: "2.2.0"),
        .package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
    ],
    targets: [
        .target(
            name: "IBLinter",
            dependencies: ["IBLinterFrontend"]
        ),
        .target(
            name: "IBLinterFrontend",
            dependencies: ["IBLinterKit"]
        ),
        .target(
            name: "IBLinterKit",
            dependencies: [
                "IBDecodable",
                .product(name: "SourceKittenFramework", package: "SourceKitten"), "XcodeProjKit",
                .product(name: "ArgumentParser", package: "swift-argument-parser"),
            ]
        ),
        .target(
            name: "IBLinterTools",
            dependencies: ["IBLinterKit", .product(name: "ArgumentParser", package: "swift-argument-parser")]
        ),
        .testTarget(
            name: "IBLinterKitTest",
            dependencies: ["IBLinterKit"],
            exclude: [
                "Resources"
            ]
        ),
    ]
)

#if os(Linux)
package.dependencies.append(.package(url: "https://github.com/apple/swift-crypto.git", from: "1.0.0"))
package.targets[2].dependencies.append(.product(name: "Crypto", package: "swift-crypto"))
#endif