Skip to content

Commit

Permalink
Add tags to Target model
Browse files Browse the repository at this point in the history
  • Loading branch information
woin2ee committed Jul 31, 2024
1 parent cec1766 commit 5c83961
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
23 changes: 16 additions & 7 deletions Sources/XcodeGraph/Models/Target.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public struct Target: Equatable, Hashable, Comparable, Codable {
public let mergedBinaryType: MergedBinaryType
public let mergeable: Bool
public let onDemandResourcesTags: OnDemandResourcesTags?
public var tags: [TargetTag]

// MARK: - Init

Expand Down Expand Up @@ -77,7 +78,8 @@ public struct Target: Equatable, Hashable, Comparable, Codable {
prune: Bool = false,
mergedBinaryType: MergedBinaryType = .disabled,
mergeable: Bool = false,
onDemandResourcesTags: OnDemandResourcesTags? = nil
onDemandResourcesTags: OnDemandResourcesTags? = nil,
tags: [TargetTag] = []
) {
self.name = name
self.product = product
Expand Down Expand Up @@ -106,6 +108,7 @@ public struct Target: Equatable, Hashable, Comparable, Codable {
self.mergedBinaryType = mergedBinaryType
self.mergeable = mergeable
self.onDemandResourcesTags = onDemandResourcesTags
self.tags = tags
}

/// Given a target name, it obtains the product name by turning "-" characters into "_" and "/" into "_"
Expand Down Expand Up @@ -401,7 +404,8 @@ extension Sequence<Target> {
additionalFiles: [FileElement] = [],
prune: Bool = false,
mergedBinaryType: MergedBinaryType = .disabled,
mergeable: Bool = false
mergeable: Bool = false,
tags: [TargetTag] = []
) -> Target {
Target(
name: name,
Expand All @@ -428,7 +432,8 @@ extension Sequence<Target> {
additionalFiles: additionalFiles,
prune: prune,
mergedBinaryType: mergedBinaryType,
mergeable: mergeable
mergeable: mergeable,
tags: tags
)
}

Expand Down Expand Up @@ -459,7 +464,8 @@ extension Sequence<Target> {
additionalFiles: [FileElement] = [],
prune: Bool = false,
mergedBinaryType: MergedBinaryType = .disabled,
mergeable: Bool = false
mergeable: Bool = false,
tags: [TargetTag] = []
) -> Target {
Target(
name: name,
Expand All @@ -486,7 +492,8 @@ extension Sequence<Target> {
additionalFiles: additionalFiles,
prune: prune,
mergedBinaryType: mergedBinaryType,
mergeable: mergeable
mergeable: mergeable,
tags: tags
)
}

Expand All @@ -511,7 +518,8 @@ extension Sequence<Target> {
filesGroup: ProjectGroup = .group(name: "Project"),
dependencies: [TargetDependency] = [],
rawScriptBuildPhases: [RawScriptBuildPhase] = [],
onDemandResourcesTags: OnDemandResourcesTags? = nil
onDemandResourcesTags: OnDemandResourcesTags? = nil,
tags: [TargetTag] = []
) -> Target {
Target(
name: name,
Expand All @@ -533,7 +541,8 @@ extension Sequence<Target> {
filesGroup: filesGroup,
dependencies: dependencies,
rawScriptBuildPhases: rawScriptBuildPhases,
onDemandResourcesTags: onDemandResourcesTags
onDemandResourcesTags: onDemandResourcesTags,
tags: tags
)
}

Expand Down
7 changes: 7 additions & 0 deletions Sources/XcodeGraph/Models/TargetTag.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Foundation

/// A tag for adding further infomations.
public enum TargetTag: Codable {
/// Mark it as a remote target.
case remote
}

0 comments on commit 5c83961

Please sign in to comment.