Skip to content

Commit a608ccf

Browse files
authored
Merge pull request swiftlang#2 from swiftwasm/master
[pull] swiftwasm from master
2 parents a6bf0ef + c428675 commit a608ccf

35 files changed

+836
-416
lines changed

Fixtures/Resources/Localized/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:999.0
1+
// swift-tools-version:5.3
22
import PackageDescription
33

44
let package = Package(

Fixtures/Resources/Simple/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:999.0
1+
// swift-tools-version:5.3
22
import PackageDescription
33

44
let package = Package(

IntegrationTests/Fixtures/BinaryTargets/TestBinary/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:999.0
1+
// swift-tools-version:5.3
22

33
import PackageDescription
44

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ We’ve designed the system to make it easy to share packages on services like G
66

77
Swift Package Manager includes a build system that can build for macOS and Linux. Xcode 11 integrates with libSwiftPM to provide support for iOS, watchOS, and tvOS platforms.
88

9-
The [SourceKit-LSP](https://github.com/apple/sourcekit-lsp) project leverages libSwiftPM and provides Language Server Protocol implementation for editors that support LSP.
9+
The [SourceKit-LSP](https://github.com/apple/sourcekit-lsp) project leverages libSwiftPM and provides [Language Server Protocol](https://langserver.org/) implementation for editors that support LSP.
1010

1111
---
1212

@@ -117,7 +117,7 @@ The Swift package manager uses [llbuild](https://github.com/apple/swift-llbuild)
117117

118118
## License
119119

120-
Copyright 2015 - 2019 Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception.
120+
Copyright 2015 - 2020 Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception.
121121

122122
See [https://swift.org/LICENSE.txt](https://swift.org/LICENSE.txt) for license information.
123123

Sources/Commands/SwiftPackageTool.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public class SwiftPackageTool: SwiftTool<PackageToolOptions> {
380380
let graph = try loadPackageGraph(createMultipleTestProducts: true)
381381
let parameters = try PIFBuilderParameters(buildParameters())
382382
let builder = PIFBuilder(graph: graph, parameters: parameters, diagnostics: diagnostics)
383-
let pif = try builder.generatePIF()
383+
let pif = try builder.generatePIF(preservePIFModelStructure: options.pifDumpOptions.preservePIFModelStructure)
384384
print(pif)
385385

386386
case .completionTool:
@@ -432,7 +432,12 @@ public class SwiftPackageTool: SwiftTool<PackageToolOptions> {
432432
to: { $0.describeMode = $1 })
433433

434434
_ = parser.add(subparser: PackageMode.dumpPackage.rawValue, overview: "Print parsed Package.swift as JSON")
435-
_ = parser.add(subparser: PackageMode.dumpPIF.rawValue, overview: "")
435+
let dumpPIFParser = parser.add(subparser: PackageMode.dumpPIF.rawValue, overview: "")
436+
binder.bind(
437+
option: dumpPIFParser.add(
438+
option: "--preserve-structure", kind: Bool.self,
439+
usage: "Preserve the internal structure of PIF"),
440+
to: { $0.pifDumpOptions.preservePIFModelStructure = $1 })
436441

437442
let editParser = parser.add(subparser: PackageMode.edit.rawValue, overview: "Put a package in editable mode")
438443
binder.bind(
@@ -745,6 +750,11 @@ public class PackageToolOptions: ToolOptions {
745750

746751
var editOptions = EditOptions()
747752

753+
struct PIFDumpOptions {
754+
var preservePIFModelStructure: Bool = false
755+
}
756+
var pifDumpOptions = PIFDumpOptions()
757+
748758
var outputPath: AbsolutePath?
749759
var xcodeprojOptions = XcodeprojOptions()
750760

Sources/Commands/SwiftTestTool.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,14 +769,11 @@ final class ParallelTestRunner {
769769
}
770770

771771
private func enqueueTests(_ tests: [UnitTest]) throws {
772-
// FIXME: Add a count property in SynchronizedQueue.
773-
var numTests = 0
774772
// Enqueue all the tests.
775773
for test in tests {
776-
numTests += 1
777774
pendingTests.enqueue(test)
778775
}
779-
self.numTests = numTests
776+
self.numTests = tests.count
780777
self.numCurrentTest = 0
781778
// Enqueue the sentinels, we stop a thread when it encounters a sentinel in the queue.
782779
for _ in 0..<numJobs {

Sources/Commands/SwiftTool.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,9 @@ public class SwiftTool<Options: ToolOptions> {
711711
// FIXME: We don't add edited packages in the package structure command yet (SR-11254).
712712
let hasEditedPackages = try getActiveWorkspace().state.dependencies.contains(where: { $0.isEdited })
713713

714-
return options.enableBuildManifestCaching && haveBuildManifestAndDescription && !hasEditedPackages
714+
let enableBuildManifestCaching = ProcessEnv.vars.keys.contains("SWIFTPM_ENABLE_BUILD_MANIFEST_CACHING") || options.enableBuildManifestCaching
715+
716+
return enableBuildManifestCaching && haveBuildManifestAndDescription && !hasEditedPackages
715717
}
716718

717719
func createBuildOperation(useBuildManifestCaching: Bool = true) throws -> BuildOperation {

Sources/PackageDescription/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ foreach(PACKAGE_DESCRIPTION_VERSION 4 4_2)
4747
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
4848
target_link_libraries(PD${PACKAGE_DESCRIPTION_VERSION} PRIVATE
4949
Foundation)
50+
set_target_properties(PD${PACKAGE_DESCRIPTION_VERSION} PROPERTIES
51+
BUILD_WITH_INSTALL_RPATH TRUE
52+
INSTALL_RPATH "$ORIGIN/../../$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
5053
endif()
5154

5255
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)

Sources/PackageDescription/PackageDescription.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public final class Package {
178178
private var _platforms: [SupportedPlatform]?
179179

180180
/// The default localization for resources.
181-
@available(_PackageDescription, introduced: 999)
181+
@available(_PackageDescription, introduced: 5.3)
182182
public var defaultLocalization: LanguageTag? {
183183
get { return _defaultLocalization }
184184
set { _defaultLocalization = newValue }
@@ -298,7 +298,7 @@ public final class Package {
298298
/// - swiftLanguageVersions: The list of Swift versions that this package is compatible with.
299299
/// - cLanguageStandard: The C language standard to use for all C targets in this package.
300300
/// - cxxLanguageStandard: The C++ language standard to use for all C++ targets in this package.
301-
@available(_PackageDescription, introduced: 5, obsoleted: 999)
301+
@available(_PackageDescription, introduced: 5, obsoleted: 5.3)
302302
public init(
303303
name: String,
304304
platforms: [SupportedPlatform]? = nil,
@@ -336,7 +336,7 @@ public final class Package {
336336
/// - swiftLanguageVersions: The list of Swift versions that this package is compatible with.
337337
/// - cLanguageStandard: The C language standard to use for all C targets in this package.
338338
/// - cxxLanguageStandard: The C++ language standard to use for all C++ targets in this package.
339-
@available(_PackageDescription, introduced: 999)
339+
@available(_PackageDescription, introduced: 5.3)
340340
public init(
341341
name: String,
342342
defaultLocalization: LanguageTag? = nil,
@@ -466,7 +466,7 @@ public enum SystemPackageProvider {
466466
///
467467
/// - Parameters:
468468
/// - packages: The list of package names.
469-
@available(_PackageDescription, introduced: 999)
469+
@available(_PackageDescription, introduced: 5.3)
470470
public static func yum(_ packages: [String]) -> SystemPackageProvider {
471471
return ._yumItem(packages)
472472
}

Sources/PackageDescription/SupportedPlatforms.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public struct Platform: Encodable {
4343
public static let android: Platform = Platform(name: "android")
4444

4545
/// The WASI platform
46-
@available(_PackageDescription, introduced: 999.0)
46+
@available(_PackageDescription, introduced: 5.3)
4747
public static let wasi: Platform = Platform(name: "wasi")
4848
}
4949

Sources/PackageDescription/Target.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public final class Target {
7676
public var sources: [String]?
7777

7878
/// The explicit list of resource files in the target.
79-
@available(_PackageDescription, introduced: 999)
79+
@available(_PackageDescription, introduced: 5.3)
8080
public var resources: [Resource]? {
8181
get { _resources }
8282
set { _resources = newValue }
@@ -148,7 +148,7 @@ public final class Target {
148148
private var _linkerSettings: [LinkerSetting]?
149149

150150
/// The binary target's checksum.
151-
@available(_PackageDescription, introduced: 999)
151+
@available(_PackageDescription, introduced: 5.3)
152152
public var checksum: String? {
153153
get { _checksum }
154154
set { _checksum = newValue }
@@ -292,7 +292,7 @@ public final class Target {
292292
/// - cxxSettings: The C++ settings for this target.
293293
/// - swiftSettings: The Swift settings for this target.
294294
/// - linkerSettings: The linker settings for this target.
295-
@available(_PackageDescription, introduced: 5, obsoleted: 999)
295+
@available(_PackageDescription, introduced: 5, obsoleted: 5.3)
296296
public static func target(
297297
name: String,
298298
dependencies: [Dependency] = [],
@@ -344,7 +344,7 @@ public final class Target {
344344
/// - cxxSettings: The C++ settings for this target.
345345
/// - swiftSettings: The Swift settings for this target.
346346
/// - linkerSettings: The linker settings for this target.
347-
@available(_PackageDescription, introduced: 999)
347+
@available(_PackageDescription, introduced: 5.3)
348348
public static func target(
349349
name: String,
350350
dependencies: [Dependency] = [],
@@ -474,7 +474,7 @@ public final class Target {
474474
/// - cxxSettings: The C++ settings for this target.
475475
/// - swiftSettings: The Swift settings for this target.
476476
/// - linkerSettings: The linker settings for this target.
477-
@available(_PackageDescription, introduced: 999)
477+
@available(_PackageDescription, introduced: 5.3)
478478
public static func testTarget(
479479
name: String,
480480
dependencies: [Dependency] = [],
@@ -544,7 +544,7 @@ public final class Target {
544544
/// - name: The name of the target.
545545
/// - url: The URL to the binary artifact. Should point to a `zip` archive containing a `XCFramework`.
546546
/// - checksum: The checksum of the artifact archive for validation.
547-
@available(_PackageDescription, introduced: 999)
547+
@available(_PackageDescription, introduced: 5.3)
548548
public static func binaryTarget(
549549
name: String,
550550
url: String,
@@ -571,7 +571,7 @@ public final class Target {
571571
/// - name: The name of the target.
572572
/// - path: The path to the binary artifact. Can point directly to a `XCFramework` or a zip containing the
573573
/// `XCFramework`.
574-
@available(_PackageDescription, introduced: 999)
574+
@available(_PackageDescription, introduced: 5.3)
575575
public static func binaryTarget(
576576
name: String,
577577
path: String
@@ -647,7 +647,7 @@ extension Target.Dependency {
647647
///
648648
/// - parameters:
649649
/// - name: The name of the target.
650-
@available(_PackageDescription, obsoleted: 999)
650+
@available(_PackageDescription, obsoleted: 5.3)
651651
public static func target(name: String) -> Target.Dependency {
652652
#if PACKAGE_DESCRIPTION_4
653653
return .targetItem(name: name)
@@ -675,7 +675,7 @@ extension Target.Dependency {
675675
///
676676
/// - parameters:
677677
/// - name: The name of the dependency, either a target or a product.
678-
@available(_PackageDescription, obsoleted: 999)
678+
@available(_PackageDescription, obsoleted: 5.3)
679679
public static func byName(name: String) -> Target.Dependency {
680680
#if PACKAGE_DESCRIPTION_4
681681
return .byNameItem(name: name)
@@ -690,7 +690,7 @@ extension Target.Dependency {
690690
/// - parameters:
691691
/// - name: The name of the product.
692692
/// - package: The name of the package.
693-
@available(_PackageDescription, introduced: 5.2, obsoleted: 999)
693+
@available(_PackageDescription, introduced: 5.2, obsoleted: 5.3)
694694
public static func product(
695695
name: String,
696696
package: String
@@ -703,7 +703,7 @@ extension Target.Dependency {
703703
/// - parameters:
704704
/// - name: The name of the target.
705705
/// - condition: The condition under which the dependency is exercised.
706-
@available(_PackageDescription, introduced: 999)
706+
@available(_PackageDescription, introduced: 5.3)
707707
public static func target(name: String, condition: TargetDependencyCondition? = nil) -> Target.Dependency {
708708
return ._targetItem(name: name, condition: condition)
709709
}
@@ -714,7 +714,7 @@ extension Target.Dependency {
714714
/// - name: The name of the product.
715715
/// - package: The name of the package.
716716
/// - condition: The condition under which the dependency is exercised.
717-
@available(_PackageDescription, introduced: 999)
717+
@available(_PackageDescription, introduced: 5.3)
718718
public static func product(
719719
name: String,
720720
package: String,
@@ -729,7 +729,7 @@ extension Target.Dependency {
729729
/// - parameters:
730730
/// - name: The name of the dependency, either a target or a product.
731731
/// - condition: The condition under which the dependency is exercised.
732-
@available(_PackageDescription, introduced: 999)
732+
@available(_PackageDescription, introduced: 5.3)
733733
public static func byName(name: String, condition: TargetDependencyCondition? = nil) -> Target.Dependency {
734734
return ._byNameItem(name: name, condition: condition)
735735
}

Sources/PackageLoading/ManifestLoader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ private func sandboxProfile(toolsVersion: ToolsVersion, cacheDirectories: [Absol
712712
stream <<< "(import \"system.sb\")" <<< "\n"
713713

714714
// The following accesses are only needed when interpreting the manifest (versus running a compiled version).
715-
if toolsVersion < .vNext {
715+
if toolsVersion < .v5_3 {
716716
// Allow reading all files.
717717
stream <<< "(allow file-read*)" <<< "\n"
718718
// These are required by the Swift compiler.

Sources/PackageLoading/TargetSourcesBuilder.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public struct TargetSourcesBuilder {
112112
}
113113

114114
// Emit an error if we found files without a matching rule in
115-
// tools version >= vNext. This will be activated once resources
115+
// tools version >= v5_3. This will be activated once resources
116116
// support is complete.
117-
if toolsVersion >= .vNext {
117+
if toolsVersion >= .v5_3 {
118118
let filesWithNoRules = pathToRule.filter { $0.value.rule == .none }
119119
if !filesWithNoRules.isEmpty {
120120
var error = "found \(filesWithNoRules.count) file(s) which are unhandled; explicitly declare them as resources or exclude from the target\n"
@@ -323,7 +323,7 @@ public struct TargetSourcesBuilder {
323323
var ignoredDirectoryExtensions = ["xcodeproj", "playground", "xcworkspace"]
324324

325325
// Ignore localization directories if not supported.
326-
if toolsVersion < .vNext {
326+
if toolsVersion < .v5_3 {
327327
ignoredDirectoryExtensions.append(Resource.localizationDirectoryExtension)
328328
}
329329

@@ -366,7 +366,7 @@ public struct TargetSourcesBuilder {
366366
// sources that have an extension but are not explicitly
367367
// declared as sources in the manifest.
368368
if
369-
toolsVersion >= .vNext &&
369+
toolsVersion >= .v5_3 &&
370370
path.extension != nil &&
371371
path.extension != Resource.localizationDirectoryExtension &&
372372
!isDeclaredSource(path)
@@ -519,7 +519,7 @@ public struct FileRuleDescription {
519519
public static let xib: FileRuleDescription = {
520520
.init(
521521
rule: .processResource,
522-
toolsVersion: .vNext,
522+
toolsVersion: .v5_3,
523523
fileTypes: ["nib", "xib", "storyboard"]
524524
)
525525
}()
@@ -528,7 +528,7 @@ public struct FileRuleDescription {
528528
public static let assetCatalog: FileRuleDescription = {
529529
.init(
530530
rule: .processResource,
531-
toolsVersion: .vNext,
531+
toolsVersion: .v5_3,
532532
fileTypes: ["xcassets"]
533533
)
534534
}()
@@ -537,7 +537,7 @@ public struct FileRuleDescription {
537537
public static let coredata: FileRuleDescription = {
538538
.init(
539539
rule: .processResource,
540-
toolsVersion: .vNext,
540+
toolsVersion: .v5_3,
541541
fileTypes: ["xcdatamodeld", "xcdatamodel", "xcmappingmodel"]
542542
)
543543
}()
@@ -546,7 +546,7 @@ public struct FileRuleDescription {
546546
public static let metal: FileRuleDescription = {
547547
.init(
548548
rule: .processResource,
549-
toolsVersion: .vNext,
549+
toolsVersion: .v5_3,
550550
fileTypes: ["metal"]
551551
)
552552
}()

Sources/PackageModel/ToolsVersion.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public struct ToolsVersion: CustomStringConvertible, Comparable, Hashable, Codab
2121
public static let v4_2 = ToolsVersion(version: "4.2.0")
2222
public static let v5 = ToolsVersion(version: "5.0.0")
2323
public static let v5_2 = ToolsVersion(version: "5.2.0")
24+
public static let v5_3 = ToolsVersion(version: "5.3.0")
2425
public static let vNext = ToolsVersion(version: "999.0.0")
2526

2627
/// The current tools version in use.

Sources/SPMBuildCore/BuildParameters.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,9 @@ public struct BuildParameters: Encodable {
210210
public func binaryRelativePath(for product: ResolvedProduct) -> RelativePath {
211211
switch product.type {
212212
case .executable:
213-
if triple.isWindows() {
214-
return RelativePath("\(product.name).exe")
215-
} else {
216-
return RelativePath(product.name)
217-
}
213+
return RelativePath("\(product.name)\(triple.executableExtension)")
218214
case .library(.static):
219-
return RelativePath("lib\(product.name).a")
215+
return RelativePath("lib\(product.name)\(triple.staticLibraryExtension)")
220216
case .library(.dynamic):
221217
return RelativePath("lib\(product.name)\(triple.dynamicLibraryExtension)")
222218
case .library(.automatic):

0 commit comments

Comments
 (0)