Files
XcodeGen/Sources/ProjectSpec/Linkage.swift
T
Vlad Gorlov 4455919be3 Added support for "driver-extension" and "system-extension" product types (#1094)
* Squashed commit of the following:

commit 0bcdce0d1f0f1d13fb5a284404e4eaea4e805a89
Author: Vlad Gorlov <volodymyr.gorlov@gmail.com>
Date:   Fri Jun 18 00:58:50 2021 +0200

    [#1092] Dependency version update.

commit 0040c46fd4ce9f42102faeb744104027b6c2c757
Author: Bruce Evans <bruce.evans.dev@gmail.com>
Date:   Wed Jun 16 09:12:01 2021 +0900

    Add Support for DocC in Xcode 13 (#1091)

    * Add support for DocC

    DocC "files" are actually folders `.docc` appended to the name, but Xcode 13 treats them differently. Therefore, we need to exclude them from the normal BuildPhase.

    Resolves #1089

    * Add tests for DocC

    Expanded an existing test to include .docc support.

    Also added a .docc catalog to the Test Project.

    * Update changelog.md

    * Update changelog.md to get the correct PR Link

commit 5bb7ef4e1c632f80f63c49ee280d64b8dab1603f
Author: Vlad Gorlov <volodymyr.gorlov@gmail.com>
Date:   Wed Jun 16 01:03:42 2021 +0200

    Added support for missed product types.

commit 3f8bfdf749d0d15da8490550b95a31cf961d8649
Author: Vlad Gorlov <volodymyr.gorlov@gmail.com>
Date:   Wed Jun 16 00:01:47 2021 +0200

    Added support for missed product types.

commit 235ebe4fe906716a6a37421346318fc6515836ce
Author: Vlad Gorlov <volodymyr.gorlov@gmail.com>
Date:   Tue Jun 15 23:53:52 2021 +0200

    Added support for missed product types.

* [#1094] Fixes failing tests.

* [#1094] Added test project targets.

* [#1094] Making iig-file type of source code.

* [#1094] Attempt to fix CI failure.
2021-06-20 14:08:38 +10:00

61 lines
1.5 KiB
Swift

import Foundation
import XcodeProj
public enum Linkage {
case dynamic
case `static`
case none
}
extension Target {
public var defaultLinkage: Linkage {
switch type {
case .none,
.appExtension,
.application,
.bundle,
.commandLineTool,
.instrumentsPackage,
.intentsServiceExtension,
.messagesApplication,
.messagesExtension,
.metalLibrary,
.ocUnitTestBundle,
.onDemandInstallCapableApplication,
.stickerPack,
.tvExtension,
.uiTestBundle,
.unitTestBundle,
.watchApp,
.watchExtension,
.watch2App,
.watch2AppContainer,
.watch2Extension,
.xcodeExtension,
.xpcService,
.systemExtension,
.driverExtension:
return .none
case .framework, .xcFramework:
// Check the MACH_O_TYPE for "Static Framework"
if settings.buildSettings.machOType == "staticlib" {
return .static
} else {
return .dynamic
}
case .dynamicLibrary:
return .dynamic
case .staticLibrary, .staticFramework:
return .static
}
}
}
private extension BuildSettings {
var machOType: String? {
self["MACH_O_TYPE"] as? String
}
}