Skip to content

Commit

Permalink
Merge pull request #128 from giginet/revert-auto-link
Browse files Browse the repository at this point in the history
Revert #124
  • Loading branch information
giginet authored Jun 5, 2024
2 parents 2d76897 + 9899750 commit e4ec2e5
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions Sources/ScipioKit/Producer/PIF/PIFGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,42 +276,9 @@ private struct PIFLibraryTargetModifier {

configuration.buildSettings = settings

linkAllDependencies(of: pifTarget)

return configuration
}

/// Link all dependencies of the target
/// The original implementations of PIFBuilder links all dependencies to the PackageProduct targets
/// However, Scipio ignores PackageProduct so targets' dependencies haven't be linked
private func linkAllDependencies(of pifTarget: PIF.Target) {
let buildFiles = pifTarget.dependencies.enumerated().map { (index, dependency) in
PIF.BuildFile(guid: guid("FRAMEWORKS_BUILD_FILE_\(index)"),
targetGUID: dependency.targetGUID,
platformFilters: dependency.platformFilters)
}

if let buildPhase = fetchBuildPhase(of: PIF.FrameworksBuildPhase.self, in: pifTarget) {
buildPhase.buildFiles.append(contentsOf: buildFiles)
} else {
let buildPhase = PIF.FrameworksBuildPhase(
guid: guid("FRAMEWORKS_BUILD_PHASE"),
buildFiles: buildFiles
)
pifTarget.buildPhases.append(buildPhase)
}
}

/// Fetch BuildPhase of the passed type
private func fetchBuildPhase<BuildPhase: PIF.BuildPhase>(of buildPhasesType: BuildPhase.Type, in pifTarget: PIF.Target) -> BuildPhase? {
pifTarget.buildPhases.compactMap({ $0 as? BuildPhase }).first
}

/// Build GUID with suffixes
private func guid(_ suffixes: String...) -> String {
"GUID::SCIPIO::\(pifTarget.name)::" + suffixes.joined(separator: "::")
}

// Append extraFlags from BuildOptionsMatrix to each target settings
private func appendExtraFlagsByBuildOptionsMatrix(to settings: inout PIF.BuildSettings) {
func createOrUpdateFlags(for key: PIF.BuildSettings.MultipleValueSetting, to keyPath: KeyPath<ExtraFlags, [String]?>) {
Expand Down

0 comments on commit e4ec2e5

Please sign in to comment.