Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move CLinuxHelpers in Linux target #232

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@

import PackageDescription

#if os(Linux)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change will break cross-compilation. Generally in Package.swift files there should be no #if os(...)/#if arch(...) etc. I think the right change would be to make CLinuxHelpers compile on all OSes by using #if __linux etc in the .c/.h files similar to what SwiftNIO does for its CNIOLinux module: https://github.com/apple/swift-nio/tree/master/Sources/CNIOLinux

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you are right)
I rollback changes

var targets: [PackageDescription.Target] = [
.target(
name: "CLinuxHelpers",
dependencies: []),
.target(
name: "KituraNet",
dependencies: ["NIO", "NIOFoundationCompat", "NIOHTTP1", "NIOSSL", "SSLService", "LoggerAPI", "NIOWebSocket", "CLinuxHelpers", "NIOConcurrencyHelpers", "NIOExtras"]),
.testTarget(
name: "KituraNetTests",
dependencies: ["KituraNet"])
]
#else
var targets: [PackageDescription.Target] = [
.target(
name: "KituraNet",
dependencies: ["NIO", "NIOFoundationCompat", "NIOHTTP1", "NIOSSL", "SSLService", "LoggerAPI", "NIOWebSocket", "NIOConcurrencyHelpers", "NIOExtras"]),
.testTarget(
name: "KituraNetTests",
dependencies: ["KituraNet"])
]
#endif

let package = Package(
name: "Kitura-NIO",
products: [
Expand All @@ -33,15 +56,5 @@ let package = Package(
.package(url: "https://github.com/IBM-Swift/BlueSSLService.git", from: "1.0.0"),
.package(url: "https://github.com/IBM-Swift/LoggerAPI.git", from: "1.7.3")
],
targets: [
.target(
name: "CLinuxHelpers",
dependencies: []),
.target(
name: "KituraNet",
dependencies: ["NIO", "NIOFoundationCompat", "NIOHTTP1", "NIOSSL", "SSLService", "LoggerAPI", "NIOWebSocket", "CLinuxHelpers", "NIOConcurrencyHelpers", "NIOExtras"]),
.testTarget(
name: "KituraNetTests",
dependencies: ["KituraNet"])
]
targets: targets
)
2 changes: 1 addition & 1 deletion Sources/KituraNet/HTTP/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import NIOSSL
import SSLService
import LoggerAPI
import NIOWebSocket
import CLinuxHelpers
import Foundation
import NIOExtras
import NIOConcurrencyHelpers

#if os(Linux)
import Glibc
import CLinuxHelpers
#else
import Darwin
#endif
Expand Down
2 changes: 2 additions & 0 deletions Tests/KituraNetTests/RegressionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import NIO
import NIOHTTP1
import NIOSSL
import LoggerAPI
#if os(Linux)
import CLinuxHelpers
#endif

class RegressionTests: KituraNetTest {

Expand Down