Skip to content

Commit f3bac65

Browse files
committed
2 parents 08ece27 + 9a23d5c commit f3bac65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3497
-1577
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ xcuserdata/
66
.swiftpm
77
build
88
.vscode
9+
Package.resolved

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ else()
2121
endif()
2222
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
2323

24+
set(CMAKE_DISABLE_IN_SOURCE_BUILD YES)
25+
2426
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
2527

2628
if(FIND_PM_DEPS)
@@ -31,6 +33,7 @@ find_package(dispatch QUIET)
3133
find_package(Foundation QUIET)
3234
find_package(Threads QUIET)
3335
find_package(SQLite3 REQUIRED)
36+
find_package(SwiftSystem CONFIG REQUIRED)
3437

3538
add_subdirectory(Sources)
3639
add_subdirectory(cmake/modules)

Package.swift

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
1-
// swift-tools-version:5.2
1+
// swift-tools-version:5.4
22

33
/*
44
This source file is part of the Swift.org open source project
5-
6-
Copyright (c) 2019 - 2020 Apple Inc. and the Swift project authors
5+
6+
Copyright (c) 2019 - 2021 Apple Inc. and the Swift project authors
77
Licensed under Apache License v2.0 with Runtime Library Exception
8-
8+
99
See http://swift.org/LICENSE.txt for license information
1010
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
1111
*/
1212

1313

1414
import PackageDescription
15+
import class Foundation.ProcessInfo
16+
17+
let macOSPlatform: SupportedPlatform
18+
if let deploymentTarget = ProcessInfo.processInfo.environment["SWIFTTSC_MACOS_DEPLOYMENT_TARGET"] {
19+
macOSPlatform = .macOS(deploymentTarget)
20+
} else {
21+
macOSPlatform = .macOS(.v10_10)
22+
}
23+
24+
let CMakeFiles = ["CMakeLists.txt"]
1525

1626
let package = Package(
1727
name: "swift-tools-support-core",
28+
platforms: [
29+
macOSPlatform,
30+
],
1831
products: [
32+
.library(
33+
name: "TSCBasic",
34+
targets: ["TSCBasic"]),
1935
.library(
2036
name: "SwiftToolsSupport",
2137
type: .dynamic,
@@ -28,44 +44,50 @@ let package = Package(
2844
name: "TSCTestSupport",
2945
targets: ["TSCTestSupport"]),
3046
],
31-
dependencies: [
32-
.package(url: "https://github.com/apple/swift-system.git", .upToNextMinor(from: "0.0.1"))
33-
],
3447
targets: [
35-
48+
3649
// MARK: Tools support core targets
37-
50+
3851
.target(
3952
/** Shim target to import missing C headers in Darwin and Glibc modulemap. */
4053
name: "TSCclibc",
41-
dependencies: []),
54+
dependencies: [],
55+
exclude: CMakeFiles),
4256
.target(
4357
/** Cross-platform access to bare `libc` functionality. */
4458
name: "TSCLibc",
45-
dependencies: []),
59+
dependencies: [],
60+
exclude: CMakeFiles),
4661
.target(
4762
/** TSCBasic support library */
4863
name: "TSCBasic",
49-
dependencies: ["TSCLibc", "TSCclibc",
50-
.product(name: "SystemPackage", package: "swift-system")]),
64+
dependencies: [
65+
"TSCLibc",
66+
"TSCclibc",
67+
.product(name: "SystemPackage", package: "swift-system"),
68+
],
69+
exclude: CMakeFiles + ["README.md"],
70+
cxxSettings: [.define("_CRT_SECURE_NO_WARNINGS")]),
5171
.target(
5272
/** Abstractions for common operations, should migrate to TSCBasic */
5373
name: "TSCUtility",
54-
dependencies: ["TSCBasic", "TSCclibc"]),
55-
74+
dependencies: ["TSCBasic", "TSCclibc"],
75+
exclude: CMakeFiles),
76+
5677
// MARK: Additional Test Dependencies
57-
78+
5879
.target(
5980
/** Generic test support library */
6081
name: "TSCTestSupport",
6182
dependencies: ["TSCBasic", "TSCUtility"]),
62-
63-
83+
84+
6485
// MARK: Tools support core tests
65-
86+
6687
.testTarget(
6788
name: "TSCBasicTests",
68-
dependencies: ["TSCTestSupport", "TSCclibc"]),
89+
dependencies: ["TSCTestSupport", "TSCclibc"],
90+
exclude: ["processInputs", "Inputs"]),
6991
.testTarget(
7092
name: "TSCBasicPerformanceTests",
7193
dependencies: ["TSCBasic", "TSCTestSupport"]),
@@ -74,16 +96,20 @@ let package = Package(
7496
dependencies: ["TSCTestSupport"]),
7597
.testTarget(
7698
name: "TSCUtilityTests",
77-
dependencies: ["TSCUtility", "TSCTestSupport"]),
99+
dependencies: ["TSCUtility", "TSCTestSupport"],
100+
exclude: ["pkgconfigInputs", "Inputs"]),
78101
]
79102
)
80103

81-
// FIXME: conditionalise these flags since SwiftPM 5.3 and earlier will crash
82-
// for platforms they don't know about.
83-
#if os(Windows)
84-
if let TSCBasic = package.targets.first(where: { $0.name == "TSCBasic" }) {
85-
TSCBasic.cxxSettings = [
86-
.define("_CRT_SECURE_NO_WARNINGS", .when(platforms: [.windows])),
104+
/// When not using local dependencies, the branch to use for llbuild and TSC repositories.
105+
let relatedDependenciesBranch = "main"
106+
107+
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
108+
package.dependencies += [
109+
.package(url: "https://github.com/apple/swift-system.git", .upToNextMinor(from: "1.1.1")),
110+
]
111+
} else {
112+
package.dependencies += [
113+
.package(path: "../swift-system"),
87114
]
88-
}
89-
#endif
115+
}

Sources/TSCBasic/ByteString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Foundation
1414
///
1515
/// This struct provides useful operations for working with buffers of
1616
/// bytes. Conceptually it is just a contiguous array of bytes (UInt8), but it
17-
/// contains methods and default behavor suitable for common operations done
17+
/// contains methods and default behavior suitable for common operations done
1818
/// using bytes strings.
1919
///
2020
/// This struct *is not* intended to be used for significant mutation of byte

Sources/TSCBasic/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ add_library(TSCBasic
5050
Thread.swift
5151
Tuple.swift
5252
misc.swift)
53-
53+
5454
target_compile_options(TSCBasic PUBLIC
5555
# Don't use GNU strerror_r on Android.
5656
"$<$<PLATFORM_ID:Android>:SHELL:-Xcc -U_GNU_SOURCE>"
5757
# Ignore secure function warnings on Windows.
5858
"$<$<PLATFORM_ID:Windows>:SHELL:-Xcc -D_CRT_SECURE_NO_WARNINGS>")
5959
target_link_libraries(TSCBasic PUBLIC
60-
TSCLibc
61-
SwiftSystem)
60+
SwiftSystem::SystemPackage
61+
TSCLibc)
6262
target_link_libraries(TSCBasic PRIVATE
6363
TSCclibc)
6464
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)

0 commit comments

Comments
 (0)