Fix Firebase 9.0.0 (#4456)
* chore: bump dependencies * fix: fix Firebase 9 import * fix: fix test cases * chore: restore gitignore and resolved files * fix: fix dependencies tests * refactor: refactor ModuleMapType to ModuleMap
This commit is contained in:
parent
d3c991f640
commit
2a728bec40
|
@ -58,7 +58,7 @@ enum PackageInfoMapperError: FatalError, Equatable {
|
|||
switch self {
|
||||
case let .defaultPathNotFound(packageFolder, targetName):
|
||||
return """
|
||||
Default source path not found for package at \(packageFolder.pathString). \
|
||||
Default source path not found for target \(targetName) in package at \(packageFolder.pathString). \
|
||||
Source path must be one of \(PackageInfoMapper.predefinedSourceDirectories.map { "\($0)/\(targetName)" })
|
||||
"""
|
||||
case let .minDeploymentTargetParsingFailed(platform):
|
||||
|
@ -129,6 +129,7 @@ public protocol PackageInfoMapping {
|
|||
targetToPlatform: [String: ProjectDescription.Platform],
|
||||
targetToProducts: [String: Set<PackageInfo.Product>],
|
||||
targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]],
|
||||
targetToModuleMap: [String: ModuleMap],
|
||||
packageToProject: [String: AbsolutePath],
|
||||
swiftToolsVersion: TSCUtility.Version?
|
||||
) throws -> ProjectDescription.Project?
|
||||
|
@ -141,6 +142,7 @@ public final class PackageInfoMapper: PackageInfoMapping {
|
|||
let targetToPlatform: [String: ProjectDescription.Platform]
|
||||
let targetToProducts: [String: Set<PackageInfo.Product>]
|
||||
let targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]]
|
||||
let targetToModuleMap: [String: ModuleMap]
|
||||
}
|
||||
|
||||
// Predefined source directories, in order of preference.
|
||||
|
@ -257,6 +259,7 @@ public final class PackageInfoMapper: PackageInfoMapping {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
let minDeploymentTargets = Platform.oldestVersions.reduce(
|
||||
into: [ProjectDescription.Platform: ProjectDescription.DeploymentTarget]()
|
||||
) { acc, next in
|
||||
|
@ -272,12 +275,24 @@ public final class PackageInfoMapper: PackageInfoMapping {
|
|||
}
|
||||
}
|
||||
|
||||
let targetToModuleMap: [String: ModuleMap]
|
||||
targetToModuleMap = try packageInfos.reduce(into: [:]) { result, packageInfo in
|
||||
try packageInfo.value.targets.forEach { target in
|
||||
guard target.type == .regular else { return }
|
||||
result[target.name] = try moduleMapGenerator.generate(
|
||||
moduleName: target.name,
|
||||
publicHeadersPath: target.publicHeadersPath(packageFolder: packageToFolder[packageInfo.key]!)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return .init(
|
||||
platformToMinDeploymentTarget: minDeploymentTargets,
|
||||
productToExternalDependencies: externalDependencies,
|
||||
targetToPlatform: targetToPlatforms,
|
||||
targetToProducts: targetToProducts,
|
||||
targetToResolvedDependencies: resolvedDependencies
|
||||
targetToResolvedDependencies: resolvedDependencies,
|
||||
targetToModuleMap: targetToModuleMap
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -294,6 +309,7 @@ public final class PackageInfoMapper: PackageInfoMapping {
|
|||
targetToPlatform: [String: ProjectDescription.Platform],
|
||||
targetToProducts: [String: Set<PackageInfo.Product>],
|
||||
targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]],
|
||||
targetToModuleMap: [String: ModuleMap],
|
||||
packageToProject: [String: AbsolutePath],
|
||||
swiftToolsVersion: TSCUtility.Version?
|
||||
) throws -> ProjectDescription.Project? {
|
||||
|
@ -347,7 +363,7 @@ public final class PackageInfoMapper: PackageInfoMapping {
|
|||
platforms: targetToPlatform,
|
||||
minDeploymentTargets: minDeploymentTargets,
|
||||
targetToResolvedDependencies: targetToResolvedDependencies,
|
||||
moduleMapGenerator: moduleMapGenerator
|
||||
targetToModuleMap: targetToModuleMap
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -392,7 +408,7 @@ extension ProjectDescription.Target {
|
|||
platforms: [String: ProjectDescription.Platform],
|
||||
minDeploymentTargets: [ProjectDescription.Platform: ProjectDescription.DeploymentTarget],
|
||||
targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]],
|
||||
moduleMapGenerator: SwiftPackageManagerModuleMapGenerating
|
||||
targetToModuleMap: [String: ModuleMap]
|
||||
) throws -> Self? {
|
||||
guard target.type == .regular else {
|
||||
logger.debug("Target \(target.name) of type \(target.type) ignored")
|
||||
|
@ -407,7 +423,7 @@ extension ProjectDescription.Target {
|
|||
|
||||
let path = try target.basePath(packageFolder: packageFolder)
|
||||
let publicHeadersPath = try target.publicHeadersPath(packageFolder: packageFolder)
|
||||
let moduleMap = try moduleMapGenerator.generate(moduleName: target.name, publicHeadersPath: publicHeadersPath)
|
||||
let moduleMap = targetToModuleMap[target.name]!
|
||||
|
||||
let platform = platforms[target.name]!
|
||||
let deploymentTarget = try ProjectDescription.DeploymentTarget.from(
|
||||
|
@ -423,7 +439,7 @@ extension ProjectDescription.Target {
|
|||
path: path,
|
||||
excluding: target.exclude
|
||||
)
|
||||
let headers = try Headers.from(moduleMapType: moduleMap.type, publicHeadersPath: publicHeadersPath)
|
||||
let headers = try Headers.from(moduleMap: moduleMap, publicHeadersPath: publicHeadersPath)
|
||||
|
||||
let resolvedDependencies = targetToResolvedDependencies[target.name] ?? []
|
||||
|
||||
|
@ -442,7 +458,7 @@ extension ProjectDescription.Target {
|
|||
targetToResolvedDependencies: targetToResolvedDependencies,
|
||||
settings: target.settings,
|
||||
platform: platform,
|
||||
moduleMap: moduleMap,
|
||||
targetToModuleMap: targetToModuleMap,
|
||||
baseSettings: baseSettings,
|
||||
targetSettings: targetSettings
|
||||
)
|
||||
|
@ -682,10 +698,10 @@ extension ProjectDescription.TargetDependency {
|
|||
}
|
||||
|
||||
extension ProjectDescription.Headers {
|
||||
fileprivate static func from(moduleMapType: ModuleMapType, publicHeadersPath: AbsolutePath) throws -> Self? {
|
||||
fileprivate static func from(moduleMap: ModuleMap, publicHeadersPath: AbsolutePath) throws -> Self? {
|
||||
// As per SPM logic, headers should be added only when using the umbrella header without modulemap:
|
||||
// https://github.com/apple/swift-package-manager/blob/9b9bed7eaf0f38eeccd0d8ca06ae08f6689d1c3f/Sources/Xcodeproj/pbxproj.swift#L588-L609
|
||||
switch moduleMapType {
|
||||
switch moduleMap {
|
||||
case .header, .nestedHeader:
|
||||
let publicHeaders = FileHandler.shared.filesAndDirectoriesContained(in: publicHeadersPath)!
|
||||
.filter { $0.extension == "h" }
|
||||
|
@ -708,7 +724,7 @@ extension ProjectDescription.Settings {
|
|||
targetToResolvedDependencies: [String: [PackageInfoMapper.ResolvedDependency]],
|
||||
settings: [PackageInfo.Target.TargetBuildSettingDescription.Setting],
|
||||
platform: ProjectDescription.Platform,
|
||||
moduleMap: (type: ModuleMapType, path: AbsolutePath?),
|
||||
targetToModuleMap: [String: ModuleMap],
|
||||
baseSettings: TuistGraph.Settings,
|
||||
targetSettings: [String: TuistGraph.SettingsDictionary]
|
||||
) throws -> Self? {
|
||||
|
@ -723,7 +739,8 @@ extension ProjectDescription.Settings {
|
|||
let mainPath = try target.basePath(packageFolder: packageFolder)
|
||||
let mainRelativePath = mainPath.relative(to: packageFolder)
|
||||
|
||||
if moduleMap.type != .none {
|
||||
let moduleMap = targetToModuleMap[target.name]!
|
||||
if moduleMap != .none {
|
||||
let publicHeadersPath = try target.publicHeadersPath(packageFolder: packageFolder)
|
||||
let publicHeadersRelativePath = publicHeadersPath.relative(to: packageFolder)
|
||||
headerSearchPaths.append("$(SRCROOT)/\(publicHeadersRelativePath.pathString)")
|
||||
|
@ -738,10 +755,16 @@ extension ProjectDescription.Settings {
|
|||
|
||||
headerSearchPaths += try allDependencies
|
||||
.compactMap { dependency in
|
||||
// Add dependencies search paths if they require a modulemap
|
||||
guard let packagePath = packageToProject[dependency.package] else { return nil }
|
||||
let headersPath = try dependency.target.publicHeadersPath(packageFolder: packagePath)
|
||||
guard FileHandler.shared.exists(headersPath) else { return nil }
|
||||
return "$(SRCROOT)/\(headersPath.relative(to: packageFolder))"
|
||||
let moduleMap = targetToModuleMap[dependency.target.name]!
|
||||
switch moduleMap {
|
||||
case .none, .header, .nestedHeader:
|
||||
return nil
|
||||
case .directory, .custom:
|
||||
return "$(SRCROOT)/\(headersPath.relative(to: packageFolder))"
|
||||
}
|
||||
}
|
||||
.sorted()
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@ public final class SwiftPackageManagerGraphGenerator: SwiftPackageManagerGraphGe
|
|||
targetToPlatform: preprocessInfo.targetToPlatform,
|
||||
targetToProducts: preprocessInfo.targetToProducts,
|
||||
targetToResolvedDependencies: preprocessInfo.targetToResolvedDependencies,
|
||||
targetToModuleMap: preprocessInfo.targetToModuleMap,
|
||||
packageToProject: packageToProject,
|
||||
swiftToolsVersion: swiftToolsVersion
|
||||
)
|
||||
|
|
|
@ -2,17 +2,26 @@ import TSCBasic
|
|||
import TuistSupport
|
||||
|
||||
/// The type of modulemap file
|
||||
public enum ModuleMapType: Equatable {
|
||||
public enum ModuleMap: Equatable {
|
||||
/// No headers and hence no modulemap file
|
||||
case none
|
||||
/// Custom modulemap file provided in SPM package
|
||||
case custom
|
||||
case custom(AbsolutePath)
|
||||
/// Umbrella header provided in SPM package
|
||||
case header
|
||||
/// Nested umbrella header provided in SPM package
|
||||
case nestedHeader
|
||||
/// No umbrella header provided in SPM package, define umbrella directory
|
||||
case directory
|
||||
case directory(AbsolutePath)
|
||||
|
||||
var path: AbsolutePath? {
|
||||
switch self {
|
||||
case let .custom(path), let .directory(path):
|
||||
return path
|
||||
case .none, .header, .nestedHeader:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Protocol that allows to generate a modulemap for an SPM target.
|
||||
|
@ -20,7 +29,7 @@ public enum ModuleMapType: Equatable {
|
|||
/// [documented here](https://github.com/apple/swift-package-manager/blob/main/Documentation/Usage.md#creating-c-language-targets) and
|
||||
/// [implemented here](https://github.com/apple/swift-package-manager/blob/main/Sources/PackageLoading/ModuleMapGenerator.swift).
|
||||
public protocol SwiftPackageManagerModuleMapGenerating {
|
||||
func generate(moduleName: String, publicHeadersPath: AbsolutePath) throws -> (type: ModuleMapType, path: AbsolutePath?)
|
||||
func generate(moduleName: String, publicHeadersPath: AbsolutePath) throws -> ModuleMap
|
||||
}
|
||||
|
||||
public final class SwiftPackageManagerModuleMapGenerator: SwiftPackageManagerModuleMapGenerating {
|
||||
|
@ -29,34 +38,23 @@ public final class SwiftPackageManagerModuleMapGenerator: SwiftPackageManagerMod
|
|||
public func generate(
|
||||
moduleName: String,
|
||||
publicHeadersPath: AbsolutePath
|
||||
) throws -> (type: ModuleMapType, path: AbsolutePath?) {
|
||||
) throws -> ModuleMap {
|
||||
let umbrellaHeaderPath = publicHeadersPath.appending(component: moduleName + ".h")
|
||||
let nestedUmbrellaHeaderPath = publicHeadersPath.appending(component: moduleName).appending(component: moduleName + ".h")
|
||||
|
||||
let moduleMapType: ModuleMapType
|
||||
|
||||
if let customModuleMapPath = try Self.customModuleMapPath(publicHeadersPath: publicHeadersPath) {
|
||||
// User defined modulemap exists, use it
|
||||
return (type: .custom, path: customModuleMapPath)
|
||||
return .custom(customModuleMapPath)
|
||||
} else if FileHandler.shared.exists(umbrellaHeaderPath) {
|
||||
// If 'PublicHeadersDir/ModuleName.h' exists, then use it as the umbrella header.
|
||||
// When umbrella header is present, no need to define a modulemap as it is generated by Xcode
|
||||
return (type: .header, path: nil)
|
||||
return .header
|
||||
} else if FileHandler.shared.exists(nestedUmbrellaHeaderPath) {
|
||||
// If 'PublicHeadersDir/ModuleName/ModuleName.h' exists, then use it as the umbrella header.
|
||||
moduleMapType = .nestedHeader
|
||||
return .nestedHeader
|
||||
} else if FileHandler.shared.exists(publicHeadersPath) {
|
||||
// Otherwise, consider the public headers folder as umbrella directory
|
||||
moduleMapType = .directory
|
||||
} else {
|
||||
return (type: .none, path: nil)
|
||||
}
|
||||
|
||||
let sanitizedModuleName = moduleName.replacingOccurrences(of: "-", with: "_")
|
||||
switch moduleMapType {
|
||||
case .none, .header, .nestedHeader, .custom:
|
||||
return (type: moduleMapType, path: nil)
|
||||
case .directory:
|
||||
let sanitizedModuleName = moduleName.replacingOccurrences(of: "-", with: "_")
|
||||
let generatedModuleMapContent =
|
||||
"""
|
||||
module \(sanitizedModuleName) {
|
||||
|
@ -67,7 +65,9 @@ public final class SwiftPackageManagerModuleMapGenerator: SwiftPackageManagerMod
|
|||
"""
|
||||
let generatedModuleMapPath = publicHeadersPath.appending(component: "\(moduleName).modulemap")
|
||||
try FileHandler.shared.write(generatedModuleMapContent, path: generatedModuleMapPath, atomically: true)
|
||||
return (type: moduleMapType, path: generatedModuleMapPath)
|
||||
return .directory(generatedModuleMapPath)
|
||||
} else {
|
||||
return .none
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
}
|
||||
|
||||
func testPreprocess_whenProductContainsBinaryTarget_mapsToXcframework() throws {
|
||||
let basePath = try temporaryPath()
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Sources/Target_1")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Sources/Target_2")))
|
||||
let preprocessInfo = try subject.preprocess(
|
||||
packageInfos: [
|
||||
"Package": .init(
|
||||
|
@ -86,7 +89,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
),
|
||||
],
|
||||
productToPackage: [:],
|
||||
packageToFolder: ["Package": "/Package"],
|
||||
packageToFolder: ["Package": basePath],
|
||||
packageToTargetsToArtifactPaths: ["Package": ["Target_1": .init("/artifacts/Package/Target_1.xcframework")]],
|
||||
platforms: [.iOS]
|
||||
)
|
||||
|
@ -110,15 +113,69 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
[
|
||||
"Product1": [
|
||||
.xcframework(path: "/artifacts/Package/Target_1.xcframework"),
|
||||
.project(target: "Target_2", path: "/Package"),
|
||||
.project(target: "Target_2", path: .relativeToManifest(basePath.pathString)),
|
||||
],
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
func testPreprocess_whenDependencyNameContainsDot_mapsToUnderscoreInTargetName() throws {
|
||||
let basePath = try temporaryPath()
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Target_1")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("com.example.dep-1/Sources/com.example.dep-1")))
|
||||
let preprocessInfo = try subject.preprocess(
|
||||
packageInfos: [
|
||||
"Package": .init(
|
||||
products: [
|
||||
.init(name: "Product1", type: .library(.automatic), targets: ["Target_1"]),
|
||||
],
|
||||
targets: [
|
||||
.test(
|
||||
name: "Target_1",
|
||||
dependencies: [
|
||||
.product(name: "com.example.dep-1", package: "com.example.dep-1", condition: nil),
|
||||
]
|
||||
),
|
||||
],
|
||||
platforms: [],
|
||||
cLanguageStandard: nil,
|
||||
cxxLanguageStandard: nil,
|
||||
swiftLanguageVersions: nil
|
||||
),
|
||||
"com.example.dep-1": .init(
|
||||
products: [
|
||||
.init(name: "com.example.dep-1", type: .library(.automatic), targets: ["com.example.dep-1"]),
|
||||
],
|
||||
targets: [
|
||||
.test(name: "com.example.dep-1"),
|
||||
],
|
||||
platforms: [],
|
||||
cLanguageStandard: nil,
|
||||
cxxLanguageStandard: nil,
|
||||
swiftLanguageVersions: nil
|
||||
),
|
||||
],
|
||||
productToPackage: [:],
|
||||
packageToFolder: [
|
||||
"Package": basePath.appending(component: "Package"),
|
||||
"com.example.dep-1": basePath.appending(component: "com.example.dep-1"),
|
||||
],
|
||||
packageToTargetsToArtifactPaths: [:],
|
||||
platforms: [.iOS]
|
||||
)
|
||||
|
||||
XCTAssertEqual(
|
||||
preprocessInfo.targetToResolvedDependencies,
|
||||
[
|
||||
"Target_1": [.externalTarget(package: "com.example.dep-1", target: "com_example_dep-1")],
|
||||
"com.example.dep-1": [],
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
func testMap() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -152,7 +209,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenMacCatalyst() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -191,7 +248,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
func testMap_whenAlternativeDefaultSources() throws {
|
||||
for alternativeDefaultSource in ["Source", "src", "srcs"] {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/\(alternativeDefaultSource)/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/\(alternativeDefaultSource)/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -222,13 +279,13 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
basePath: basePath,
|
||||
customSources: .init(
|
||||
globs: [
|
||||
basePath.appending(RelativePath("Package/Path/\(alternativeDefaultSource)/Target1/**"))
|
||||
basePath.appending(RelativePath("Package/\(alternativeDefaultSource)/Target1/**"))
|
||||
.pathString,
|
||||
]
|
||||
),
|
||||
customDefaultResources: .defaultResources(
|
||||
path: basePath
|
||||
.appending(components: ["Package", "Path", alternativeDefaultSource, "Target1"])
|
||||
.appending(components: ["Package", alternativeDefaultSource, "Target1"])
|
||||
)
|
||||
),
|
||||
]
|
||||
|
@ -263,7 +320,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenNameContainsUnderscores_mapsToDashInBundleID() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target_1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target_1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -303,7 +360,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
// Tuist needs to escape those definitions for SPM manifests, as SPM is doing, so they can be built the same way.
|
||||
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -357,7 +414,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenNameContainsDot_mapsToUnderscoreInTargetName() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/com.example.target-1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/com.example.target-1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -389,11 +446,11 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
customBundleID: "com.example.target-1",
|
||||
customSources: .init(globs: [
|
||||
basePath
|
||||
.appending(RelativePath("Package/Path/Sources/com.example.target-1/**")).pathString,
|
||||
.appending(RelativePath("Package/Sources/com.example.target-1/**")).pathString,
|
||||
]),
|
||||
customDefaultResources: .defaultResources(
|
||||
path: basePath
|
||||
.appending(components: ["Package", "Path", "Sources", "com.example.target-1"])
|
||||
.appending(components: ["Package", "Sources", "com.example.target-1"])
|
||||
)
|
||||
),
|
||||
]
|
||||
|
@ -401,61 +458,10 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
)
|
||||
}
|
||||
|
||||
func testPreprocess_whenDependencyNameContainsDot_mapsToUnderscoreInTargetName() throws {
|
||||
let preprocessInfo = try subject.preprocess(
|
||||
packageInfos: [
|
||||
"Package": .init(
|
||||
products: [
|
||||
.init(name: "Product1", type: .library(.automatic), targets: ["Target_1"]),
|
||||
],
|
||||
targets: [
|
||||
.test(
|
||||
name: "Target_1",
|
||||
dependencies: [
|
||||
.product(name: "com.example.dep-1", package: "com.example.dep-1", condition: nil),
|
||||
]
|
||||
),
|
||||
],
|
||||
platforms: [],
|
||||
cLanguageStandard: nil,
|
||||
cxxLanguageStandard: nil,
|
||||
swiftLanguageVersions: nil
|
||||
),
|
||||
"com.example.dep-1": .init(
|
||||
products: [
|
||||
.init(name: "com.example.dep-1", type: .library(.automatic), targets: ["com.example.dep-1"]),
|
||||
],
|
||||
targets: [
|
||||
.test(name: "com.example.dep-1"),
|
||||
],
|
||||
platforms: [],
|
||||
cLanguageStandard: nil,
|
||||
cxxLanguageStandard: nil,
|
||||
swiftLanguageVersions: nil
|
||||
),
|
||||
],
|
||||
productToPackage: [:],
|
||||
packageToFolder: [
|
||||
"Package": "/Package",
|
||||
"com.example.dep-1": "/com.example.dep-1",
|
||||
],
|
||||
packageToTargetsToArtifactPaths: [:],
|
||||
platforms: [.iOS]
|
||||
)
|
||||
|
||||
XCTAssertEqual(
|
||||
preprocessInfo.targetToResolvedDependencies,
|
||||
[
|
||||
"Target_1": [.externalTarget(package: "com.example.dep-1", target: "com_example_dep-1")],
|
||||
"com.example.dep-1": [],
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
func testMap_whenTargetNotInProduct_ignoresIt() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath1 = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath2 = basePath.appending(RelativePath("Package/Path/Sources/Target2"))
|
||||
let sourcesPath1 = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
let sourcesPath2 = basePath.appending(RelativePath("Package/Sources/Target2"))
|
||||
try fileHandler.createFolder(sourcesPath1)
|
||||
try fileHandler.createFolder(sourcesPath2)
|
||||
|
||||
|
@ -491,9 +497,9 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenTargetIsNotRegular_ignoresTarget() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath1 = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath2 = basePath.appending(RelativePath("Package/Path/Sources/Target2"))
|
||||
let sourcesPath3 = basePath.appending(RelativePath("Package/Path/Sources/Target3"))
|
||||
let sourcesPath1 = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
let sourcesPath2 = basePath.appending(RelativePath("Package/Sources/Target2"))
|
||||
let sourcesPath3 = basePath.appending(RelativePath("Package/Sources/Target3"))
|
||||
try fileHandler.createFolder(sourcesPath1)
|
||||
try fileHandler.createFolder(sourcesPath2)
|
||||
try fileHandler.createFolder(sourcesPath3)
|
||||
|
@ -531,8 +537,9 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenProductIsNotLibrary_ignoresProduct() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Target1")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Target2")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Target3")))
|
||||
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -569,7 +576,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenCustomSources() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -601,11 +608,11 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
customSources: [
|
||||
.init(
|
||||
stringLiteral:
|
||||
basePath.appending(RelativePath("Package/Path/Sources/Target1/Subfolder/**")).pathString
|
||||
basePath.appending(RelativePath("Package/Sources/Target1/Subfolder/**")).pathString
|
||||
),
|
||||
.init(
|
||||
stringLiteral:
|
||||
basePath.appending(RelativePath("Package/Path/Sources/Target1/Another/Subfolder/file.swift"))
|
||||
basePath.appending(RelativePath("Package/Sources/Target1/Another/Subfolder/file.swift"))
|
||||
.pathString
|
||||
),
|
||||
],
|
||||
|
@ -618,7 +625,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenHasResources() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -659,10 +666,10 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
basePath: basePath,
|
||||
customSources: .init(globs: [
|
||||
.glob(
|
||||
Path(basePath.appending(RelativePath("Package/Path/Sources/Target1/**")).pathString),
|
||||
Path(basePath.appending(RelativePath("Package/Sources/Target1/**")).pathString),
|
||||
excluding: [
|
||||
Path(
|
||||
basePath.appending(RelativePath("Package/Path/Sources/Target1/AnotherOne/Resource/**"))
|
||||
basePath.appending(RelativePath("Package/Sources/Target1/AnotherOne/Resource/**"))
|
||||
.pathString
|
||||
),
|
||||
]
|
||||
|
@ -671,12 +678,12 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
resources: [
|
||||
.glob(
|
||||
pattern: Path(
|
||||
basePath.appending(RelativePath("Package/Path/Sources/Target1/Resource/Folder/**"))
|
||||
basePath.appending(RelativePath("Package/Sources/Target1/Resource/Folder/**"))
|
||||
.pathString
|
||||
),
|
||||
excluding: [
|
||||
Path(
|
||||
basePath.appending(RelativePath("Package/Path/Sources/Target1/AnotherOne/Resource/**"))
|
||||
basePath.appending(RelativePath("Package/Sources/Target1/AnotherOne/Resource/**"))
|
||||
.pathString
|
||||
),
|
||||
],
|
||||
|
@ -685,12 +692,12 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
.glob(
|
||||
pattern: Path(
|
||||
basePath
|
||||
.appending(RelativePath("Package/Path/Sources/Target1/Another/Resource/Folder/**"))
|
||||
.appending(RelativePath("Package/Sources/Target1/Another/Resource/Folder/**"))
|
||||
.pathString
|
||||
),
|
||||
excluding: [
|
||||
Path(
|
||||
basePath.appending(RelativePath("Package/Path/Sources/Target1/AnotherOne/Resource/**"))
|
||||
basePath.appending(RelativePath("Package/Sources/Target1/AnotherOne/Resource/**"))
|
||||
.pathString
|
||||
),
|
||||
],
|
||||
|
@ -699,12 +706,12 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
.glob(
|
||||
pattern: Path(
|
||||
basePath
|
||||
.appending(RelativePath("Package/Path/Sources/Target1/AnotherOne/Resource/Folder/**"))
|
||||
.appending(RelativePath("Package/Sources/Target1/AnotherOne/Resource/Folder/**"))
|
||||
.pathString
|
||||
),
|
||||
excluding: [
|
||||
Path(
|
||||
basePath.appending(RelativePath("Package/Path/Sources/Target1/AnotherOne/Resource/**"))
|
||||
basePath.appending(RelativePath("Package/Sources/Target1/AnotherOne/Resource/**"))
|
||||
.pathString
|
||||
),
|
||||
],
|
||||
|
@ -712,12 +719,11 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
),
|
||||
],
|
||||
customDefaultResources: .defaultResources(
|
||||
path: basePath.appending(components: ["Package", "Path", "Sources", "Target1"]),
|
||||
path: basePath.appending(components: ["Package", "Sources", "Target1"]),
|
||||
excluding: [.init(
|
||||
basePath
|
||||
.appending(components: [
|
||||
"Package",
|
||||
"Path",
|
||||
"Sources",
|
||||
"Target1",
|
||||
"AnotherOne",
|
||||
|
@ -735,7 +741,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenHasHeadersWithCustomModuleMap() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let headersPath = basePath.appending(RelativePath("Package/Path/Sources/Target1/include"))
|
||||
let headersPath = basePath.appending(RelativePath("Package/Sources/Target1/include"))
|
||||
let moduleMapPath = headersPath.appending(component: "module.modulemap")
|
||||
let topHeaderPath = headersPath.appending(component: "AnHeader.h")
|
||||
let nestedHeaderPath = headersPath.appending(component: "Subfolder").appending(component: "AnotherHeader.h")
|
||||
|
@ -784,7 +790,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenHasHeadersWithUmbrellaHeader() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let headersPath = basePath.appending(RelativePath("Package/Path/Sources/Target1/include"))
|
||||
let headersPath = basePath.appending(RelativePath("Package/Sources/Target1/include"))
|
||||
let topHeaderPath = headersPath.appending(component: "Target1.h")
|
||||
let nestedHeaderPath = headersPath.appending(component: "Subfolder").appending(component: "AnHeader.h")
|
||||
try fileHandler.createFolder(headersPath.appending(component: "Subfolder"))
|
||||
|
@ -831,11 +837,11 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenDependenciesHaveHeaders() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let target1HeadersPath = basePath.appending(RelativePath("Package/Path/Sources/Target1/include"))
|
||||
let target1HeadersPath = basePath.appending(RelativePath("Package/Sources/Target1/include"))
|
||||
let target1ModuleMapPath = target1HeadersPath.appending(component: "module.modulemap")
|
||||
let dependency1HeadersPath = basePath.appending(RelativePath("Package/Path/Sources/Dependency1/include"))
|
||||
let dependency1HeadersPath = basePath.appending(RelativePath("Package/Sources/Dependency1/include"))
|
||||
let dependency1ModuleMapPath = dependency1HeadersPath.appending(component: "module.modulemap")
|
||||
let dependency2HeadersPath = basePath.appending(RelativePath("Package/Path/Sources/Dependency2/include"))
|
||||
let dependency2HeadersPath = basePath.appending(RelativePath("Package/Sources/Dependency2/include"))
|
||||
let dependency2ModuleMapPath = dependency2HeadersPath.appending(component: "module.modulemap")
|
||||
try fileHandler.createFolder(target1HeadersPath.appending(component: "Subfolder"))
|
||||
try fileHandler.write("", path: target1ModuleMapPath, atomically: true)
|
||||
|
@ -915,11 +921,11 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenExternalDependenciesHaveHeaders() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let target1HeadersPath = basePath.appending(RelativePath("Package/Path/Sources/Target1/include"))
|
||||
let target1HeadersPath = basePath.appending(RelativePath("Package/Sources/Target1/include"))
|
||||
let target1ModuleMapPath = target1HeadersPath.appending(component: "module.modulemap")
|
||||
let dependency1HeadersPath = basePath.appending(RelativePath("Package2/Path/Sources/Dependency1/include"))
|
||||
let dependency1HeadersPath = basePath.appending(RelativePath("Package2/Sources/Dependency1/include"))
|
||||
let dependency1ModuleMapPath = dependency1HeadersPath.appending(component: "module.modulemap")
|
||||
let dependency2HeadersPath = basePath.appending(RelativePath("Package3/Path/Sources/Dependency2/include"))
|
||||
let dependency2HeadersPath = basePath.appending(RelativePath("Package3/Sources/Dependency2/include"))
|
||||
let dependency2ModuleMapPath = dependency2HeadersPath.appending(component: "module.modulemap")
|
||||
try fileHandler.createFolder(target1HeadersPath.appending(component: "Subfolder"))
|
||||
try fileHandler.write("", path: target1ModuleMapPath, atomically: true)
|
||||
|
@ -986,12 +992,12 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
.test(
|
||||
"Target1",
|
||||
basePath: basePath,
|
||||
dependencies: [.project(target: "Dependency1", path: Path("\(basePath.pathString)/Package2/Path"))],
|
||||
dependencies: [.project(target: "Dependency1", path: Path("\(basePath.pathString)/Package2"))],
|
||||
customSettings: [
|
||||
"HEADER_SEARCH_PATHS": [
|
||||
"$(SRCROOT)/Sources/Target1/include",
|
||||
"$(SRCROOT)/../../Package2/Path/Sources/Dependency1/include",
|
||||
"$(SRCROOT)/../../Package3/Path/Sources/Dependency2/include",
|
||||
"$(SRCROOT)/../Package2/Sources/Dependency1/include",
|
||||
"$(SRCROOT)/../Package3/Sources/Dependency2/include",
|
||||
],
|
||||
],
|
||||
moduleMap: "$(SRCROOT)/Sources/Target1/include/module.modulemap"
|
||||
|
@ -1003,7 +1009,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenCustomPath() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let headersPath = basePath.appending(RelativePath("Package/Path/Custom/Path/Headers"))
|
||||
let headersPath = basePath.appending(RelativePath("Package/Custom/Headers"))
|
||||
let headerPath = headersPath.appending(component: "module.h")
|
||||
let moduleMapPath = headersPath.appending(component: "module.modulemap")
|
||||
try fileHandler.createFolder(headersPath)
|
||||
|
@ -1021,7 +1027,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
targets: [
|
||||
.test(
|
||||
name: "Target1",
|
||||
path: "Custom/Path",
|
||||
path: "Custom",
|
||||
sources: ["Sources/Folder"],
|
||||
resources: [.init(rule: .copy, path: "Resource/Folder")],
|
||||
publicHeadersPath: "Headers"
|
||||
|
@ -1044,19 +1050,19 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
basePath: basePath,
|
||||
customSources: .init(globs: [
|
||||
basePath
|
||||
.appending(RelativePath("Package/Path/Custom/Path/Sources/Folder/**")).pathString,
|
||||
.appending(RelativePath("Package/Custom/Sources/Folder/**")).pathString,
|
||||
]),
|
||||
resources: [
|
||||
.init(
|
||||
stringLiteral: basePath.appending(RelativePath("Package/Path/Custom/Path/Resource/Folder/**"))
|
||||
stringLiteral: basePath.appending(RelativePath("Package/Custom/Resource/Folder/**"))
|
||||
.pathString
|
||||
),
|
||||
],
|
||||
customDefaultResources: [],
|
||||
customSettings: [
|
||||
"HEADER_SEARCH_PATHS": ["$(SRCROOT)/Custom/Path/Headers"],
|
||||
"HEADER_SEARCH_PATHS": ["$(SRCROOT)/Custom/Headers"],
|
||||
],
|
||||
moduleMap: "$(SRCROOT)/Custom/Path/Headers/module.modulemap"
|
||||
moduleMap: "$(SRCROOT)/Custom/Headers/module.modulemap"
|
||||
),
|
||||
]
|
||||
)
|
||||
|
@ -1065,8 +1071,8 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenDependencyHasHeaders_addsThemToHeaderSearchPath() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let dependencyHeadersPath = basePath.appending(RelativePath("Package/Path/Sources/Dependency1/include"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let dependencyHeadersPath = basePath.appending(RelativePath("Package/Sources/Dependency1/include"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(dependencyHeadersPath)
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
|
@ -1119,7 +1125,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenIOSAvailable_takesIOS() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1185,7 +1191,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
exitstatus: 0
|
||||
)
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1219,7 +1225,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenNoneAvailable_throws() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
XCTAssertThrowsSpecific(
|
||||
try subject.map(
|
||||
|
@ -1251,7 +1257,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenPackageDefinesPlatform_configuresDeploymentTarget() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1290,7 +1296,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsCHeaderSearchPath_mapsToHeaderSearchPathsSetting() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1330,7 +1336,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsCXXHeaderSearchPath_mapsToHeaderSearchPathsSetting() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1370,7 +1376,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsCDefine_mapsToGccPreprocessorDefinitions() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1414,7 +1420,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsCXXDefine_mapsToGccPreprocessorDefinitions() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1457,7 +1463,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsSwiftDefine_mapsToSwiftActiveCompilationConditions() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1495,7 +1501,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsCUnsafeFlags_mapsToOtherCFlags() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1534,7 +1540,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsCXXUnsafeFlags_mapsToOtherCPlusPlusFlags() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1573,7 +1579,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsSwiftUnsafeFlags_mapsToOtherSwiftFlags() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
let project = try subject.map(
|
||||
package: "Package",
|
||||
|
@ -1612,7 +1618,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsLinkerUnsafeFlags_mapsToOtherLdFlags() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -1652,7 +1658,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenConfigurationContainsBaseSettingsDictionary_usesBaseSettings() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -1725,7 +1731,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenConfigurationContainsTargetSettingsDictionary_mapsToCustomSettings() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let customSettings: TuistGraph.SettingsDictionary = ["CUSTOM_SETTING": .string("CUSTOM_VALUE")]
|
||||
|
@ -1777,7 +1783,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenConditionalSetting_ignoresByPlatform() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -1831,7 +1837,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsLinkedFramework_mapsToSDKDependency() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -1874,7 +1880,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenSettingsContainsLinkedLibrary_mapsToSDKDependency() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -1917,8 +1923,8 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenTargetDependency_mapsToTargetDependency() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let dependenciesPath = basePath.appending(RelativePath("Package/Path/Sources/Dependency1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
let dependenciesPath = basePath.appending(RelativePath("Package/Sources/Dependency1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
try fileHandler.createFolder(dependenciesPath)
|
||||
|
||||
|
@ -1958,8 +1964,8 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenBinaryTargetDependency_mapsToXcframework() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let dependenciesPath = basePath.appending(RelativePath("Package/Path/Sources/Dependency1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
let dependenciesPath = basePath.appending(RelativePath("Package/Sources/Dependency1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
try fileHandler.createFolder(dependenciesPath)
|
||||
|
||||
|
@ -2007,8 +2013,8 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenTargetByNameDependency_mapsToTargetDependency() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let dependenciesPath = basePath.appending(RelativePath("Package/Path/Sources/Dependency1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
let dependenciesPath = basePath.appending(RelativePath("Package/Sources/Dependency1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
try fileHandler.createFolder(dependenciesPath)
|
||||
|
||||
|
@ -2048,7 +2054,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenBinaryTargetURLByNameDependency_mapsToXcFramework() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2097,7 +2103,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenBinaryTargetPathByNameDependency_mapsToXcFramework() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2144,14 +2150,11 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenExternalProductDependency_mapsToProjectDependencies() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath1 = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath2 = basePath.appending(RelativePath("Package2/Path/Sources/Target2"))
|
||||
let sourcesPath3 = basePath.appending(RelativePath("Package2/Path/Sources/Target3"))
|
||||
let sourcesPath4 = basePath.appending(RelativePath("Package2/Path/Sources/Target4"))
|
||||
try fileHandler.createFolder(sourcesPath1)
|
||||
try fileHandler.createFolder(sourcesPath2)
|
||||
try fileHandler.createFolder(sourcesPath3)
|
||||
try fileHandler.createFolder(sourcesPath4)
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Target1")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package2/Sources/Target2")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package2/Sources/Target3")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package2/Sources/Target4")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Dependency1")))
|
||||
|
||||
let package1 = PackageInfo(
|
||||
products: [
|
||||
|
@ -2198,8 +2201,8 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
"Target1",
|
||||
basePath: basePath,
|
||||
dependencies: [
|
||||
.project(target: "Target2", path: Path(basePath.appending(RelativePath("Package2/Path")).pathString)),
|
||||
.project(target: "Target3", path: Path(basePath.appending(RelativePath("Package2/Path")).pathString)),
|
||||
.project(target: "Target2", path: Path(basePath.appending(RelativePath("Package2")).pathString)),
|
||||
.project(target: "Target3", path: Path(basePath.appending(RelativePath("Package2")).pathString)),
|
||||
]
|
||||
),
|
||||
]
|
||||
|
@ -2209,14 +2212,11 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenExternalByNameProductDependency_mapsToProjectDependencies() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath1 = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath2 = basePath.appending(RelativePath("Package2/Path/Sources/Target2"))
|
||||
let sourcesPath3 = basePath.appending(RelativePath("Package2/Path/Sources/Target3"))
|
||||
let sourcesPath4 = basePath.appending(RelativePath("Package2/Path/Sources/Target4"))
|
||||
try fileHandler.createFolder(sourcesPath1)
|
||||
try fileHandler.createFolder(sourcesPath2)
|
||||
try fileHandler.createFolder(sourcesPath3)
|
||||
try fileHandler.createFolder(sourcesPath4)
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Target1")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package2/Sources/Target2")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package2/Sources/Target3")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package2/Sources/Target4")))
|
||||
try fileHandler.createFolder(basePath.appending(RelativePath("Package/Sources/Dependency1")))
|
||||
|
||||
let package1 = PackageInfo(
|
||||
products: [
|
||||
|
@ -2263,8 +2263,8 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
"Target1",
|
||||
basePath: basePath,
|
||||
dependencies: [
|
||||
.project(target: "Target2", path: Path(basePath.appending(RelativePath("Package2/Path")).pathString)),
|
||||
.project(target: "Target3", path: Path(basePath.appending(RelativePath("Package2/Path")).pathString)),
|
||||
.project(target: "Target2", path: Path(basePath.appending(RelativePath("Package2")).pathString)),
|
||||
.project(target: "Target3", path: Path(basePath.appending(RelativePath("Package2")).pathString)),
|
||||
]
|
||||
),
|
||||
]
|
||||
|
@ -2274,7 +2274,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenCustomCVersion_mapsToGccCLanguageStandardSetting() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2309,7 +2309,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenCustomCXXVersion_mapsToClangCxxLanguageStandardSetting() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2344,7 +2344,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenCustomSwiftVersion_mapsToSwiftVersionSetting() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2379,7 +2379,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenMultipleCustomSwiftVersions_mapsLargestToSwiftVersionSetting() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2414,7 +2414,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenMultipleCustomSwiftVersionsAndConfiguredVersion_mapsLargestToSwiftVersionLowerThanConfigured() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2450,7 +2450,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
|
||||
func testMap_whenDependenciesContainsCustomConfiguration_mapsToProjectWithCustomConfig() throws {
|
||||
let basePath = try temporaryPath()
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Path/Sources/Target1"))
|
||||
let sourcesPath = basePath.appending(RelativePath("Package/Sources/Target1"))
|
||||
try fileHandler.createFolder(sourcesPath)
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2494,7 +2494,7 @@ final class PackageInfoMapperTests: TuistUnitTestCase {
|
|||
]
|
||||
let allTargets = ["RxSwift"] + testTargets
|
||||
try allTargets
|
||||
.map { basePath.appending(RelativePath("Package/Path/Sources/\($0)")) }
|
||||
.map { basePath.appending(RelativePath("Package/Sources/\($0)")) }
|
||||
.forEach { try fileHandler.createFolder($0) }
|
||||
|
||||
let project = try subject.map(
|
||||
|
@ -2545,7 +2545,7 @@ private func defaultSpmResources(_ target: String, customPath: String? = nil) ->
|
|||
if let customPath = customPath {
|
||||
fullPath = customPath
|
||||
} else {
|
||||
fullPath = "/Package/Path/Sources/\(target)"
|
||||
fullPath = "/Package/Sources/\(target)"
|
||||
}
|
||||
return [
|
||||
"\(fullPath)/**/*.xib",
|
||||
|
@ -2601,7 +2601,7 @@ extension PackageInfoMapping {
|
|||
packageInfo: packageInfos[package]!,
|
||||
packageInfos: packageInfos,
|
||||
name: package,
|
||||
path: basePath.appending(component: package).appending(component: "Path"),
|
||||
path: basePath.appending(component: package),
|
||||
productTypes: [:],
|
||||
baseSettings: baseSettings,
|
||||
targetSettings: targetSettings,
|
||||
|
@ -2609,8 +2609,9 @@ extension PackageInfoMapping {
|
|||
targetToPlatform: preprocessInfo.targetToPlatform,
|
||||
targetToProducts: preprocessInfo.targetToProducts,
|
||||
targetToResolvedDependencies: preprocessInfo.targetToResolvedDependencies,
|
||||
targetToModuleMap: preprocessInfo.targetToModuleMap,
|
||||
packageToProject: Dictionary(uniqueKeysWithValues: packageInfos.keys.map {
|
||||
($0, basePath.appending(component: $0).appending(component: "Path"))
|
||||
($0, basePath.appending(component: $0))
|
||||
}),
|
||||
swiftToolsVersion: swiftToolsVersion
|
||||
)
|
||||
|
@ -2702,7 +2703,7 @@ extension ProjectDescription.Target {
|
|||
if let customDefaultResources = customDefaultResources {
|
||||
defaultResources = customDefaultResources
|
||||
} else {
|
||||
defaultResources = .defaultResources(path: basePath.appending(components: ["Package", "Path", "Sources", name]))
|
||||
defaultResources = .defaultResources(path: basePath.appending(components: ["Package", "Sources", name]))
|
||||
}
|
||||
let allResources = resources + defaultResources
|
||||
|
||||
|
@ -2714,7 +2715,7 @@ extension ProjectDescription.Target {
|
|||
deploymentTarget: deploymentTarget,
|
||||
infoPlist: .default,
|
||||
sources: customSources ??
|
||||
.init(globs: [basePath.appending(RelativePath("Package/Path/Sources/\(name)/**")).pathString]),
|
||||
.init(globs: [basePath.appending(RelativePath("Package/Sources/\(name)/**")).pathString]),
|
||||
resources: allResources.isEmpty ? nil : ResourceFileElements(resources: allResources),
|
||||
headers: headers,
|
||||
dependencies: dependencies,
|
||||
|
|
|
@ -214,6 +214,7 @@ class SwiftPackageManagerGraphGeneratorTests: TuistUnitTestCase {
|
|||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/ADependency/Sources/ALibrary"))
|
||||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/ADependency/Sources/ALibraryUtils"))
|
||||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/another-dependency/Sources/AnotherLibrary"))
|
||||
try fileHandler.createFolder(AbsolutePath("/tmp/localPackage/Sources/TestUtilities"))
|
||||
|
||||
let testPath = AbsolutePath("/tmp/localPackage")
|
||||
try checkGenerated(
|
||||
|
@ -269,6 +270,7 @@ class SwiftPackageManagerGraphGeneratorTests: TuistUnitTestCase {
|
|||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/ADependency/Sources/ALibrary"))
|
||||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/ADependency/Sources/ALibraryUtils"))
|
||||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/another-dependency/Sources/AnotherLibrary"))
|
||||
try fileHandler.createFolder(AbsolutePath("/tmp/localPackage/Sources/TestUtilities"))
|
||||
try fileHandler.createFolder(AbsolutePath("/tmp/localPackage/Sources/TuistKit"))
|
||||
|
||||
let testPath = AbsolutePath("/tmp/localPackage")
|
||||
|
@ -325,6 +327,7 @@ class SwiftPackageManagerGraphGeneratorTests: TuistUnitTestCase {
|
|||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/ADependency/Sources/ALibrary"))
|
||||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/ADependency/Sources/ALibraryUtils"))
|
||||
try fileHandler.createFolder(AbsolutePath("\(spmFolder.pathString)/checkouts/another-dependency/Sources/AnotherLibrary"))
|
||||
try fileHandler.createFolder(AbsolutePath("/tmp/localPackage/Sources/TestUtilities"))
|
||||
try fileHandler.createFolder(AbsolutePath("/tmp/localPackage/Sources/TuistKit"))
|
||||
|
||||
let testPath = AbsolutePath("/tmp/localPackage")
|
||||
|
@ -440,6 +443,7 @@ class SwiftPackageManagerGraphGeneratorTests: TuistUnitTestCase {
|
|||
dependenciesGraph: TuistCore.DependenciesGraph
|
||||
) throws {
|
||||
// Given
|
||||
try fileHandler.createFolder(AbsolutePath("/tmp/localPackage/Sources/TestUtilities"))
|
||||
fileHandler.stubReadFile = {
|
||||
XCTAssertEqual($0, self.path.appending(component: "workspace-state.json"))
|
||||
return """
|
||||
|
|
|
@ -22,7 +22,7 @@ class SwiftPackageManagerModuleMapGeneratorTests: TuistTestCase {
|
|||
}
|
||||
|
||||
func test_generate_when_custom_module_map() throws {
|
||||
try test_generate(for: .custom)
|
||||
try test_generate(for: .custom("/Absolute/Public/Headers/Path/module.modulemap"))
|
||||
}
|
||||
|
||||
func test_generate_when_umbrella_header() throws {
|
||||
|
@ -33,10 +33,10 @@ class SwiftPackageManagerModuleMapGeneratorTests: TuistTestCase {
|
|||
try test_generate(for: .nestedHeader)
|
||||
}
|
||||
|
||||
private func test_generate(for moduleMapType: ModuleMapType) throws {
|
||||
private func test_generate(for moduleMap: ModuleMap) throws {
|
||||
var writeCalled = false
|
||||
fileHandler.stubContentsOfDirectory = { _ in
|
||||
switch moduleMapType {
|
||||
switch moduleMap {
|
||||
case .none:
|
||||
return []
|
||||
case .custom:
|
||||
|
@ -52,13 +52,13 @@ class SwiftPackageManagerModuleMapGeneratorTests: TuistTestCase {
|
|||
fileHandler.stubExists = { path in
|
||||
switch path {
|
||||
case "/Absolute/Public/Headers/Path":
|
||||
return moduleMapType != .none
|
||||
return moduleMap != .none
|
||||
case "/Absolute/Public/Headers/Path/module.modulemap":
|
||||
return moduleMapType == .custom
|
||||
return moduleMap == .custom("/Absolute/Public/Headers/Path/module.modulemap")
|
||||
case "/Absolute/Public/Headers/Path/Module.h":
|
||||
return moduleMapType == .header
|
||||
return moduleMap == .header
|
||||
case "/Absolute/Public/Headers/Path/Module/Module.h":
|
||||
return moduleMapType == .nestedHeader
|
||||
return moduleMap == .nestedHeader
|
||||
default:
|
||||
XCTFail("Unexpected exists call: \(path)")
|
||||
return false
|
||||
|
@ -67,7 +67,7 @@ class SwiftPackageManagerModuleMapGeneratorTests: TuistTestCase {
|
|||
fileHandler.stubWrite = { content, path, atomically in
|
||||
writeCalled = true
|
||||
let expectedContent: String
|
||||
switch moduleMapType {
|
||||
switch moduleMap {
|
||||
case .none, .custom, .header:
|
||||
XCTFail("FileHandler.write should not be called")
|
||||
return
|
||||
|
@ -92,17 +92,9 @@ class SwiftPackageManagerModuleMapGeneratorTests: TuistTestCase {
|
|||
XCTAssertEqual(path, "/Absolute/Public/Headers/Path/Module.modulemap")
|
||||
XCTAssertTrue(atomically)
|
||||
}
|
||||
let moduleMap = try subject.generate(moduleName: "Module", publicHeadersPath: "/Absolute/Public/Headers/Path")
|
||||
XCTAssertEqual(moduleMap.type, moduleMapType)
|
||||
switch moduleMapType {
|
||||
case .none, .header, .nestedHeader:
|
||||
XCTAssertNil(moduleMap.path)
|
||||
case .custom:
|
||||
XCTAssertEqual(moduleMap.path, "/Absolute/Public/Headers/Path/module.modulemap")
|
||||
case .directory:
|
||||
XCTAssertEqual(moduleMap.path, "/Absolute/Public/Headers/Path/Module.modulemap")
|
||||
}
|
||||
switch moduleMapType {
|
||||
let got = try subject.generate(moduleName: "Module", publicHeadersPath: "/Absolute/Public/Headers/Path")
|
||||
XCTAssertEqual(got, moduleMap)
|
||||
switch moduleMap {
|
||||
case .none, .custom, .header, .nestedHeader:
|
||||
XCTAssertFalse(writeCalled)
|
||||
case .directory:
|
||||
|
|
|
@ -63,4 +63,4 @@ DerivedData/
|
|||
*.xcworkspace
|
||||
|
||||
### Tuist managed dependencies ###
|
||||
Tuist/Dependencies
|
||||
Tuist/Dependencies
|
||||
|
|
|
@ -63,4 +63,4 @@ DerivedData/
|
|||
*.xcworkspace
|
||||
|
||||
### Tuist managed dependencies ###
|
||||
Tuist/Dependencies
|
||||
Tuist/Dependencies
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import ProjectDescription
|
||||
|
||||
let packages: [Package] = [
|
||||
.package(url: "https://github.com/Alamofire/Alamofire", .upToNextMajor(from: "5.0.0")),
|
||||
.package(url: "https://github.com/Alamofire/Alamofire", .upToNextMajor(from: "5.6.0")),
|
||||
.package(url: "https://github.com/danielgindi/Charts", .upToNextMajor(from: "4.0.0")),
|
||||
.package(url: "https://github.com/facebook/facebook-ios-sdk", .upToNextMajor(from: "12.1.0")),
|
||||
.package(url: "https://github.com/firebase/firebase-ios-sdk", .upToNextMajor(from: "8.14.0")),
|
||||
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", .upToNextMinor(from: "0.22.0")),
|
||||
.package(url: "https://github.com/iterable/swift-sdk", .upToNextMajor(from: "6.0.0")),
|
||||
.package(url: "https://github.com/facebook/facebook-ios-sdk", .upToNextMajor(from: "13.2.0")),
|
||||
.package(url: "https://github.com/firebase/firebase-ios-sdk", .upToNextMajor(from: "9.0.0")),
|
||||
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", .upToNextMinor(from: "0.34.0")),
|
||||
.package(url: "https://github.com/iterable/swift-sdk", .upToNextMajor(from: "6.4.0")),
|
||||
.package(url: "https://github.com/Trendyol/ios-components", .revision("c9260bfe203a16a278eca5542c98455eece98aa4")),
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue