Skip to content

Commit

Permalink
Merge branch 'main' into assetResources
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleformichelli committed Feb 21, 2024
2 parents cb3631b + c481dc4 commit 27bf5ab
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tools]
tuist = "4.3.1"
tuist = "4.3.2"
swiftlint = "0.54.0"
swiftformat = "0.53.0"

Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 4.3.2 - 2024-02-21

### Tuist

#### Changed

- Remove PackageSettings platforms property [#5953](https://github.com/tuist/tuist/pull/5953) by [@fortmarek](https://github.com/fortmarek)

### Tuist Cloud

#### Fixed

- Improve retrying logic when interacting with the remote cache by [@pepicrft](https://github.com/pepicrft)

## 4.3.1 - 2024-02-20

### Tuist
Expand Down
3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ var targets: [Target] = [
// To revert once we release Tuist 4
targetSettings: [
"MockableTest": ["ENABLE_TESTING_SEARCH_PATHS": "YES"],
],
platforms: [.macOS]
]
)

#endif
Expand Down
8 changes: 1 addition & 7 deletions Sources/ProjectDescription/PackageSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,21 @@ public struct PackageSettings: Codable, Equatable {
/// Custom project configurations to be used for projects generated from SwiftPackageManager.
public var projectOptions: [String: Project.Options]

/// The custom set of `platforms` that are used by your project
public let platforms: Set<PackagePlatform>

/// Creates `PackageSettings` instance for custom Swift Package Manager configuration.
/// - Parameter productTypes: The custom `Product` types to be used for SPM targets.
/// - Parameter baseSettings: Additional settings to be added to targets generated from SwiftPackageManager.
/// - Parameter targetSettings: Additional settings to be added to targets generated from SwiftPackageManager.
/// - Parameter projectOptions: Custom project configurations to be used for projects generated from SwiftPackageManager.
/// - Parameter platforms: The custom set of `platforms` that are used by your project
public init(
productTypes: [String: Product] = [:],
baseSettings: Settings = .settings(),
targetSettings: [String: SettingsDictionary] = [:],
projectOptions: [String: Project.Options] = [:],
platforms: Set<PackagePlatform> = Set(PackagePlatform.allCases)
projectOptions: [String: Project.Options] = [:]
) {
self.productTypes = productTypes
self.baseSettings = baseSettings
self.targetSettings = targetSettings
self.projectOptions = projectOptions
self.platforms = platforms
dumpIfNeeded(self)
}
}
7 changes: 1 addition & 6 deletions Sources/TuistGraph/Models/Dependencies/PackageSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public struct PackageSettings: Equatable {
/// Swift tools version of the parsed `Package.swift`
public let swiftToolsVersion: Version

/// The custom set of `platforms` that are used by your project
public let platforms: Set<PackagePlatform>

/// Initializes a new `PackageSettings` instance.
/// - Parameters:
/// - productTypes: The custom `Product` types to be used for SPM targets.
Expand All @@ -32,14 +29,12 @@ public struct PackageSettings: Equatable {
baseSettings: Settings,
targetSettings: [String: SettingsDictionary],
projectOptions: [String: TuistGraph.Project.Options] = [:],
swiftToolsVersion: Version,
platforms: Set<PackagePlatform>
swiftToolsVersion: Version
) {
self.productTypes = productTypes
self.baseSettings = baseSettings
self.targetSettings = targetSettings
self.projectOptions = projectOptions
self.swiftToolsVersion = swiftToolsVersion
self.platforms = platforms
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ extension PackageSettings {
baseSettings: Settings = .test(),
targetSettings: [String: SettingsDictionary] = [:],
projectOptions: [String: TuistGraph.Project.Options] = [:],
swiftToolsVersion: Version = Version("5.4.9"),
platforms: Set<PackagePlatform> = [.iOS]
swiftToolsVersion: Version = Version("5.4.9")
) -> PackageSettings {
PackageSettings(
productTypes: productTypes,
baseSettings: baseSettings,
targetSettings: targetSettings,
projectOptions: projectOptions,
swiftToolsVersion: swiftToolsVersion,
platforms: platforms
swiftToolsVersion: swiftToolsVersion
)
}
}
19 changes: 0 additions & 19 deletions Sources/TuistLoader/Loaders/SwiftPackageManagerGraphLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,6 @@ public final class SwiftPackageManagerGraphLoader: SwiftPackageManagerGraphLoadi
packageToTargetsToArtifactPaths: packageToTargetsToArtifactPaths
)

let destinations: ProjectDescription
.Destinations = Set(packageSettings.platforms.flatMap { platform -> ProjectDescription.Destinations in
switch platform {
case .iOS:
[.iPhone, .iPad, .appleVisionWithiPadDesign, .macWithiPadDesign]
case .macCatalyst:
[.macCatalyst]
case .macOS:
[.mac]
case .tvOS:
[.appleTv]
case .watchOS:
[.appleWatch]
case .visionOS:
[.appleVision]
}
})

let externalProjects: [Path: ProjectDescription.Project] = try packageInfos.reduce(into: [:]) { result, packageInfo in
let manifest = try packageInfoMapper.map(
packageInfo: packageInfo.info,
Expand All @@ -192,7 +174,6 @@ public final class SwiftPackageManagerGraphLoader: SwiftPackageManagerGraphLoadi
targetSettings: packageSettings.targetSettings,
projectOptions: packageSettings.projectOptions[packageInfo.name],
minDeploymentTargets: preprocessInfo.platformToMinDeploymentTarget,
destinations: destinations,
targetToProducts: preprocessInfo.targetToProducts,
targetToResolvedDependencies: preprocessInfo.targetToResolvedDependencies,
macroDependencies: preprocessInfo.macroDependencies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ extension TuistGraph.PackageSettings {
let projectOptions: [String: TuistGraph.Project.Options] = manifest
.projectOptions
.mapValues { .from(manifest: $0) }
let platforms = try Set(manifest.platforms.map { try TuistGraph.PackagePlatform.from(manifest: $0) })

return .init(
productTypes: productTypes,
baseSettings: baseSettings,
targetSettings: targetSettings,
projectOptions: projectOptions,
swiftToolsVersion: swiftToolsVersion,
platforms: platforms
swiftToolsVersion: swiftToolsVersion
)
}
}
18 changes: 12 additions & 6 deletions Sources/TuistLoader/SwiftPackageManager/PackageInfoMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public protocol PackageInfoMapping {
targetSettings: [String: TuistGraph.SettingsDictionary],
projectOptions: TuistGraph.Project.Options?,
minDeploymentTargets: ProjectDescription.DeploymentTargets,
destinations: ProjectDescription.Destinations,
targetToProducts: [String: Set<PackageInfo.Product>],
targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]],
macroDependencies: Set<PackageInfoMapper.ResolvedDependency>,
Expand Down Expand Up @@ -398,7 +397,6 @@ public final class PackageInfoMapper: PackageInfoMapping {
targetSettings: [String: TuistGraph.SettingsDictionary],
projectOptions: TuistGraph.Project.Options?,
minDeploymentTargets: ProjectDescription.DeploymentTargets,
destinations: ProjectDescription.Destinations,
targetToProducts: [String: Set<PackageInfo.Product>],
targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]],
macroDependencies: Set<PackageInfoMapper.ResolvedDependency>,
Expand Down Expand Up @@ -459,7 +457,6 @@ public final class PackageInfoMapper: PackageInfoMapping {
productTypes: productTypes,
baseSettings: baseSettings,
targetSettings: targetSettings,
packageDestinations: destinations,
minDeploymentTargets: minDeploymentTargets,
targetToResolvedDependencies: targetToResolvedDependencies,
targetToModuleMap: targetToModuleMap,
Expand Down Expand Up @@ -511,7 +508,6 @@ extension ProjectDescription.Target {
productTypes: [String: TuistGraph.Product],
baseSettings: TuistGraph.Settings,
targetSettings: [String: TuistGraph.SettingsDictionary],
packageDestinations: ProjectDescription.Destinations,
minDeploymentTargets: ProjectDescription.DeploymentTargets,
targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]],
targetToModuleMap: [String: ModuleMap],
Expand Down Expand Up @@ -542,7 +538,17 @@ extension ProjectDescription.Target {
destinations = Set<ProjectDescription.Destination>([.mac])
} else {
// All packages implicitly support all platforms, we constrain this with the platforms defined in `Package.swift`
destinations = packageDestinations.intersection(Set(Destination.allCases))
let packageDestinations: ProjectDescription.Destinations = Set(
try packageInfo.platforms.flatMap { platform -> ProjectDescription.Destinations in
return try platform.destinations()
}
)

if packageDestinations.isEmpty {
destinations = Set(Destination.allCases)
} else {
destinations = Set(Destination.allCases).intersection(packageDestinations)
}
}

if macroDependencies.contains(where: { dependency in
Expand Down Expand Up @@ -1075,7 +1081,7 @@ extension ProjectDescription.Settings {
}

extension ProjectDescription.PackagePlatform {
fileprivate func destinations() throws -> ProjectDescription.Destinations {
fileprivate func destinations() -> ProjectDescription.Destinations {
switch self {
case .iOS:
return [.iPhone, .iPad, .macWithiPadDesign, .appleVisionWithiPadDesign]
Expand Down
2 changes: 1 addition & 1 deletion Sources/TuistSupport/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public enum Constants {
public static let githubAPIURL = "https://api.github.com"
public static let githubSlug = "tuist/tuist"
public static let communityURL = "https://github.com/tuist/tuist/discussions/categories/general"
public static let version = "4.3.1"
public static let version = "4.3.2"
public static let bundleName: String = "tuist.zip"
public static let trueValues: [String] = ["1", "true", "TRUE", "yes", "YES"]
public static let tuistDirectoryName: String = "Tuist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ final class DumpServiceTests: TuistTestCase {
import ProjectDescription
let packageSettings = PackageSettings(
platforms: [.iOS, .watchOS]
targetSettings: ["TargetA": ["OTHER_LDFLAGS": "-ObjC"]]
)
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ final class ManifestLoaderTests: TuistTestCase {
import ProjectDescription
let packageSettings = PackageSettings(
platforms: [.iOS, .watchOS]
targetSettings: ["TargetA": ["OTHER_LDFLAGS": "-ObjC"]]
)
#endif
Expand Down Expand Up @@ -188,7 +188,13 @@ final class ManifestLoaderTests: TuistTestCase {
// Then
XCTAssertEqual(
got,
.init(platforms: [.iOS, .watchOS])
.init(
targetSettings: [
"TargetA": [
"OTHER_LDFLAGS": "-ObjC",
],
]
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ final class PackageSettingsLoaderTests: TuistUnitTestCase {
TSCUtility.Version("5.4.9")
}

manifestLoader.loadPackageSettingsStub = { _ in
PackageSettings(
platforms: [.iOS, .macOS]
)
}

// When
let got = try subject.loadPackageSettings(at: temporaryPath, with: plugins)

Expand All @@ -72,8 +66,7 @@ final class PackageSettingsLoaderTests: TuistUnitTestCase {
defaultSettings: .recommended
),
targetSettings: [:],
swiftToolsVersion: TSCUtility.Version("5.4.9"),
platforms: [.iOS, .macOS]
swiftToolsVersion: TSCUtility.Version("5.4.9")
)
XCTAssertEqual(manifestLoader.registerPluginsCount, 1)
XCTAssertEqual(got, expected)
Expand Down

0 comments on commit 27bf5ab

Please sign in to comment.