Deprecate legacy spm support (#4112)
* chore: deprecate legacy SPM support * chore: remove tests for synthesized legacy Package conformance * chore: remove legacy Package mapping tests * docs: changelog * docs: add deprecations to docs as well
This commit is contained in:
parent
651f119eee
commit
90af2ebe1f
|
@ -34,6 +34,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
|
|||
- **Motivation**: A struct better represents the semantic of the type
|
||||
- Add support for configuring code coverage and testing options at the project level [#4090](https://github.com/tuist/tuist/pull/4090) by [@danyf90](https://github.com/danyf90)
|
||||
- Add more detailed messaging for errors during manifest loading [#4076](https://github.com/tuist/tuist/pull/4076) by [@luispadron](https://github.com/luispadron)
|
||||
- Deprecate legacy SPM support via Project.packages [#4112](https://github.com/tuist/tuist/pull/4112) by [@danyf90](https://github.com/danyf90)
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ extension Package {
|
|||
/// - Parameters:
|
||||
/// - url: The valid Git URL of the package.
|
||||
/// - version: The minimum version requirement.
|
||||
@available(*, deprecated, message: "Use Dependencies.swift instead")
|
||||
public static func package(url: String, from version: Version) -> Package {
|
||||
.package(url: url, .upToNextMajor(from: version))
|
||||
}
|
||||
|
@ -63,6 +64,7 @@ extension Package {
|
|||
/// - Parameters:
|
||||
/// - url: The valid Git URL of the package.
|
||||
/// - requirement: A dependency requirement. See static methods on `Package.Dependency.Requirement` for available options.
|
||||
@available(*, deprecated, message: "Use Dependencies.swift instead")
|
||||
public static func package(url: String, _ requirement: Package.Requirement) -> Package {
|
||||
.remote(url: url, requirement: requirement)
|
||||
}
|
||||
|
@ -78,6 +80,7 @@ extension Package {
|
|||
/// - Parameters:
|
||||
/// - url: The valid Git URL of the package.
|
||||
/// - range: The custom version range requirement.
|
||||
@available(*, deprecated, message: "Use Dependencies.swift instead")
|
||||
public static func package(url: String, _ range: Range<Version>) -> Package {
|
||||
.remote(url: url, requirement: .range(from: range.lowerBound, to: range.upperBound))
|
||||
}
|
||||
|
@ -93,6 +96,7 @@ extension Package {
|
|||
/// - Parameters:
|
||||
/// - url: The valid Git URL of the package.
|
||||
/// - range: The closed version range requirement.
|
||||
@available(*, deprecated, message: "Use Dependencies.swift instead")
|
||||
public static func package(url: String, _ range: ClosedRange<Version>) -> Package {
|
||||
// Increase upperbound's patch version by one.
|
||||
let upper = range.upperBound
|
||||
|
@ -112,6 +116,7 @@ extension Package {
|
|||
/// on multiple tightly coupled packages.
|
||||
///
|
||||
/// - Parameter path: The path of the package.
|
||||
@available(*, deprecated, message: "Use Dependencies.swift instead")
|
||||
public static func package(path: Path) -> Package {
|
||||
.local(path: path)
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ public enum TargetDependency: Codable, Equatable {
|
|||
/// - Parameters:
|
||||
/// - product: The name of the output product. ${PRODUCT_NAME} inside Xcode.
|
||||
/// e.g. RxSwift
|
||||
@available(*, deprecated, message: "Use `Dependencies.swift` and `.external(name:)` instead")
|
||||
case package(product: String)
|
||||
|
||||
/// Dependency on system library or framework
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
import ProjectDescription
|
||||
import TuistSupportTesting
|
||||
import XCTest
|
||||
|
||||
class PackageTests: XCTestCase {
|
||||
func test_package_remotePackages_codable() throws {
|
||||
// Given
|
||||
let subject = Package.package(
|
||||
url: "https://github.com/Swinject/Swinject",
|
||||
.upToNextMajor(from: "2.6.2")
|
||||
)
|
||||
|
||||
// Then
|
||||
XCTAssertCodable(subject)
|
||||
}
|
||||
|
||||
func test_package_localPackages_codable() throws {
|
||||
// Given
|
||||
let subject = Package.package(path: "foo/bar")
|
||||
|
||||
// Then
|
||||
XCTAssertCodable(subject)
|
||||
}
|
||||
}
|
|
@ -43,14 +43,6 @@ final class TargetDependencyTests: XCTestCase {
|
|||
XCTAssertEqual(decoded, sdks)
|
||||
}
|
||||
|
||||
func test_package_codable() throws {
|
||||
// Given
|
||||
let subject = TargetDependency.package(product: "foo")
|
||||
|
||||
// Then
|
||||
XCTAssertCodable(subject)
|
||||
}
|
||||
|
||||
func test_xcframework_codable() {
|
||||
// Given
|
||||
let subject: [TargetDependency] = [
|
||||
|
|
|
@ -10,27 +10,6 @@ import XCTest
|
|||
@testable import TuistSupportTesting
|
||||
|
||||
final class DependencyManifestMapperTests: TuistUnitTestCase {
|
||||
func test_from_when_localPackage() throws {
|
||||
// Given
|
||||
let dependency = ProjectDescription.TargetDependency.package(product: "library")
|
||||
let generatorPaths = GeneratorPaths(manifestDirectory: AbsolutePath("/"))
|
||||
|
||||
// When
|
||||
let got = try TuistGraph.TargetDependency.from(
|
||||
manifest: dependency,
|
||||
generatorPaths: generatorPaths,
|
||||
externalDependencies: [:]
|
||||
)
|
||||
|
||||
// Then
|
||||
XCTAssertEqual(got.count, 1)
|
||||
guard case let .package(product) = got[0] else {
|
||||
XCTFail("Dependency should be package")
|
||||
return
|
||||
}
|
||||
XCTAssertEqual(product, "library")
|
||||
}
|
||||
|
||||
func test_from_when_external_xcframework() throws {
|
||||
// Given
|
||||
let dependency = ProjectDescription.TargetDependency.external(name: "library")
|
||||
|
|
|
@ -94,11 +94,16 @@ You can read more about the different locations of frameworks on [this issue](ht
|
|||
|
||||
### SPM dependencies
|
||||
|
||||
:::warning Deprecated
|
||||
This feature is deprecated. You should use `Dependencies.swift` and `.external(name:)` dependencies instead.
|
||||
:::
|
||||
|
||||
Targets can add Swift package products as dependencies:
|
||||
|
||||
```swift
|
||||
.package(product: "LibraryA")
|
||||
```
|
||||
|
||||
### XCFramework dependencies
|
||||
|
||||
```swift
|
||||
|
|
|
@ -111,4 +111,3 @@ When Swift Packages are integrated into your project's graph, there are some heu
|
|||
|
||||
- Tuist defaults to using `iOS` as a platform when there's more than one platform defined in the `Dependencies.swift` and the package manifest file. This is currently a limitation of Tuist [because it does not support multi-platform targets](https://github.com/tuist/tuist/issues/397).
|
||||
- Tuist defaults to using the product type defined in the `SwiftPackageManagerDependencies.productTypes` property if the linking type is not defined in the package manifest file. If no product type is defined in `SwiftPackageManagerDependencies`, Tuist will default to a `.staticFramework`
|
||||
- Tuist defaults to not configuring the `ENABLE_TESTING_SEARCH_PATHS` setting for generated SwiftPackageManager targets. If one of your dependencies require it, configure it using the `targetSettings` property in your `Dependencies.swift` file, for example: `targetSettings: ["Nimble": ["ENABLE_TESTING_SEARCH_PATHS": "YES"]]`
|
|
@ -128,6 +128,10 @@ Text settings to override user ones. Would use Xcode defined settings if pass `n
|
|||
|
||||
### Package
|
||||
|
||||
:::warning Deprecated
|
||||
This feature is deprecated. You should use `Dependencies.swift` instead.
|
||||
:::
|
||||
|
||||
You can add Swift Packages very similarly to how you add dependencies in a `Package.swift`:
|
||||
|
||||
For remote:
|
||||
|
|
Loading…
Reference in New Issue