Skip to content

Commit

Permalink
Revert "Fix runtime error when using objc dependencies (#5929)"
Browse files Browse the repository at this point in the history
This reverts commit 9297022.
  • Loading branch information
thedavidharris committed Apr 30, 2024
1 parent baa4afb commit 8bc3ef9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
35 changes: 1 addition & 34 deletions Sources/TuistGenerator/Mappers/ModuleMapMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import TuistSupport
public final class ModuleMapMapper: GraphMapping { // swiftlint:disable:this type_body_length
private static let modulemapFileSetting = "MODULEMAP_FILE"
private static let otherCFlagsSetting = "OTHER_CFLAGS"
private static let otherLinkerFlagsSetting = "OTHER_LDFLAGS"
private static let otherSwiftFlagsSetting = "OTHER_SWIFT_FLAGS"
private static let headerSearchPaths = "HEADER_SEARCH_PATHS"

Expand Down Expand Up @@ -82,15 +81,7 @@ public final class ModuleMapMapper: GraphMapping { // swiftlint:disable:this typ
mappedSettingsDictionary[Self.headerSearchPaths] = updatedHeaderSearchPaths
}

if let updatedOtherLinkerFlags = Self.updatedOtherLinkerFlags(
targetID: targetID,
oldOtherLinkerFlags: mappedSettingsDictionary[Self.otherLinkerFlagsSetting],
targetToDependenciesMetadata: targetToDependenciesMetadata
) {
mappedSettingsDictionary[Self.otherLinkerFlagsSetting] = updatedOtherLinkerFlags
}

let targetSettings = target.settings ?? Settings(
let targetSettings = mappedTarget.settings ?? Settings(
base: [:],
configurations: [:],
defaultSettings: project.settings.defaultSettings
Expand Down Expand Up @@ -277,28 +268,4 @@ public final class ModuleMapMapper: GraphMapping { // swiftlint:disable:this typ

return .array(mappedOtherCFlags)
}

private static func updatedOtherLinkerFlags(
targetID: TargetID,
oldOtherLinkerFlags: SettingsDictionary.Value?,
targetToDependenciesMetadata: [TargetID: Set<DependencyMetadata>]
) -> SettingsDictionary.Value? {
guard let dependenciesModuleMaps = targetToDependenciesMetadata[targetID]?.compactMap(\.moduleMapPath),
!dependenciesModuleMaps.isEmpty
else { return nil }

var mappedOtherLinkerFlags: [String]
switch oldOtherLinkerFlags ?? .array(["$(inherited)"]) {
case let .array(values):
mappedOtherLinkerFlags = values
case let .string(value):
mappedOtherLinkerFlags = value.split(separator: " ").map(String.init)
}

if !mappedOtherLinkerFlags.contains("-ObjC") {
mappedOtherLinkerFlags.append("-ObjC")
}

return .array(mappedOtherLinkerFlags)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ final class ModuleMapMapperTests: TuistUnitTestCase {
"-fmodule-map-file=$(SRCROOT)/../B/B2/B2.module",
]),
"HEADER_SEARCH_PATHS": .array(["$(inherited)", "$(SRCROOT)/../B/B1/include", "$(SRCROOT)/../B/B2/include"]),
"OTHER_LDFLAGS": .array(["$(inherited)", "-ObjC"]),
]),
dependencies: [
.project(target: "B1", path: projectBPath),
Expand All @@ -134,7 +133,6 @@ final class ModuleMapMapperTests: TuistUnitTestCase {
"OTHER_CFLAGS": .array(["$(inherited)", "-fmodule-map-file=$(SRCROOT)/B2/B2.module"]),
"OTHER_SWIFT_FLAGS": .array(["$(inherited)", "-Xcc", "-fmodule-map-file=$(SRCROOT)/B2/B2.module"]),
"HEADER_SEARCH_PATHS": .array(["$(SRCROOT)/B1/include", "$(SRCROOT)/B2/include"]),
"OTHER_LDFLAGS": .array(["$(inherited)", "-ObjC"]),
]),
dependencies: [
.target(name: "B2"),
Expand Down Expand Up @@ -262,7 +260,6 @@ final class ModuleMapMapperTests: TuistUnitTestCase {
"-fmodule-map-file=$(SRCROOT)/../B/B/B.module",
]),
"HEADER_SEARCH_PATHS": .array(["$(inherited)", "$(SRCROOT)/../B/B/include"]),
"OTHER_LDFLAGS": .array(["$(inherited)", "-ObjC"]),
],
configurations: [:],
defaultSettings: .recommended
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum AppKit {
_ = YAMLEncoder()

// Use GoogleSignIn
_ = GIDSignIn.sharedInstance.hasPreviousSignIn()
_ = GIDSignIn.sharedInstance.configuration

// Use Sentry
SentrySDK.startSession()
Expand Down

0 comments on commit 8bc3ef9

Please sign in to comment.