Skip to content

Commit

Permalink
[6.0] NFC: Expose Environment with @_spi (#7793)
Browse files Browse the repository at this point in the history
Cherry-pick of #7780.

**Explanation**: Initializers for this type should be available via
`@_spi` for clients to consume.
**Scope**: Limited to a single type and relevant initializers.
**Risk**: Very low, change is NFC.
**Testing**: Verified through existing test suite.
**Issue**: rdar://131407852
**Reviewer**: @bnbarham
  • Loading branch information
MaxDesiatov authored Jul 19, 2024
1 parent a087542 commit b46e02a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Sources/Basics/Environment/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ extension Environment {
// MARK: - Conversions between Dictionary<String, String>

extension Environment {
package init(_ dictionary: [String: String]) {
@_spi(SwiftPMInternal)
public init(_ dictionary: [String: String]) {
self.storage = .init()
let sorted = dictionary.sorted { $0.key < $1.key }
for (key, value) in sorted {
Expand All @@ -74,7 +75,8 @@ extension Environment {
}

extension [String: String] {
package init(_ environment: Environment) {
@_spi(SwiftPMInternal)
public init(_ environment: Environment) {
self.init()
let sorted = environment.sorted { $0.key < $1.key }
for (key, value) in sorted {
Expand Down
2 changes: 2 additions & 0 deletions Sources/DriverSupport/DriverSupportUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
//
//===----------------------------------------------------------------------===//

@_spi(SwiftPMInternal)
import Basics

import PackageModel
import SwiftDriver
import class TSCBasic.Process
Expand Down
2 changes: 2 additions & 0 deletions Sources/DriverSupport/SPMSwiftDriverExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
//
//===----------------------------------------------------------------------===//

@_spi(SwiftPMInternal)
import Basics

import SwiftDriver

import class TSCBasic.Process
Expand Down
2 changes: 2 additions & 0 deletions Sources/SPMBuildCore/Plugins/PluginInvocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
//
//===----------------------------------------------------------------------===//

@_spi(SwiftPMInternal)
import Basics

import Foundation
import PackageModel
import PackageLoading
Expand Down
2 changes: 2 additions & 0 deletions Sources/Workspace/DefaultPluginScriptRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
//
//===----------------------------------------------------------------------===//

@_spi(SwiftPMInternal)
import Basics

import Foundation
import PackageGraph
import PackageModel
Expand Down
5 changes: 4 additions & 1 deletion Tests/BasicsTests/Environment/EnvironmentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
//
//===----------------------------------------------------------------------===//

@testable import Basics
@_spi(SwiftPMInternal)
@testable
import Basics

import XCTest

final class EnvironmentTests: XCTestCase {
Expand Down
1 change: 1 addition & 0 deletions Tests/SPMBuildCoreTests/PluginInvocationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_spi(SwiftPMInternal)
import Basics
@testable import PackageGraph
import PackageLoading
Expand Down

0 comments on commit b46e02a

Please sign in to comment.